appypod-rattail/gen/plone25/skin/page.pt

341 lines
17 KiB
Plaintext
Raw Normal View History

<tal:comment replace="nothing">
This macro contains global page-related Javascripts.
</tal:comment>
<div metal:define-macro="prologue">
<tal:comment replace="nothing">Javascript messages</tal:comment>
<script language="javascript" tal:content="tool/getJavascriptMessages"></script>
<tal:comment replace="nothing">Global form for deleting an object</tal:comment>
<form id="deleteForm" method="post" action="skyn/do">
<input type="hidden" name="action" value="Delete"/>
<input type="hidden" name="objectUid"/>
</form>
<tal:comment replace="nothing">Global form for generating a document from a pod template.</tal:comment>
<form 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"/>
</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">
<metal:layout use-macro="here/skyn/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>
2011-09-18 08:00:05 -05:00
<table metal:define-macro="widgets"
tal:attributes="width layout/width">
<tr tal:repeat="widget python: contextObj.getGroupedAppyTypes(layoutType, page)">
<td tal:condition="python: widget['type'] == 'group'">
2011-09-18 08:00:05 -05:00
<metal:call use-macro="app/skyn/widgets/show/macros/group"/>
</td>
<td tal:condition="python: widget['type'] != 'group'">
2011-09-18 08:00:05 -05:00
<metal:call use-macro="app/skyn/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'));
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">
<tal:comment replace="nothing">Table containing the history</tal:comment>
<tal:history condition="objs">
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
<table width="100%" class="listing nosort">
<tr i18n:domain="plone">
<th i18n:translate="listingheader_action"/>
<th i18n:translate="listingheader_performed_by"/>
<th i18n:translate="listingheader_date_and_time"/>
<th i18n:translate="listingheader_comment"/>
</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" tal:content="python: tool.translate('data_change')"></td>
<td tal:condition="not: isDataChange"
tal:content="python: tool.translate(contextObj.getWorkflowLabel(event['action']))"
tal:attributes="class string:state-${state}"/>
<td tal:define="actorid python:event.get('actor');
actor python:contextObj.portal_membership.getMemberInfo(actorid);
fullname actor/fullname|nothing;
username actor/username|nothing"
tal:content="python:fullname or username or actorid"/>
<td tal:content="python:contextObj.restrictedTraverse('@@plone').toLocalizedTime(event['time'],long_format=True)"/>
<td tal:condition="not: isDataChange"><tal:comment condition="rhComments" tal:content="structure rhComments"/>
<tal:noComment condition="not: rhComments" i18n:translate="no_comments" i18n:domain="plone"/></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 align="left" width="30%" tal:content="python: tool.translate('modified_field')"></th>
<th align="left" width="70%" tal:content="python: tool.translate('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: tool.translate(appyType['labelId'])"></td>
<td tal:define="appyValue python: contextObj.getFormattedFieldValue(change[0], change[1][0]);
severalValues python: (appyType['multiplicity'][1] &gt; 1) or (appyType['multiplicity'][1] == None)">
<span tal:condition="not: severalValues" tal:replace="appyValue"></span>
<ul tal:condition="python: severalValues">
<li tal:repeat="av appyValue" tal:content="av"></li>
</ul>
</td>
</tal:change>
</tr>
</table>
</td>
</tr>
</tal:event>
</table>
</tal:history>
</metal:history>
<tal:comment replace="nothing">
This macro displays an object's state(s). It is used by macro "header" below.
</tal:comment>
<metal:states define-macro="states"
tal:define="showAllStatesInPhase python: tool.getAttr('showAllStatesInPhaseFor' + contextObj.meta_type);
states python: contextObj.getAppyStates(phase, currentOnly=not showAllStatesInPhase)"
tal:condition="python: test(showAllStatesInPhase, len(states)&gt;1, True)">
<table>
<tr>
<tal:state repeat="stateInfo states">
<td tal:attributes="class python: 'appyState step%sState' % stateInfo['stateStatus']"
tal:content="python: tool.translate(contextObj.getWorkflowLabel(stateInfo['name']))">
</td>
<td tal:condition="python: stateInfo['name'] != states[-1]['name']">
2011-09-18 08:00:05 -05:00
<img tal:attributes="src string: $appUrl/skyn/nextState.png"/>
</td>
</tal:state>
</tr>
</table>
</metal:states>
<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 contextObj/getAppyTransitions"
tal:condition="transitions">
<form id="triggerTransitionForm" method="post"
tal:attributes="action python: contextObj.absolute_url() + '/skyn/do'">
<input type="hidden" name="action" value="Do"/>
<input type="hidden" name="workflow_action"/>
<table>
<tr valign="middle">
<tal:comment replace="nothing">Input field allowing to enter a comment before triggering a transition</tal:comment>
<td tal:define="showCommentsField python:tool.getAttr('showWorkflowCommentFieldFor'+contextObj.meta_type)"
align="right" tal:condition="showCommentsField">
<span tal:content="python: tool.translate('workflow_comment')" class="discreet"></span>
<input type="text" id="comment" name="comment" size="30"/>
</td>
<tal:comment replace="nothing">Buttons for triggering transitions</tal:comment>
<td align="right" tal:repeat="transition transitions">
<tal:comment replace="nothing">Real button</tal:comment>
<input type="button" class="appyButton" tal:condition="transition/may_trigger"
tal:attributes="value transition/title;
onClick python: 'triggerTransition(\'%s\',\'%s\')' % (transition['name'],transition['confirm']);"/>
<tal:comment replace="nothing">Fake button, explaining why the transition can't be triggered</tal:comment>
<div class="appyButton 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="showCommonInfo python: layoutType == 'view';
showWorkflow python: tool.getAttr('showWorkflowFor' + contextObj.meta_type);
hasHistory contextObj/hasHistory;
historyMaxPerPage options/maxPerPage|python: 5;
historyExpanded python: tool.getCookieValue('appyHistory', default='collapsed') == 'expanded';
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>
2011-09-18 08:00:05 -05:00
<table width="100%" tal:condition="showCommonInfo" class="summary">
<tr>
<tal:comment replace="nothing">Title</tal:comment>
<td colspan="2" class="objectTitle" tal:content="contextObj/title_or_id"></td>
</tr>
2011-09-18 08:00:05 -05:00
<tr class="underTitle">
<td class="by" colspan="2">
<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 align="left" style="cursor:pointer" onClick="toggleCookie('appyHistory')"
tal:attributes="src python:test(historyExpanded, 'skyn/collapse.gif', 'skyn/expand.gif');"
id="appyHistory_img"/>&nbsp;
<span i18n:translate="label_history" i18n:domain="plone" class="appyHistory"></span>&nbsp;
</tal:accessHistory>
<tal:comment replace="nothing">Show document creator</tal:comment>
<tal:creator condition="creator"
define="author python:contextObj.portal_membership.getMemberInfo(creator)">
2011-09-18 08:00:05 -05:00
<span i18n:domain="plone" i18n:translate="label_by_author">
by <span tal:content="python:author and author['fullname'] or creator"
tal:omit-tag="not:author" i18n:name="author"/>
&mdash;
</span>
</tal:creator>
<tal:comment replace="nothing">Show last modification date</tal:comment>
<span tal:replace="python:contextObj.restrictedTraverse('@@plone').toLocalizedTime(contextObj.ModificationDate(),long_format=1)"></span>
</td>
</tr>
<tal:comment replace="nothing">Object history</tal:comment>
2011-09-18 08:00:05 -05:00
<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">
2011-09-18 08:00:05 -05:00
<script tal:content="python: 'askObjectHistory(\'%s\',\'%s\',%d,0)' % (ajaxHookId, contextObj.absolute_url(),historyMaxPerPage)">
</script>
</div>
</span>
</td>
</tr>
<tal:comment replace="nothing">Workflow-related information and actions</tal:comment>
2011-09-18 08:00:05 -05:00
<tr tal:condition="python: showWorkflow and contextObj.getWorkflowLabel()">
<td colspan="2" class="workflow">
<table width="100%">
<tr>
<td><metal:states use-macro="here/skyn/page/macros/states"/></td>
<td align="right"><metal:states use-macro="here/skyn/page/macros/transitions"/></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<tal:comment replace="nothing">The page footer.</tal:comment>
<metal:footer define-macro="footer">
2011-09-18 08:00:05 -05:00
<tal:dummy define="messages app/plone_utils/showPortalMessages"/>
<script language="javascript">
<!--
initSlaves();
-->
</script>
</metal:footer>
<tal:comment replace="nothing">
This macro shows the range of buttons (next, previous, save,...).
</tal:comment>
<div metal:define-macro="buttons"
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']">
<tal:button condition="isEdit">
<input type="image" class="imageInput" style="cursor:pointer" name="buttonPrevious"
title="label_previous" i18n:attributes="title" i18n:domain="plone"
2011-09-18 08:00:05 -05:00
tal:attributes="src string:$appUrl/skyn/previous.png"/>
<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)">
2011-09-18 08:00:05 -05:00
<img tal:attributes="src string:$appUrl/skyn/previous.png"
title="label_previous" i18n:attributes="title" i18n:domain="plone"/>
</a>
</tal:link>
</tal:previous>
<tal:save condition="python: isEdit and pageInfo['showSave']">
<input type="image" class="imageInput" style="cursor:pointer" name="buttonOk"
title="label_save" i18n:attributes="title" i18n:domain="plone"
2011-09-18 08:00:05 -05:00
tal:attributes="src string:$appUrl/skyn/save.png"/>
</tal:save>
<tal:cancel condition="python: isEdit and pageInfo['showCancel']">
<input type="image" class="imageInput" style="cursor:pointer" name="buttonCancel"
title="label_cancel" i18n:attributes="title" i18n:domain="plone"
2011-09-18 08:00:05 -05:00
tal:attributes="src string:$appUrl/skyn/cancel.png"/>
</tal:cancel>
<tal:edit condition="python: not isEdit and pageInfo['showOnEdit']">
<img title="Edit" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode='edit', page=page);
2011-09-18 08:00:05 -05:00
src string: $appUrl/skyn/editBig.png"
tal:condition="python: contextObj.allows('Modify portal content')"/>
</tal:edit>
<tal:refresh condition="contextObj/isDebug">
<img title="Refresh" style="cursor:pointer"
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode=layoutType, page=page, refresh='yes');
2011-09-18 08:00:05 -05:00
src string: $appUrl/skyn/refresh.png"/>
</tal:refresh>
<tal:next condition="python: nextPage and pageInfo['showNext']">
<tal:button condition="isEdit">
<input type="image" class="imageInput" style="cursor:pointer" name="buttonNext"
title="label_next" i18n:attributes="title" i18n:domain="plone"
2011-09-18 08:00:05 -05:00
tal:attributes="src string:$appUrl/skyn/next.png"/>
<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)">
2011-09-18 08:00:05 -05:00
<img tal:attributes="src string:$appUrl/skyn/next.png"
title="label_next" i18n:attributes="title" i18n:domain="plone"/>
</a>
</tal:link>
</tal:next>
</div>
<tal:comment replace="nothing">
This macro displays the global message on the page.
</tal:comment>
<metal:message define-macro="message">
<tal:comment replace="nothing">Single message from portal_status_message request key</tal:comment>
2011-09-18 08:00:05 -05:00
<div tal:define="msg req/portal_status_message | nothing"
tal:condition="msg" class="message" tal:content="structure msg"></div>
<tal:comment replace="nothing">Messages added via plone_utils</tal:comment>
2011-09-18 08:00:05 -05:00
<tal:messages define="messages python: ''.join([m.message for m in app.plone_utils.showPortalMessages()])"
condition="messages">
<div class="message" tal:content="structure messages"></div>
</tal:messages>
</metal:message>