[gen] Remove attributes showWorkflowFor...; buttons for triggering workflow transitions are not located besides the standard actions (icons): edit, save, etc.

This commit is contained in:
Gaetan Delannay 2012-11-05 13:12:18 +01:00
parent 21585df6a1
commit fcb1d36da0
7 changed files with 35 additions and 51 deletions

View file

@ -529,17 +529,6 @@ class ToolClassDescriptor(ClassDescriptor):
default=defValue,group=classDescr.klass.__name__) default=defValue,group=classDescr.klass.__name__)
self.addField(fieldName, fieldType) self.addField(fieldName, fieldType)
def addWorkflowFields(self, classDescr):
'''Adds, for a given p_classDescr, the workflow-related fields.'''
className = classDescr.name
groupName = classDescr.klass.__name__
# Adds a field allowing to show/hide completely any workflow-related
# information for a given class.
fieldName = 'showWorkflowFor%s' % className
fieldType = gen.Boolean(default=True, page='userInterface',
group=groupName)
self.addField(fieldName, fieldType)
class UserClassDescriptor(ClassDescriptor): class UserClassDescriptor(ClassDescriptor):
'''Appy-specific class for representing a user.''' '''Appy-specific class for representing a user.'''
def __init__(self, klass, generator): def __init__(self, klass, generator):

View file

@ -919,7 +919,6 @@ class ZopeGenerator(Generator):
importMean = classDescr.getCreateMean('Import') importMean = classDescr.getCreateMean('Import')
if importMean: if importMean:
self.tool.addImportRelatedFields(classDescr) self.tool.addImportRelatedFields(classDescr)
self.tool.addWorkflowFields(self.user)
self.tool.generateSchema() self.tool.generateSchema()
# Generate the Tool class # Generate the Tool class
@ -935,8 +934,6 @@ class ZopeGenerator(Generator):
generating the corresponding Archetype class.''' generating the corresponding Archetype class.'''
k = classDescr.klass k = classDescr.klass
print 'Generating %s.%s (gen-class)...' % (k.__module__, k.__name__) print 'Generating %s.%s (gen-class)...' % (k.__module__, k.__name__)
if not classDescr.isAbstract():
self.tool.addWorkflowFields(classDescr)
# Determine base Zope class # Determine base Zope class
isFolder = classDescr.isFolder() isFolder = classDescr.isFolder()
baseClass = isFolder and 'Folder' or 'SimpleItem' baseClass = isFolder and 'Folder' or 'SimpleItem'

View file

@ -210,7 +210,7 @@ setattr(Page, Page.pages.back.attribute, Page.pages.back)
# Prefixes of the fields generated on the Tool. # Prefixes of the fields generated on the Tool.
toolFieldPrefixes = ('podTemplate', 'formats', 'resultColumns', toolFieldPrefixes = ('podTemplate', 'formats', 'resultColumns',
'enableAdvancedSearch', 'numberOfSearchColumns', 'enableAdvancedSearch', 'numberOfSearchColumns',
'searchFields', 'showWorkflow') 'searchFields')
defaultToolFields = ('title', 'mailHost', 'mailEnabled', 'mailFrom', defaultToolFields = ('title', 'mailHost', 'mailEnabled', 'mailFrom',
'appyVersion', 'dateFormat', 'hourFormat', 'users', 'appyVersion', 'dateFormat', 'hourFormat', 'users',
'connectedUsers', 'groups', 'translations', 'connectedUsers', 'groups', 'translations',

View file

@ -35,7 +35,6 @@ class PoMessage:
MSG_enableAdvancedSearch = "Enable advanced search" MSG_enableAdvancedSearch = "Enable advanced search"
MSG_numberOfSearchColumns = "Number of search columns" MSG_numberOfSearchColumns = "Number of search columns"
MSG_searchFields = "Search fields" MSG_searchFields = "Search fields"
MSG_showWorkflow = 'Show workflow-related information'
POD_ASKACTION = 'Trigger related action' POD_ASKACTION = 'Trigger related action'
REF_NO = 'No object.' REF_NO = 'No object.'
REF_ADD = 'Add a new one' REF_ADD = 'Add a new one'

View file

@ -116,7 +116,6 @@ img { border: 0; vertical-align: middle}
.objectTitle { font-size: 11pt; border-bottom: 3px solid grey; .objectTitle { font-size: 11pt; border-bottom: 3px solid grey;
font-weight: bold;} font-weight: bold;}
.by { padding-top: 5px; color: grey; font-size: 97% } .by { padding-top: 5px; color: grey; font-size: 97% }
.workflow { text-align: center; border-top: 1px solid grey }
.underTitle { background-color: #e9e9e9 } .underTitle { background-color: #e9e9e9 }
.objectNavigate { margin-top: 3px;} .objectNavigate { margin-top: 3px;}
.underline { border-bottom: 1px dotted grey;} .underline { border-bottom: 1px dotted grey;}

View file

@ -173,8 +173,7 @@
workflow-related info, object history, etc. workflow-related info, object history, etc.
</tal:comment> </tal:comment>
<div metal:define-macro="header" <div metal:define-macro="header"
tal:define="showWorkflow python: tool.getAttr('showWorkflowFor' + contextObj.meta_type); tal:define="hasHistory contextObj/hasHistory;
hasHistory contextObj/hasHistory;
historyMaxPerPage options/maxPerPage|python: 5; historyMaxPerPage options/maxPerPage|python: 5;
historyExpanded python: request.get('appyHistory', 'collapsed') == 'expanded'; historyExpanded python: request.get('appyHistory', 'collapsed') == 'expanded';
_ python: tool.translate; _ python: tool.translate;
@ -238,12 +237,6 @@
</span> </span>
</td> </td>
</tr> </tr>
<tal:comment replace="nothing">Possible transitions</tal:comment>
<tr tal:condition="python: showWorkflow and contextObj.getWorkflowLabel()" class="workflow">
<td colspan="2" tal:attributes="align dright">
<metal:states use-macro="here/ui/page/macros/transitions"/>
</td>
</tr>
</table> </table>
</div> </div>
@ -257,15 +250,16 @@
</metal:footer> </metal:footer>
<tal:comment replace="nothing"> <tal:comment replace="nothing">
This macro shows the range of buttons (next, previous, save,...). This macro shows the range of buttons (next, previous, save,...) and the workflow transitions.
</tal:comment> </tal:comment>
<div metal:define-macro="buttons" <table metal:define-macro="buttons" cellpadding="2" cellspacing="0" style="margin-top: 7px"
tal:define="previousPage python: contextObj.getPreviousPage(phaseInfo, page)[0]; tal:define="previousPage python: contextObj.getPreviousPage(phaseInfo, page)[0];
nextPage python: contextObj.getNextPage(phaseInfo, page)[0]; nextPage python: contextObj.getNextPage(phaseInfo, page)[0];
isEdit python: layoutType == 'edit'; isEdit python: layoutType == 'edit';
pageInfo python: phaseInfo['pagesInfo'][page]"> pageInfo python: phaseInfo['pagesInfo'][page]">
<br/> <tr>
<tal:previous condition="python: previousPage and pageInfo['showPrevious']"> <tal:comment replace="nothing">Previous</tal:comment>
<td tal:condition="python: previousPage and pageInfo['showPrevious']">
<tal:button condition="isEdit"> <tal:button condition="isEdit">
<input type="image" name="buttonPrevious" <input type="image" name="buttonPrevious"
tal:attributes="src string:$appUrl/ui/previous.png; tal:attributes="src string:$appUrl/ui/previous.png;
@ -278,35 +272,40 @@
title python: _('page_previous')"/> title python: _('page_previous')"/>
</a> </a>
</tal:link> </tal:link>
</tal:previous> </td>
<tal:save condition="python: isEdit and pageInfo['showSave']"> <tal:comment replace="nothing">Save</tal:comment>
<td tal:condition="python: isEdit and pageInfo['showSave']">
<input type="image" name="buttonOk" <input type="image" name="buttonOk"
tal:attributes="src string:$appUrl/ui/save.png; tal:attributes="src string:$appUrl/ui/save.png;
title python: _('object_save')"/> title python: _('object_save')"/>
</tal:save> </td>
<tal:cancel condition="python: isEdit and pageInfo['showCancel']"> <tal:comment replace="nothing">Cancel</tal:comment>
<td tal:condition="python: isEdit and pageInfo['showCancel']">
<input type="image" name="buttonCancel" <input type="image" name="buttonCancel"
tal:attributes="src string:$appUrl/ui/cancel.png; tal:attributes="src string:$appUrl/ui/cancel.png;
title python: _('object_cancel')"/> title python: _('object_cancel')"/>
</tal:cancel> </td>
<tal:edit condition="python: not isEdit and pageInfo['showOnEdit']"> <tal:comment replace="nothing">Edit</tal:comment>
<td tal:condition="python: not isEdit and pageInfo['showOnEdit']">
<img style="cursor:pointer" <img style="cursor:pointer"
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode='edit', page=page); tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode='edit', page=page);
title python: _('object_edit'); title python: _('object_edit');
src string: $appUrl/ui/editBig.png" src string: $appUrl/ui/editBig.png"
tal:condition="contextObj/mayEdit"/> tal:condition="contextObj/mayEdit"/>
</tal:edit> </td>
<tal:refresh condition="contextObj/isDebug"> <tal:comment replace="nothing">Refresh</tal:comment>
<td tal:condition="contextObj/isDebug">
<img title="Refresh" style="cursor:pointer; vertical-align:top" <img title="Refresh" style="cursor:pointer; vertical-align:top"
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode=layoutType, page=page, refresh='yes'); tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode=layoutType, page=page, refresh='yes');
src string: $appUrl/ui/refresh.png"/> src string: $appUrl/ui/refresh.png"/>
</tal:refresh> </td>
<tal:next condition="python: nextPage and pageInfo['showNext']"> <tal:comment replace="nothing">Next</tal:comment>
<td tal:condition="python: nextPage and pageInfo['showNext']">
<tal:button condition="isEdit"> <tal:button condition="isEdit">
<input type="image" name="buttonNext" <input type="image" name="buttonNext"
tal:attributes="src string:$appUrl/ui/next.png; tal:attributes="src string:$appUrl/ui/next.png;
@ -319,8 +318,13 @@
title python: _('page_next')"/> title python: _('page_next')"/>
</a> </a>
</tal:link> </tal:link>
</tal:next> </td>
</div> <tal:comment replace="nothing">Workflow transitions</tal:comment>
<td tal:condition="python: layoutType in ('view', 'result')">
<metal:transitions use-macro="app/ui/page/macros/transitions"/>
</td>
</tr>
</table>
<tal:comment replace="nothing"> <tal:comment replace="nothing">
This macro displays the global message on the page. This macro displays the global message on the page.

View file

@ -109,10 +109,6 @@ class ToolWrapper(AbstractWrapper):
"searchFields" "searchFields"
Determines, among all indexed fields for p_klass, which one will Determines, among all indexed fields for p_klass, which one will
really be used in the search screen. really be used in the search screen.
"showWorkflow"
Stores the boolean field indicating if we must show workflow-
related information for p_klass or not.
''' '''
fullClassName = self.o.getPortalType(klass) fullClassName = self.o.getPortalType(klass)
res = '%sFor%s' % (attributeType, fullClassName) res = '%sFor%s' % (attributeType, fullClassName)