Improved advanced search functionality + completed String fields with Selection instance as validator.
This commit is contained in:
parent
f8baeee4f7
commit
d6607d7815
15 changed files with 333 additions and 84 deletions
|
@ -647,7 +647,8 @@
|
|||
totalNumber queryResult/totalNumber;
|
||||
batchSize queryResult/batchSize;
|
||||
ajaxHookId python:'queryResult';
|
||||
baseUrl python: tool.getQueryUrl(contentType, flavourNumber, searchName, startNumber='**v**')">
|
||||
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">
|
||||
|
||||
|
@ -655,6 +656,10 @@
|
|||
<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>
|
||||
|
@ -787,9 +792,13 @@
|
|||
</fieldset>
|
||||
</tal:result>
|
||||
|
||||
<span tal:condition="not: objs"
|
||||
tal:content="python: tool.translate('query_no_result')">No result.
|
||||
</span>
|
||||
<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>
|
||||
|
||||
|
@ -883,7 +892,9 @@
|
|||
<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">
|
||||
<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">
|
||||
|
@ -911,6 +922,8 @@
|
|||
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')"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<table class="no-style-table" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<tal:comment replace="nothing">Arrows for moving objects up or down</tal:comment>
|
||||
<td class="noPadding" tal:condition="python: (len(objs)>1) and member.has_permission('Modify portal content', obj)">
|
||||
<td class="noPadding" tal:condition="python: (len(objs)>1) and member.has_permission('Modify portal content', contextObj)">
|
||||
<tal:moveRef define="objectIndex python:contextObj.getAppyRefIndex(fieldName, obj);
|
||||
baseUrl python: contextObj.getUrl('showRef', **{'fieldName': fieldName, 'isBack': isBack, 'innerRef': innerRef, 'labelId': labelId, 'descrId': descrId, '%s_startNumber' % ajaxHookId: startNumber, 'action':'ChangeRefOrder', 'refObjectUid': obj.UID()})">
|
||||
<tal:comment replace="nothing">Move up</tal:comment>
|
||||
|
|
|
@ -16,10 +16,12 @@
|
|||
tal:define="appFolder context/getParentNode;
|
||||
contentType request/type_name;
|
||||
tool python: portal.get('portal_%s' % appFolder.id.lower());
|
||||
searchableFields python: tool.getSearchableFields(contentType)">
|
||||
flavour python: tool.getFlavour('Dummy_%s' % request['flavourNumber']);
|
||||
searchableFields python: flavour.getSearchableFields(contentType)">
|
||||
|
||||
<tal:comment replace="nothing">Search title</tal:comment>
|
||||
<h1 tal:content="python: tool.translate('search_title')"></h1><br/>
|
||||
<h1><span tal:replace="python: tool.translate('%s_plural' % contentType)"/> —
|
||||
<span tal:replace="python: tool.translate('search_title')"/></h1><br/>
|
||||
|
||||
<tal:comment replace="nothing">Form for searching objects of request/type_name.</tal:comment>
|
||||
<form name="search" tal:attributes="action python: appFolder.absolute_url()+'/skyn/do'" method="post">
|
||||
|
@ -27,12 +29,20 @@
|
|||
<input type="hidden" name="type_name" tal:attributes="value contentType"/>
|
||||
<input type="hidden" name="flavourNumber:int" tal:attributes="value request/flavourNumber"/>
|
||||
|
||||
<tal:searchFields repeat="searchField searchableFields">
|
||||
<tal:showSearchField define="fieldName python:searchField[0];
|
||||
appyType python:searchField[1]">
|
||||
<metal:searchField use-macro="python: appFolder.skyn.widgets.macros.get('search%s' % searchField[1]['type'])"/>
|
||||
</tal:showSearchField>
|
||||
</tal:searchFields>
|
||||
<table class="no-style-table" cellpadding="0" cellspacing="0" width="100%"
|
||||
tal:define="numberOfColumns python: flavour.getAttr('numberOfSearchColumnsFor%s' % contentType)">
|
||||
<tr tal:repeat="searchRow python: tool.tabularize(searchableFields, numberOfColumns)" valign="top" class="appySearchRow">
|
||||
<td tal:repeat="searchField searchRow">
|
||||
<tal:field condition="searchField">
|
||||
<tal:showSearchField define="fieldName python:searchField[0];
|
||||
appyType python:searchField[1];
|
||||
widgetName python: 'w_%s' % fieldName">
|
||||
<metal:searchField use-macro="python: appFolder.skyn.widgets.macros.get('search%s' % searchField[1]['type'])"/>
|
||||
</tal:showSearchField>
|
||||
</tal:field><br/><br class="discreet"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<tal:comment replace="nothing">Submit button</tal:comment>
|
||||
<p align="right"><br/>
|
||||
|
|
|
@ -7,11 +7,35 @@
|
|||
</metal:searchFloat>
|
||||
|
||||
<metal:searchString define-macro="searchString">
|
||||
<p tal:content="fieldName">Hello</p>
|
||||
<label tal:attributes="for widgetName" tal:content="python: tool.translate(appyType['label'])"></label><br>
|
||||
<tal:comment replace="nothing">Show a simple search field for most String fields.</tal:comment>
|
||||
<tal:simpleSearch condition="not: appyType/isSelect">
|
||||
<input type="text" tal:attributes="name widgetName"/>
|
||||
</tal:simpleSearch>
|
||||
<tal:comment replace="nothing">Show a multi-selection box for fields whose validator defines a list of values.</tal:comment>
|
||||
<tal:selectSearch condition="appyType/isSelect">
|
||||
<select tal:attributes="name widgetName" multiple="multiple" size="5">
|
||||
<option tal:repeat="v appyType/validator" tal:attributes="value v"
|
||||
tal:content="python: tool.truncate(tool.translate('%s_list_%s' % (appyType['label'], v)), 70)">
|
||||
</option>
|
||||
</select>
|
||||
</tal:selectSearch>
|
||||
</metal:searchString>
|
||||
|
||||
<metal:searchBoolean define-macro="searchBoolean">
|
||||
<p tal:content="fieldName">Hello</p>
|
||||
<metal:searchBoolean define-macro="searchBoolean" tal:define="typedWidget python:'%s*bool' % widgetName">
|
||||
<label tal:attributes="for widgetName" tal:content="python: tool.translate(appyType['label'])"></label><br>
|
||||
<tal:yes define="valueId python:'%s_yes' % fieldName">
|
||||
<input type="radio" class="noborder" value="True" tal:attributes="name typedWidget; id valueId"/>
|
||||
<label tal:attributes="for valueId" i18n:translate="yes" i18n:domain="plone"></label>
|
||||
</tal:yes>
|
||||
<tal:no define="valueId python:'%s_no' % fieldName">
|
||||
<input type="radio" class="noborder" value="False" tal:attributes="name typedWidget; id valueId"/>
|
||||
<label tal:attributes="for valueId" i18n:translate="no" i18n:domain="plone"></label>
|
||||
</tal:no>
|
||||
<tal:whatever define="valueId python:'%s_whatever' % fieldName">
|
||||
<input type="radio" class="noborder" value="" tal:attributes="name typedWidget; id valueId" checked="checked"/>
|
||||
<label tal:attributes="for valueId" tal:content="python: tool.translate('whatever')"></label>
|
||||
</tal:whatever>
|
||||
</metal:searchBoolean>
|
||||
|
||||
<metal:searchDate define-macro="searchDate">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue