2012-11-14 04:36:48 -06:00
|
|
|
<tal:comment replace="nothing">Macro for displaying a search</tal:comment>
|
|
|
|
<div metal:define-macro="search" class="portletSearch">
|
|
|
|
<a tal:attributes="href python: '%s?className=%s&search=%s' % (queryUrl, rootClass, search['name']);
|
2012-11-14 10:40:52 -06:00
|
|
|
title search/translatedDescr;
|
2012-11-14 04:36:48 -06:00
|
|
|
class python: test(search['name'] == currentSearch, 'portletCurrent', '');"
|
2012-11-14 10:40:52 -06:00
|
|
|
tal:content="search/translated">
|
|
|
|
</a>
|
2012-11-14 04:36:48 -06:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Macro for displaying a group of searches</tal:comment>
|
|
|
|
<metal:group define-macro="group"
|
|
|
|
tal:define="expanded python: request.get(widget['labelId'], 'collapsed') == 'expanded'">
|
|
|
|
<tal:comment replace="nothing">Group name</tal:comment>
|
|
|
|
<div class="portletGroup">
|
|
|
|
<img style="cursor:pointer; margin-right: 3px"
|
|
|
|
tal:attributes="id python: '%s_img' % widget['labelId'];
|
|
|
|
src python:test(expanded, 'ui/collapse.gif', 'ui/expand.gif');
|
|
|
|
onClick python:'toggleCookie(\'%s\')' % widget['labelId'];
|
|
|
|
align dleft"/>
|
2012-11-14 10:40:52 -06:00
|
|
|
<span tal:condition="not: widget/translated" tal:replace="python: _(widget['labelId'])"/>
|
|
|
|
<span tal:condition="widget/translated" tal:replace="widget/translated"/>
|
2012-11-14 04:36:48 -06:00
|
|
|
</div>
|
|
|
|
<tal:comment replace="nothing">Group content</tal:comment>
|
|
|
|
<div tal:define="display python:test(expanded, 'display:block', 'display:none')"
|
|
|
|
tal:attributes="id widget/labelId;
|
|
|
|
style python: 'padding-left: 10px;; %s' % display">
|
|
|
|
<tal:searchRows repeat="searches widget/widgets">
|
|
|
|
<tal:searchElem repeat="searchElem searches">
|
|
|
|
<tal:comment replace="nothing">An inner group within this group</tal:comment>
|
|
|
|
<tal:group condition="python: searchElem['type'] == 'group'">
|
|
|
|
<tal:g define="widget searchElem">
|
|
|
|
<metal:s use-macro="app/ui/portlet/macros/group"/>
|
|
|
|
</tal:g>
|
|
|
|
</tal:group>
|
|
|
|
<tal:search condition="python: searchElem['type'] != 'group'">
|
|
|
|
<tal:s define="search searchElem">
|
|
|
|
<metal:s use-macro="app/ui/portlet/macros/search"/>
|
|
|
|
</tal:s>
|
|
|
|
</tal:search>
|
|
|
|
</tal:searchElem>
|
|
|
|
</tal:searchRows>
|
|
|
|
</div>
|
|
|
|
</metal:group>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Macro displaying the whole 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;
|
2012-11-14 04:36:48 -06:00
|
|
|
app tool/getApp;
|
|
|
|
appUrl app/absolute_url;
|
2011-09-18 08:00:05 -05:00
|
|
|
currentSearch req/search|nothing;
|
2011-11-25 11:01:20 -06:00
|
|
|
currentClass req/className|nothing;
|
2013-02-18 08:03:26 -06:00
|
|
|
currentPage python: req['PATH_INFO'].rsplit('/',1)[-1];
|
2012-11-29 13:45:21 -06:00
|
|
|
rootClasses tool/getRootClasses;
|
|
|
|
phases python: contextObj and contextObj.getAppyPhases() or None">
|
2010-03-29 13:45:25 -05:00
|
|
|
|
2012-11-29 13:45:21 -06:00
|
|
|
<tal:phases condition="python: contextObj and phases and contextObj.mayNavigate()">
|
2012-11-14 04:36:48 -06:00
|
|
|
<metal:phases use-macro="app/ui/portlet/macros/phases"/>
|
2012-11-29 13:45:21 -06:00
|
|
|
</tal:phases>
|
2011-09-18 08:00:05 -05:00
|
|
|
|
2012-02-23 08:58:06 -06:00
|
|
|
<tal:comment replace="nothing">One section for every searchable root class.</tal:comment>
|
|
|
|
<tal:section repeat="rootClass python: [rc for rc in rootClasses if tool.userMaySearch(rc)]">
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">A separator if required</tal:comment>
|
|
|
|
<div class="portletSep" tal:define="nb repeat/rootClass/number"
|
2012-11-29 13:45:21 -06:00
|
|
|
tal:condition="python: (nb != 1) or ((nb == 1) and phases)"></div>
|
2012-02-23 08:58:06 -06:00
|
|
|
|
2012-11-14 04:36:48 -06:00
|
|
|
<div class="portletContent" tal:define="searchInfo python: tool.getGroupedSearches(rootClass)">
|
[gen] Added param Search.default allowing to define a default Search. The default search, if present, will be triggered when clicking on the main link for a class, instead of the query that collects all instances of this class; appy.gen.Type: removed 3 obsolete params: 'index', 'editDefault' and 'optional'. For achieving the same result than using 'editDefault', one may define 'by hand' an attribute on the Tool for storing the editable default value, and define, on the appropriate field in param 'default', a method that returns the value of the tool attribute; Added Type.defaultForSearch, allowing, for some sub-types, to define a default value when displaying the corresponding widget on the search screen; added a default 'state' field allowing to include workflow state among search criteria in the search screens; removed obsolete test applications.
2012-10-31 07:20:25 -05:00
|
|
|
<tal:comment replace="nothing">Section title (link triggers the default search), with action icons</tal:comment>
|
2013-01-08 06:28:35 -06:00
|
|
|
<a tal:define="queryParam python: searchInfo['default'] and searchInfo['default']['name'] or ''"
|
|
|
|
tal:attributes="href python: '%s?className=%s&search=%s' % (queryUrl, rootClass, queryParam);
|
2013-02-18 08:03:26 -06:00
|
|
|
class python: (not currentSearch and (currentClass==rootClass) and (currentPage=='query')) and 'portletCurrent' or ''"
|
2012-02-23 08:58:06 -06:00
|
|
|
tal:content="structure python: _(rootClass + '_plural')">
|
|
|
|
</a>
|
2013-02-18 08:03:26 -06:00
|
|
|
<tal:icons define="addPermission python: '%s: Add %s' % (appName, rootClass);
|
|
|
|
userMayAdd python: user.has_permission(addPermission, appFolder);
|
|
|
|
createMeans python: tool.getCreateMeans(rootClass)">
|
2012-02-23 08:58:06 -06:00
|
|
|
<tal:comment replace="nothing">Create a new object from a web form</tal:comment>
|
|
|
|
<a tal:condition="python: ('form' in createMeans) and userMayAdd"
|
|
|
|
tal:attributes="href python: '%s/do?action=Create&className=%s' % (toolUrl, rootClass);
|
|
|
|
title python: _('query_create')">
|
|
|
|
<img tal:attributes="src string: $appUrl/ui/plus.png"/>
|
|
|
|
</a>
|
|
|
|
<tal:comment replace="nothing">Create (a) new object(s) by importing data</tal:comment>
|
|
|
|
<a tal:condition="python: ('import' in createMeans) and userMayAdd"
|
|
|
|
tal:attributes="href python: '%s/ui/import?className=%s' % (toolUrl, rootClass);
|
|
|
|
title python: _('query_import')">
|
|
|
|
<img tal:attributes="src string: $appUrl/ui/import.png"/>
|
|
|
|
</a>
|
2013-02-18 08:03:26 -06:00
|
|
|
</tal:icons>
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
<tal:search condition="python: tool.getAttr('enableAdvancedSearchFor%s' % rootClass)">
|
|
|
|
<tal:comment replace="nothing">Live search</tal:comment>
|
|
|
|
<form tal:attributes="action string: $appUrl/config/do">
|
|
|
|
<input type="hidden" name="action" value="SearchObjects"/>
|
|
|
|
<input type="hidden" name="className" tal:attributes="value rootClass"/>
|
|
|
|
<table cellpadding="0" cellspacing="0">
|
|
|
|
<tr valign="middle">
|
|
|
|
<td style="padding-right: 3px"><input type="text" size="14" name="w_SearchableText"/></td>
|
|
|
|
<td><input type="image" style="cursor:pointer"
|
|
|
|
tal:attributes="src string: $appUrl/ui/search.gif;
|
|
|
|
title python: _('search_button')"/></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
<tal:comment replace="nothing">Advanced search</tal:comment>
|
|
|
|
<div tal:define="highlighted python: (currentClass == rootClass) and (currentPage == 'search')"
|
|
|
|
tal:attributes="class python: highlighted and 'portletSearch portletCurrent' or 'portletSearch'">
|
|
|
|
<a tal:define="text python: _('search_title')"
|
|
|
|
tal:attributes="href python: '%s/ui/search?className=%s' % (toolUrl, rootClass); title text">
|
|
|
|
<span tal:replace="text"/>...
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</tal:search>
|
|
|
|
<tal:comment replace="nothing">Predefined searches</tal:comment>
|
2012-11-14 04:36:48 -06:00
|
|
|
<tal:widget repeat="widget searchInfo/searches">
|
|
|
|
<tal:group condition="python: widget['type'] == 'group'">
|
|
|
|
<metal:s use-macro="app/ui/portlet/macros/group"/>
|
|
|
|
</tal:group>
|
|
|
|
<tal:search condition="python: widget['type'] != 'group'">
|
|
|
|
<tal:s define="search widget">
|
|
|
|
<metal:s use-macro="app/ui/portlet/macros/search"/>
|
|
|
|
</tal:s>
|
|
|
|
</tal:search>
|
|
|
|
</tal:widget>
|
[gen] Added param Search.default allowing to define a default Search. The default search, if present, will be triggered when clicking on the main link for a class, instead of the query that collects all instances of this class; appy.gen.Type: removed 3 obsolete params: 'index', 'editDefault' and 'optional'. For achieving the same result than using 'editDefault', one may define 'by hand' an attribute on the Tool for storing the editable default value, and define, on the appropriate field in param 'default', a method that returns the value of the tool attribute; Added Type.defaultForSearch, allowing, for some sub-types, to define a default value when displaying the corresponding widget on the search screen; added a default 'state' field allowing to include workflow state among search criteria in the search screens; removed obsolete test applications.
2012-10-31 07:20:25 -05:00
|
|
|
</div>
|
|
|
|
</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>
|
2012-11-29 13:45:21 -06:00
|
|
|
<table metal:define-macro="phases" class="portletContent"
|
|
|
|
tal:define="singlePhase python: phases and (len(phases) == 1);
|
2013-01-14 09:58:30 -06:00
|
|
|
page python: req.get('page', 'main');
|
2013-01-18 04:26:01 -06:00
|
|
|
mayEdit contextObj/mayEdit">
|
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>
|
2012-03-27 08:49:41 -05:00
|
|
|
<tr tal:define="singlePage python: len(phase['pages']) == 1">
|
2012-12-07 04:23:08 -06:00
|
|
|
<td tal:define="label python:'%s_phase_%s' % (contextObj.meta_type, phase['name'])">
|
2012-03-27 03:37:41 -05:00
|
|
|
<tal:comment replace="nothing">The title of the phase</tal:comment>
|
2012-03-27 08:49:41 -05:00
|
|
|
<div class="portletGroup" tal:condition="python: not singlePhase and not singlePage"
|
2012-03-27 03:37:41 -05:00
|
|
|
tal:content="structure python: _(label)">
|
|
|
|
</div>
|
|
|
|
<tal:comment replace="nothing">The page(s) within the phase</tal:comment>
|
2012-05-05 10:04:19 -05:00
|
|
|
<tal:page repeat="aPage phase/pages">
|
|
|
|
<tal:comment replace="nothing">First line: page name and icons</tal:comment>
|
|
|
|
<div tal:condition="python: not (singlePhase and singlePage)"
|
|
|
|
tal:attributes="class python: test(aPage == page, 'portletCurrent portletPage', 'portletPage')">
|
|
|
|
<a tal:attributes="href python: contextObj.getUrl(page=aPage)"
|
2012-03-27 03:37:41 -05:00
|
|
|
tal:content="structure python: _('%s_page_%s' % (contextObj.meta_type, aPage))">
|
2012-05-05 10:04:19 -05:00
|
|
|
</a>
|
2013-01-14 09:58:30 -06:00
|
|
|
<tal:icons define="locked python: contextObj.isLocked(user, aPage);
|
|
|
|
editable python: mayEdit and phase['pagesInfo'][aPage]['showOnEdit']">
|
|
|
|
<a tal:condition="python: editable and not locked"
|
|
|
|
tal:attributes="href python: contextObj.getUrl(mode='edit', page=aPage)">
|
|
|
|
<img tal:attributes="src string: $appUrl/ui/edit.png;
|
|
|
|
title python: _('object_edit')"/>
|
|
|
|
</a>
|
|
|
|
<a tal:condition="python: editable and locked">
|
|
|
|
<img style="cursor: help"
|
2013-01-18 04:26:01 -06:00
|
|
|
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/locked.png; title lockMsg"/>
|
2013-01-14 09:58:30 -06:00
|
|
|
</a>
|
|
|
|
</tal:icons>
|
2012-05-05 10:04:19 -05:00
|
|
|
</div>
|
|
|
|
<tal:comment replace="nothing">Next lines: links</tal:comment>
|
|
|
|
<tal:links define="links python: phase['pagesInfo'][aPage].get('links')" tal:condition="links">
|
|
|
|
<div tal:repeat="link links">
|
|
|
|
<a tal:content="link/title" tal:attributes="href link/url"></a>
|
|
|
|
</div>
|
|
|
|
</tal:links>
|
|
|
|
</tal:page>
|
2010-08-05 11:23:17 -05:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tal:phase>
|
|
|
|
</table>
|