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