Commit 28ae96d7 authored by Amos Latteier's avatar Amos Latteier

Added online help to ZClasses (not done yet) and updated View management to...

Added online help to ZClasses (not done yet) and updated View management to allow setting online help for Views.
parent 99d4f1e7
......@@ -152,7 +152,7 @@ class ZClassViewsSheet(OFS.PropertySheets.PropertySheet,
return self.getClassAttr('manage_options',(),1)
manage=Globals.HTMLFile('views', globals())
def manage_edit(self, actions=[], REQUEST=None):
def manage_edit(self, actions=[], helps=[], REQUEST=None):
"Change view actions"
options=self.data()
changed=0
......@@ -163,7 +163,12 @@ class ZClassViewsSheet(OFS.PropertySheets.PropertySheet,
if options[i]['action'] != actions[i]:
options[i]['action'] = actions[i]
changed=1
if (options[i].has_key('help') and options[i]['help'] != helps[i]) or \
(not options[i].has_key('help') and helps[i]):
if helps[i]:
options[i]['help'] = (self.zclass_productid(), helps[i])
else:
del options[i]['help']
if changed:
self.setClassAttr('manage_options', options)
message='The changes were saved.'
......@@ -191,7 +196,18 @@ class ZClassViewsSheet(OFS.PropertySheets.PropertySheet,
return self.manage(
self, REQUEST, manage_tabs_message=message)
def manage_add(self, label, action, REQUEST=None):
def zclass_productid(self):
# find the name of the enclosing Product
obj=self
while hasattr(obj, 'aq_parent'):
obj=obj.aq_parent
try:
if obj.meta_type=='Product':
return obj.id
except:
pass
def manage_add(self, label, action, help, REQUEST=None):
"Add a view"
options=self.data()
for option in options:
......@@ -199,8 +215,12 @@ class ZClassViewsSheet(OFS.PropertySheets.PropertySheet,
raise 'Bad Request', (
'Please provide a <strong>new</strong> label.'
)
self.setClassAttr('manage_options',
tuple(options)+({'label': label, 'action': action},))
if help:
t=({'label': label, 'action': action,
'help': (self.zclass_productid(), help)},)
else:
t=({'label': label, 'action': action},)
self.setClassAttr('manage_options', tuple(options) + t)
if REQUEST is not None:
return self.manage(
......
......@@ -112,8 +112,10 @@ class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item):
_properties=()
manage_options=(
{'label':'Properties', 'action':'manage'},
{'label':'Define Permissions', 'action':'manage_security'},
{'label':'Properties', 'action':'manage',
'help':('OFSP','Common-Instance-Property-Sheet_Properties.dtml')},
{'label':'Define Permissions', 'action':'manage_security',
'help':('OFSP','Common-Instance-Property-Sheet_Define-Permissions.dtml')},
)
__ac_permissions__=(
......
......@@ -210,9 +210,9 @@ class ZClass(OFS.SimpleItem.SimpleItem):
isPrincipiaFolderish=1
__ac_permissions__=(
('Create class instances',
('Create class instances',
('', '__call__', 'index_html', 'createInObjectManager')),
)
)
def __init__(self, id, title, bases, zope_object=1):
"""Build a Zope class
......@@ -583,13 +583,19 @@ class ZClassSheets(OFS.PropertySheets.PropertySheets):
class ZObject:
manage_options=(
{'label': 'Methods', 'action' :'propertysheets/methods/manage'},
{'label': 'Basic', 'action' :'propertysheets/basic/manage'},
{'label': 'Views', 'action' :'propertysheets/views/manage'},
{'label': 'Property Sheets', 'action' :'propertysheets/common/manage'},
{'label': 'Methods', 'action' :'propertysheets/methods/manage',
'help':('OFSP','ZClass_Methods.dtml')},
{'label': 'Basic', 'action' :'propertysheets/basic/manage',
'help':('OFSP','ZClass_Basic.dtml')},
{'label': 'Views', 'action' :'propertysheets/views/manage',
'help':('OFSP','ZClass_Views.dtml')},
{'label': 'Property Sheets', 'action' :'propertysheets/common/manage',
'help':('OFSP','ZClass_Property-Sheets.dtml')},
{'label': 'Permissions',
'action' :'propertysheets/permissions/manage'},
{'label': 'Security', 'action' :'manage_access'},
'action' :'propertysheets/permissions/manage',
'help':('OFSP','ZClass_Permissions.dtml')},
{'label': 'Security', 'action' :'manage_access',
'help':('OFSP','ZClass_Define-Permissions.dtml')},
)
ZStandardSheets=ZObject
......
......@@ -6,6 +6,8 @@
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<H2>Add Common Instance Property Sheet</H2>
<dtml-var "HelpSys.HelpButton('Common-Instance-Property-Sheet_Add.dtml')">
<FORM ACTION="manage_addCommonSheet" METHOD="POST">
<TABLE CELLSPACING="2">
<TR>
......
......@@ -6,6 +6,8 @@
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<H2>Add ZClass</H2>
<dtml-var "HelpSys.HelpButton('ZClass_Add.dtml')">
<dtml-with "_(selected=[], unselected=[], baseclasses=[], id='', title='',
meta_type='',
all=manage_subclassableClassNames(),
......
......@@ -6,6 +6,10 @@
<form action=".">
<table>
<tr>
<th colspan="2">Name</th><th>Method</th><th>Help Topic</th>
</tr>
<dtml-in data mapping>
<tr>
<td valign=center>
......@@ -20,9 +24,19 @@
</dtml-if>><dtml-var sequence-item></option>
</dtml-in>
</select></td>
<td align="left" valign="center">
<select name="helps:list">
<option></option>
<dtml-in "Help.helpValues()">
<option
<dtml-if "_.has_key('help') and _.getitem('sequence-item').id() == help[1]">SELECTED
</dtml-if>><dtml-var id></option>
</dtml-in>
</select>
</td>
</tr>
</dtml-in>
<tr><td colspan=3 align=center>
<tr><td></td><td colspan=3 align=left>
<input type=submit value=" Change " name="manage_edit:method">
<input type=submit value=" Delete " name="manage_delete:method">
<input type=submit value=" First " name="manage_first:method">
......@@ -31,15 +45,28 @@
<form action=manage_add><table>
<tr>
<th align=left valign=top>New: <input type=text name="label" size=20></th>
<th colspan="2">Name</th><th>Method</th><th>Help Topic</th>
</tr>
<tr>
<th>New:</th>
<th align=left valign=top><input type=text name="label" size=20></th>
<td align=left valign=top>
<select name=action>
<select name=action>
<dtml-in zclass_candidate_view_actions>
<option><dtml-var sequence-item></option>
</dtml-in>
</select></td>
<td align="left" valign="top">
<select name="help">
<option></option>
<dtml-in "Help.helpValues()">
<option><dtml-var id></option>
</dtml-in>
</select>
</td>
</tr>
<tr><td colspan=2 align=center>
<tr><td></td><td colspan=2 align=left>
<input type=submit value=" Add ">
</td></tr>
</table></form>
......
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