Commit 2d178ab0 authored by Jim Fulton's avatar Jim Fulton

Added option to change the title.

parent f934c4b4
...@@ -87,15 +87,18 @@ ...@@ -87,15 +87,18 @@
import Globals, OFS.PropertySheets, OFS.Image, ExtensionClass import Globals, OFS.PropertySheets, OFS.Image, ExtensionClass
from string import split, join, strip from string import split, join, strip
import Acquisition
class ZClassBasicSheet(OFS.PropertySheets.PropertySheet, class ZClassBasicSheet(OFS.PropertySheets.PropertySheet,
OFS.PropertySheets.View): OFS.PropertySheets.View):
"""Provide management view for item classes """Provide management view for item classes
""" """
_getZClass=Acquisition.Acquired
manage=Globals.HTMLFile('itemProp', globals()) manage=Globals.HTMLFile('itemProp', globals())
def manage_edit(self, meta_type='', icon='', file='', def manage_edit(self, meta_type='', icon='', file='',
class_id=None, REQUEST=None): class_id=None, title=None, REQUEST=None):
"""Set basic item properties. """Set basic item properties.
""" """
if meta_type: self.setClassAttr('meta_type', meta_type) if meta_type: self.setClassAttr('meta_type', meta_type)
...@@ -115,6 +118,9 @@ class ZClassBasicSheet(OFS.PropertySheets.PropertySheet, ...@@ -115,6 +118,9 @@ class ZClassBasicSheet(OFS.PropertySheets.PropertySheet,
self.setClassAttr('icon', icon) self.setClassAttr('icon', icon)
if title is not None:
self._getZClass().title=title
if class_id is not None and class_id != self.class_id(): if class_id is not None and class_id != self.class_id():
self.changeClassId(class_id) self.changeClassId(class_id)
...@@ -133,6 +139,7 @@ class ZClassBasicSheet(OFS.PropertySheets.PropertySheet, ...@@ -133,6 +139,7 @@ class ZClassBasicSheet(OFS.PropertySheets.PropertySheet,
def class_id(self): def class_id(self):
return (self.getClassAttr('__module__','') or '')[1:] return (self.getClassAttr('__module__','') or '')[1:]
def zClassTitle(self): return self._getZClass().title
class ZClassViewsSheet(OFS.PropertySheets.PropertySheet, class ZClassViewsSheet(OFS.PropertySheets.PropertySheet,
OFS.PropertySheets.View): OFS.PropertySheets.View):
......
...@@ -514,6 +514,8 @@ class ZClass(OFS.SimpleItem.SimpleItem): ...@@ -514,6 +514,8 @@ class ZClass(OFS.SimpleItem.SimpleItem):
elif hasattr(c, '__name__'): r.append(c.__name__) elif hasattr(c, '__name__'): r.append(c.__name__)
return r return r
def _getZClass(self): return self
class ZClassSheets(OFS.PropertySheets.PropertySheets): class ZClassSheets(OFS.PropertySheets.PropertySheets):
"Manage a collection of property sheets that provide ZClass management" "Manage a collection of property sheets that provide ZClass management"
......
...@@ -17,6 +17,13 @@ will need to be adjusted if the class is moved.</p> ...@@ -17,6 +17,13 @@ will need to be adjusted if the class is moved.</p>
<TD ALIGN="LEFT" VALIGN="TOP"><!--#var "_.string.join(ZClassBaseClassNames(), ', ')"--> <TD ALIGN="LEFT" VALIGN="TOP"><!--#var "_.string.join(ZClassBaseClassNames(), ', ')"-->
</TD> </TD>
</TR> </TR>
<TR>
<TH ALIGN="LEFT" VALIGN="TOP">title</TH>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="title" SIZE="40"
value="<!--#var zClassTitle-->">
</TD>
</TR>
<TR> <TR>
<TH ALIGN="LEFT" VALIGN="TOP">meta type</TH> <TH ALIGN="LEFT" VALIGN="TOP">meta type</TH>
<TD ALIGN="LEFT" VALIGN="TOP"> <TD ALIGN="LEFT" VALIGN="TOP">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment