1083 lines
57 KiB
XML
1083 lines
57 KiB
XML
<div metal:define-macro="listPodTemplates" class="appyPod" tal:condition="podTemplates"
|
|
tal:define="podTemplates python: flavour.getAvailablePodTemplates(contextObj, phase);">
|
|
<script language="javascript">
|
|
<!--
|
|
// Function that allows to generate a meeting document containing selected items.
|
|
function generatePodDocument(contextUid, templateUid) {
|
|
var theForm = document.forms["podTemplateForm"];
|
|
theForm.objectUid.value = contextUid;
|
|
theForm.templateUid.value = templateUid;
|
|
theForm.submit();
|
|
}
|
|
-->
|
|
</script>
|
|
|
|
<tal:comment replace="nothing">Form submitted when an object needs to be generated as a document.</tal:comment>
|
|
<form name="podTemplateForm" method="post"
|
|
tal:attributes="action python: contextObj.absolute_url() + '/generateDocument'">
|
|
<input type="hidden" name="objectUid"/>
|
|
<input type="hidden" name="templateUid"/>
|
|
</form>
|
|
|
|
<tal:podTemplates define="maxShownTemplates python: flavour.getMaxShownTemplates(contextObj)">
|
|
<tal:comment replace="nothing">Display templates as links if a few number of templates must be shown</tal:comment>
|
|
<span class="discreet" tal:condition="python: len(podTemplates)<=maxShownTemplates"
|
|
tal:repeat="podTemplate podTemplates">
|
|
<a style="cursor: pointer"
|
|
tal:define="podFormat podTemplate/getPodFormat"
|
|
tal:attributes="onclick python: 'javascript:generatePodDocument(\'%s\',\'%s\')' % (contextObj.UID(), podTemplate.UID())" >
|
|
<img tal:attributes="src string: $portal_url/$podFormat.png"/>
|
|
<span tal:replace="podTemplate/Title"/>
|
|
</a>
|
|
</span>
|
|
<tal:comment replace="nothing">Display templates as a list if a lot of templates must be shown</tal:comment>
|
|
<select tal:condition="python: len(podTemplates)>maxShownTemplates">
|
|
<option value="" tal:content="python: tool.translate('choose_a_doc')"></option>
|
|
<option tal:repeat="podTemplate podTemplates" tal:content="podTemplate/Title"
|
|
tal:attributes="onclick python: 'javascript:generatePodDocument(\'%s\',\'%s\')' % (contextObj.UID(), podTemplate.UID())" />
|
|
</select>
|
|
</tal:podTemplates>
|
|
</div>
|
|
|
|
<metal:editString define-macro="editString" tal:define="vocab python:field.Vocabulary(contextObj)">
|
|
<label tal:attributes="for fieldName" tal:condition="showLabel" tal:content="label"/>
|
|
<span class="fieldRequired" tal:condition="python: appyType['multiplicity'][0] > 0"></span>
|
|
<div class="discreet" tal:content="structure description"/>
|
|
<select tal:attributes="name fieldName;
|
|
id fieldName;
|
|
tabindex tabindex/next;
|
|
multiple isMultiple;
|
|
onchange python: 'javascript:updateSlaves(getMasterValue(this), \'%s\')' % appyType['id'];
|
|
class python: contextObj.getCssClasses(appyType, asSlave=False)">
|
|
<option tal:repeat="item vocab" i18n:translate=""
|
|
tal:attributes="value item;
|
|
selected python:contextObj.fieldValueSelected(fieldName, value, item)"
|
|
tal:content="python:here.translate(vocab.getMsgId(item), default=vocab.getValue(item))"/>
|
|
</select>
|
|
</metal:editString>
|
|
|
|
<metal:editBoolean define-macro="editBoolean">
|
|
<input type="checkbox"
|
|
tal:attributes="tabindex tabindex/next;
|
|
name python: fieldName + '_visible';
|
|
id fieldName;
|
|
checked python:contextObj.checkboxChecked(fieldName, value);
|
|
onClick python:'toggleCheckbox(\'%s\', \'%s_hidden\');;updateSlaves(getMasterValue(this), \'%s\')' % (fieldName, fieldName, appyType['id']);
|
|
class python: 'noborder ' + contextObj.getCssClasses(appyType, asSlave=False)"/>
|
|
<input tal:attributes="name fieldName;
|
|
id string:${fieldName}_hidden;
|
|
value python: test(contextObj.checkboxChecked(fieldName, value), 'True', 'False')"
|
|
type="hidden" />
|
|
<span class="fieldRequired" tal:condition="python: appyType['multiplicity'][0] > 0"></span>
|
|
<label tal:attributes="for fieldName" tal:condition="showLabel" tal:content="label"/>
|
|
<div class="discreet" tal:content="structure description"/>
|
|
</metal:editBoolean>
|
|
|
|
<div metal:define-macro="editField"
|
|
tal:define="fieldName field/getName;
|
|
isMultiple python:test(appyType['multiplicity'][1]!=1, 'multiple', '');
|
|
inError python:test(errors.has_key(fieldName), True, False);
|
|
value python:field.getAccessor(contextObj)();
|
|
defaultValue python: contextObj.getDefault(fieldName)"
|
|
tal:attributes="class python:'field ' + test(inError, ' error', '')">
|
|
<div tal:condition="inError" tal:content="python: errors[fieldName]"></div>
|
|
<tal:stringField condition="python: appyType['type'] == 'String'">
|
|
<metal:edit use-macro="here/skyn/macros/macros/editString"/>
|
|
</tal:stringField>
|
|
<tal:booleanField condition="python: appyType['type'] == 'Boolean'">
|
|
<metal:edit use-macro="here/skyn/macros/macros/editBoolean"/>
|
|
</tal:booleanField>
|
|
</div>
|
|
|
|
<div metal:define-macro="showComputedField">
|
|
<span class="appyLabel" tal:condition="showLabel" tal:content="label"></span>
|
|
<tal:showValue define="theValue python: contextObj.getComputedValue(appyType)">
|
|
<span tal:condition="appyType/plainText" tal:replace="theValue"/>
|
|
<span tal:condition="not: appyType/plainText" tal:replace="structure theValue"/>
|
|
</tal:showValue>
|
|
</div>
|
|
|
|
<div metal:define-macro="showInfoField">
|
|
<span class="appyLabel" tal:content="structure label"></span>
|
|
<span tal:content="structure description"></span>
|
|
</div>
|
|
|
|
<div metal:define-macro="showActionField">
|
|
<form name="executeAppyAction"
|
|
tal:attributes="action python: contextObj.absolute_url()+'/skyn/do'">
|
|
<input type="hidden" name="action" value="ExecuteAppyAction"/>
|
|
<input type="hidden" name="objectUid" tal:attributes="value contextObj/UID"/>
|
|
<input type="hidden" name="fieldName" tal:attributes="value field/getName"/>
|
|
<input type="submit" name="do" tal:attributes="value label" onClick="javascript:;"/>
|
|
<tal:comment replace="nothing">The previous onClick is simply used to prevent Plone
|
|
from adding a CSS class that displays a popup when the user triggers the form multiple
|
|
times.</tal:comment>
|
|
</form>
|
|
</div>
|
|
|
|
<metal:showDate define-macro="showDateField"
|
|
tal:define="v python: contextObj.getAppyValue(field.getName(), appyType)">
|
|
<span tal:condition="showLabel" tal:content="label" class="appyLabel"></span>
|
|
<span tal:replace="v"></span>
|
|
</metal:showDate>
|
|
|
|
<metal:showString define-macro="showStringField"
|
|
tal:define="v python: contextObj.getAppyValue(field.getName(), appyType);
|
|
fmt python: appyType['format'];
|
|
maxMult python: appyType['multiplicity'][1];
|
|
severalValues python: (maxMult == None) or (maxMult > 1)">
|
|
<tal:simpleString condition="python: fmt in (0, 3)">
|
|
<span tal:condition="showLabel" tal:content="label" class="appyLabel"
|
|
tal:attributes="class python: 'appyLabel ' + contextObj.getCssClasses(appyType, asSlave=False);
|
|
id python: v"></span>
|
|
<ul class="appyList" tal:condition="python: v and severalValues">
|
|
<li class="appyBullet" tal:repeat="sv v"><i tal:content="structure sv"></i></li>
|
|
</ul>
|
|
<tal:singleValue condition="python: v and not severalValues">
|
|
<span tal:condition="python: fmt != 3" tal:replace="structure v"/>
|
|
<span tal:condition="python: fmt == 3">********</span>
|
|
</tal:singleValue>
|
|
</tal:simpleString>
|
|
<tal:formattedString condition="python: fmt not in (0, 3)">
|
|
<fieldset>
|
|
<legend tal:condition="showLabel" tal:content="label"></legend>
|
|
<span tal:condition="python: appyType['format'] == 1"
|
|
tal:replace="structure python: v.replace('\n', '<br>')"/>
|
|
<span tal:condition="python: appyType['format'] == 2" tal:replace="structure v"/>
|
|
</fieldset>
|
|
</tal:formattedString>
|
|
</metal:showString>
|
|
|
|
<div metal:define-macro="showArchetypesField"
|
|
tal:define="field fieldDescr/atField|widgetDescr/atField;
|
|
appyType fieldDescr/appyType|widgetDescr/appyType;
|
|
showLabel showLabel|python:True;
|
|
labelId field/widget/label_msgid;
|
|
label python: tool.translate(labelId);
|
|
descrId field/widget/description_msgid|python:'';
|
|
description python: tool.translate(descrId)"
|
|
tal:attributes="class python: contextObj.getCssClasses(appyType, asSlave=True)">
|
|
|
|
<tal:comment replace="nothing">For some fields we simply use the standard Archetypes
|
|
macro for showing it. Special Appy field types like Ref and Computed have their
|
|
corresponding Archetypes fields set as invisible, so they won't be shown by the following
|
|
tal:showField.</tal:comment>
|
|
|
|
<tal:showField define="mode python:test(isEdit, 'edit', 'view');"
|
|
tal:condition="python: test(isEdit, member.has_permission(field.write_permission, contextObj), member.has_permission(field.read_permission, contextObj))">
|
|
<tal:editField condition="isEdit">
|
|
<metal:editMacro use-macro="python:contextObj.widget(field.getName(), mode='edit', use_label=showLabel)" />
|
|
</tal:editField>
|
|
<tal:viewField tal:condition="not: isEdit">
|
|
<tal:fileField condition="python: (appyType['type'] == 'File')">
|
|
<span tal:condition="showLabel" tal:content="label" class="appyLabel"></span>
|
|
<metal:viewField use-macro="python: contextObj.widget(field.getName(), 'view', use_label=0)"/>
|
|
</tal:fileField>
|
|
<tal:date condition="python: appyType['type'] == 'Date'">
|
|
<metal:showDate use-macro="here/skyn/macros/macros/showDateField"/>
|
|
</tal:date>
|
|
<tal:string condition="python: appyType['type'] == 'String'">
|
|
<metal:showString use-macro="here/skyn/macros/macros/showStringField"/>
|
|
</tal:string>
|
|
<tal:simpleField condition="python: (appyType['type'] in ('Integer', 'Float', 'Boolean'))">
|
|
<span tal:condition="showLabel" tal:content="label"
|
|
tal:attributes="class python: 'appyLabel ' + contextObj.getCssClasses(appyType, asSlave=False);
|
|
id python: field.getAccessor(contextObj)()"></span>
|
|
<metal:viewField use-macro="python: contextObj.widget(field.getName(), 'view', use_label=0)"/>
|
|
</tal:simpleField>
|
|
</tal:viewField>
|
|
</tal:showField>
|
|
|
|
<tal:comment replace="nothing">For other fields like Refs we use specific view/edit macros.</tal:comment>
|
|
<tal:viewRef condition="python: (not isEdit) and (appyType['type'] == 'Ref')">
|
|
<tal:ref define="isBack python:False;
|
|
fieldName field/getName;
|
|
innerRef innerRef|python:False">
|
|
<metal:viewRef use-macro="here/skyn/ref/macros/showReference" />
|
|
</tal:ref>
|
|
</tal:viewRef>
|
|
<tal:editRef condition="python: isEdit and (appyType['type'] == 'Ref')">
|
|
<tal:ref define="appyType fieldDescr/appyType|widgetDescr/appyType"
|
|
condition="python: appyType['link']==True">
|
|
<metal:editRef use-macro="here/skyn/ref/macros/editReference" />
|
|
</tal:ref>
|
|
</tal:editRef>
|
|
<tal:computedField condition="python: appyType['type'] == 'Computed'">
|
|
<metal:cf use-macro="here/skyn/macros/macros/showComputedField" />
|
|
</tal:computedField>
|
|
<tal:actionField condition="python: appyType['type'] == 'Action'">
|
|
<metal:af use-macro="here/skyn/macros/macros/showActionField" />
|
|
</tal:actionField>
|
|
<tal:masterString condition="python: isEdit and (appyType['type'] in ('String', 'Boolean')) and (appyType['slaves'])">
|
|
<metal:mf use-macro="here/skyn/macros/macros/editField" />
|
|
</tal:masterString>
|
|
<tal:infoField condition="python: (not isEdit) and (appyType['type'] == 'Info')">
|
|
<metal:af use-macro="here/skyn/macros/macros/showInfoField" />
|
|
</tal:infoField>
|
|
</div>
|
|
|
|
<div metal:define-macro="showBackwardField"
|
|
tal:define="isBack python:True;
|
|
appyType widgetDescr/appyType;
|
|
fieldName widgetDescr/fieldRel;
|
|
labelId python: '%s_%s_back' % (contextObj.meta_type, appyType['backd']['attribute']);
|
|
descrId python: '';
|
|
innerRef innerRef|python:False">
|
|
<div metal:use-macro="here/skyn/ref/macros/showReference" />
|
|
</div>
|
|
|
|
<metal:group define-macro="showGroup">
|
|
<fieldset class="appyGroup">
|
|
<legend><i tal:define="groupDescription python:contextObj.translate('%s_group_%s' % (contextObj.meta_type, widgetDescr['name']))"
|
|
tal:content="structure groupDescription"></i></legend>
|
|
<table tal:define="global fieldNb python:-1" width="100%">
|
|
<tr valign="top" tal:repeat="rowNb python:range(widgetDescr['rows'])">
|
|
<td tal:repeat="colNb python:range(widgetDescr['cols'])"
|
|
tal:attributes="width python: str(100.0/widgetDescr['cols']) + '%'">
|
|
<tal:showField define="global fieldNb python:fieldNb+1;
|
|
hasFieldDescr python: test(fieldNb < len(widgetDescr['fields']), True, False);"
|
|
tal:condition="hasFieldDescr">
|
|
<tal:field define="fieldDescr python:widgetDescr['fields'][fieldNb]">
|
|
<tal:archetypesField condition="python: fieldDescr['widgetType'] == 'field'">
|
|
<metal:atField use-macro="here/skyn/macros/macros/showArchetypesField"/>
|
|
</tal:archetypesField>
|
|
<tal:backwardRef tal:condition="python: (not isEdit) and (fieldDescr['widgetType'] == 'backField')">
|
|
<metal:backRef use-macro="here/skyn/macros/macros/showBackwardField" />
|
|
</tal:backwardRef>
|
|
</tal:field>
|
|
</tal:showField>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</fieldset>
|
|
<br/>
|
|
</metal:group>
|
|
|
|
<metal:fields define-macro="listFields"
|
|
tal:repeat="widgetDescr python: contextObj.getAppyFields(isEdit, pageName)">
|
|
<tal:displayArchetypesField condition="python: widgetDescr['widgetType'] == 'field'">
|
|
<tal:atField condition="python: widgetDescr['page'] == pageName">
|
|
<metal:field use-macro="here/skyn/macros/macros/showArchetypesField" />
|
|
</tal:atField>
|
|
</tal:displayArchetypesField>
|
|
<tal:displayBackwardRef condition="python: (not isEdit) and (widgetDescr['widgetType'] == 'backField')">
|
|
<tal:backRef condition="python: widgetDescr['appyType']['backd']['page'] == pageName">
|
|
<metal:field metal:use-macro="here/skyn/macros/macros/showBackwardField" />
|
|
</tal:backRef>
|
|
</tal:displayBackwardRef>
|
|
<tal:displayGroup condition="python: widgetDescr['widgetType'] == 'group'">
|
|
<tal:displayG condition="python: widgetDescr['page'] == pageName">
|
|
<metal:group metal:use-macro="here/skyn/macros/macros/showGroup" />
|
|
</tal:displayG>
|
|
</tal:displayGroup>
|
|
</metal:fields>
|
|
|
|
<metal:history define-macro="history"
|
|
tal:define="startNumber request/startNumber|python:0;
|
|
startNumber python: int(startNumber);
|
|
historyInfo python: contextObj.getHistory(startNumber);
|
|
objs historyInfo/events;
|
|
batchSize historyInfo/batchSize;
|
|
totalNumber historyInfo/totalNumber;
|
|
ajaxHookId python:'appyHistory';
|
|
baseUrl python: contextObj.getUrl('showHistory', startNumber='**v**');
|
|
tool contextObj/getTool">
|
|
|
|
<tal:comment replace="nothing">Table containing the history</tal:comment>
|
|
<tal:history condition="objs">
|
|
<metal:nav use-macro="here/skyn/macros/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.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">
|
|
<td tal:content="python: tool.translate(change[1][1])"></td>
|
|
<td tal:define="appyType python:contextObj.getAppyType(change[0]);
|
|
appyValue python: contextObj.getAppyValue(change[0], appyType, True, change[1][0]);
|
|
severalValues python: (appyType['multiplicity'][1] > 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>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</tal:event>
|
|
</table>
|
|
</tal:history>
|
|
</metal:history>
|
|
|
|
<div metal:define-macro="pagePrologue">
|
|
<tal:comment replace="nothing">Global elements used in every page.</tal:comment>
|
|
|
|
<tal:comment replace="nothing">Javascript messages</tal:comment>
|
|
<script language="javascript" tal:content="tool/getJavascriptMessages"></script>
|
|
|
|
<tal:comment replace="nothing">"Static" javascripts</tal:comment>
|
|
<script language="javascript">
|
|
<!--
|
|
var isIe = (navigator.appName == "Microsoft Internet Explorer");
|
|
// AJAX machinery
|
|
var xhrObjects = new Array(); // An array of XMLHttpRequest objects
|
|
function XhrObject() { // Wraps a XmlHttpRequest object
|
|
this.freed = 1; // Is this xhr object already dealing with a request or not?
|
|
this.xhr = false;
|
|
if (window.XMLHttpRequest) this.xhr = new XMLHttpRequest();
|
|
else this.xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
|
this.hook = ''; // The ID of the HTML element in the page that will be
|
|
// replaced by result of executing the Ajax request.
|
|
}
|
|
|
|
function getAjaxChunk(pos) {
|
|
// This function is the callback called by the AJAX machinery (see function
|
|
// askAjaxChunk below) when an Ajax response is available.
|
|
// First, find back the correct XMLHttpRequest object
|
|
if ( (typeof(xhrObjects[pos]) != 'undefined') &&
|
|
(xhrObjects[pos].freed == 0)) {
|
|
var hook = xhrObjects[pos].hook;
|
|
if (xhrObjects[pos].xhr.readyState == 1) {
|
|
// The request has been initialized: display the waiting radar
|
|
var hookElem = document.getElementById(hook);
|
|
if (hookElem) hookElem.innerHTML = "<div align=\"center\"><img src=\"skyn/waiting.gif\"/><\/div>";
|
|
}
|
|
if (xhrObjects[pos].xhr.readyState == 4) {
|
|
// We have received the HTML chunk
|
|
var hookElem = document.getElementById(hook);
|
|
if (hookElem && (xhrObjects[pos].xhr.status == 200)) {
|
|
hookElem.innerHTML = xhrObjects[pos].xhr.responseText;
|
|
}
|
|
xhrObjects[pos].freed = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
function askAjaxChunk(hook, url) {
|
|
// This function will ask to get a chunk of HTML on the server by
|
|
// triggering a XMLHttpRequest.
|
|
// First, get a non-busy XMLHttpRequest object.
|
|
var pos = -1;
|
|
for (var i=0; i < xhrObjects.length; i++) {
|
|
if (xhrObjects[i].freed == 1) { pos = i; break; }
|
|
}
|
|
if (pos == -1) {
|
|
pos = xhrObjects.length;
|
|
xhrObjects[pos] = new XhrObject();
|
|
}
|
|
xhrObjects[pos].hook = hook;
|
|
if (xhrObjects[pos].xhr) {
|
|
xhrObjects[pos].freed = 0;
|
|
// Perform the asynchronous HTTP GET
|
|
xhrObjects[pos].xhr.open('GET', url, true);
|
|
xhrObjects[pos].xhr.onreadystatechange = function() { getAjaxChunk(pos); }
|
|
if (window.XMLHttpRequest) { xhrObjects[pos].xhr.send(null); }
|
|
else if (window.ActiveXObject) { xhrObjects[pos].xhr.send(); }
|
|
}
|
|
}
|
|
|
|
// Function used by checkbox widgets for having radio-button-like behaviour
|
|
function toggleCheckbox(visibleCheckbox, hiddenBoolean) {
|
|
vis = document.getElementById(visibleCheckbox);
|
|
hidden = document.getElementById(hiddenBoolean);
|
|
if (vis.checked) hidden.value = 'True';
|
|
else hidden.value = 'False';
|
|
}
|
|
// Functions used for master/slave relationships between widgets
|
|
function getMasterValue(widget) {
|
|
// Returns an array of selected options in a select widget
|
|
res = new Array();
|
|
if (widget.type == 'checkbox') {
|
|
var mv = widget.checked + '';
|
|
mv = mv.charAt(0).toUpperCase() + mv.substr(1);
|
|
res.push(mv);
|
|
}
|
|
else { // SELECT widget
|
|
for (var i=0; i < widget.options.length; i++) {
|
|
if (widget.options[i].selected) res.push(widget.options[i].value);
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
function updateSlaves(masterValues, appyTypeId) {
|
|
// Given the value(s) selected in a master field, this function updates the
|
|
// state of all corresponding slaves.
|
|
var slaves = cssQuery('div.slave_' + appyTypeId);
|
|
for (var i=0; i< slaves.length; i++){
|
|
slaves[i].style.display = "none";
|
|
}
|
|
for (var i=0; i < masterValues.length; i++) {
|
|
var activeSlaves = cssQuery('div.slaveValue_' + appyTypeId + '_' + masterValues[i]);
|
|
for (var j=0; j < activeSlaves.length; j++){
|
|
activeSlaves[j].style.display = "";
|
|
}
|
|
}
|
|
}
|
|
// Function used for triggering a workflow transition
|
|
function triggerTransition(transitionId) {
|
|
var theForm = document.getElementById('triggerTransitionForm');
|
|
theForm.workflow_action.value = transitionId;
|
|
theForm.submit();
|
|
}
|
|
function onDeleteObject(objectUid) {
|
|
if (confirm(delete_confirm)) {
|
|
f = document.getElementById('deleteForm');
|
|
f.objectUid.value = objectUid;
|
|
f.submit();
|
|
}
|
|
}
|
|
function toggleCookie(cookieId) {
|
|
// What is the state of this boolean (expanded/collapsed) cookie?
|
|
var state = readCookie(cookieId);
|
|
if ((state != 'collapsed') && (state != 'expanded')) {
|
|
// No cookie yet, create it.
|
|
createCookie(cookieId, 'collapsed');
|
|
state = 'collapsed';
|
|
}
|
|
var hook = document.getElementById(cookieId); // The hook is the part of
|
|
// the HTML document that needs to be shown or hidden.
|
|
var displayValue = 'none';
|
|
var newState = 'collapsed';
|
|
var imgSrc = 'skyn/expand.gif';
|
|
if (state == 'collapsed') {
|
|
// Show the HTML zone
|
|
displayValue = 'block';
|
|
imgSrc = 'skyn/collapse.gif';
|
|
newState = 'expanded';
|
|
}
|
|
// Update the corresponding HTML element
|
|
hook.style.display = displayValue;
|
|
var img = document.getElementById(cookieId + '_img');
|
|
img.src = imgSrc;
|
|
// Inverse the cookie value
|
|
createCookie(cookieId, newState);
|
|
}
|
|
-->
|
|
</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>
|
|
</div>
|
|
|
|
<div metal:define-macro="showPageHeader"
|
|
tal:define="appyPages python: contextObj.getAppyPages(phase);
|
|
showCommonInfo python: not isEdit;
|
|
hasHistory contextObj/hasHistory;
|
|
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>
|
|
<table width="100%" tal:condition="showCommonInfo" class="appyCommonInfo">
|
|
<tr valign="bottom">
|
|
<tal:comment replace="nothing">Title, edit icon and state</tal:comment>
|
|
<td width="80%">
|
|
<b class="appyTitle" tal:content="contextObj/title_or_id"></b>
|
|
<tal:comment replace="nothing">Show the phase name tied to this page</tal:comment>
|
|
<span class="discreet" tal:condition="python: phaseInfo['totalNbOfPhases']>1">−
|
|
<span tal:replace="python:contextObj.translate('phase')"/>:
|
|
<span tal:replace="python:tool.translate('%s_phase_%s' % (contextObj.meta_type, phase))"/>
|
|
</span>
|
|
<tal:comment replace="nothing">When no tabs are shown, we provide an edit icon.</tal:comment>
|
|
<img tal:define="editPageName python:test(pageName=='main', 'default', pageName);
|
|
nav request/nav|nothing;
|
|
nav python: test(nav, '&nav=%s' % nav, '')"
|
|
title="Edit" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
|
|
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/edit?fieldset=%s&phase=%s%s\'' % (contextObj.absolute_url(), editPageName, phase, nav);
|
|
src string: $portal_url/skyn/edit.gif"
|
|
tal:condition="python: (len(appyPages)==1) and member.has_permission('Modify portal content', contextObj)"/>
|
|
</td>
|
|
<td><metal:actions use-macro="here/document_actions/macros/document_actions"/>
|
|
</td>
|
|
</tr>
|
|
<tr tal:define="descrLabel python: contextObj.translate('%s_edit_descr' % contextObj.portal_type)"
|
|
tal:condition="descrLabel/strip" >
|
|
<tal:comment replace="nothing">Content type description</tal:comment>
|
|
<td colspan="2" class="discreet" tal:content="descrLabel"/>
|
|
</tr>
|
|
<tr>
|
|
<td class="documentByLine">
|
|
<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="javascript:toggleCookie('appyHistory')"
|
|
tal:attributes="src python:test(historyExpanded, 'skyn/collapse.gif', 'skyn/expand.gif');"
|
|
id="appyHistory_img"/>
|
|
<span i18n:translate="label_history" i18n:domain="plone" class="appyHistory"></span>
|
|
</tal:accessHistory>
|
|
|
|
<tal:comment replace="nothing">Show document creator</tal:comment>
|
|
<tal:creator condition="creator"
|
|
define="author python:contextObj.portal_membership.getMemberInfo(creator)">
|
|
<span class="documentAuthor" i18n:domain="plone" i18n:translate="label_by_author">
|
|
by <a tal:attributes="href string:${portal_url}/author/${creator}"
|
|
tal:content="python:author and author['fullname'] or creator"
|
|
tal:omit-tag="not:author" i18n:name="author"/>
|
|
—
|
|
</span>
|
|
</tal:creator>
|
|
<tal:comment replace="nothing">Show last modification date</tal:comment>
|
|
<span i18n:translate="box_last_modified" i18n:domain="plone"></span>
|
|
<span tal:replace="python:contextObj.toLocalizedTime(contextObj.ModificationDate(),long_format=1)"></span>
|
|
</td>
|
|
<td valign="top"><metal:pod use-macro="here/skyn/macros/macros/listPodTemplates"/>
|
|
</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';
|
|
ajaxUrl python: contextObj.getUrl('showHistory')"
|
|
tal:attributes="id ajaxHookId">
|
|
<script language="javascript" tal:content="python: 'askAjaxChunk(\'%s\',\'%s\')' % (ajaxHookId, ajaxUrl)">
|
|
</script>
|
|
</div>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
|
|
<tal:comment replace="nothing">Workflow-related information and actions</tal:comment>
|
|
<tr tal:condition="python: showWorkflow and contextObj.getWorkflowLabel()">
|
|
<td colspan="2" class="appyWorkflow">
|
|
<table width="100%">
|
|
<tr>
|
|
<td><metal:states use-macro="here/skyn/macros/macros/states"/></td>
|
|
<td align="right"><metal:states use-macro="here/skyn/macros/macros/transitions"/></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<metal:nav use-macro="here/skyn/macros/macros/objectNavigate"/>
|
|
|
|
<tal:comment replace="nothing">Tabs</tal:comment>
|
|
<ul class="contentViews appyTabs" tal:condition="python: len(appyPages)>1">
|
|
<li tal:repeat="thePage appyPages"
|
|
tal:attributes="class python:test(thePage == pageName, 'selected', 'plain')">
|
|
<tal:tab define="pageLabel python: tool.translate('%s_page_%s' % (contextObj.meta_type, thePage))">
|
|
<a tal:content="pageLabel"
|
|
tal:attributes="href python: contextObj.absolute_url() + '/skyn/view?phase=%s&pageName=%s' % (phase, thePage)">
|
|
</a>
|
|
<img tal:define="editPageName python:test(thePage=='main', 'default', thePage);
|
|
nav request/nav|nothing;
|
|
nav python: test(nav, '&nav=%s' % nav, '')"
|
|
title="Edit" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer" class="appyPlusImg"
|
|
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/edit?fieldset=%s&phase=%s%s\'' % (contextObj.absolute_url(), editPageName, phase, nav);
|
|
src string: $portal_url/skyn/edit.gif"
|
|
tal:condition="python: member.has_permission('Modify portal content', contextObj)"/>
|
|
</tal:tab>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div metal:define-macro="showPageFooter">
|
|
<script language="javascript">
|
|
<!--
|
|
// When the current page is loaded, we must set the correct state for all slave fields.
|
|
var masters = cssQuery('.appyMaster');
|
|
for (var i=0; i < masters.length; i++) {
|
|
var cssClasses = masters[i].className.split(' ');
|
|
for (var j=0; j < cssClasses.length; j++) {
|
|
if (cssClasses[j].indexOf('master_') == 0) {
|
|
var appyId = cssClasses[j].split('_')[1];
|
|
var masterValue = [];
|
|
if (masters[i].nodeName == 'SPAN'){
|
|
var idField = masters[i].id;
|
|
if (idField == '') {
|
|
masterValue.push(idField);
|
|
}
|
|
else {
|
|
if (idField[0] == '(') {
|
|
// There are multiple values, split it
|
|
var subValues = idField.substring(1, idField.length-1).split(',');
|
|
for (var k=0; k < subValues.length; k++){
|
|
var subValue = subValues[k].strip();
|
|
masterValue.push(subValue.substring(1, subValue.length-1));
|
|
}
|
|
}
|
|
else { masterValue.push(masters[i].id);
|
|
}
|
|
}
|
|
}
|
|
else { masterValue = getMasterValue(masters[i]);
|
|
}
|
|
updateSlaves(masterValue, appyId);
|
|
}
|
|
}
|
|
}
|
|
-->
|
|
</script>
|
|
</div>
|
|
|
|
<metal:queryResults define-macro="queryResult"
|
|
tal:define="tool python: contextObj;
|
|
contentType request/type_name;
|
|
flavourNumber python: int(request['flavourNumber']);
|
|
startNumber request/startNumber|python:'0';
|
|
startNumber python: int(startNumber);
|
|
searchName request/search;
|
|
searchLabel python: test(searchName=='_advanced', 'search_results', '%s_search_%s' % (contentType, searchName));
|
|
searchDescr python: '%s_descr' % searchLabel;
|
|
severalTypes python: contentType and (contentType.find(',') != -1);
|
|
queryResult python: tool.executeQuery(contentType, flavourNumber, searchName, startNumber, remember=True);
|
|
objs queryResult/objects;
|
|
totalNumber queryResult/totalNumber;
|
|
batchSize queryResult/batchSize;
|
|
ajaxHookId python:'queryResult';
|
|
baseUrl python: tool.getQueryUrl(contentType, flavourNumber, searchName, startNumber='**v**');
|
|
newSearchUrl python: '%s/skyn/search?type_name=%s&flavourNumber=%d' % (tool.getAppFolder().absolute_url(), contentType, flavourNumber);">
|
|
|
|
<tal:result condition="objs">
|
|
|
|
<fieldset>
|
|
<legend>
|
|
<span tal:replace="structure python: test(searchName, tool.translate(searchLabel), test(severalTypes, tool.translate(tool.getAppName()), tool.translate('%s_plural' % contentType)))"/>
|
|
(<span tal:replace="totalNumber"/>)
|
|
<tal:newSearch condition="python: searchName == '_advanced'">
|
|
— <i><a tal:attributes="href newSearchUrl"
|
|
tal:content="python: tool.translate('search_new')"></a></i>
|
|
</tal:newSearch>
|
|
</legend>
|
|
|
|
<table cellpadding="0" cellspacing="0" width="100%"><tr>
|
|
<td tal:define="descr python: tool.translate(searchDescr)"
|
|
tal:condition="python: searchName and descr">
|
|
<span class="discreet" tal:content="descr"></span><br/><br/>
|
|
</td>
|
|
<td align="right" width="25%">
|
|
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
|
|
<metal:nav use-macro="here/skyn/macros/macros/appyNavigate"/>
|
|
</td>
|
|
</tr></table>
|
|
|
|
<table tal:define="fieldDescrs python: tool.getResultColumns(objs[0], contentType)"
|
|
class="listing nosort" width="100%" cellpadding="0" cellspacing="0">
|
|
<tal:comment replace="nothing">Every item in fieldDescr is a FieldDescr instance,
|
|
excepted for workflow state (which is not a field): in this case it is simply the
|
|
string "workflowState".</tal:comment>
|
|
|
|
<tal:comment replace="nothing">Headers, with (disabled) filters and sort arrows</tal:comment>
|
|
<tr>
|
|
<tal:comment replace="nothing">Mandatory column "Title"/"Name"</tal:comment>
|
|
<th><!--img tal:attributes= "src string: $portal_url/arrowDown.gif;
|
|
onClick python:'javascript:onSort(\'title\')';"
|
|
id="arrow_title" style="cursor:pointer"/-->
|
|
<span tal:content="python: tool.translate('ref_name')"/>
|
|
<!--input id="filter_title" type="text" size="5" onkeyup="javascript:onTextEntered('title')"/-->
|
|
<tal:comment replace="nothing">Input fields like this have been commented out because they will
|
|
be replaced by Ajax server- searches that will be more relevant (the current Javascript search
|
|
is limited to the batch, which has little interest).</tal:comment>
|
|
</th>
|
|
|
|
<tal:comment replace="nothing">Columns corresponding to other fields</tal:comment>
|
|
<tal:columnHeader repeat="fieldDescr fieldDescrs">
|
|
<th tal:define="fieldName fieldDescr/atField/getName|string:workflow_state">
|
|
<!--img tal:attributes= "src string: $portal_url/arrowDown.gif;
|
|
onClick python:'javascript:onSort(\'%s\')' % fieldName;
|
|
id python: 'arrow_%s' % fieldName"
|
|
style="cursor:pointer"/-->
|
|
<tal:comment replace="nothing">Display header for a "standard" field</tal:comment>
|
|
<tal:standardField condition="python: fieldName != 'workflow_state'">
|
|
<span tal:replace="python: tool.translate(fieldDescr['atField'].widget.label_msgid)"/>
|
|
</tal:standardField>
|
|
<tal:comment replace="nothing">Display header for the workflow state</tal:comment>
|
|
<tal:workflowState condition="python: fieldName == 'workflow_state'">
|
|
<span tal:replace="python: tool.translate('workflow_state')"/>
|
|
</tal:workflowState>
|
|
<!--input type="text" size="5"
|
|
tal:attributes="id python: 'filter_%s' % fieldName;
|
|
onkeyup python:'javascript:onTextEntered(\'%s\')' % fieldName"/-->
|
|
</th>
|
|
</tal:columnHeader>
|
|
|
|
<tal:comment replace="nothing">Column "Object type", shown if instances of several types are shown</tal:comment>
|
|
<th tal:condition="severalTypes"><!--img
|
|
tal:attributes= "src string: $portal_url/arrowDown.gif;
|
|
onClick python:'javascript:onSort(\'root_type\')';"
|
|
id = "arrow_root_type" style="cursor:pointer"/-->
|
|
<span tal:replace="python: tool.translate('root_type')"/>
|
|
<!--input type="text" size="5" id="filter_root_type"
|
|
tal:attributes="onkeyup python:'javascript:onTextEntered(\'root_type\')'"/-->
|
|
</th>
|
|
|
|
<tal:comment replace="nothing">Column "Actions"</tal:comment>
|
|
<th tal:content="python: tool.translate('ref_actions')"></th>
|
|
</tr>
|
|
|
|
<tal:comment replace="nothing">Results</tal:comment>
|
|
<tal:row repeat="obj objs">
|
|
<tr id="query_row" tal:define="odd repeat/obj/odd"
|
|
tal:attributes="class python:test(odd, 'even', 'odd')">
|
|
|
|
<tal:comment replace="nothing">Mandatory column "Title"/"Name"</tal:comment>
|
|
<td id="field_title"><a
|
|
tal:define="navInfo python:'nav=search.%s:%d.%s.%d.%d' % (contentType, flavourNumber, searchName, repeat['obj'].number()+startNumber, totalNumber);"
|
|
tal:content="obj/Title" tal:attributes="href python: obj.getUrl() + '/?' + navInfo"></a></td>
|
|
|
|
<tal:comment replace="nothing">Columns corresponding to other fields</tal:comment>
|
|
<tal:otherFields repeat="fieldDescr fieldDescrs">
|
|
<tal:standardField condition="python: fieldDescr != 'workflowState'">
|
|
<td tal:condition="fieldDescr/atField"
|
|
tal:attributes="id python:'field_%s' % fieldDescr['atField'].getName()">
|
|
<tal:field define="contextObj python:obj;
|
|
isEdit python:False;
|
|
showLabel python:False;
|
|
innerRef python:True"
|
|
condition="python: contextObj.showField(fieldDescr)">
|
|
<metal:field use-macro="here/skyn/macros/macros/showArchetypesField"/>
|
|
</tal:field>
|
|
</td>
|
|
<td tal:condition="not: fieldDescr/atField" style="color:red">Field
|
|
<span tal:replace="fieldDescr/name"/> not found.
|
|
</td>
|
|
</tal:standardField>
|
|
<tal:workflowState condition="python: fieldDescr == 'workflowState'">
|
|
<td id="field_workflow_state" tal:content="python: tool.translate(obj.getWorkflowLabel())"></td>
|
|
</tal:workflowState>
|
|
</tal:otherFields>
|
|
|
|
<tal:comment replace="nothing">Column "Object type", shown if instances of several types are shown</tal:comment>
|
|
<td tal:condition="severalTypes" id="field_root_type"
|
|
tal:content="python: tool.translate(obj.portal_type)"></td>
|
|
|
|
<tal:comment replace="nothing">Column "Actions"</tal:comment>
|
|
<td align="right">
|
|
<table class="no-style-table" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<tal:comment replace="nothing">Edit the element</tal:comment>
|
|
<td class="noPadding"><a tal:attributes="href python: obj.absolute_url() + '/skyn/edit'"
|
|
tal:condition="python: member.has_permission('Modify portal content', obj)">
|
|
<img title="Edit" i18n:domain="plone" i18n:attributes="title"
|
|
tal:attributes="src string: $portal_url/skyn/edit.gif"/>
|
|
</a></td>
|
|
<tal:comment replace="nothing">Delete the element</tal:comment>
|
|
<td class="noPadding">
|
|
<img tal:condition="python: member.has_permission('Delete objects', obj)"
|
|
title="Delete" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
|
|
tal:attributes="src string: $portal_url/skyn/delete.png;
|
|
onClick python:'javascript:onDeleteObject(\'%s\')' % obj.UID()"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</tal:row>
|
|
</table>
|
|
|
|
<tal:comment replace="nothing">Appy (bottom) navigation</tal:comment>
|
|
<metal:nav use-macro="here/skyn/macros/macros/appyNavigate"/>
|
|
</fieldset>
|
|
</tal:result>
|
|
|
|
<tal:noResult condition="not: objs">
|
|
<span tal:replace="python: tool.translate('query_no_result')"/>
|
|
<tal:newSearch condition="python: searchName == '_advanced'">
|
|
<br/><i class="discreet"><a tal:attributes="href newSearchUrl"
|
|
tal:content="python: tool.translate('search_new')"></a></i>
|
|
</tal:newSearch>
|
|
</tal:noResult>
|
|
|
|
</metal:queryResults>
|
|
|
|
<metal:phases define-macro="phases">
|
|
<tal:comment replace="nothing">This macro displays phases defined for a given content type,
|
|
only if more than one phase is defined.</tal:comment>
|
|
<table width="100%" tal:define="phases contextObj/getAppyPhases|nothing"
|
|
tal:condition="python: phases and (len(phases)>1)" cellspacing="1" cellpadding="0">
|
|
<tal:phase repeat="phase phases">
|
|
<tr>
|
|
<td tal:define="label python:'%s_phase_%s' % (contextObj.meta_type, phase['name']);
|
|
displayLink python: (phase['phaseStatus'] != 'Future') and ('/portal_factory' not in contextObj.absolute_url())"
|
|
tal:attributes="class python: 'appyPhase step' + phase['phaseStatus']">
|
|
<a tal:attributes="href python: '%s?phase=%s&pageName=%s' % (contextObj.getUrl(), phase['name'], phase['pages'][0]);" tal:condition="displayLink"
|
|
tal:content="python: tool.translate(label)"/>
|
|
<span tal:condition="not: displayLink" tal:content="python: tool.translate(label)"/>
|
|
</td>
|
|
</tr>
|
|
<tr tal:condition="python: phase['name'] != phases[-1]['name']">
|
|
<td align="center"><img tal:attributes="src string: $portal_url/skyn/nextPhase.png"/></td>
|
|
</tr>
|
|
</tal:phase>
|
|
</table>
|
|
</metal:phases>
|
|
|
|
<metal:states define-macro="states"
|
|
tal:define="showAllStatesInPhase python: flavour.getAttr('showAllStatesInPhaseFor' + contextObj.meta_type);
|
|
states python: contextObj.getAppyStates(phase, currentOnly=not showAllStatesInPhase)"
|
|
tal:condition="python: test(showAllStatesInPhase, len(states)>1, True)">
|
|
<table>
|
|
<tr>
|
|
<tal:state repeat="stateInfo states">
|
|
<td tal:attributes="class python: 'appyState step' + stateInfo['stateStatus']"
|
|
tal:content="python: tool.translate(contextObj.getWorkflowLabel(stateInfo['name']))">
|
|
</td>
|
|
<td tal:condition="python: stateInfo['name'] != states[-1]['name']">
|
|
<img tal:attributes="src string: $portal_url/skyn/nextState.png"/>
|
|
</td>
|
|
</tal:state>
|
|
</tr>
|
|
</table>
|
|
</metal:states>
|
|
|
|
<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="TriggerTransition"/>
|
|
<input type="hidden" name="workflow_action"/>
|
|
<table>
|
|
<tr>
|
|
<tal:comment replace="nothing">Input field allowing to enter a comment before triggering a transition</tal:comment>
|
|
<td tal:define="showCommentsField python:flavour.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="35"/>
|
|
</td>
|
|
|
|
<tal:comment replace="nothing">Buttons for triggering transitions</tal:comment>
|
|
<td align="right" tal:repeat="transition transitions">
|
|
<input type="button" class="context"
|
|
tal:attributes="value python: tool.translate(transition['name']);
|
|
onClick python: 'javascript: triggerTransition(\'%s\')' % transition['id'];"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</metal:transitions>
|
|
|
|
<metal:portletContent define-macro="portletContent"
|
|
tal:define="queryUrl python: '%s/skyn/query' % appFolder.absolute_url();
|
|
currentSearch request/search|nothing;
|
|
currentType request/type_name|nothing;">
|
|
<tal:comment replace="nothing">Portlet title, with link to tool.</tal:comment>
|
|
<dt class="portletHeader">
|
|
<tal:comment replace="nothing">If there is only one flavour, clicking on the portlet
|
|
title allows to see all root objects in the database.</tal:comment>
|
|
<a tal:condition="python: len(flavours)==1"
|
|
tal:attributes="href python:'%s?type_name=%s&flavourNumber=1' % (queryUrl, ','.join(rootClasses))"
|
|
tal:content="python: tool.translate(appName)"></a>
|
|
<span tal:condition="python: len(flavours)>1"
|
|
tal:replace="python: tool.translate(appName)"/>
|
|
<img style="cursor:pointer"
|
|
tal:condition="python: member.has_role('Manager')"
|
|
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/view\'' % tool.absolute_url();
|
|
title python: tool.translate('%sTool' % appName);
|
|
src string:$portal_url/skyn/appyConfig.gif"/>
|
|
</dt>
|
|
|
|
<tal:comment replace="nothing">TODO: implement a widget for selecting the needed flavour.</tal:comment>
|
|
|
|
<tal:comment replace="nothing">Create a section for every root class.</tal:comment>
|
|
<tal:section repeat="rootClass rootClasses"
|
|
define="flavourNumber python:1;
|
|
flavour python: tool.getFlavour('Dummy_%d' % flavourNumber)">
|
|
<tal:comment replace="nothing">Section title, with action icons</tal:comment>
|
|
<dt tal:attributes="class python:test(repeat['rootClass'].number()==1, 'portletAppyItem', 'portletAppyItem portletSep')">
|
|
<table width="100%" cellspacing="0" cellpadding="0" class="no-style-table">
|
|
<tr>
|
|
<td>
|
|
<a tal:attributes="href python: '%s?type_name=%s&flavourNumber=%s' % (queryUrl, rootClass, flavourNumber);
|
|
class python:test(not currentSearch and (currentType==rootClass), 'portletCurrent', '')"
|
|
tal:content="python: tool.translate(rootClass + '_plural')"></a>
|
|
</td>
|
|
<td align="right"
|
|
tal:define="addPermission python: '%s: Add %s' % (appName, rootClass);
|
|
userMayAdd python: member.has_permission(addPermission, appFolder);
|
|
createMeans python: tool.getCreateMeans(rootClass)">
|
|
<tal:comment replace="nothing">Create a new object from a web form</tal:comment>
|
|
<img style="cursor:pointer"
|
|
tal:condition="python: ('form' in createMeans) and userMayAdd"
|
|
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/do?action=Create&type_name=%s\'' % (appFolder.absolute_url(), rootClass);
|
|
src string: $portal_url/skyn/plus.png;
|
|
title python: tool.translate('query_create')"/>
|
|
<tal:comment replace="nothing">Create (a) new object(s) by importing data</tal:comment>
|
|
<img style="cursor:pointer"
|
|
tal:condition="python: ('import' in createMeans) and userMayAdd"
|
|
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/import?type_name=%s\'' % (appFolder.absolute_url(), rootClass);
|
|
src string: $portal_url/skyn/import.png;
|
|
title python: tool.translate('query_import')"/>
|
|
<tal:comment replace="nothing">Search objects of this type (todo: update flavourNumber)</tal:comment>
|
|
<img style="cursor:pointer"
|
|
tal:define="showSearch python: flavour.getAttr('enableAdvancedSearchFor%s' % rootClass)"
|
|
tal:condition="showSearch"
|
|
tal:attributes="onClick python: 'href: window.location=\'%s/skyn/search?type_name=%s&flavourNumber=1\'' % (appFolder.absolute_url(), rootClass);
|
|
src string: $portal_url/skyn/search.gif;
|
|
title python: tool.translate('search_objects')"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</dt>
|
|
<tal:comment replace="nothing">Searches for this content type.</tal:comment>
|
|
<tal:searchOrGroup repeat="searchOrGroup python: tool.getSearches(rootClass)">
|
|
<tal:group condition="searchOrGroup/isGroup">
|
|
<tal:expanded define="group searchOrGroup;
|
|
expanded python: tool.getCookieValue(group['labelId'], default='collapsed') == 'expanded'">
|
|
<tal:comment replace="nothing">Group name</tal:comment>
|
|
<dt class="portletAppyItem portletGroup">
|
|
<img align="left" style="cursor:pointer"
|
|
tal:attributes="id python: '%s_img' % group['labelId'];
|
|
src python:test(expanded, 'skyn/collapse.gif', 'skyn/expand.gif');
|
|
onClick python:'javascript:toggleCookie(\'%s\')' % group['labelId']"/>
|
|
<span tal:replace="group/label"/>
|
|
</dt>
|
|
<tal:comment replace="nothing">Group searches</tal:comment>
|
|
<span tal:attributes="id group/labelId;
|
|
style python:test(expanded, 'display:block', 'display:none')">
|
|
<dt class="portletAppyItem portletSearch portletGroupItem" tal:repeat="search group/searches">
|
|
<a tal:attributes="href python: '%s?type_name=%s&flavourNumber=%s&search=%s' % (queryUrl, rootClass, flavourNumber, search['name']);
|
|
title search/descr;
|
|
class python: test(search['name'] == currentSearch, 'portletCurrent', '');"
|
|
tal:content="structure search/label"></a>
|
|
</dt>
|
|
</span>
|
|
</tal:expanded>
|
|
</tal:group>
|
|
<dt tal:define="search searchOrGroup" tal:condition="not: searchOrGroup/isGroup"
|
|
class="portletAppyItem portletSearch">
|
|
|
|
<a tal:attributes="href python: '%s?type_name=%s&flavourNumber=%s&search=%s' % (queryUrl, rootClass, flavourNumber, search['name']);
|
|
title search/descr;
|
|
class python: test(search['name'] == currentSearch, 'portletCurrent', '');"
|
|
tal:content="structure search/label"></a>
|
|
</dt>
|
|
</tal:searchOrGroup>
|
|
</tal:section>
|
|
|
|
<tal:comment replace="nothing">All objects in flavour</tal:comment>
|
|
<!--dt class="portletAppyItem" tal:define="flavourInfo python: flavours[0]">
|
|
<a tal:define="flavourNumber flavourInfo/number;
|
|
rootTypes python: test(flavourNumber==1, rootClasses, ['%s_%s' % (rc, flavourNumber) for rc in rootClasses]);
|
|
rootClassesQuery python:','.join(rootTypes)"
|
|
tal:content="flavourInfo/title"
|
|
tal:attributes="title python: tool.translate('query_consult_all');
|
|
href python:'%s?type_name=%s&flavourNumber=%d' % (queryUrl, rootClassesQuery, flavourNumber)"></a>
|
|
</dt-->
|
|
|
|
<dt class="portletAppyItem" tal:define="contextObj tool/getPublishedObject"
|
|
tal:condition="python: contextObj.meta_type in rootClasses">
|
|
<metal:phases use-macro="here/skyn/macros/macros/phases"/>
|
|
</dt>
|
|
</metal:portletContent>
|
|
|
|
<div metal:define-macro="appyNavigate" tal:condition="python: totalNumber > batchSize" align="right">
|
|
<tal:comment replace="nothing">
|
|
Buttons for navigating among a list of elements (next, back, first, last, etc).
|
|
</tal:comment>
|
|
<table cellpadding="0" cellspacing="0" class="appyNav">
|
|
<tr>
|
|
<tal:comment replace="nothing">Go to the first page</tal:comment>
|
|
<td><img style="cursor:pointer" tal:condition="python: (startNumber != 0) and (startNumber != batchSize)"
|
|
tal:attributes="src string: $portal_url/skyn/arrowLeftDouble.png;
|
|
title python: tool.translate('goto_first');
|
|
onClick python: 'askAjaxChunk(\'%s\', \'%s\')' % (ajaxHookId, baseUrl.replace('**v**', '0'))"/></td>
|
|
<tal:comment replace="nothing">Go to the previous page</tal:comment>
|
|
<td><img style="cursor:pointer" tal:condition="python: startNumber != 0"
|
|
tal:define="sNumber python: startNumber - batchSize"
|
|
tal:attributes="src string: $portal_url/skyn/arrowLeftSimple.png;
|
|
title python: tool.translate('goto_previous');
|
|
onClick python: 'askAjaxChunk(\'%s\', \'%s\')' % (ajaxHookId, baseUrl.replace('**v**', str(sNumber)))"/></td>
|
|
<tal:comment replace="nothing">Explain which elements are currently shown</tal:comment>
|
|
<td class="discreet" valign="middle">
|
|
<span tal:replace="python: startNumber+1"/>
|
|
<img tal:attributes="src string: $portal_url/skyn/to.png"/>
|
|
<span tal:replace="python: startNumber+len(objs)"/> <b>//</b>
|
|
<span tal:replace="python: totalNumber"/>
|
|
</td>
|
|
<tal:comment replace="nothing">Go to the next page</tal:comment>
|
|
<td><img style="cursor:pointer" tal:condition="python: sNumber < totalNumber"
|
|
tal:define="sNumber python: startNumber + batchSize"
|
|
tal:attributes="src string: $portal_url/skyn/arrowRightSimple.png;
|
|
title python: tool.translate('goto_next');
|
|
onClick python: 'askAjaxChunk(\'%s\', \'%s\')' % (ajaxHookId, baseUrl.replace('**v**', str(sNumber)))"/></td>
|
|
<tal:comment replace="nothing">Go to the last page</tal:comment>
|
|
<td><img style="cursor:pointer" tal:condition="python: (startNumber != sNumber) and (startNumber != sNumber-batchSize)"
|
|
tal:define="lastPageIsIncomplete python: totalNumber % batchSize;
|
|
nbOfCompletePages python: totalNumber/batchSize;
|
|
nbOfCountedPages python: test(lastPageIsIncomplete, nbOfCompletePages, nbOfCompletePages-1);
|
|
sNumber python: (nbOfCountedPages*batchSize)"
|
|
tal:attributes="src string: $portal_url/skyn/arrowRightDouble.png;
|
|
title python: tool.translate('goto_last');
|
|
onClick python: 'askAjaxChunk(\'%s\', \'%s\')' % (ajaxHookId, baseUrl.replace('**v**', str(sNumber)))"/></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div metal:define-macro="objectNavigate" tal:condition="request/nav|nothing" align="right">
|
|
<tal:comment replace="nothing">
|
|
Buttons for going to next/previous elements if this one is among bunch of referenced or searched objects.
|
|
currentNumber starts with 1.
|
|
</tal:comment>
|
|
<table cellpadding="0" cellspacing="0"
|
|
tal:define="navInfo tool/getNavigationInfo;
|
|
currentNumber navInfo/currentNumber;
|
|
totalNumber navInfo/totalNumber;
|
|
firstUrl navInfo/firstUrl;
|
|
previousUrl navInfo/previousUrl;
|
|
nextUrl navInfo/nextUrl;
|
|
lastUrl navInfo/lastUrl;
|
|
sourceUrl navInfo/sourceUrl;
|
|
backText navInfo/backText">
|
|
<tr>
|
|
<tal:comment replace="nothing">Go to the source URL (search or referred object)</tal:comment>
|
|
<td><a tal:condition="sourceUrl" tal:attributes="href sourceUrl"><img style="cursor:pointer"
|
|
tal:attributes="src string: $portal_url/skyn/gotoSource.png;
|
|
title python: backText + ' : ' + tool.translate('goto_source')"/></a></td>
|
|
<tal:comment replace="nothing">Go to the first page</tal:comment>
|
|
<td><a tal:condition="firstUrl" tal:attributes="href firstUrl"><img style="cursor:pointer"
|
|
tal:attributes="src string: $portal_url/skyn/arrowLeftDouble.png;
|
|
title python: tool.translate('goto_first')"/></a></td>
|
|
<tal:comment replace="nothing">Go to the previous page</tal:comment>
|
|
<td><a tal:condition="previousUrl" tal:attributes="href previousUrl"><img style="cursor:pointer"
|
|
tal:attributes="src string: $portal_url/skyn/arrowLeftSimple.png;
|
|
title python: tool.translate('goto_previous')"/></a></td>
|
|
<tal:comment replace="nothing">Explain which element is currently shown</tal:comment>
|
|
<td class="discreet" valign="middle">
|
|
<span tal:replace="python: currentNumber"/> <b>//</b>
|
|
<span tal:replace="python: totalNumber"/>
|
|
</td>
|
|
<tal:comment replace="nothing">Go to the next page</tal:comment>
|
|
<td><a tal:condition="python: nextUrl" tal:attributes="href nextUrl"><img style="cursor:pointer"
|
|
tal:attributes="src string: $portal_url/skyn/arrowRightSimple.png;
|
|
title python: tool.translate('goto_next')"/></a></td>
|
|
<tal:comment replace="nothing">Go to the last page</tal:comment>
|
|
<td><a tal:condition="lastUrl" tal:attributes="href lastUrl"><img style="cursor:pointer"
|
|
tal:attributes="src string: $portal_url/skyn/arrowRightDouble.png;
|
|
title python: tool.translate('goto_last')"/></a></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|