[Zope-CMF] dtml-tree alternatives?

Grégoire Weber gregoire.weber@switzerland.org
Wed, 18 Sep 2002 16:29:06 +0200


Hi Ed,

have a look at the code below. I've gotten it from somewhere but do not know 
anymore from where.

Strip out Java-Script (onclick attributes) parts of code and have alook at it.

Greg

-----------------------------------------------------------------------------
show_tree page template:

[... blabla html code]
<div tal:define="mf python:here.portal_membership.getHomeFolder();
        len_base python:len(mf.absolute_url());
        t python:here.simple_tree(mf, 'tree'); 
        height t/root/height">

  <!-- Show the root link -->
  <table cellspacing="0" border="0">
    <tr>
      <td valign="top" nowrap>
       <a href="#form_end"
          onclick="string:document.SaveAsForm.object_path.value='/';"
          tal:condition="here/icon | nothing">
       <img border="0" title="Click to open this item"
            alt="Metatype" src="/misc_/OFSP/Folder_icon.gif"
            tal:attributes="src string:${request/BASEPATH1}/${mf/icon};
                            alt mf/meta_type" /></a>&nbsp;<strong><a
    href="#form_end"
    onclick="string:document.SaveAsForm.object_path.value='/';">root</a>
       </strong>
       </td></tr></table>

  <!-- Show the leaves -->
  <table cellspacing="0" cellpadding="0" border="0">
    <tr tal:repeat="row t/rows">

      <!-- indentation -->
      <td colspan="1"
          tal:define="indent python:row.depth - 1"
          tal:condition="indent"
          tal:attributes="colspan indent;
                          background python:here.portal_url()+string('/vertline.gif')">
        <img tal:attributes="src python:here.portal_url()+string('/pix.gif')" /></td>

      <!-- expand/collapse link -->
      <td width="16" tal:define="rlink row/branch"
          tal:attributes="background python:here.portal_url()+string('/vertline.gif')">
        <a tal:condition="rlink/link"
           tal:attributes="name row/id;
                           href string:${request/URL}${rlink/link}"
           tal:content="structure rlink/img">
        <img src="/p_/pl"></a>
        <img tal:attributes="src python:here.portal_url()+string('/foldline.gif');
                             width string:16;
                             height string:16;"
             tal:omit-tag="rlink/link" />
        </td>

      <!-- item icon and Id -->
      <td colspan="1" width="99%"
          tal:attributes="colspan python:height-row.depth"
          tal:define="obj row/object;
                      url python:obj.absolute_url();
                      rel_url python:url[len_base:];">
        <a href="#form_end"
           tal:condition="obj/icon | nothing">
        <img border="0" title="Click to open this item"
             alt="Metatype"
             src="/misc_/OFSP/Folder_icon.gif"
             tal:attributes="src string:${request/BASEPATH1}/${obj/icon};
                             onClick string:document.SaveAsForm.object_path.value='${rel_url}';
                             alt obj/meta_type;" /></a>&nbsp;<a
    href="#form_end"
    tal:attributes="onClick string:document.SaveAsForm.object_path.value='${rel_url}';"
    tal:content="obj/id">Id</a>

        </td></tr></table>
[blabla html code ...]

-----------------------------------------------------------------------------
simple_tree python script (Parameter list: tree_root, tree_pre):

from ZTUtils import SimpleTreeMaker

tm = SimpleTreeMaker(tree_pre)
tm.setSkip('')
tree, rows = tm.cookieTree(tree_root)
rows.pop(0)
return {'root': tree, 'rows': rows}


At 08:37 18.09.2002 -0500, you wrote:
>I understand that there is a ZPT alternative to dtml-trees that I 
>should be looking at if I have a need to display tree type 
>structures. Can someone point me in the right direction?
>
>Thanks
>Ed
>
>
>_______________________________________________
>Zope-CMF maillist  -  Zope-CMF@zope.org
>http://lists.zope.org/mailman/listinfo/zope-cmf
>
>See http://collector.zope.org/CMF for bug reports and feature requests 

_____________________________________
Grégoire Weber
mailto:gregoire.weber@switzerland.org