Fixed https://bugs.launchpad.net/appy/+bug/403975 and https://bugs.launchpad.net/smetest/+bug/403979
This commit is contained in:
parent
4aeaf975ab
commit
4c29c7c484
|
@ -20,6 +20,39 @@ class AbstractMixin:
|
||||||
inherits from this class. It contains basic functions allowing to
|
inherits from this class. It contains basic functions allowing to
|
||||||
minimize the amount of generated code.'''
|
minimize the amount of generated code.'''
|
||||||
|
|
||||||
|
def content_edit_impl(self, state, id):
|
||||||
|
'''This method is called by the Plone machinery every time an object
|
||||||
|
must be created or edited through the edit view.'''
|
||||||
|
rq = self.REQUEST
|
||||||
|
newSelf = self.portal_factory.doCreate(self, id)
|
||||||
|
newSelf.processForm()
|
||||||
|
|
||||||
|
# Get the current language and put it in the request
|
||||||
|
if rq.form.has_key('current_lang'):
|
||||||
|
rq.form['language'] = rq.form.get('current_lang')
|
||||||
|
|
||||||
|
# Generate the message returned to the user after creation/edition
|
||||||
|
portal_status_message = self.translate(
|
||||||
|
msgid='message_content_changes_saved',
|
||||||
|
default='Content changes saved.')
|
||||||
|
portal_status_message = rq.get(
|
||||||
|
'portal_status_message', portal_status_message)
|
||||||
|
|
||||||
|
# What page must I display next ?
|
||||||
|
previousClicked = rq.get('form_previous', None)
|
||||||
|
nextClicked = rq.get('form_next', None)
|
||||||
|
if previousClicked or nextClicked:
|
||||||
|
# We must redirect the user to the previous or next page
|
||||||
|
targetPage = rq.get('nextPage', None)
|
||||||
|
if previousClicked:
|
||||||
|
targetPage = rq.get('previousPage', None)
|
||||||
|
return state.set(status='next_schemata', context=newSelf,
|
||||||
|
fieldset=targetPage,
|
||||||
|
portal_status_message=portal_status_message)
|
||||||
|
else:
|
||||||
|
return state.set(status='success', context=newSelf,
|
||||||
|
portal_status_message=portal_status_message)
|
||||||
|
|
||||||
def getAppyType(self, fieldName):
|
def getAppyType(self, fieldName):
|
||||||
'''Returns the Appy type corresponding to p_fieldName.'''
|
'''Returns the Appy type corresponding to p_fieldName.'''
|
||||||
res = None
|
res = None
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<metal:editString define-macro="editString" i18n:domain="<!applicationName!>"
|
<metal:editString define-macro="editString" i18n:domain="<!applicationName!>"
|
||||||
tal:define="vocab python:field.Vocabulary(contextObj);">
|
tal:define="vocab python:field.Vocabulary(contextObj);">
|
||||||
<label tal:attributes="for fieldName" tal:condition="showLabel" tal:content="label"/>
|
<label tal:attributes="for fieldName" tal:condition="showLabel" tal:content="label"/>
|
||||||
<div class="discreet" tal:content="description"/>
|
<div class="discreet" tal:content="structure description"/>
|
||||||
<select tal:attributes="name fieldName;
|
<select tal:attributes="name fieldName;
|
||||||
id fieldName;
|
id fieldName;
|
||||||
tabindex tabindex/next;
|
tabindex tabindex/next;
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
value python: test(contextObj.checkboxChecked(fieldName, value), 'True', 'False')"
|
value python: test(contextObj.checkboxChecked(fieldName, value), 'True', 'False')"
|
||||||
type="hidden" />
|
type="hidden" />
|
||||||
<label tal:attributes="for fieldName" tal:condition="showLabel" tal:content="label"/>
|
<label tal:attributes="for fieldName" tal:condition="showLabel" tal:content="label"/>
|
||||||
<div class="discreet" tal:content="description"/>
|
<div class="discreet" tal:content="structure description"/>
|
||||||
</metal:editBoolean>
|
</metal:editBoolean>
|
||||||
|
|
||||||
<div metal:define-macro="editField" i18n:domain="<!applicationName!>"
|
<div metal:define-macro="editField" i18n:domain="<!applicationName!>"
|
||||||
|
@ -601,8 +601,8 @@
|
||||||
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>
|
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>
|
||||||
<tr>
|
<tr>
|
||||||
<tal:comment replace="nothing">Mandatory column "Title"/"Name"</tal:comment>
|
<tal:comment replace="nothing">Mandatory column "Title"/"Name"</tal:comment>
|
||||||
<th><img tal:attributes= "src python: '%s/arrowDown.gif' % context.absolute_url();
|
<th><img tal:attributes= "src string: $portal_url/arrowDown.gif;
|
||||||
onClick python:'javascript:onSort(\'title\')';"
|
onClick python:'javascript:onSort(\'title\')';"
|
||||||
id="arrow_title" style="cursor:pointer"/>
|
id="arrow_title" style="cursor:pointer"/>
|
||||||
<span i18n:translate="ref_name"/>
|
<span i18n:translate="ref_name"/>
|
||||||
<input id="filter_title" type="text" size="10" onkeyup="javascript:onTextEntered('title')"/>
|
<input id="filter_title" type="text" size="10" onkeyup="javascript:onTextEntered('title')"/>
|
||||||
|
@ -611,7 +611,7 @@
|
||||||
<tal:comment replace="nothing">Columns corresponding to other fields</tal:comment>
|
<tal:comment replace="nothing">Columns corresponding to other fields</tal:comment>
|
||||||
<tal:columnHeader repeat="fieldDescr fieldDescrs">
|
<tal:columnHeader repeat="fieldDescr fieldDescrs">
|
||||||
<th tal:define="fieldName fieldDescr/atField/getName|string:workflow_state">
|
<th tal:define="fieldName fieldDescr/atField/getName|string:workflow_state">
|
||||||
<img tal:attributes= "src string: '$portal_url/arrowDown.gif;
|
<img tal:attributes= "src string: $portal_url/arrowDown.gif;
|
||||||
onClick python:'javascript:onSort(\'%s\')' % fieldName;
|
onClick python:'javascript:onSort(\'%s\')' % fieldName;
|
||||||
id python: 'arrow_%s' % fieldName"
|
id python: 'arrow_%s' % fieldName"
|
||||||
style="cursor:pointer"/>
|
style="cursor:pointer"/>
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
<div metal:use-macro="here/<!macros!>/macros/listFields" />
|
<div metal:use-macro="here/<!macros!>/macros/listFields" />
|
||||||
|
|
||||||
<div class="formControls">
|
<div class="formControls">
|
||||||
<input type="hidden" name="fieldset" value="default" tal:attributes="value fieldset"/>
|
<input type="hidden" name="fieldset" tal:attributes="value fieldset"/>
|
||||||
<input type="hidden" name="form.submitted" value="1"/>
|
<input type="hidden" name="form.submitted" value="1"/>
|
||||||
<input type="hidden" name="add_reference.field:record" value=""/>
|
<input type="hidden" name="add_reference.field:record" value=""/>
|
||||||
<input type="hidden" name="add_reference.type:record" value=""/>
|
<input type="hidden" name="add_reference.type:record" value=""/>
|
||||||
|
@ -122,24 +122,29 @@
|
||||||
|
|
||||||
<tal:comment replace="nothing">Buttons (Previous, Next, Save, etc)</tal:comment>
|
<tal:comment replace="nothing">Buttons (Previous, Next, Save, etc)</tal:comment>
|
||||||
<metal:block define-slot="buttons"
|
<metal:block define-slot="buttons"
|
||||||
tal:define="fieldset_index python:fieldsets.index(fieldset);
|
tal:define="pages phaseInfo/pages;
|
||||||
n_fieldsets python:len(fieldsets)">
|
pageIndex python:pages.index(fieldset);
|
||||||
|
numberOfPages python:len(pages)">
|
||||||
|
|
||||||
<input tal:condition="python:(fieldset_index > 0) and (fieldsets[fieldset_index-1] in phaseInfo['pages'])"
|
<tal:previousButton condition="python: pageIndex > 0">
|
||||||
class="context" type="submit" name="form_previous" value="Previous"
|
<input class="context" type="submit" name="form_previous"
|
||||||
i18n:attributes="value label_previous;" i18n:domain="plone"
|
i18n:attributes="value label_previous;" i18n:domain="plone"
|
||||||
tal:attributes="tabindex tabindex/next;
|
tal:attributes="tabindex tabindex/next;
|
||||||
disabled python:test(isLocked, 'disabled', None);"/>
|
disabled python:test(isLocked, 'disabled', None);"/>
|
||||||
<input tal:condition="python:(fieldset_index < n_fieldsets - 1) and (fieldsets[fieldset_index+1] in phaseInfo['pages'])"
|
<input type="hidden" name="previousPage" tal:attributes="value python: pages[pageIndex-1]"/>
|
||||||
class="context" type="submit" name="form_next" value="Next"
|
</tal:previousButton>
|
||||||
i18n:attributes="value label_next;" i18n:domain="plone"
|
<tal:nextButton condition="python: pageIndex < numberOfPages - 1">
|
||||||
tal:attributes="tabindex tabindex/next;
|
<input class="context" type="submit" name="form_next" value="Next"
|
||||||
disabled python:test(isLocked, 'disabled', None);"/>
|
i18n:attributes="value label_next;" i18n:domain="plone"
|
||||||
<input class="context" type="submit" name="form_submit" value="Save"
|
tal:attributes="tabindex tabindex/next;
|
||||||
|
disabled python:test(isLocked, 'disabled', None);"/>
|
||||||
|
<input type="hidden" name="nextPage" tal:attributes="value python: pages[pageIndex+1]"/>
|
||||||
|
</tal:nextButton>
|
||||||
|
<input class="context" type="submit" name="form_submit"
|
||||||
i18n:attributes="value label_save;" i18n:domain="plone"
|
i18n:attributes="value label_save;" i18n:domain="plone"
|
||||||
tal:attributes="tabindex tabindex/next;
|
tal:attributes="tabindex tabindex/next;
|
||||||
disabled python:test(isLocked, 'disabled', None);"/>
|
disabled python:test(isLocked, 'disabled', None);"/>
|
||||||
<input class="standalone" type="submit" name="form.button.cancel" value="Cancel"
|
<input class="standalone" type="submit" name="form.button.cancel"
|
||||||
i18n:attributes="value label_cancel;" i18n:domain="plone"
|
i18n:attributes="value label_cancel;" i18n:domain="plone"
|
||||||
tal:attributes="tabindex tabindex/next"/>
|
tal:attributes="tabindex tabindex/next"/>
|
||||||
</metal:block>
|
</metal:block>
|
||||||
|
|
Loading…
Reference in a new issue