[Zope3-checkins] CVS: Zope3/src/zope/products/statictree/example -
configure.zcml:1.2 example1.pt:1.2
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sun Feb 15 14:00:27 EST 2004
Update of /cvs-repository/Zope3/src/zope/products/statictree/example
In directory cvs.zope.org:/tmp/cvs-serv15926/src/zope/products/statictree/example
Modified Files:
configure.zcml example1.pt
Log Message:
Upgraded static tree to display lines, so it is visually easier to keep
track of the levels.
Just check it out!
PS: Fixes to apidoc follow soon.
=== Zope3/src/zope/products/statictree/example/configure.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/products/statictree/example/configure.zcml:1.1 Fri Jan 16 07:39:02 2004
+++ Zope3/src/zope/products/statictree/example/configure.zcml Sun Feb 15 13:59:56 2004
@@ -1,12 +1,9 @@
<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser"
- i18n_domain="statictree"
- >
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="statictree"
+ >
-<!-- browser stuff -->
-
- <browser:page
+<browser:page
for="*"
permission="zope.View"
name="tree_example1.html"
=== Zope3/src/zope/products/statictree/example/example1.pt 1.1 => 1.2 ===
--- Zope3/src/zope/products/statictree/example/example1.pt:1.1 Fri Jan 16 07:39:02 2004
+++ Zope3/src/zope/products/statictree/example/example1.pt Sun Feb 15 13:59:56 2004
@@ -23,12 +23,13 @@
<div metal:fill-slot="body">
-<table cellspacing="0"
+<table cellspacing="0" cellpadding="0"
tal:define="root context/@@static_cookie_tree;
result root/getFlatDicts;
- flatdicts python:result[0];
- maxdepth python:result[1];">
+ nodeDictList python:result[0];
+ maxDepth python:result[1]">
+<!-- the root needs some special treatment, since it is not in nodeDictList -->
<tr>
<td width="16">
<img src="" tal:define="icon context/@@zmi_icon | nothing"
@@ -36,26 +37,51 @@
</td>
<td class="list-item"
- tal:attributes="colspan python:maxdepth+2">
+ tal:attributes="colspan python:maxDepth+2">
<b tal:content="root/getId() | string:[top]"></b>
</td>
</tr>
-<tr tal:repeat="dict flatdicts">
-<tal:block tal:define="node dict/node">
+<tr tal:repeat="nodeInfo nodeDictList">
+<tal:block tal:define="node nodeInfo/node">
- <td style="width:16px" tal:repeat="depth python:range(dict['depth'])">
+ <!-- generate the lines that will point to the next node in the level -->
+ <td style="width:16px" tal:repeat="state nodeInfo/row-state">
+ <img tal:attributes="src context/++resource++tree_images/empty.png"
+ tal:condition="not:state" alt="" border="0" />
+ <img tal:attributes="src context/++resource++tree_images/vline.png"
+ tal:condition="state" alt="|" border="0" />
</td>
<td style="width:16px">
+ <!-- if we have children, let's allow them to be expanded and collapsed -->
<a href=""
- tal:attributes="href string:?tree-state=${dict/tree-state}"
+ tal:attributes="href string:?tree-state=${nodeInfo/tree-state}"
tal:condition="node/hasChildren">
- <img tal:attributes="src context/++resource++pl.gif"
- tal:condition="not:node/expanded" alt="+" border="0" />
- <img tal:attributes="src context/++resource++mi.gif"
- tal:condition="node/expanded" alt="-" border="0" />
+ <tal:block condition="not:nodeInfo/last-level-node">
+ <img tal:attributes="src context/++resource++tree_images/plus_vline.png"
+ tal:condition="not:node/expanded" alt="+" border="0" />
+ <img tal:attributes="src context/++resource++tree_images/minus_vline.png"
+ tal:condition="node/expanded" alt="-" border="0" />
+ </tal:block>
+ <!-- If the node is the last node of the level, then we need to use
+ different plus and minus that do not have a line going off
+ downward -->
+ <tal:block condition="nodeInfo/last-level-node">
+ <img tal:attributes="src context/++resource++tree_images/plus.png"
+ tal:condition="not:node/expanded" alt="+" border="0" />
+ <img tal:attributes="src context/++resource++tree_images/minus.png"
+ tal:condition="node/expanded" alt="-" border="0" />
+ </tal:block>
</a>
+
+ <!-- this node has no children, so either display a T or L as lines -->
+ <tal:block condition="not:node/hasChildren">
+ <img tal:attributes="src context/++resource++tree_images/tline.png"
+ tal:condition="not:nodeInfo/last-level-node" alt="T" border="0" />
+ <img tal:attributes="src context/++resource++tree_images/lline.png"
+ tal:condition="nodeInfo/last-level-node" alt="L" border="0" />
+ </tal:block>
</td>
<td style="width:16px"
@@ -64,10 +90,14 @@
<img src="" tal:replace="structure icon" />
</td>
- <td colspan="1" class="list-item"
- tal:attributes="colspan python:maxdepth - dict['depth'] + 1"
- tal:content="node/context/__name__">
- node/id
+ <td class="list-item"
+ tal:attributes="colspan python:maxDepth-len(nodeInfo['row-state'])+1">
+ <a href=""
+ tal:attributes="href
+ string:${node/context/@@absolute_url}/@@SelectedManagementView.html"
+ tal:content="node/context/zope:name">
+ node/id
+ </a>
</td>
</tal:block>
More information about the Zope3-Checkins
mailing list