Resolvendo o problema de implantar no site um menu drop down, foi 
customizado o componente navigation tree. Só que dentro dessa 
customização surgiram alguns "bugs" que estou tendo grandes 
dificuldades em resolver, que são:
- Quando é  clicado para o menu se expandir, ele de vez em quando 
fecha sozinho;
- O browser trava;
- fica extremamente lento quando se aumenta a extrutura de 
diretórios;
O código fonte é:

<html xmlns:tal="http://xml.zope.org/namespaces/tal";
      xmlns:metal="http://xml.zope.org/namespaces/metal";
      i18n:domain="plone">
<body>
<!-- This code is *really* messed up, and will be replaced in the 
next version of Plone. 
     Do not try to make sense of this.
-->
<div metal:define-macro="portlet"
       i18n:domain="plone"
       tal:omit-tag=""  
       tal:define="isContainer here/isPrincipiaFolderish|nothing;
                   navBatchStart request/navBatchStart | python:None;
                   portalObject portal;
                   rootName string:menu;
                   folderIds python:container.objectIds('Plone 
Folder');
                   folderValues python:container.objectValues('Plone 
Folder');
                   rootIndex python:folderIds.index(rootName);
                   rootValue python:folderValues[rootIndex];
                   tree 
python:here.plone_utils.createNavigationTreeBuilderNew
(rootValue,navBatchStart);
                   showOtherNav python:0;
                   showNav python:0;
                   listContentsPermission python:checkPermission
('List folder contents', here);
                   notFolderContents python:test(template.getId()!
='folder_contents', 1, 0);
                   editorView python:test(listContentsPermission and 
notFolderContents, 1, 0);
                   croppingLength 
here/navtree_properties/croppingLength | 
portal_properties/navtree_properties/croppingLength | python:18;
                   rolesSeeContentsView 
here/navtree_properties/rolesSeeContentsView | 
portal_properties/navtree_properties/rolesSeeContentsView | python:
['Manager','Reviewer','Owner'];
                   useFolderContents 
here/navtree_properties/typesLinkToFolderContents | 
portal_properties/navtree_properties/typesLinkToFolderContents | 
python:[];
                   desc_ellipsis site_properties/ellipsis;"
                   >
    <div class="portlet_nav" id="portlet-navigation-tree"
         tal:repeat="tro tree/listroot">
    <div tal:define="number repeat/tro/number"
         tal:attributes="class string:navItem$number">
        <h5 
            tal:content="python:tro['object'].title_or_id()"
            >Navigation</h5>
        <div class="portletNavBody">
            <div class="portletNavContent odd">
                <div tal:condition="tree/prev">
                    <a tal:attributes="href string:${request/URL}?
navBatchStart=${tree/prevBatchStart}">
                        <span tal:replace="desc_ellipsis">...</span>
                    </a>
                </div>
                <div tal:repeat="te tree/list">
                    <span id="" class=""
                          tal:condition="python: te['rootcount'] == 
number"
                          tal:attributes="id identificador;
                                          class python:te
['parent'].getId() + '_';
                                          style python: test(te
['isshown'] == 1,'display:block','display:none');"
                          tal:define="iscurrent te/iscurrent | 
python:0;
                                      sibling python:te['object'];
                                      identificador python: te
['object'].getId() + '_';
                                      typeInfo sibling/getTypeInfo;
                                      stdCommand python:test(not 
notFolderContents,'folder_contents',test(typeInfo.id in 
useFolderContents,'folder_contents',typeInfo.getActionById
('view')));                                      
                                      command python:test(stdCommand 
in ('folder_contents','folder_listing') and not checkPermission
('List folder contents',sibling) ,'',stdCommand);
                                      title python:te
['object'].title_or_id();
                                      charset 
site_properties/default_charset|string:utf-8;
                                      sibling_title python:' '.join( 
(unicode(title, charset)[:croppingLength]).encode(charset).split
(' '));"
                                      tal:on-error="structure 
string:&lt;!--Error in Navigation loop!!--&gt;"
                                           >
                        <div tal:define="number repeat/tro/number"
                             tal:attributes="class 
string:item$number">

<a href="javascript:void(0)">

                        <img class="navMais" id="" src="/p_/pl" 
alt="+" border="0"
                             tal:attributes="id python: 
identificador + 'img';
                                             style python: 'padding-
left: ' + str(te['indent']/2.0) + 'em;;' + test(te['num_filhos'] > 
0,'','display:none');
                                             src python: test(te
['isopened'] == 1, '/p_/mi', '/p_/pl');
                                             onclick string: 
mudaImagem(this,'$identificador')"
                             >
</a>
                        <a class="" href=""
                           tal:condition="python: sibling != 
portalObject"
                           tal:define="url 
string:${sibling/absolute_url}/${command}"
                           tal:attributes="href url;
                                           title python:test(title !
= sibling_title, title, '');
                                           "
                                           accesskey="accesskeys-
navigation"
                                           
i18n:attributes="accesskey">
                            <!--<tal:block replace="structure 
python:path('here/%s' % sibling.getIcon(1))"
                                 on-error="structure 
here/site_icon.gif"
                                    />&nbsp;-->
                         <span tal:condition="not: iscurrent" 
tal:content="sibling_title" /><span class="currentNavItem" 
tal:condition=" iscurrent" tal:content="sibling_title" />
                        </a>
                        <a class=""  href=""
                           tal:condition="python: sibling == 
portalObject"
                           tal:define="url 
string:${sibling/absolute_url}/${command}"
                           tal:attributes="href url;
                                           title title;"
                                           accesskey="accesskeys-
navigation"
                                           
i18n:attributes="accesskey">
                          <!--  <tal:block replace="structure 
portal/site_icon.gif"/>&nbsp;-->
                            <span class="" tal:attributes="class 
python:test(iscurrent,'currentNavItem','')" 
i18n:translate="tabs_home">Home</span>
                        </a></div>
                     </span>
                </div>
                <div tal:condition="tree/next">
                    <a tal:attributes="href string:${request/URL}?
navBatchStart=${tree/nextBatchStart}">
                        <span tal:replace="desc_ellipsis">...</span>
                    </a>
                </div>
            </div>
        </div>
    </div>
    </div>
</div>
</body>
</html>

do js é:

function mudaImagem(imagem,ident) {
   if (imagem.src.indexOf("/p_/pl") != -1) {
      x = document.getElementsByTagName('*');
      for (i = 0; i < x.length; i++)
          if (x[i].className.indexOf(ident) != -1)
              x[i].style.display='block';
      imagem = document.getElementById(ident+'img');
      imagem.src = "/p_/mi";
      imagem.alt = "-";
   }
   else if (imagem.src.indexOf("/p_/mi") != -1) {
      x = document.getElementsByTagName('*');
      for (i = 0; i < x.length; i++)
          if (x[i].className.indexOf(ident) != -1) {
              x[i].style.display='none';
              j = i;
              mudaImagem(imagem,x[i].id);
              i = j;
          }
      imagem = document.getElementById(ident+'img');
      imagem.src = "/p_/pl";
      imagem.alt = "+";
   }
}




Para enviar uma mensagem: zope-pt@yahoogrupos.com.br
Para desistir envie uma mensagem em branco para: [EMAIL PROTECTED] 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/zope-pt/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 


Responder a