2010-03-29 13:45:25 -05:00
|
|
|
<tal:comment replace="nothing">
|
|
|
|
This macro displays the content of the application portlet.
|
|
|
|
</tal:comment>
|
2011-09-18 08:00:05 -05:00
|
|
|
<metal:portlet define-macro="portlet"
|
2011-11-25 11:01:20 -06:00
|
|
|
tal:define="queryUrl python: '%s/ui/query' % tool.absolute_url();
|
2011-09-18 08:00:05 -05:00
|
|
|
toolUrl tool/absolute_url;
|
|
|
|
currentSearch req/search|nothing;
|
2011-11-25 11:01:20 -06:00
|
|
|
currentClass req/className|nothing;
|
2011-09-18 08:00:05 -05:00
|
|
|
contextObj tool/getPublishedObject;
|
|
|
|
rootClasses tool/getRootClasses">
|
2010-03-29 13:45:25 -05:00
|
|
|
|
2010-12-17 07:46:55 -06:00
|
|
|
<tal:publishedObject condition="python: contextObj and contextObj.mayNavigate()">
|
2011-10-06 09:27:58 -05:00
|
|
|
<div class="portletTitle" tal:content="contextObj/Title"></div>
|
2011-11-25 11:01:20 -06:00
|
|
|
<span><metal:phases use-macro="here/ui/portlet/macros/phases"/></span>
|
2010-08-05 11:23:17 -05:00
|
|
|
</tal:publishedObject>
|
2011-09-18 08:00:05 -05:00
|
|
|
|
|
|
|
<tal:comment replace="nothing">One section for every searchable root class.</tal:comment>
|
2011-02-01 04:09:54 -06:00
|
|
|
<tal:section repeat="rootClass python: [rc for rc in rootClasses if tool.userMaySearch(rc)]">
|
2010-03-29 13:45:25 -05:00
|
|
|
<tal:comment replace="nothing">Section title, with action icons</tal:comment>
|
2011-09-18 08:00:05 -05:00
|
|
|
<table width="100%"
|
|
|
|
tal:attributes="class python:test((repeat['rootClass'].number()==1) and not contextObj, '', 'portletSep')">
|
|
|
|
<tr>
|
|
|
|
<td>
|
2011-11-25 11:01:20 -06:00
|
|
|
<a tal:attributes="href python: '%s?className=%s' % (queryUrl, rootClass);
|
|
|
|
class python:test(not currentSearch and (currentClass==rootClass), 'portletCurrent', '')"
|
2011-09-18 08:00:05 -05:00
|
|
|
tal:content="structure python: _(rootClass + '_plural')"></a>
|
|
|
|
</td>
|
|
|
|
<td align="right"
|
|
|
|
tal:define="addPermission python: '%s: Add %s' % (appName, rootClass);
|
|
|
|
userMayAdd python: user.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"
|
2011-11-25 11:01:20 -06:00
|
|
|
tal:attributes="onClick python: 'href: window.location=\'%s/do?action=Create&className=%s\'' % (toolUrl, rootClass);
|
|
|
|
src string: $appUrl/ui/plus.png;
|
2011-09-18 08:00:05 -05:00
|
|
|
title python: _('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"
|
2011-11-25 11:01:20 -06:00
|
|
|
tal:attributes="onClick python: 'href: window.location=\'%s/ui/import?className=%s\'' % (toolUrl, rootClass);
|
|
|
|
src string: $appUrl/ui/import.png;
|
2011-09-18 08:00:05 -05:00
|
|
|
title python: _('query_import')"/>
|
|
|
|
<tal:comment replace="nothing">Search objects of this type</tal:comment>
|
|
|
|
<img style="cursor:pointer"
|
|
|
|
tal:define="showSearch python: tool.getAttr('enableAdvancedSearchFor%s' % rootClass)"
|
|
|
|
tal:condition="showSearch"
|
2011-11-25 11:01:20 -06:00
|
|
|
tal:attributes="onClick python: 'href: window.location=\'%s/ui/search?className=%s\'' % (toolUrl, rootClass);
|
|
|
|
src string: $appUrl/ui/search.gif;
|
2011-09-18 08:00:05 -05:00
|
|
|
title python: _('search_objects')"/>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2010-03-29 13:45:25 -05:00
|
|
|
<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;
|
2011-10-01 15:40:13 -05:00
|
|
|
expanded python: request.get(group['labelId'], 'collapsed') == 'expanded'">
|
2010-03-29 13:45:25 -05:00
|
|
|
<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'];
|
2011-11-25 11:01:20 -06:00
|
|
|
src python:test(expanded, 'ui/collapse.gif', 'ui/expand.gif');
|
2010-09-17 08:32:48 -05:00
|
|
|
onClick python:'toggleCookie(\'%s\')' % group['labelId']"/>
|
2010-03-29 13:45:25 -05:00
|
|
|
<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">
|
2011-11-25 11:01:20 -06:00
|
|
|
<a tal:attributes="href python: '%s?className=%s&search=%s' % (queryUrl, rootClass, search['name']);
|
2010-03-29 13:45:25 -05:00
|
|
|
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">
|
|
|
|
|
2011-11-25 11:01:20 -06:00
|
|
|
<a tal:attributes="href python: '%s?className=%s&search=%s' % (queryUrl, rootClass, search['name']);
|
2010-03-29 13:45:25 -05:00
|
|
|
title search/descr;
|
|
|
|
class python: test(search['name'] == currentSearch, 'portletCurrent', '');"
|
|
|
|
tal:content="structure search/label"></a>
|
|
|
|
</dt>
|
|
|
|
</tal:searchOrGroup>
|
|
|
|
</tal:section>
|
2011-09-18 08:00:05 -05:00
|
|
|
</metal:portlet>
|
2010-08-05 11:23:17 -05:00
|
|
|
|
|
|
|
<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">
|
2010-09-17 08:32:48 -05:00
|
|
|
<table tal:define="phases contextObj/getAppyPhases|nothing;
|
2011-10-06 09:27:58 -05:00
|
|
|
singlePhase python: len(phases) == 1;
|
2011-09-18 08:00:05 -05:00
|
|
|
page python: req.get('page', 'main')"
|
2011-10-06 09:27:58 -05:00
|
|
|
tal:condition="python: phases and not (singlePhase and len(phases[0]['pages'])==1)"
|
2011-09-18 08:00:05 -05:00
|
|
|
width="100%">
|
2010-08-05 11:23:17 -05:00
|
|
|
<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']);
|
2011-10-06 09:27:58 -05:00
|
|
|
singlePage python: len(phase['pages']) == 1;
|
|
|
|
status phase/phaseStatus;
|
|
|
|
phaseCss python: (status == 'Current') and ' phaseSelected' or '';
|
|
|
|
underCreation python: '/portal_factory' in context.absolute_url();
|
|
|
|
displayLink python: (status != 'Future') and not underCreation and singlePage"
|
|
|
|
tal:attributes="class python: not singlePhase and 'phase%s' % phaseCss or ''">
|
|
|
|
<div class="portletGroup" tal:condition="not: singlePhase">
|
2010-09-17 08:32:48 -05:00
|
|
|
|
|
|
|
<tal:comment replace="nothing">A single page in the phase</tal:comment>
|
2011-09-18 08:00:05 -05:00
|
|
|
<table tal:condition="displayLink" width="100%">
|
2010-09-17 08:32:48 -05:00
|
|
|
<tr tal:define="pageName python: phase['pages'][0]">
|
|
|
|
<td><a tal:attributes="href python: contextObj.getUrl(page=pageName)"
|
2011-09-18 08:00:05 -05:00
|
|
|
tal:content="structure python: _(label)"></a>
|
2010-09-17 08:32:48 -05:00
|
|
|
</td>
|
|
|
|
<td align="right">
|
|
|
|
<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=pageName);
|
2011-11-25 11:01:20 -06:00
|
|
|
src string: $appUrl/ui/edit.gif"
|
2011-09-18 08:00:05 -05:00
|
|
|
tal:condition="python: contextObj.allows('Modify portal content') and phase['pagesInfo'][pageName]['showOnEdit']"/>
|
2010-09-17 08:32:48 -05:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<tal:comment replace="nothing">Several pages in the phase</tal:comment>
|
2011-09-18 08:00:05 -05:00
|
|
|
<span tal:condition="not: displayLink" tal:replace="structure python: _(label)"/>
|
2010-09-13 14:04:10 -05:00
|
|
|
</div>
|
|
|
|
<div class="portletMenu">
|
2011-10-06 09:27:58 -05:00
|
|
|
<table width="100%" cellpadding="0" tal:condition="python: len(phase['pages']) > 1">
|
2010-08-05 11:23:17 -05:00
|
|
|
<tr tal:repeat="aPage phase/pages" valign="top">
|
2011-09-18 08:00:05 -05:00
|
|
|
<td tal:attributes="class python: test(aPage == page, 'portletCurrent portletPage', 'portletPage')">
|
2010-09-17 08:32:48 -05:00
|
|
|
<a tal:attributes="href python: contextObj.getUrl(page=aPage)"
|
2011-09-18 08:00:05 -05:00
|
|
|
tal:content="structure python: _('%s_page_%s' % (contextObj.meta_type, aPage))">
|
2010-08-05 11:23:17 -05:00
|
|
|
</a>
|
|
|
|
</td>
|
2010-09-02 09:16:08 -05:00
|
|
|
<td align="right">
|
2010-09-17 08:32:48 -05:00
|
|
|
<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=aPage);
|
2011-11-25 11:01:20 -06:00
|
|
|
src string: $appUrl/ui/edit.gif"
|
2011-09-18 08:00:05 -05:00
|
|
|
tal:condition="python: user.has_permission('Modify portal content', contextObj) and phase['pagesInfo'][aPage]['showOnEdit']"/>
|
2010-08-05 11:23:17 -05:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2010-09-13 14:04:10 -05:00
|
|
|
</div>
|
2010-08-05 11:23:17 -05:00
|
|
|
</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']">
|
2011-11-25 11:01:20 -06:00
|
|
|
<td> <img tal:attributes="src string: $appUrl/ui/nextPhase.png"/></td>
|
2010-08-05 11:23:17 -05:00
|
|
|
</tr>
|
|
|
|
</tal:phase>
|
|
|
|
</table>
|
|
|
|
</metal:phases>
|