[Zope-CVS] CVS: Products/CompositePage - composite.py:1.9.2.4
slot.py:1.14.2.1
Shane Hathaway
shane at zope.com
Wed Feb 25 16:15:34 EST 2004
Update of /cvs-repository/Products/CompositePage
In directory cvs.zope.org:/tmp/cvs-serv5497
Modified Files:
Tag: composite-flat-ui-branch
composite.py slot.py
Log Message:
Wired the add, remove, copy, cut, and paste functions.
Also added an icon for each element.
=== Products/CompositePage/composite.py 1.9.2.3 => 1.9.2.4 ===
--- Products/CompositePage/composite.py:1.9.2.3 Tue Feb 24 17:34:11 2004
+++ Products/CompositePage/composite.py Wed Feb 25 16:15:01 2004
@@ -28,7 +28,7 @@
from AccessControl.ZopeGuards import guarded_getattr
from interfaces import ISlot, CompositeError
-from slot import Slot
+from slot import Slot, getIconURL
from macro import renderMacro, getRootMacro
import perm_names
@@ -205,6 +205,10 @@
contents = [] # [{name, slot_info}]
seen = {}
names = self.getSlotNames()
+ if hasattr(self, 'portal_url'):
+ icon_base_url = self.portal_url()
+ else:
+ icon_base_url = self.REQUEST['BASEPATH1']
for name in names:
if seen.has_key(name):
# Don't show duplicate uses of a slot.
@@ -214,8 +218,10 @@
elements = []
index = 0
for element in slot.objectValues():
+ icon = getIconURL(element, icon_base_url)
element_info = {
'title': element.title_or_id(),
+ 'icon': icon,
'source_path': '/'.join(element.getPhysicalPath()),
'index': index,
'next_index': index + 1,
=== Products/CompositePage/slot.py 1.14 => 1.14.2.1 ===
--- Products/CompositePage/slot.py:1.14 Tue Jan 6 11:38:28 2004
+++ Products/CompositePage/slot.py Wed Feb 25 16:15:01 2004
@@ -166,19 +166,7 @@
text = self._handleError(editing)
if editing:
- base = aq_base(obj)
-
- if hasattr(base, 'getIcon'):
- icon = str(obj.getIcon())
- elif hasattr(base, 'icon'):
- icon = str(obj.icon)
- else:
- icon = ""
- if icon and '://' not in icon:
- if not icon.startswith('/'):
- icon = '/' + icon
- icon = icon_base_url + icon
-
+ icon = getIconURL(obj, icon_base_url)
title = obj.title_and_id()
path = escape('/'.join(obj.getPhysicalPath()))
res.append(edit_tag % (path,
@@ -220,6 +208,20 @@
Globals.InitializeClass(Slot)
+
+def getIconURL(obj, icon_base_url):
+ base = aq_base(obj)
+ if hasattr(base, 'getIcon'):
+ icon = str(obj.getIcon())
+ elif hasattr(base, 'icon'):
+ icon = str(obj.icon)
+ else:
+ icon = ""
+ if icon and '://' not in icon:
+ if not icon.startswith('/'):
+ icon = '/' + icon
+ icon = icon_base_url + icon
+ return icon
addSlotForm = PageTemplateFile("addSlotForm", _www)
More information about the Zope-CVS
mailing list