[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__)
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):
'''Appy-specific class for representing a user.'''
def __init__(self, klass, generator):

View file

@ -919,7 +919,6 @@ class ZopeGenerator(Generator):
importMean = classDescr.getCreateMean('Import')
if importMean:
self.tool.addImportRelatedFields(classDescr)
self.tool.addWorkflowFields(self.user)
self.tool.generateSchema()
# Generate the Tool class
@ -935,8 +934,6 @@ class ZopeGenerator(Generator):
generating the corresponding Archetype class.'''
k = classDescr.klass
print 'Generating %s.%s (gen-class)...' % (k.__module__, k.__name__)
if not classDescr.isAbstract():
self.tool.addWorkflowFields(classDescr)
# Determine base Zope class
isFolder = classDescr.isFolder()
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.
toolFieldPrefixes = ('podTemplate', 'formats', 'resultColumns',
'enableAdvancedSearch', 'numberOfSearchColumns',
'searchFields', 'showWorkflow')
'searchFields')
defaultToolFields = ('title', 'mailHost', 'mailEnabled', 'mailFrom',
'appyVersion', 'dateFormat', 'hourFormat', 'users',
'connectedUsers', 'groups', 'translations',

View file

@ -35,7 +35,6 @@ class PoMessage:
MSG_enableAdvancedSearch = "Enable advanced search"
MSG_numberOfSearchColumns = "Number of search columns"
MSG_searchFields = "Search fields"
MSG_showWorkflow = 'Show workflow-related information'
POD_ASKACTION = 'Trigger related action'
REF_NO = 'No object.'
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;
font-weight: bold;}
.by { padding-top: 5px; color: grey; font-size: 97% }
.workflow { text-align: center; border-top: 1px solid grey }
.underTitle { background-color: #e9e9e9 }
.objectNavigate { margin-top: 3px;}
.underline { border-bottom: 1px dotted grey;}

View file

@ -173,8 +173,7 @@
workflow-related info, object history, etc.
</tal:comment>
<div metal:define-macro="header"
tal:define="showWorkflow python: tool.getAttr('showWorkflowFor' + contextObj.meta_type);
hasHistory contextObj/hasHistory;
tal:define="hasHistory contextObj/hasHistory;
historyMaxPerPage options/maxPerPage|python: 5;
historyExpanded python: request.get('appyHistory', 'collapsed') == 'expanded';
_ python: tool.translate;
@ -238,12 +237,6 @@
</span>
</td>
</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>
</div>
@ -257,15 +250,16 @@
</metal:footer>
<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>
<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];
nextPage python: contextObj.getNextPage(phaseInfo, page)[0];
isEdit python: layoutType == 'edit';
pageInfo python: phaseInfo['pagesInfo'][page]">
<br/>
<tal:previous condition="python: previousPage and pageInfo['showPrevious']">
<tr>
<tal:comment replace="nothing">Previous</tal:comment>
<td tal:condition="python: previousPage and pageInfo['showPrevious']">
<tal:button condition="isEdit">
<input type="image" name="buttonPrevious"
tal:attributes="src string:$appUrl/ui/previous.png;
@ -278,35 +272,40 @@
title python: _('page_previous')"/>
</a>
</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"
tal:attributes="src string:$appUrl/ui/save.png;
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"
tal:attributes="src string:$appUrl/ui/cancel.png;
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"
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode='edit', page=page);
title python: _('object_edit');
src string: $appUrl/ui/editBig.png"
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"
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode=layoutType, page=page, refresh='yes');
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">
<input type="image" name="buttonNext"
tal:attributes="src string:$appUrl/ui/next.png;
@ -319,8 +318,13 @@
title python: _('page_next')"/>
</a>
</tal:link>
</tal:next>
</div>
</td>
<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">
This macro displays the global message on the page.

View file

@ -109,10 +109,6 @@ class ToolWrapper(AbstractWrapper):
"searchFields"
Determines, among all indexed fields for p_klass, which one will
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)
res = '%sFor%s' % (attributeType, fullClassName)