diff --git a/gen/__init__.py b/gen/__init__.py index db657ed..85c4e48 100644 --- a/gen/__init__.py +++ b/gen/__init__.py @@ -403,7 +403,7 @@ class Action(Type): page='main', group=None, move=0, indexed=False, searchable=False, specificReadPermission=False, specificWritePermission=False, width=None, height=None, - action=None, result='computation', master=None, + action=None, result='computation', confirm=False, master=None, masterValue=None, focus=False, historized=False): Type.__init__(self, None, (0,1), index, default, optional, False, show, page, group, move, indexed, False, @@ -414,6 +414,8 @@ class Action(Type): # compute things and redirect the user to the same page, with some # status message about execution of the action. 'file' means that the # result is the binary content of a file that the user will download. + self.confirm = confirm # If True, a popup will ask the user if she is + # really sure about triggering this action. def __call__(self, obj): '''Calls the action on p_obj.''' diff --git a/gen/plone25/generator.py b/gen/plone25/generator.py index cd3a569..c45d460 100644 --- a/gen/plone25/generator.py +++ b/gen/plone25/generator.py @@ -142,6 +142,9 @@ class Generator(AbstractGenerator): msg('goto_last', '', msg.GOTO_LAST), msg('goto_source', '', msg.GOTO_SOURCE), msg('whatever', '', msg.WHATEVER), + msg('confirm', '', msg.CONFIRM), + msg('yes', '', msg.YES), + msg('no', '', msg.NO), ] # Create basic files (config.py, Install.py, etc) self.generateTool() diff --git a/gen/plone25/mixins/__init__.py b/gen/plone25/mixins/__init__.py index 61aa80c..0d7b1be 100644 --- a/gen/plone25/mixins/__init__.py +++ b/gen/plone25/mixins/__init__.py @@ -544,9 +544,10 @@ class AbstractMixin: res.append(transition) return res - def getAppyPage(self, isEdit, phaseInfo, appyName=True): + def getAppyPage(self, isEdit, phaseInfo, appyPages, appyName=True): '''On which page am I? p_isEdit indicates if the current page is an - edit or consult view. p_phaseInfo indicates the current phase.''' + edit or consult view. p_phaseInfo indicates the current phase. + p_appyPages is the list of displayable appy pages.''' pageAttr = 'pageName' if isEdit: pageAttr = 'fieldset' # Archetypes page name @@ -555,6 +556,11 @@ class AbstractMixin: res = self.REQUEST.get(pageAttr, default) if appyName and (res == 'default'): res = 'main' + # If the page is not among currently displayable pages, return the + # default page + if res not in appyPages: + res = 'main' + if not appyName: res = 'default' return res def getAppyPages(self, phase='main'): diff --git a/gen/plone25/skin/edit.pt b/gen/plone25/skin/edit.pt index abb9c52..767bc3a 100644 --- a/gen/plone25/skin/edit.pt +++ b/gen/plone25/skin/edit.pt @@ -17,7 +17,8 @@ js python:contextObj.getUniqueWidgetAttr(fields, 'helper_js'); phaseInfo python: contextObj.getAppyPhases(fieldset=fieldset, forPlone=True); phase request/phase|phaseInfo/name; - pageName python: contextObj.getAppyPage(isEdit, phaseInfo);"> + appyPages python: contextObj.getAppyPages(phase); + pageName python: contextObj.getAppyPage(isEdit, phaseInfo, appyPages);">