[Zope3-checkins] CVS: ZopeProducts/RotterdamSprint - XmlObjectView.py:1.7
Godefroid Chapelle
gotcha@swing.be
Tue, 10 Dec 2002 16:38:32 -0500
Update of /cvs-repository/ZopeProducts/RotterdamSprint
In directory cvs.zope.org:/tmp/cvs-serv18715
Modified Files:
XmlObjectView.py
Log Message:
added folders icon to tree
=== ZopeProducts/RotterdamSprint/XmlObjectView.py 1.6 => 1.7 ===
--- ZopeProducts/RotterdamSprint/XmlObjectView.py:1.6 Thu Dec 5 16:12:08 2002
+++ ZopeProducts/RotterdamSprint/XmlObjectView.py Tue Dec 10 16:38:32 2002
@@ -1,7 +1,7 @@
from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.App.OFS.Container.IContainer import IReadContainer
from Zope.App.Traversing import objectName, getParents
-
+from Zope.ComponentArchitecture import queryView
class XmlObjectView(BrowserView):
"""Provide a user interface for editing a contact"""
@@ -13,11 +13,12 @@
result = []
container = self.context
for name in container.keys():
- item = container[name]
+ item = container[name]
+ icon = queryView(item, 'zmi_icon', self.request)
if IReadContainer.isImplementedBy(item):
- result.append('<collection name="%s" length="%s" />' % (name, len(item)))
+ result.append('<collection name="%s" length="%s" icon_url="%s"/>' % (name, len(item), icon.url()))
else:
- result.append('<item name="%s" />' % name)
+ result.append('<item name="%s" icon_url="%s"/>' % (name, icon.url()))
return ' '.join(result)
@@ -31,16 +32,17 @@
result = ''
oldItem = self.context
for item in getParents(self.context):
- if item == oldItem:
- continue
+ if item == oldItem:
+ continue
subItems = []
for name in item.keys():
subItem = item[name]
+ icon = queryView(subItem, 'zmi_icon', self.request)
if IReadContainer.isImplementedBy(subItem):
if oldItem and subItem == oldItem:
- subItems.append('<collection name="%s" length="%s">%s</collection>' % (name, len(subItem), result))
+ subItems.append('<collection name="%s" length="%s" icon_url="%s">%s</collection>' % (name, len(subItem), icon.url(), result))
else:
- subItems.append('<collection name="%s" length="%s" />' % (name, len(subItem)))
+ subItems.append('<collection name="%s" length="%s" icon_url="%s"/>' % (name, len(subItem), icon.url()))
else:
subItems.append('<item name="%s" />' % name)
result = ' '.join(subItems)