196 lines
11 KiB
XML
196 lines
11 KiB
XML
<tal:comment replace="nothing">
|
|
This macro displays the content of the application portlet.
|
|
</tal:comment>
|
|
<metal:portletContent define-macro="portletContent"
|
|
tal:define="queryUrl python: '%s/skyn/query' % appFolder.absolute_url();
|
|
currentSearch request/search|nothing;
|
|
currentType request/type_name|nothing;
|
|
contextObj python: tool.getPublishedObject(rootClasses)">
|
|
<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>
|
|
<table cellpadding="0" cellspacing="0" width="100%">
|
|
<tr>
|
|
<td>
|
|
<a tal:condition="python: len(flavours)==1 and rootClasses"
|
|
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 or not rootClasses"
|
|
tal:replace="python: tool.translate(appName)"/>
|
|
</td>
|
|
<td align="right">
|
|
<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"/>
|
|
</td>
|
|
</dt>
|
|
|
|
<tal:publishedObject condition="python: contextObj">
|
|
<dt class="portletAppyItem portletCurrent">
|
|
<a tal:attributes="href python: contextObj.getUrl() + '?page=main'"
|
|
tal:content="contextObj/Title"></a>
|
|
</dt>
|
|
<dt class="portletAppyItem"><metal:phases use-macro="here/skyn/portlet/macros/phases"/></dt>
|
|
</tal:publishedObject>
|
|
|
|
<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) and not contextObj, '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) and tool.userMayAdd(rootClass);
|
|
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-->
|
|
|
|
<tal:comment replace="nothing">
|
|
Greyed transparent zone that is deployed on the
|
|
whole screen when a popup is displayed.
|
|
</tal:comment>
|
|
<div id="appyGrey" class="appyGrey"></div>
|
|
|
|
<tal:comment replace="nothing">Popup for confirming an action</tal:comment>
|
|
<div id="confirmActionPopup" class="appyPopup">
|
|
<form id="confirmActionForm" method="post">
|
|
<div align="center">
|
|
<p tal:content="python: tool.translate('confirm')"></p>
|
|
<input type="hidden" name="actionFormId"/>
|
|
<input type="button" onClick="javascript: doConfirm()"
|
|
tal:attributes="value python:tool.translate('yes')"/>
|
|
<input type="button" value="No" onClick="javascript:closePopup('confirmActionPopup')"
|
|
tal:attributes="value python:tool.translate('no')"/>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</metal:portletContent>
|
|
|
|
<tal:comment replace="nothing">
|
|
This macro displays, within the portlet, the navigation tree for the
|
|
currently shown object, made of phases and contained pages.
|
|
</tal:comment>
|
|
<metal:phases define-macro="phases">
|
|
<table tal:define="phases contextObj/getAppyPhases|nothing;
|
|
page python: request.get('page', 'main')"
|
|
tal:condition="python: phases and not ((len(phases)==1) and len(phases[0]['pages'])==1)"
|
|
cellspacing="1" cellpadding="0" width="100%">
|
|
<tal:phase repeat="phase phases">
|
|
<tal:comment replace="nothing">The box containing phase-related information</tal:comment>
|
|
<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()) and (len(phase['pages']) == 1)"
|
|
tal:attributes="class python: (len(phases) > 1) and ('appyPhase step%s' % phase['phaseStatus']) or 'appyPhase'">
|
|
<span class="portletGroup" tal:condition="python: len(phases) > 1">
|
|
<a tal:attributes="href python: '%s?page=%s' % (contextObj.getUrl(), phase['pages'][0]);"
|
|
tal:condition="displayLink"
|
|
tal:content="python: tool.translate(label)"></a>
|
|
<span tal:condition="not: displayLink" tal:replace="python: tool.translate(label)"/>
|
|
</span>
|
|
<table width="100%" cellpadding="0" cellspacing="0"
|
|
tal:condition="python: len(phase['pages']) > 1">
|
|
<tr tal:repeat="aPage phase/pages" valign="top">
|
|
<td tal:attributes="class python: test(aPage == page, 'portletCurrent portletPageItem', 'portletPageItem')">
|
|
<a tal:attributes="href python: contextObj.getUrl()+'?page=%s' % aPage"
|
|
tal:content="structure python: tool.translate('%s_page_%s' % (contextObj.meta_type, aPage))">
|
|
</a>
|
|
</td>
|
|
<td align="right">
|
|
<img tal:define="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?page=%s%s\'' % (contextObj.absolute_url(), aPage, nav);
|
|
src string: $portal_url/skyn/edit.gif"
|
|
tal:condition="python: member.has_permission('Modify portal content', contextObj)"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tal:comment replace="nothing">The down arrow pointing to the next phase (if any)</tal:comment>
|
|
<tr tal:condition="python: phase['name'] != phases[-1]['name']">
|
|
<td> <img tal:attributes="src string: $portal_url/skyn/nextPhase.png"/></td>
|
|
</tr>
|
|
</tal:phase>
|
|
</table>
|
|
</metal:phases>
|