362 lines
17 KiB
XML
362 lines
17 KiB
XML
<tal:comment replace="nothing">
|
|
This macro contains global page-related Javascripts.
|
|
</tal:comment>
|
|
<div metal:define-macro="prologue">
|
|
<tal:comment replace="nothing">Include type-specific CSS and JS.</tal:comment>
|
|
<tal:include condition="cssJs|nothing">
|
|
<link tal:repeat="cssFile cssJs/css" rel="stylesheet" type="text/css"
|
|
tal:attributes="href string:$appUrl/ui/$cssFile"/>
|
|
<script tal:repeat="jsFile cssJs/js" type="text/javascript"
|
|
tal:attributes="src string:$appUrl/ui/$jsFile"></script>
|
|
</tal:include>
|
|
|
|
<tal:comment replace="nothing">Javascript messages</tal:comment>
|
|
<script type="text/javascript" tal:content="tool/getJavascriptMessages"></script>
|
|
|
|
<tal:comment replace="nothing">Global form for deleting an object</tal:comment>
|
|
<form id="deleteForm" method="post" action="do">
|
|
<input type="hidden" name="action" value="Delete"/>
|
|
<input type="hidden" name="objectUid"/>
|
|
</form>
|
|
<tal:comment replace="nothing">Global form for deleting an event from an object's history</tal:comment>
|
|
<form id="deleteEventForm" method="post" action="do">
|
|
<input type="hidden" name="action" value="DeleteEvent"/>
|
|
<input type="hidden" name="objectUid"/>
|
|
<input type="hidden" name="eventTime"/>
|
|
</form>
|
|
<tal:comment replace="nothing">Global form for unlinking an object</tal:comment>
|
|
<form id="unlinkForm" method="post" action="do">
|
|
<input type="hidden" name="action" value="Unlink"/>
|
|
<input type="hidden" name="sourceUid"/>
|
|
<input type="hidden" name="fieldName"/>
|
|
<input type="hidden" name="targetUid"/>
|
|
</form>
|
|
<tal:comment replace="nothing">Global form for unlocking a page</tal:comment>
|
|
<form id="unlockForm" method="post" action="do">
|
|
<input type="hidden" name="action" value="Unlock"/>
|
|
<input type="hidden" name="objectUid"/>
|
|
<input type="hidden" name="pageName"/>
|
|
</form>
|
|
<tal:comment replace="nothing">Global form for generating a document from a pod template</tal:comment>
|
|
<form id="podTemplateForm" name="podTemplateForm" method="post"
|
|
tal:attributes="action python: tool.absolute_url() + '/generateDocument'">
|
|
<input type="hidden" name="objectUid"/>
|
|
<input type="hidden" name="fieldName"/>
|
|
<input type="hidden" name="podFormat"/>
|
|
<input type="hidden" name="askAction"/>
|
|
<input type="hidden" name="queryData"/>
|
|
<input type="hidden" name="customParams"/>
|
|
</form>
|
|
</div>
|
|
|
|
<tal:comment replace="nothing">
|
|
This macro shows the content of page. Because a page is a layouted object,
|
|
we simply call the macro that displays a layouted object.
|
|
contextObj The Zope object for which this page must be shown
|
|
layoutType The kind of layout: "view"? "edit"? "cell"?
|
|
layout The layout object that will dictate how object content
|
|
will be rendered.
|
|
</tal:comment>
|
|
<metal:show define-macro="show" tal:define="tagId python: 'pageLayout'">
|
|
<metal:layout use-macro="context/ui/widgets/show/macros/layout"/>
|
|
</metal:show>
|
|
|
|
<tal:comment replace="nothing">
|
|
This macro displays all widgets of a given page. It requires:
|
|
contextObj The Zope object for which widgets must be shown
|
|
page We show widgets of a given page
|
|
layoutType We must know if we must render the widgets in a "view",
|
|
"edit" or "cell" layout
|
|
</tal:comment>
|
|
<table metal:define-macro="widgets"
|
|
tal:attributes="width layout/width">
|
|
<tr tal:repeat="widget groupedWidgets">
|
|
<td tal:condition="python: widget['type'] == 'group'">
|
|
<metal:call use-macro="app/ui/widgets/show/macros/group"/>
|
|
</td>
|
|
<td tal:condition="python: widget['type'] != 'group'">
|
|
<metal:call use-macro="app/ui/widgets/show/macros/field"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<tal:comment replace="nothing">
|
|
This macro displays an object's history. It is used by macro "header" below.
|
|
</tal:comment>
|
|
<metal:history define-macro="objectHistory"
|
|
tal:define="startNumber request/startNumber|python:0;
|
|
startNumber python: int(startNumber);
|
|
batchSize python: int(request.get('maxPerPage', 5));
|
|
historyInfo python: contextObj.getHistory(startNumber, batchSize=batchSize);
|
|
objs historyInfo/events;
|
|
totalNumber historyInfo/totalNumber;
|
|
ajaxHookId python:'appyHistory';
|
|
navBaseCall python: 'askObjectHistory(\'%s\',\'%s\',%d,**v**)' % (ajaxHookId, contextObj.absolute_url(),batchSize);
|
|
tool contextObj/getTool;
|
|
_ python: tool.translate">
|
|
|
|
<tal:comment replace="nothing">Table containing the history</tal:comment>
|
|
<tal:history condition="objs">
|
|
<metal:nav use-macro="context/ui/navigate/macros/appyNavigate"/>
|
|
<table width="100%" class="history">
|
|
<tr>
|
|
<th tal:attributes="align dleft" tal:content="python: _('object_action')"></th>
|
|
<th tal:attributes="align dleft" tal:content="python: _('object_author')"></th>
|
|
<th tal:attributes="align dleft" tal:content="python: _('action_date')"></th>
|
|
<th tal:attributes="align dleft" tal:content="python: _('action_comment')"></th>
|
|
</tr>
|
|
<tal:event repeat="event objs">
|
|
<tr tal:define="odd repeat/event/odd;
|
|
rhComments event/comments|nothing;
|
|
state event/review_state|nothing;
|
|
isDataChange python: event['action'] == '_datachange_'"
|
|
tal:attributes="class python:test(odd, 'even', 'odd')" valign="top">
|
|
<td tal:condition="isDataChange">
|
|
<span tal:content="python: _('data_change')"></span>
|
|
<img tal:condition="python: user.has_role('Manager')" style="cursor:pointer"
|
|
tal:attributes="src string:$appUrl/ui/delete.png;
|
|
onClick python: 'onDeleteEvent(\'%s\', \'%s\')' % (contextObj.UID(), event['time'])"/>
|
|
</td>
|
|
<td tal:condition="not: isDataChange"
|
|
tal:content="python: _(contextObj.getWorkflowLabel(event['action']))"/>
|
|
<td tal:define="actorId python:event.get('actor')">
|
|
<span tal:condition="not: actorId" tal:replace="python: '?'"/>
|
|
<span tal:condition="actorId" tal:content="python: tool.getUserName(actorId)"></span>
|
|
</td>
|
|
<td tal:content="python: tool.formatDate(event['time'], withHour=True)"/>
|
|
<td tal:condition="not: isDataChange">
|
|
<tal:c condition="rhComments"
|
|
content="structure python: contextObj.formatText(rhComments)"/>
|
|
<span tal:condition="not: rhComments">-</span>
|
|
</td>
|
|
<td tal:condition="isDataChange">
|
|
<tal:comment replace="nothing">
|
|
Display the previous values of the fields whose value were modified in this change.</tal:comment>
|
|
<table class="appyChanges" width="100%">
|
|
<tr>
|
|
<th tal:attributes="align dleft" width="30%" tal:content="python: _('modified_field')"></th>
|
|
<th tal:attributes="align dleft" width="70%" tal:content="python: _('previous_value')"></th>
|
|
</tr>
|
|
<tr tal:repeat="change event/changes/items" valign="top">
|
|
<tal:change define="appyType python:contextObj.getAppyType(change[0], asDict=True);">
|
|
<td tal:content="structure python: _(appyType['labelId'])"></td>
|
|
<td tal:content="structure python:change[1][0]"></td>
|
|
</tal:change>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</tal:event>
|
|
</table>
|
|
</tal:history>
|
|
</metal:history>
|
|
|
|
<tal:comment replace="nothing">
|
|
This macro displays an object's transitions(s). It is used by macro "header" below.
|
|
</tal:comment>
|
|
<metal:transitions define-macro="transitions"
|
|
tal:define="transitions targetObj/getAppyTransitions"
|
|
tal:condition="transitions">
|
|
<form tal:define="formId python: 'trigger_%s' % targetObj.UID()" method="post"
|
|
tal:attributes="id formId; action python: targetObj.absolute_url() + '/do'">
|
|
<input type="hidden" name="action" value="Trigger"/>
|
|
<input type="hidden" name="workflow_action"/>
|
|
<table>
|
|
<tr valign="middle">
|
|
<tal:comment replace="nothing">Input field for storing comment</tal:comment>
|
|
<textarea id="comment" name="comment" cols="30" rows="3" style="display:none"></textarea>
|
|
<tal:comment replace="nothing">Buttons for triggering transitions</tal:comment>
|
|
<td tal:attributes="align dright" tal:repeat="transition transitions">
|
|
<tal:comment replace="nothing">Real button</tal:comment>
|
|
<input type="button" tal:condition="transition/may_trigger"
|
|
tal:attributes="value transition/title;
|
|
onClick python: 'triggerTransition(\'%s\',\'%s\',\'%s\')' % (formId,transition['name'],transition['confirm'])"/>
|
|
<tal:comment replace="nothing">Fake button, explaining why the transition can't be triggered</tal:comment>
|
|
<div class="fakeButton" tal:condition="not: transition/may_trigger">
|
|
<acronym tal:content="transition/title"
|
|
tal:attributes="title transition/reason"></acronym>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</metal:transitions>
|
|
|
|
<tal:comment replace="nothing">
|
|
This macros displays the page header, containing object title,
|
|
workflow-related info, object history, etc.
|
|
</tal:comment>
|
|
<div metal:define-macro="header"
|
|
tal:define="hasHistory contextObj/hasHistory;
|
|
historyMaxPerPage options/maxPerPage|python: 5;
|
|
historyExpanded python: request.get('appyHistory', 'collapsed') == 'expanded';
|
|
_ python: tool.translate;
|
|
creator contextObj/Creator"
|
|
tal:condition="not: contextObj/isTemporary">
|
|
|
|
<tal:comment replace="nothing">Information that is common to all tabs (object title, state, etc)</tal:comment>
|
|
<table width="100%" class="summary">
|
|
<tr>
|
|
<td colspan="2" class="by">
|
|
<tal:comment replace="nothing">Creator and last modification date</tal:comment>
|
|
<tal:comment replace="nothing">Plus/minus icon for accessing history</tal:comment>
|
|
<tal:accessHistory condition="hasHistory">
|
|
<img style="cursor:pointer" onClick="toggleCookie('appyHistory')"
|
|
tal:attributes="src python:test(historyExpanded, 'ui/collapse.gif', 'ui/expand.gif');
|
|
align dleft"
|
|
id="appyHistory_img"/>
|
|
<span tal:replace="python: _('object_history')"></span> ||
|
|
</tal:accessHistory>
|
|
|
|
<tal:comment replace="nothing">Document creator</tal:comment>
|
|
<tal:creator>
|
|
<tal:by replace="python: _('object_created_by')"/>
|
|
<tal:creator replace="python: tool.getUserName(creator)"/>
|
|
</tal:creator>
|
|
<tal:comment replace="nothing">Creation and last modification dates</tal:comment>
|
|
<tal:by replace="python: _('object_created_on')"/>
|
|
<tal:dates define="creationDate contextObj/Created;
|
|
modificationDate contextObj/Modified">
|
|
<tal:date replace="python: tool.formatDate(creationDate, withHour=True)"/>
|
|
<tal:modified condition="python: modificationDate != creationDate">—
|
|
<tal:by replace="python: _('object_modified_on')"/>
|
|
<tal:date replace="python: tool.formatDate(modificationDate, withHour=True)"/>
|
|
</tal:modified>
|
|
</tal:dates>
|
|
<tal:comment replace="nothing">State</tal:comment>
|
|
<tal:state condition="contextObj/showState">
|
|
—
|
|
<tal:label replace="python: _('workflow_state')"/>:
|
|
<b tal:content="python: _(contextObj.getWorkflowLabel())"></b>
|
|
</tal:state>
|
|
</td>
|
|
</tr>
|
|
<tal:comment replace="nothing">Object history</tal:comment>
|
|
<tr tal:condition="hasHistory">
|
|
<td colspan="2">
|
|
<span id="appyHistory"
|
|
tal:attributes="style python:test(historyExpanded, 'display:block', 'display:none')">
|
|
<div tal:define="ajaxHookId python: contextObj.UID() + '_history';"
|
|
tal:attributes="id ajaxHookId">
|
|
<script type="text/javascript"
|
|
tal:content="python: 'askObjectHistory(\'%s\',\'%s\',%d,0)' % (ajaxHookId, contextObj.absolute_url(),historyMaxPerPage)">
|
|
</script>
|
|
</div>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<tal:comment replace="nothing">The page footer.</tal:comment>
|
|
<metal:footer define-macro="footer">
|
|
<script type="text/javascript">initSlaves();</script>
|
|
</metal:footer>
|
|
|
|
<tal:comment replace="nothing">
|
|
This macro shows the range of buttons (next, previous, save,...) and the workflow transitions.
|
|
</tal:comment>
|
|
<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]">
|
|
<tr>
|
|
<tal:comment replace="nothing">Previous</tal:comment>
|
|
<td tal:condition="python: previousPage and pageInfo['showPrevious']">
|
|
<tal:button condition="isEdit">
|
|
<img style="cursor:pointer" onClick="submitAppyForm('previous')"
|
|
tal:attributes="src string:$appUrl/ui/previous.png; title python: _('page_previous')"/>
|
|
<input type="hidden" name="previousPage" tal:attributes="value previousPage"/>
|
|
</tal:button>
|
|
<tal:link condition="not: isEdit">
|
|
<a tal:attributes="href python: contextObj.getUrl(page=previousPage)">
|
|
<img tal:attributes="src string:$appUrl/ui/previous.png; title python: _('page_previous')"/>
|
|
</a>
|
|
</tal:link>
|
|
</td>
|
|
|
|
<tal:comment replace="nothing">Save</tal:comment>
|
|
<td tal:condition="python: isEdit and pageInfo['showSave']">
|
|
<img style="cursor:pointer" onClick="submitAppyForm('save')"
|
|
tal:attributes="src string:$appUrl/ui/save.png; title python: _('object_save');"/>
|
|
</td>
|
|
|
|
<tal:comment replace="nothing">Cancel</tal:comment>
|
|
<td tal:condition="python: isEdit and pageInfo['showCancel']">
|
|
<img style="cursor:pointer" onClick="submitAppyForm('cancel')"
|
|
tal:attributes="src string:$appUrl/ui/cancel.png; title python: _('object_cancel')"/>
|
|
</td>
|
|
|
|
<tal:edit condition="not: isEdit">
|
|
<td tal:define="locked python: contextObj.isLocked(user, page);
|
|
editable python: pageInfo['showOnEdit'] and contextObj.mayEdit()">
|
|
|
|
<tal:comment replace="nothing">Edit</tal:comment>
|
|
<a tal:condition="python: editable and not locked"
|
|
tal:attributes="href python: contextObj.getUrl(mode='edit', page=page)">
|
|
<img tal:attributes="src string: $appUrl/ui/editBig.png;
|
|
title python: _('object_edit')"/>
|
|
</a>
|
|
<tal:comment replace="nothing">Locked</tal:comment>
|
|
<a tal:condition="python: editable and locked">
|
|
<img style="cursor: help"
|
|
tal:define="lockDate python: tool.formatDate(locked[1]);
|
|
lockMsg python: _('page_locked', mapping={'user':tool.getUserName(locked[0]), 'date': lockDate})"
|
|
tal:attributes="src string: $appUrl/ui/lockedBig.png; title lockMsg"/>
|
|
</a>
|
|
</td>
|
|
</tal:edit>
|
|
|
|
<tal:comment replace="nothing">Refresh</tal:comment>
|
|
<td tal:condition="contextObj/isDebug">
|
|
<a tal:attributes="href python: contextObj.getUrl(mode=layoutType, page=page, refresh='yes')">
|
|
<img title="Refresh" style="vertical-align:top"
|
|
tal:attributes="src string: $appUrl/ui/refresh.png"/>
|
|
</a>
|
|
</td>
|
|
|
|
<tal:comment replace="nothing">Next</tal:comment>
|
|
<td tal:condition="python: nextPage and pageInfo['showNext']">
|
|
<tal:button condition="isEdit">
|
|
<img style="cursor:pointer" onClick="submitAppyForm('next')"
|
|
tal:attributes="src string:$appUrl/ui/next.png; title python: _('page_next')"/>
|
|
<input type="hidden" name="nextPage" tal:attributes="value nextPage"/>
|
|
</tal:button>
|
|
<tal:link condition="not: isEdit">
|
|
<a tal:attributes="href python: contextObj.getUrl(page=nextPage)">
|
|
<img tal:attributes="src string:$appUrl/ui/next.png;
|
|
title python: _('page_next')"/>
|
|
</a>
|
|
</tal:link>
|
|
</td>
|
|
<tal:comment replace="nothing">Workflow transitions</tal:comment>
|
|
<td tal:define="targetObj python: contextObj"
|
|
tal:condition="python: targetObj.showTransitions(layoutType)">
|
|
<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.
|
|
</tal:comment>
|
|
<metal:message define-macro="message" tal:define="messages tool/consumeMessages" tal:condition="messages">
|
|
<div class="message">
|
|
<img tal:attributes="src python: '%s/ui/close.png' % appUrl"
|
|
align="right" style="cursor:pointer" onClick="this.parentNode.style.display='none'"/>
|
|
<span tal:replace="structure messages"></span>
|
|
</div>
|
|
</metal:message>
|
|
|
|
<tal:comment replace="nothing">
|
|
Save the content of a rich field and return its consult view.
|
|
Requires request/fieldContent.
|
|
</tal:comment>
|
|
<metal:save define-macro="saveField"
|
|
tal:define="fieldName request/fieldName;
|
|
fieldContent request/fieldContent;
|
|
dummy python: contextObj.updateField(fieldName, fieldContent)">
|
|
<metal:call use-macro="app/ui/widgets/show/macros/fieldAjax"/>
|
|
</metal:save>
|