Custom messages can now be returned as result of triggering transitions; added a mechanism for asking a confirmation to the user before saving it; bugfix in navigation (navigation info disappeared when firing workflow actions.
This commit is contained in:
parent
cccdc12372
commit
502c86dab8
7 changed files with 95 additions and 39 deletions
|
@ -11,7 +11,8 @@
|
|||
page request/page|python:'main';
|
||||
cssAndJs python: contextObj.getCssAndJs(layoutType, page);
|
||||
css python: cssAndJs[0];
|
||||
js python: cssAndJs[1]">
|
||||
js python: cssAndJs[1];
|
||||
confirmMsg request/confirmMsg | nothing;">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
|
||||
xmlns:tal="http://xml.zope.org/namespaces/tal"
|
||||
|
@ -46,15 +47,19 @@
|
|||
<body>
|
||||
<metal:fill fill-slot="main">
|
||||
<metal:prologue use-macro="here/skyn/page/macros/prologue"/>
|
||||
<form name="edit_form" method="post" enctype="multipart/form-data"
|
||||
class="enableUnloadProtection atBaseEditForm"
|
||||
tal:attributes="action python: contextObj.absolute_url()+'/skyn/do'">
|
||||
<form id="appyEditForm" name="appyEditForm" method="post" enctype="multipart/form-data"
|
||||
tal:attributes="action python: contextObj.absolute_url()+'/skyn/do';
|
||||
class python: test(confirmMsg, 'atBaseEditForm', 'enableUnloadProtection atBaseEditForm')">
|
||||
<input type="hidden" name="action" value="Update"/>
|
||||
<input type="hidden" name="page" tal:attributes="value page"/>
|
||||
<input type="hidden" name="nav" tal:attributes="value request/nav|nothing"/>
|
||||
<input type="hidden" name="is_new" tal:attributes="value contextObj/isTemporary"/>
|
||||
<input type="hidden" name="confirmed" value="False"/>
|
||||
<metal:show use-macro="here/skyn/page/macros/show"/>
|
||||
</form>
|
||||
<script tal:condition="confirmMsg"
|
||||
tal:content="python: 'askConfirm(\'script\', \'postConfirmedEditForm()\', \'%s\')' % confirmMsg">
|
||||
</script>
|
||||
<metal:footer use-macro="here/skyn/page/macros/footer"/>
|
||||
</metal:fill>
|
||||
</body>
|
||||
|
|
|
@ -46,8 +46,13 @@
|
|||
if (xhrObjects[pos].onGet) {
|
||||
xhrObjects[pos].onGet(xhrObjects[pos], hookElem);
|
||||
}
|
||||
// Eval inner scripts if any.
|
||||
var innerScripts = document.getElementsByName("appyHook");
|
||||
for (var i=0; i<innerScripts.length; i++) {
|
||||
eval(innerScripts[i].innerHTML);
|
||||
}
|
||||
xhrObjects[pos].freed = 1;
|
||||
}
|
||||
xhrObjects[pos].freed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +309,13 @@
|
|||
// We must execute Javascript code in "action"
|
||||
eval(action);
|
||||
}
|
||||
|
||||
}
|
||||
// Function that finally posts the edit form after the user has confirmed that
|
||||
// she really wants to post it.
|
||||
function postConfirmedEditForm() {
|
||||
var theForm = document.getElementById('appyEditForm');
|
||||
theForm.confirmed.value = "True";
|
||||
theForm.submit();
|
||||
}
|
||||
// Function that shows or hides a tab. p_action is 'show' or 'hide'.
|
||||
function manageTab(tabId, action) {
|
||||
|
|
|
@ -89,11 +89,10 @@
|
|||
|
||||
<tal:comment replace="nothing">View macro for a Ref.</tal:comment>
|
||||
<div metal:define-macro="view"
|
||||
tal:define= "innerRef innerRef|python:False;
|
||||
tal:define= "innerRef innerRef|python:False;
|
||||
ajaxHookId python: contextObj.UID() + name"
|
||||
tal:attributes = "id ajaxHookId">
|
||||
<script language="javascript"
|
||||
tal:content="python: 'askRefField(\'%s\',\'%s\',\'%s\',\'%s\',0)' % (ajaxHookId, contextObj.absolute_url(), name, innerRef)">
|
||||
<script name="appyHook" tal:content="python: 'askRefField(\'%s\',\'%s\',\'%s\',\'%s\',0)' % (ajaxHookId, contextObj.absolute_url(), name, innerRef)">
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
@ -148,9 +147,6 @@
|
|||
<tal:objectIsPresent condition="objs">
|
||||
<tal:obj repeat="obj objs">
|
||||
<td tal:define="includeShownInfo python:True"><metal:showObjectTitle use-macro="portal/skyn/widgets/ref/macros/objectTitle" /></td>
|
||||
<td tal:condition="not: appyType/isBack">
|
||||
<metal:showObjectActions use-macro="portal/skyn/widgets/ref/macros/objectActions" />
|
||||
</td>
|
||||
</tal:obj>
|
||||
</tal:objectIsPresent>
|
||||
</tr></table>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue