2010-08-05 11:23:17 -05:00
|
|
|
<tal:comment replace="nothing">View macro for a String.</tal:comment>
|
|
|
|
<metal:view define-macro="view"
|
2013-03-29 08:50:12 -05:00
|
|
|
tal:define="fmt widget/format; isUrl widget/isUrl;
|
|
|
|
mayAjaxEdit python: not showChanges and widget['inlineEdit'] and contextObj.mayEdit(widget['writePermission'])">
|
2011-11-10 14:59:02 -06:00
|
|
|
<span tal:condition="python: fmt in (0, 3)">
|
2011-09-20 12:21:48 -05:00
|
|
|
<ul tal:condition="python: value and isMultiple">
|
|
|
|
<li tal:repeat="sv value"><i tal:content="structure sv"></i></li>
|
2010-08-05 11:23:17 -05:00
|
|
|
</ul>
|
2010-08-27 01:59:53 -05:00
|
|
|
<tal:singleValue condition="python: value and not isMultiple">
|
2012-10-31 15:17:31 -05:00
|
|
|
<tal:comment replace="nothing">A password</tal:comment>
|
2010-08-05 11:23:17 -05:00
|
|
|
<span tal:condition="python: fmt == 3">********</span>
|
2012-10-31 15:17:31 -05:00
|
|
|
<tal:comment replace="nothing">A URL</tal:comment>
|
|
|
|
<a tal:condition="python: (fmt != 3) and isUrl" target="_blank"
|
|
|
|
tal:attributes="href value" tal:content="value"></a>
|
|
|
|
<tal:comment replace="nothing">Any other value</tal:comment>
|
|
|
|
<span tal:condition="python: (fmt != 3) and not isUrl"
|
|
|
|
tal:replace="structure value"/>
|
2010-08-05 11:23:17 -05:00
|
|
|
</tal:singleValue>
|
|
|
|
</span>
|
2012-01-09 10:00:47 -06:00
|
|
|
<tal:comment replace="nothing">Text</tal:comment>
|
|
|
|
<span tal:condition="python: value and (fmt == 1)"
|
|
|
|
tal:replace="structure python: contextObj.formatText(value, format='html')"/>
|
|
|
|
<tal:comment replace="nothing">XHTML text</tal:comment>
|
2013-03-29 08:50:12 -05:00
|
|
|
<tal:xhtml condition="python: value and (fmt == 2)">
|
|
|
|
<div tal:condition="not: mayAjaxEdit" class="xhtml" tal:content="structure value"></div>
|
|
|
|
<div tal:condition="mayAjaxEdit" class="xhtml" contenteditable="true"
|
|
|
|
tal:attributes="id python: '%s_%s_ck' % (contextObj.UID(), name)"
|
|
|
|
tal:content="structure value">
|
|
|
|
</div>
|
|
|
|
<script tal:condition="mayAjaxEdit"
|
|
|
|
tal:content="python: contextObj.getEditorInlineInit(name)">
|
|
|
|
</script>
|
|
|
|
</tal:xhtml>
|
2011-11-10 14:59:02 -06:00
|
|
|
<input type="hidden" tal:condition="masterCss"
|
|
|
|
tal:attributes="class masterCss; value rawValue; name name; id name"/>
|
2010-08-05 11:23:17 -05:00
|
|
|
</metal:view>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Edit macro for a String.</tal:comment>
|
|
|
|
<metal:edit define-macro="edit"
|
|
|
|
tal:define="fmt widget/format;
|
|
|
|
isSelect widget/isSelect;
|
|
|
|
isMaster widget/slaves;
|
2012-02-16 11:13:51 -06:00
|
|
|
isOneLine python: fmt in (0,3,4);
|
2011-05-05 09:44:06 -05:00
|
|
|
maxChars python: test(widget['maxChars'], widget['maxChars'], '')">
|
2010-08-05 11:23:17 -05:00
|
|
|
|
|
|
|
<tal:choice condition="isSelect">
|
2010-09-02 09:16:08 -05:00
|
|
|
<select tal:define="possibleValues python:contextObj.getPossibleValues(name, withTranslations=True, withBlankValue=True)"
|
2010-08-05 11:23:17 -05:00
|
|
|
tal:attributes="name name;
|
|
|
|
id name;
|
2010-09-02 09:16:08 -05:00
|
|
|
multiple python: isMultiple and 'multiple' or '';
|
2011-10-01 15:40:13 -05:00
|
|
|
onchange python: isMaster and 'updateSlaves(this)' or '';
|
|
|
|
class masterCss;
|
2010-09-02 09:16:08 -05:00
|
|
|
size python: isMultiple and widget['height'] or 1">
|
2010-08-05 11:23:17 -05:00
|
|
|
<option tal:repeat="possibleValue possibleValues"
|
|
|
|
tal:attributes="value python: possibleValue[0];
|
2010-11-22 08:34:04 -06:00
|
|
|
selected python:contextObj.fieldValueSelected(name, possibleValue[0], rawValue);
|
|
|
|
title python: possibleValue[1]"
|
2013-02-19 02:57:02 -06:00
|
|
|
tal:content="python:tool.truncateValue(possibleValue[1], widget['width'])"></option>
|
2010-08-05 11:23:17 -05:00
|
|
|
</select>
|
|
|
|
</tal:choice>
|
|
|
|
<tal:line condition="python: isOneLine and not isSelect">
|
2011-05-05 09:44:06 -05:00
|
|
|
<input tal:attributes="id name; name name; size widget/width; maxlength maxChars;
|
2010-09-02 09:16:08 -05:00
|
|
|
value python: test(inRequest, requestValue, value);
|
2010-11-23 10:25:00 -06:00
|
|
|
style python: 'text-transform:%s' % widget['transform'];
|
2010-09-02 09:16:08 -05:00
|
|
|
type python: (widget['format'] == 3) and 'password' or 'text'"/>
|
2012-02-16 11:13:51 -06:00
|
|
|
<tal:comment replace="nothing">Display a captcha if required</tal:comment>
|
|
|
|
<tal:captcha condition="python: widget['format'] == 4">
|
|
|
|
<span tal:define="challenge python: contextObj.getCaptchaChallenge(name)"
|
|
|
|
tal:content="python: _('captcha_text', mapping=challenge)">
|
|
|
|
</span>
|
|
|
|
</tal:captcha>
|
2010-08-05 11:23:17 -05:00
|
|
|
</tal:line>
|
2011-09-28 14:17:15 -05:00
|
|
|
<tal:textarea condition="python: fmt in (1,2)">
|
2010-08-05 11:23:17 -05:00
|
|
|
<textarea tal:attributes="id name; name name;
|
|
|
|
cols widget/width;
|
2010-11-23 10:25:00 -06:00
|
|
|
rows widget/height;
|
2011-09-28 14:17:15 -05:00
|
|
|
style python: 'text-transform:%s' % widget['transform'];
|
|
|
|
class python: (fmt==2) and ('rich_%s' % name) or ''"
|
2010-08-05 11:23:17 -05:00
|
|
|
tal:content="python: test(inRequest, requestValue, value)">
|
|
|
|
</textarea>
|
2012-09-10 04:44:22 -05:00
|
|
|
<script type="text/javascript" tal:condition="python: fmt == 2"
|
2012-01-02 06:54:03 -06:00
|
|
|
tal:content="python: contextObj.getEditorInit(name)">
|
|
|
|
</script>
|
2010-08-05 11:23:17 -05:00
|
|
|
</tal:textarea>
|
|
|
|
</metal:edit>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Cell macro for a String.</tal:comment>
|
2010-09-02 09:16:08 -05:00
|
|
|
<metal:cell define-macro="cell"
|
|
|
|
tal:define="multipleValues python: value and isMultiple">
|
|
|
|
<tal:multiple condition="multipleValues"
|
|
|
|
content="python: ', '.join(value)">
|
|
|
|
</tal:multiple>
|
|
|
|
<tal:notMultiple condition="not: multipleValues">
|
2011-11-25 11:01:20 -06:00
|
|
|
<metal:call use-macro="app/ui/widgets/string/macros/view"/>
|
2010-09-02 09:16:08 -05:00
|
|
|
</tal:notMultiple>
|
2010-08-05 11:23:17 -05:00
|
|
|
</metal:cell>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Search macro for a String.</tal:comment>
|
|
|
|
<metal:search define-macro="search">
|
2012-06-03 11:34:56 -05:00
|
|
|
<label tal:attributes="for widgetName" tal:content="python: _(widget['labelId'])"></label><br>
|
2010-08-05 11:23:17 -05:00
|
|
|
<tal:comment replace="nothing">Show a simple search field for most String fields.</tal:comment>
|
|
|
|
<tal:simpleSearch condition="not: widget/isSelect">
|
2011-05-05 09:44:06 -05:00
|
|
|
<input type="text" tal:define="maxChars python: test(widget['maxChars'], widget['maxChars'], '')"
|
|
|
|
tal:attributes="name python: '%s*string-%s' % (widgetName, widget['transform']);
|
2013-02-19 02:57:02 -06:00
|
|
|
maxlength maxChars; size widget/swidth;
|
[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
|
|
|
style python: 'text-transform:%s' % widget['transform'];
|
2012-12-14 02:23:33 -06:00
|
|
|
value widget/sdefault"/>
|
2010-08-05 11:23:17 -05:00
|
|
|
</tal:simpleSearch>
|
|
|
|
<tal:comment replace="nothing">Show a multi-selection box for fields whose
|
|
|
|
validator defines a list of values, with a "AND/OR" checkbox.</tal:comment>
|
|
|
|
<tal:selectSearch condition="widget/isSelect">
|
|
|
|
<tal:comment replace="nothing">The "and" / "or" radio buttons</tal:comment>
|
2010-08-12 04:56:42 -05:00
|
|
|
<tal:operator define="operName python: 'o_%s' % name;
|
2010-08-05 11:23:17 -05:00
|
|
|
orName python: '%s_or' % operName;
|
|
|
|
andName python: '%s_and' % operName;"
|
|
|
|
condition="python: widget['multiplicity'][1]!=1">
|
2011-10-04 13:12:58 -05:00
|
|
|
<input type="radio" tal:attributes="name operName; id orName" checked="checked" value="or"/>
|
2012-06-03 11:34:56 -05:00
|
|
|
<label tal:attributes="for orName" tal:content="python: _('search_or')"></label>
|
2011-10-04 13:12:58 -05:00
|
|
|
<input type="radio" tal:attributes="name operName; id andName" value="and"/>
|
2012-06-03 11:34:56 -05:00
|
|
|
<label tal:attributes="for andName" tal:content="python: _('search_and')"></label><br/>
|
2010-08-05 11:23:17 -05:00
|
|
|
</tal:operator>
|
|
|
|
<tal:comment replace="nothing">The list of values</tal:comment>
|
2012-12-14 02:23:33 -06:00
|
|
|
<select tal:define="preSelected widget/sdefault"
|
2013-02-19 02:57:02 -06:00
|
|
|
tal:attributes="name widgetName; size widget/sheight" multiple="multiple">
|
2012-02-02 10:30:54 -06:00
|
|
|
<option tal:repeat="v python:tool.getPossibleValues(name, withTranslations=True, withBlankValue=False, className=className)"
|
[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:attributes="value python:v[0]; title python: v[1];
|
|
|
|
selected python: v[0] in preSelected"
|
2013-02-19 02:57:02 -06:00
|
|
|
tal:content="python: tool.truncateValue(v[1], widget['swidth'])">
|
2010-08-05 11:23:17 -05:00
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
</tal:selectSearch><br/>
|
|
|
|
</metal:search>
|