Added a new system for layouting production-ready forms without any HTML coding, many performance improvements and more independence towards Archetypes.
This commit is contained in:
parent
309ea921fa
commit
bfd2357f69
84 changed files with 4663 additions and 3549 deletions
30
gen/plone25/skin/widgets/action.pt
Normal file
30
gen/plone25/skin/widgets/action.pt
Normal file
|
@ -0,0 +1,30 @@
|
|||
<tal:comment replace="nothing">View macro for an Action.</tal:comment>
|
||||
<metal:view define-macro="view">
|
||||
<form name="executeAppyAction"
|
||||
tal:define="formId python: '%s_%s' % (contextObj.UID(), name);
|
||||
label python: contextObj.translate(widget['labelId'])"
|
||||
tal:attributes="id formId; action python: contextObj.absolute_url()+'/skyn/do'">
|
||||
<input type="hidden" name="action" value="ExecuteAppyAction"/>
|
||||
<input type="hidden" name="objectUid" tal:attributes="value contextObj/UID"/>
|
||||
<input type="hidden" name="fieldName" tal:attributes="value name"/>
|
||||
<input type="button" tal:condition="widget/confirm"
|
||||
tal:attributes="value label;
|
||||
onClick python: 'javascript:askConfirm(\'%s\')' % formId"/>
|
||||
<input type="submit" name="do" tal:condition="not: widget/confirm"
|
||||
tal:attributes="value label" onClick="javascript:;"/>
|
||||
<tal:comment replace="nothing">The previous onClick is simply used to prevent Plone
|
||||
from adding a CSS class that displays a popup when the user triggers the form multiple
|
||||
times.</tal:comment>
|
||||
</form>
|
||||
</metal:view>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for an Action.</tal:comment>
|
||||
<metal:edit define-macro="edit"></metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for an Action.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/action/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for an Action.</tal:comment>
|
||||
<metal:search define-macro="search"></metal:search>
|
39
gen/plone25/skin/widgets/boolean.pt
Normal file
39
gen/plone25/skin/widgets/boolean.pt
Normal file
|
@ -0,0 +1,39 @@
|
|||
<tal:comment replace="nothing">View macro for a Boolean.</tal:comment>
|
||||
<metal:view define-macro="view"><span tal:replace="value"/></metal:view>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for an Boolean.</tal:comment>
|
||||
<metal:edit define-macro="edit">
|
||||
<input type="checkbox"
|
||||
tal:attributes="name python: name + '_visible';
|
||||
id name;
|
||||
checked python:contextObj.checkboxChecked(name);
|
||||
onClick python:'toggleCheckbox(\'%s\', \'%s_hidden\');;updateSlaves(getMasterValue(this), \'%s\')' % (name, name, widget['id']);
|
||||
class python: 'noborder ' + widget['master_css']"/>
|
||||
<input tal:attributes="name name;
|
||||
id string:${name}_hidden;
|
||||
value python: test(contextObj.checkboxChecked(name), 'True', 'False')"
|
||||
type="hidden" />
|
||||
</metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for an Boolean.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/boolean/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for an Boolean.</tal:comment>
|
||||
<metal:search define-macro="search"
|
||||
tal:define="typedWidget python:'%s*bool' % widgetName">
|
||||
<label tal:attributes="for widgetName" tal:content="python: tool.translate(widget['labelId'])"></label><br>
|
||||
<tal:yes define="valueId python:'%s_yes' % name">
|
||||
<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' % name">
|
||||
<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' % name">
|
||||
<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><br/>
|
||||
</metal:search>
|
18
gen/plone25/skin/widgets/computed.pt
Normal file
18
gen/plone25/skin/widgets/computed.pt
Normal file
|
@ -0,0 +1,18 @@
|
|||
<tal:comment replace="nothing">View macro for a Computed.</tal:comment>
|
||||
<metal:view define-macro="view">
|
||||
<span tal:condition="widget/plainText" tal:replace="value"/>
|
||||
<span tal:condition="not: widget/plainText" tal:replace="structure value"/>
|
||||
</metal:view>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for a Computed.</tal:comment>
|
||||
<metal:edit define-macro="edit">
|
||||
<metal:call use-macro="portal/skyn/widgets/computed/macros/view"/>
|
||||
</metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for a Computed.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/computed/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for a Computed.</tal:comment>
|
||||
<metal:search define-macro="search"></metal:search>
|
132
gen/plone25/skin/widgets/date.pt
Normal file
132
gen/plone25/skin/widgets/date.pt
Normal file
|
@ -0,0 +1,132 @@
|
|||
<tal:comment replace="nothing">View macro for a Date.</tal:comment>
|
||||
<metal:view define-macro="view"><span tal:replace="value"/></metal:view>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for an Date.</tal:comment>
|
||||
<metal:edit define-macro="edit"
|
||||
tal:define="years python:range(widget['startYear'], widget['endYear']+1);
|
||||
dummyName python: '_d_ummy_%s' % name">
|
||||
<tal:comment replace="nothing">This field is not used but required by the Javascript popup.</tal:comment>
|
||||
<input type="hidden" tal:attributes="name dummyName; id dummyName"/>
|
||||
<tal:comment replace="nothing">Day</tal:comment>
|
||||
<select tal:define="days python:range(1,32)"
|
||||
tal:attributes="name string:${name}_day;
|
||||
id string:${name}_day;">
|
||||
<option value="">-</option>
|
||||
<tal:days repeat="day days">
|
||||
<option tal:define="zDay python: str(day).zfill(2)"
|
||||
tal:attributes="value zDay;
|
||||
selected python:contextObj.dateValueSelected(name, 'day', day)"
|
||||
tal:content="zDay"></option>
|
||||
</tal:days>
|
||||
</select>
|
||||
|
||||
<tal:comment replace="nothing">Month</tal:comment>
|
||||
<select tal:define="months python:range(1,13)"
|
||||
tal:attributes="name string:${name}_month;
|
||||
id string:${name}_month;">
|
||||
<option value="">-</option>
|
||||
<tal:months repeat="month months">
|
||||
<option tal:define="zMonth python: str(month).zfill(2)"
|
||||
tal:attributes="value zMonth;
|
||||
selected python:contextObj.dateValueSelected(name, 'month', month)"
|
||||
tal:content="zMonth"></option>
|
||||
</tal:months>
|
||||
</select>
|
||||
|
||||
<tal:comment replace="nothing">Year</tal:comment>
|
||||
<select tal:attributes="name string:${name}_year;
|
||||
id string:${name}_year;">
|
||||
<option value="">-</option>
|
||||
<option tal:repeat="year years"
|
||||
tal:attributes="value year;
|
||||
selected python:contextObj.dateValueSelected(name, 'year', year)"
|
||||
tal:content="year"></option>
|
||||
</select>
|
||||
<tal:comment replace="nothing">The icon for displaying the date chooser</tal:comment>
|
||||
<a tal:attributes="onclick python: 'return showJsCalendar(\'%s_month\', \'%s\', \'%s_year\', \'%s_month\', \'%s_day\', null, null, %d, %d)' % (name, dummyName, name, name, name, years[0], years[-1])"><img tal:attributes="src string: $portal_url/popup_calendar.gif"/></a>
|
||||
|
||||
<tal:hour condition="python: widget['format'] == 0">
|
||||
<select tal:define="hours python:range(0,24);"
|
||||
tal:attributes="name string:${name}_hour;
|
||||
id string:${name}_hour;">
|
||||
<option value="">-</option>
|
||||
<tal:hours repeat="hour hours">
|
||||
<option tal:define="zHour python: str(hour).zfill(2)"
|
||||
tal:attributes="value zHour;
|
||||
selected python:contextObj.dateValueSelected(name, 'hour', hour)"
|
||||
tal:content="zHour"></option>
|
||||
</tal:hours>
|
||||
</select> :
|
||||
<select tal:define="minutes python:range(0,60,5);"
|
||||
tal:attributes="name string:${name}_minute;
|
||||
id string:${name}_minute;">
|
||||
<option value="">-</option>
|
||||
<tal:minutes repeat="minute minutes">
|
||||
<option tal:define="zMinute python: str(minute).zfill(2)"
|
||||
tal:attributes="value zMinute;
|
||||
selected python:contextObj.dateValueSelected(name, 'minute', minute)"
|
||||
tal:content="zMinute"></option>
|
||||
</tal:minutes>
|
||||
</select>
|
||||
</tal:hour>
|
||||
</metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for an Date.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/date/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for an Date.</tal:comment>
|
||||
<metal:search define-macro="search">
|
||||
<label tal:content="python: tool.translate(widget['labelId'])"></label>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tal:comment replace="nothing">From</tal:comment>
|
||||
<tr tal:define="fromName python: '%s*date' % widgetName">
|
||||
<td width="10px"> </td>
|
||||
<td>
|
||||
<label tal:content="python: tool.translate('search_from')"></label>
|
||||
</td>
|
||||
<td>
|
||||
<select tal:attributes="name fromName">
|
||||
<option value="">--</option>
|
||||
<option tal:repeat="value python:range(widget['startYear'], widget['endYear']+1)"
|
||||
tal:content="value" tal:attributes="value value"></option>
|
||||
</select> /
|
||||
<select tal:attributes="name python: '%s_from_month' % name">
|
||||
<option value="">--</option>
|
||||
<option tal:repeat="value python: [str(v).zfill(2) for v in range(1, 13)]"
|
||||
tal:content="python:tool.getMonthName(value)" tal:attributes="value value"></option>
|
||||
</select> /
|
||||
<select tal:attributes="name python: '%s_from_day' % name">
|
||||
<option value="">--</option>
|
||||
<option tal:repeat="value python: [str(v).zfill(2) for v in range(1, 32)]"
|
||||
tal:content="value" tal:attributes="value value"></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">To</tal:comment>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<label tal:content="python: tool.translate('search_to')"></label>
|
||||
</td>
|
||||
<td>
|
||||
<select tal:attributes="name python: '%s_to_year' % name">
|
||||
<option value="">--</option>
|
||||
<option tal:repeat="value python:range(widget['startYear'], widget['endYear']+1)"
|
||||
tal:content="value" tal:attributes="value value"></option>
|
||||
</select> /
|
||||
<select tal:attributes="name python: '%s_to_month' % name">
|
||||
<option value="">--</option>
|
||||
<option tal:repeat="value python: [str(v).zfill(2) for v in range(1, 13)]"
|
||||
tal:content="python:tool.getMonthName(value)" tal:attributes="value value"></option>
|
||||
</select> /
|
||||
<select tal:attributes="name python: '%s_to_day' % name">
|
||||
<option value="">--</option>
|
||||
<option tal:repeat="value python: [str(v).zfill(2) for v in range(1, 32)]"
|
||||
tal:content="value" tal:attributes="value value"></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</metal:search>
|
73
gen/plone25/skin/widgets/file.pt
Normal file
73
gen/plone25/skin/widgets/file.pt
Normal file
|
@ -0,0 +1,73 @@
|
|||
<tal:comment replace="nothing">View macro for a File.</tal:comment>
|
||||
<metal:view define-macro="view"
|
||||
tal:define="empty python: not value or not value.size;
|
||||
imageSrc string:${contextObj/absolute_url}/download?name=$name">
|
||||
<tal:file condition="python: not empty and not widget['isImage']">
|
||||
<img tal:define="icon value/getBestIcon"
|
||||
tal:condition="icon" tal:attributes="src string: $portal_url/$icon"/>
|
||||
<a tal:attributes="href imageSrc"
|
||||
tal:content="value/filename">
|
||||
</a> -
|
||||
<i class="discreet" tal:content="python:'%sKb' % (value.size / 1024)"></i>
|
||||
</tal:file>
|
||||
<tal:image condition="python: not empty and widget['isImage']">
|
||||
<img tal:attributes="src python: imageSrc" />
|
||||
</tal:image>
|
||||
<tal:nothing tal:condition="empty">-</tal:nothing>
|
||||
</metal:view>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for an File.</tal:comment>
|
||||
<metal:edit define-macro="edit">
|
||||
<tal:showFile condition="python: value and value.size">
|
||||
<metal:call use-macro="portal/skyn/widgets/file/macros/view"/><br/>
|
||||
</tal:showFile>
|
||||
<tal:editButtons condition="python: value and value.size">
|
||||
<tal:comment replace="nothing">Keep the file untouched.</tal:comment>
|
||||
<input class="noborder" type="radio" value="nochange"
|
||||
tal:attributes="checked python:test(value.size!=0, 'checked', None);
|
||||
name string:${name}_delete;
|
||||
id string:${name}_nochange;
|
||||
onclick string:document.getElementById('${name}_file').disabled=true;"/>
|
||||
<label tal:attributes="for string:${name}_nochange"
|
||||
i18n:translate="nochange_file" i18n:domain="plone">
|
||||
</label>
|
||||
<br/>
|
||||
<tal:comment replace="nothing">Delete the file.</tal:comment>
|
||||
<tal:delete condition="not: widget/required">
|
||||
<input class="noborder" type="radio" value="delete"
|
||||
tal:attributes="name string:${name}_delete;
|
||||
id string:${name}_delete;
|
||||
onclick string:document.getElementById('${name}_file').disabled=true;"/>
|
||||
<label tal:attributes="for string:${name}_delete"
|
||||
i18n:translate="delete_file" i18n:domain="plone">
|
||||
</label>
|
||||
<br/>
|
||||
</tal:delete>
|
||||
<tal:comment replace="nothing">Replace with a new file.</tal:comment>
|
||||
<input class="noborder" type="radio" value=""
|
||||
tal:attributes="checked python:test(value.size==0, 'checked', None);
|
||||
name string:${name}_delete;
|
||||
id string:${name}_upload;
|
||||
onclick string:document.getElementById('${name}_file').disabled=false"/>
|
||||
<label tal:attributes="for string:${name}_upload;"
|
||||
i18n:translate="upload_file" i18n:domain="plone">
|
||||
</label>
|
||||
<br/>
|
||||
</tal:editButtons>
|
||||
<tal:comment replace="nothing">The upload field.</tal:comment>
|
||||
<input type="file" size="30"
|
||||
tal:attributes="name string:${name}_file;
|
||||
id string:${name}_file;"/>
|
||||
<script type="text/javascript"
|
||||
tal:define="isDisabled python:test(value and value.size, 'true', 'false')"
|
||||
tal:content="string: document.getElementById('${name}_file').disabled=$isDisabled;">
|
||||
</script>
|
||||
</metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for an File.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/file/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for an File.</tal:comment>
|
||||
<metal:search define-macro="search"></metal:search>
|
29
gen/plone25/skin/widgets/float.pt
Normal file
29
gen/plone25/skin/widgets/float.pt
Normal file
|
@ -0,0 +1,29 @@
|
|||
<tal:comment replace="nothing">View macro for a Float.</tal:comment>
|
||||
<metal:view define-macro="view">
|
||||
<span tal:content="value"
|
||||
tal:attributes="id value; class widget/master_css"></span>
|
||||
</metal:view>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for an Float.</tal:comment>
|
||||
<metal:edit define-macro="edit">
|
||||
<input tal:attributes="id name; name name; size widget/width;
|
||||
value python: test(inRequest, requestValue, value)" type="text"/>
|
||||
</metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for an Float.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/float/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for an Float.</tal:comment>
|
||||
<metal:search define-macro="search">
|
||||
<label tal:content="python: tool.translate(widget['labelId'])"></label><br>
|
||||
<tal:from define="fromName python: '%s*float' % widgetName">
|
||||
<label tal:attributes="for fromName" tal:content="python: tool.translate('search_from')"></label>
|
||||
<input type="text" tal:attributes="name fromName" size="4"/>
|
||||
</tal:from>
|
||||
<tal:to define="toName python: '%s_to' % name">
|
||||
<label tal:attributes="for toName" tal:content="python: tool.translate('search_to')"></label>
|
||||
<input type="text" tal:attributes="name toName" size="4"/>
|
||||
</tal:to><br/>
|
||||
</metal:search>
|
11
gen/plone25/skin/widgets/info.pt
Normal file
11
gen/plone25/skin/widgets/info.pt
Normal file
|
@ -0,0 +1,11 @@
|
|||
<tal:comment replace="nothing">View macro for an Info.</tal:comment>
|
||||
<metal:view define-macro="view"><tal:comment replace="nothing">Shows nothing more.</tal:comment></metal:view>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for an Info.</tal:comment>
|
||||
<metal:edit define-macro="edit"></metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for an Info.</tal:comment>
|
||||
<metal:cell define-macro="cell"></metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for an Info.</tal:comment>
|
||||
<metal:search define-macro="search"></metal:search>
|
28
gen/plone25/skin/widgets/integer.pt
Normal file
28
gen/plone25/skin/widgets/integer.pt
Normal file
|
@ -0,0 +1,28 @@
|
|||
<tal:comment replace="nothing">View macro for an Integer.</tal:comment>
|
||||
<metal:view define-macro="view">
|
||||
<span tal:content="value" tal:attributes="id value; class widget/master_css"></span>
|
||||
</metal:view>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for an Integer.</tal:comment>
|
||||
<metal:edit define-macro="edit">
|
||||
<input tal:attributes="id name; name name; size widget/width;
|
||||
value python: test(inRequest, requestValue, value)" type="text"/>
|
||||
</metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for an Integer.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/integer/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for an Integer.</tal:comment>
|
||||
<metal:search define-macro="search">
|
||||
<label tal:content="python: tool.translate(widget['labelId'])"></label><br>
|
||||
<tal:from define="fromName python: '%s*int' % widgetName">
|
||||
<label tal:attributes="for fromName" tal:content="python: tool.translate('search_from')"></label>
|
||||
<input type="text" tal:attributes="name fromName" size="4"/>
|
||||
</tal:from>
|
||||
<tal:to define="toName python: '%s_to' % name">
|
||||
<label tal:attributes="for toName" tal:content="python: tool.translate('search_to')"></label>
|
||||
<input type="text" tal:attributes="name toName" size="4"/>
|
||||
</tal:to><br/>
|
||||
</metal:search>
|
26
gen/plone25/skin/widgets/pod.pt
Normal file
26
gen/plone25/skin/widgets/pod.pt
Normal file
|
@ -0,0 +1,26 @@
|
|||
<tal:comment replace="nothing">View macro for a Pod.</tal:comment>
|
||||
<metal:view define-macro="view">
|
||||
<tal:askAction condition="widget/askAction"
|
||||
define="doLabel python:'%s_askaction' % widget['labelId'];
|
||||
chekboxId python: '%s_%s' % (contextObj.UID(), name)">
|
||||
<input type="checkbox" tal:attributes="name doLabel; id chekboxId"/>
|
||||
<label tal:attributes="for chekboxId" class="discreet"
|
||||
tal:content="python: tool.translate(doLabel)"></label>
|
||||
</tal:askAction>
|
||||
<img tal:repeat="podFormat python:flavour.getPodInfo(contextObj, name)['formats']"
|
||||
tal:attributes="src string: $portal_url/skyn/${podFormat}.png;
|
||||
onClick python: 'javascript:generatePodDocument(\'%s\',\'\',\'%s\',\'%s\')' % (contextObj.UID(), name, podFormat);
|
||||
title podFormat/capitalize"
|
||||
style="cursor:pointer"/>
|
||||
</metal:view>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for a Pod.</tal:comment>
|
||||
<metal:edit define-macro="edit"></metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for a Pod.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/pod/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for a Pod.</tal:comment>
|
||||
<metal:search define-macro="search"></metal:search>
|
277
gen/plone25/skin/widgets/ref.pt
Normal file
277
gen/plone25/skin/widgets/ref.pt
Normal file
|
@ -0,0 +1,277 @@
|
|||
<tal:comment replace="nothing">
|
||||
We begin with some sub-macros used within macro "show" defined below.
|
||||
</tal:comment>
|
||||
|
||||
<metal:objectTitle define-macro="objectTitle">
|
||||
<tal:comment replace="nothing">Displays the title of a referenced object, with a link on
|
||||
it to reach the consult view for this object. If we are on a back reference, the link
|
||||
allows to reach the correct page where the forward reference is defined. If we are
|
||||
on a forward reference, the "nav" parameter is added to the URL for allowing to navigate
|
||||
from one object to the next/previous on skyn/view.</tal:comment>
|
||||
<a tal:define="viewUrl obj/getUrl;
|
||||
navInfo python:'nav=ref.%s.%s.%d.%d' % (contextObj.UID(), fieldName, repeat['obj'].number()+startNumber, totalNumber);
|
||||
fullUrl python: test(appyType['isBack'], viewUrl + '/?page=%s' % appyType['page'], viewUrl + '/?' + navInfo)"
|
||||
tal:attributes="href fullUrl" tal:content="obj/Title"></a>
|
||||
</metal:objectTitle>
|
||||
|
||||
<metal:objectActions define-macro="objectActions">
|
||||
<tal:comment replace="nothing">Displays icons for triggering actions on a given
|
||||
referenced object (edit, delete, etc).</tal:comment>
|
||||
<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', contextObj)">
|
||||
<tal:moveRef define="objectIndex python: contextObj.getAppyRefIndex(fieldName, obj);
|
||||
ajaxBaseCall python: navBaseCall.replace('**v**', '\'%s\',\'ChangeRefOrder\', {\'refObjectUid\':\'%s\', \'move\':\'**v**\'}' % (startNumber, obj.UID()))">
|
||||
<tal:comment replace="nothing">Move up</tal:comment>
|
||||
<img tal:condition="python: objectIndex > 0"
|
||||
tal:attributes="src string: $portal_url/skyn/arrowUp.png;
|
||||
title python: tool.translate('move_up');
|
||||
onClick python: ajaxBaseCall.replace('**v**', 'up')"
|
||||
style="cursor:pointer"/>
|
||||
<tal:comment replace="nothing">Move down</tal:comment>
|
||||
<img tal:condition="python: objectIndex < (totalNumber-1)"
|
||||
tal:attributes="src string: $portal_url/skyn/arrowDown.png;
|
||||
title python: tool.translate('move_down');
|
||||
onClick python: ajaxBaseCall.replace('**v**', 'down')"
|
||||
style="cursor:pointer"/>
|
||||
</tal:moveRef>
|
||||
</td>
|
||||
<tal:comment replace="nothing">Edit the element</tal:comment>
|
||||
<td class="noPadding"><a tal:attributes="href python: obj.absolute_url() + '/skyn/edit'"
|
||||
tal:condition="python: member.has_permission('Modify portal content', obj)">
|
||||
<img title="label_edit" i18n:domain="plone" i18n:attributes="title"
|
||||
tal:attributes="src string: $portal_url/skyn/edit.gif"/>
|
||||
</a></td>
|
||||
<tal:comment replace="nothing">Delete the element</tal:comment>
|
||||
<td class="noPadding">
|
||||
<img tal:condition="python: member.has_permission('Delete objects', obj)"
|
||||
title="Delete" i18n:domain="plone" i18n:attributes="title" style="cursor:pointer"
|
||||
tal:attributes="src string: $portal_url/skyn/delete.png;
|
||||
onClick python:'javascript:onDeleteObject(\'%s\')' % obj.UID()"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</metal:objectActions>
|
||||
|
||||
<metal:plusIcon define-macro="plusIcon">
|
||||
<tal:comment replace="nothing">Displays the "plus" icon that allows to add new object
|
||||
through a reference widget. Indeed, If field was declared as "addable", we must provide
|
||||
an icon for creating a new linked object (at least if multiplicities allow it).</tal:comment>
|
||||
<img style="cursor:pointer" tal:condition="showPlusIcon"
|
||||
tal:attributes="src string:$portal_url/skyn/plus.png;
|
||||
title python: tool.translate('add_ref');
|
||||
onClick python: 'href: window.location=\'%s/skyn/do?action=Create&initiator=%s&field=%s&type_name=%s\'' % (folder.absolute_url(), contextObj.UID(), fieldName, linkedPortalType)"/>
|
||||
</metal:plusIcon>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays, in a cell header from a ref table, icons for sorting the
|
||||
ref field according to the field that corresponds to this column.
|
||||
</tal:comment>
|
||||
<metal:sortIcons define-macro="sortIcons"
|
||||
tal:define="ajaxBaseCall python: navBaseCall.replace('**v**', '\'%s\',\'SortReference\', {\'sortKey\':\'%s\', \'reverse\':\'**v**\'}' % (startNumber, shownField))" tal:condition="python: canWrite and objs[0].isRefSortable(shownField)">
|
||||
<img style="cursor:pointer"
|
||||
tal:attributes="src string:$portal_url/skyn/sortAsc.png;
|
||||
onClick python: ajaxBaseCall.replace('**v**', 'False')"/>
|
||||
<img style="cursor:pointer"
|
||||
tal:attributes="src string:$portal_url/skyn/sortDesc.png;
|
||||
onClick python: ajaxBaseCall.replace('**v**', 'True')"/>
|
||||
</metal:sortIcons>
|
||||
|
||||
<tal:comment replace="nothing">View macro for a Ref.</tal:comment>
|
||||
<div metal:define-macro="view"
|
||||
tal:define= "innerRef innerRef|python:False;
|
||||
ajaxHookId python: contextObj.UID() + name"
|
||||
tal:attributes = "id ajaxHookId">
|
||||
<script language="javascript"
|
||||
tal:content="python: 'askRefField(\'%s\',\'%s\',\'%s\',\'%s\',0)' % (ajaxHookId, contextObj.absolute_url(), name, innerRef)">
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro is called by a XmlHttpRequest for displaying the paginated
|
||||
referred objects of a reference field.
|
||||
</tal:comment>
|
||||
<div metal:define-macro="viewContent"
|
||||
tal:define="fieldName request/fieldName;
|
||||
appyType python: contextObj.getAppyType(fieldName, asDict=True);
|
||||
innerRef python: test(request['innerRef']=='True', True, False);
|
||||
ajaxHookId python: contextObj.UID()+fieldName;
|
||||
startNumber python: int(request.get('%s_startNumber' % ajaxHookId, 0));
|
||||
tool contextObj/getTool;
|
||||
refObjects python:contextObj.getAppyRefs(appyType, startNumber);
|
||||
objs refObjects/objects;
|
||||
totalNumber refObjects/totalNumber;
|
||||
batchSize refObjects/batchSize;
|
||||
folder python: test(contextObj.isPrincipiaFolderish, contextObj, contextObj.getParentNode());
|
||||
flavour python:tool.getFlavour(contextObj);
|
||||
linkedPortalType python:flavour.getPortalType(appyType['klass']);
|
||||
addPermission python: '%s: Add %s' % (tool.getAppName(), linkedPortalType);
|
||||
canWrite python: not appyType['isBack'] and member.has_permission(appyType['writePermission'], contextObj);
|
||||
multiplicity appyType/multiplicity;
|
||||
maxReached python:(multiplicity[1] != None) and (len(objs) >= multiplicity[1]);
|
||||
showPlusIcon python:not appyType['isBack'] and appyType['add'] and not maxReached and member.has_permission(addPermission, folder) and canWrite;
|
||||
atMostOneRef python: (multiplicity[1] == 1) and (len(objs)<=1);
|
||||
label python: tool.translate(appyType['labelId']);
|
||||
description python: tool.translate(appyType['descrId']);
|
||||
navBaseCall python: 'askRefField(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, contextObj.absolute_url(), fieldName, innerRef)">
|
||||
|
||||
<tal:comment replace="nothing">This macro displays the Reference widget on a "consult" page.
|
||||
|
||||
The definition of "atMostOneRef" above may sound strange: we shouldn't check the actual number
|
||||
of referenced objects. But for back references people often forget to specify multiplicities.
|
||||
So concretely, multiplicities (0,None) are coded as (0,1).</tal:comment>
|
||||
|
||||
<tal:atMostOneReference condition="atMostOneRef">
|
||||
<tal:comment replace="nothing">Display a simplified widget if maximum number of
|
||||
referenced objects is 1.</tal:comment>
|
||||
<table class="no-style-table" cellpadding="0" cellspacing="0"><tr valign="top">
|
||||
<td><span class="appyLabel" tal:condition="not: innerRef" tal:content="structure label"></span></td>
|
||||
|
||||
<tal:comment replace="nothing">If there is no object...</tal:comment>
|
||||
<tal:noObject condition="not:objs">
|
||||
<td tal:content="python: tool.translate('no_ref')"></td>
|
||||
<td><metal:plusIcon use-macro="portal/skyn/widgets/ref/macros/plusIcon"/></td>
|
||||
</tal:noObject>
|
||||
|
||||
<tal:comment replace="nothing">If there is an object...</tal:comment>
|
||||
<tal:objectIsPresent condition="python: len(objs) == 1">
|
||||
<tal:obj repeat="obj objs">
|
||||
<td><metal:showObjectTitle use-macro="portal/skyn/widgets/ref/macros/objectTitle" /></td>
|
||||
<td tal:condition="not: appyType/isBack">
|
||||
<metal:showObjectActions use-macro="portal/skyn/widgets/ref/macros/objectActions" />
|
||||
</td>
|
||||
</tal:obj>
|
||||
</tal:objectIsPresent>
|
||||
</tr></table>
|
||||
</tal:atMostOneReference>
|
||||
|
||||
<tal:comment replace="nothing">Display a fieldset in all other cases.</tal:comment>
|
||||
<tal:anyNumberOfReferences condition="not: atMostOneRef">
|
||||
<fieldset tal:attributes="class python:test(innerRef, 'innerAppyFieldset', '')">
|
||||
<legend tal:condition="python: not innerRef or showPlusIcon">
|
||||
<span tal:condition="not: innerRef" tal:content="label"/>
|
||||
(<span tal:replace="totalNumber"/>)
|
||||
<metal:plusIcon use-macro="portal/skyn/widgets/ref/macros/plusIcon"/>
|
||||
</legend>
|
||||
|
||||
<tal:comment replace="nothing">Object description</tal:comment>
|
||||
<!--p tal:condition="python: not innerRef and description.strip()"
|
||||
tal:content="description" class="discreet" ></p-->
|
||||
|
||||
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
|
||||
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
|
||||
|
||||
<tal:comment replace="nothing">No object is present</tal:comment>
|
||||
<p tal:condition="not:objs" tal:content="python: tool.translate('no_ref')"></p>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0" tal:condition="objs"
|
||||
tal:attributes="class python:test(innerRef, 'innerAppyTable', '')">
|
||||
<tr valign="bottom"><td>
|
||||
|
||||
<tal:comment replace="nothing">Show backward reference(s)</tal:comment>
|
||||
<table class="no-style-table" cellspacing="0" cellpadding="0"
|
||||
tal:condition="python: appyType['isBack'] and objs">
|
||||
<tr tal:repeat="obj objs">
|
||||
<td><metal:showObjectTitle use-macro="portal/skyn/widgets/ref/macros/objectTitle" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<tal:comment replace="nothing">Show forward reference(s)</tal:comment>
|
||||
<table tal:attributes="class python:test(innerRef, '', 'listing nosort');
|
||||
width python:test(innerRef, '100%', appyType['layouts']['view']['width']);"
|
||||
align="right" tal:condition="python: not appyType['isBack'] and objs" cellpadding="0" cellspacing="0">
|
||||
<tal:widgets define="widgets python: objs[0].getAppyTypesFromNames(appyType['shownInfo'])">
|
||||
<tr tal:condition="appyType/showHeaders">
|
||||
<th tal:condition="python: 'title' not in appyType['shownInfo']"
|
||||
tal:define="shownField python:'title'">
|
||||
<span tal:content="python: tool.translate('ref_name')"></span>
|
||||
<metal:sortIcons use-macro="portal/skyn/widgets/ref/macros/sortIcons" />
|
||||
</th>
|
||||
<th tal:repeat="widget widgets">
|
||||
<tal:header define="shownField widget/name">
|
||||
<span tal:content="python: tool.translate(widget['labelId'])"></span>
|
||||
<metal:sortIcons use-macro="portal/skyn/widgets/ref/macros/sortIcons" />
|
||||
</tal:header>
|
||||
</th>
|
||||
<th tal:content="python: tool.translate('ref_actions')"></th>
|
||||
</tr>
|
||||
<tal:row repeat="obj objs">
|
||||
<tr valign="top" tal:define="odd repeat/obj/odd"
|
||||
tal:attributes="class python:test(odd, 'even', 'odd')">
|
||||
<tal:comment replace="nothing">Object title, shown here if not specified somewhere
|
||||
else in appyType.shownInfo.</tal:comment>
|
||||
<td tal:condition="python: 'title' not in appyType['shownInfo']"><metal:showObjectTitle
|
||||
use-macro="portal/skyn/widgets/ref/macros/objectTitle"/>
|
||||
</td>
|
||||
<tal:comment replace="nothing">Additional fields that must be shown</tal:comment>
|
||||
<td tal:repeat="widget widgets">
|
||||
<tal:showTitle condition="python: widget['name'] == 'title'">
|
||||
<metal:showObjectTitle use-macro="portal/skyn/widgets/ref/macros/objectTitle"/>
|
||||
</tal:showTitle>
|
||||
<tal:showOtherField define="contextObj python:obj;
|
||||
layoutType python: 'cell';
|
||||
innerRef python:True"
|
||||
condition="python: widget['name'] != 'title'">
|
||||
<metal:showField use-macro="portal/skyn/widgets/show/macros/field" />
|
||||
</tal:showOtherField>
|
||||
</td>
|
||||
<tal:comment replace="nothing">Actions</tal:comment>
|
||||
<td align="right">
|
||||
<metal:showObjectActions use-macro="portal/skyn/widgets/ref/macros/objectActions" />
|
||||
</td>
|
||||
</tr>
|
||||
</tal:row>
|
||||
</tal:widgets>
|
||||
</table>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<tal:comment replace="nothing">Appy (bottom) navigation</tal:comment>
|
||||
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
|
||||
|
||||
</fieldset>
|
||||
<tal:comment replace="nothing">A carriage return needed in some cases.</tal:comment>
|
||||
<br tal:define="widgetDescr widgetDescr|nothing"
|
||||
tal:condition="python: not widgetDescr or (widgetDescr['widgetType'] != 'group')"/>
|
||||
</tal:anyNumberOfReferences>
|
||||
</div>
|
||||
|
||||
<tal:comment replace="nothing">Edit macro for an Ref.</tal:comment>
|
||||
<div define-macro="edit"
|
||||
tal:condition="widget/link"
|
||||
tal:define="refPortalType python: contextObj.getAppyRefPortalType(name);
|
||||
allBrains python:here.uid_catalog(portal_type=refPortalType);
|
||||
brains python:contextObj.callAppySelect(widget['select'], allBrains);
|
||||
refUids python: [o.UID() for o in here.getAppyRefs(name)['objects']];
|
||||
isMultiple python:test(widget['multiplicity'][1]!=1, 'multiple', '');
|
||||
appyFieldName python: 'appy_ref_%s' % name;
|
||||
inError python:test(errors.has_key(name), True, False);
|
||||
isBeingCreated python: contextObj.isTemporary() or ('/portal_factory/' in contextObj.absolute_url())"
|
||||
tal:attributes="class python:'appyRefEdit field' + test(inError, ' error', '')">
|
||||
|
||||
<tal:comment replace="nothing">This macro displays the Reference widget on an "edit" page</tal:comment>
|
||||
|
||||
<label tal:attributes="for python:appyFieldName" tal:content="label"></label>
|
||||
<span class="fieldRequired" tal:condition="python: appyType['multiplicity'][0]>0"></span><br/>
|
||||
<div tal:condition="inError" tal:content="python: errors[field.getName()]"></div>
|
||||
<select tal:define="valueIsInReq python:test(request.get(appyFieldName, None) != None, True, False)"
|
||||
tal:attributes="name python:'appy_ref_%s' % field.getName();
|
||||
multiple isMultiple">
|
||||
<option tal:condition="not: isMultiple" value="" i18n:translate="choose_a_value"/>
|
||||
<option tal:repeat="brain brains"
|
||||
tal:content="python: tool.getReferenceLabel(brain, appyType)"
|
||||
tal:attributes="value brain/UID;
|
||||
selected python:test((valueIsInReq and (brain.UID in request.get(appyFieldName, []))) or (not valueIsInReq and ((brain.UID in refUids) or (isBeingCreated and (brain.UID==defaultValueUID)))), True, False)"/>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for a Ref.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/ref/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for a Ref.</tal:comment>
|
||||
<metal:search define-macro="search"></metal:search>
|
203
gen/plone25/skin/widgets/show.pt
Normal file
203
gen/plone25/skin/widgets/show.pt
Normal file
|
@ -0,0 +1,203 @@
|
|||
<tal:comment replace="nothing">
|
||||
This macro shows the content of a layouted object, like a page or widget.
|
||||
It requires:
|
||||
contextObj The Zope object on which we are working
|
||||
layoutType The kind of layout: "view"? "edit"? "cell"?
|
||||
layout The layout object that will dictate how object content
|
||||
will be rendered.
|
||||
Options:
|
||||
contextMacro The base on folder containing the macros to call for
|
||||
rendering the elements within the layout.
|
||||
Defaults to portal.skyn
|
||||
</tal:comment>
|
||||
<metal:show define-macro="layout"
|
||||
tal:define="contextMacro contextMacro| python: portal.skyn">
|
||||
<table tal:attributes="cellpadding layout/cellpadding;
|
||||
cellspacing layout/cellspacing;
|
||||
width layout/width;
|
||||
align layout/align;
|
||||
class layout/css_class;
|
||||
style layout/style">
|
||||
<tal:comment replace="nothing">The table header row</tal:comment>
|
||||
<tr tal:condition="layout/headerRow" tal:attributes="valign layout/headerRow/valign">
|
||||
<th tal:repeat="cell layout/headerRow/cells"
|
||||
tal:attributes="align cell/align; width cell/width;">
|
||||
</th>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">The table content</tal:comment>
|
||||
<tr tal:repeat="row layout/rows" tal:attributes="valign row/valign">
|
||||
<td tal:repeat="cell row/cells"
|
||||
tal:attributes="align cell/align; colspan cell/colspan;
|
||||
style python: test(repeat['cell'].end, '', 'padding-right: 0.4em')">
|
||||
<tal:content repeat="elem cell/content">
|
||||
<tal:field condition="python: elem == '?'">
|
||||
<metal:call use-macro="python: contextMacro.get(widget['type'].lower()).macros.get(layoutType)"/>
|
||||
</tal:field>
|
||||
<tal:other condition="python: elem != '?'">
|
||||
<metal:call use-macro="python: contextMacro.get(elem[0]).macros.get(elem[1])"/>
|
||||
</tal:other>
|
||||
<img tal:condition="not: repeat/elem/end" tal:attributes="src string: $portal_url/skyn/space.gif"/>
|
||||
</tal:content>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</metal:show>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays the widget corresponding to a given field. It requires:
|
||||
contextObj The Zope object for which this widget must be rendered
|
||||
page The page where the widget lies
|
||||
layoutType "edit"? "view"? "cell?"
|
||||
widget The widget to render
|
||||
</tal:comment>
|
||||
<metal:field define-macro="field"
|
||||
tal:define="contextMacro python: portal.skyn.widgets;
|
||||
layout python: widget['layouts'][layoutType];
|
||||
name widget/name;
|
||||
value python: contextObj.getFormattedValue(name);
|
||||
requestValue python: request.get(name, None);
|
||||
inRequest python: request.has_key(name);
|
||||
errors errors | python: ();
|
||||
inError python: test(widget['name'] in errors, True, False)">
|
||||
<metal:layout use-macro="here/skyn/widgets/show/macros/layout"/>
|
||||
</metal:field>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays the widget corresponding to a group of widgets.
|
||||
It requires:
|
||||
contextObj The Zope object for which this widget must be rendered
|
||||
page The page where the widget lies
|
||||
layoutType "edit"? "view"? "cell?"
|
||||
widget The widget to render
|
||||
</tal:comment>
|
||||
<metal:group define-macro="group">
|
||||
<fieldset tal:condition="python: widget['style'] == 'fieldset'">
|
||||
<legend tal:condition="widget/hasLabel">
|
||||
<i tal:content="structure python: contextObj.translate(widget['labelId'])"></i>
|
||||
<tal:help condition="widget/hasHelp">
|
||||
<metal:call use-macro="portal/skyn/widgets/show/macros/help"/>
|
||||
</tal:help>
|
||||
</legend>
|
||||
<div tal:condition="widget/hasDescr" class="discreet"
|
||||
tal:content="structure python: contextObj.translate(widget['descrId'])"></div>
|
||||
<metal:content use-macro="portal/skyn/widgets/show/macros/groupContent"/>
|
||||
</fieldset>
|
||||
<tal:asSection condition="python: widget['style'] not in ('fieldset', 'tabs')">
|
||||
<metal:content use-macro="portal/skyn/widgets/show/macros/groupContent"/>
|
||||
</tal:asSection>
|
||||
<tal:asTabs condition="python: widget['style'] == 'tabs'">
|
||||
<table cellpadding="0" cellspacing="0" tal:attributes="width python: test(widget['wide'], '100%', '')">
|
||||
<tal:comment replace="nothing">First row: the tabs.</tal:comment>
|
||||
<tr><td style="border-bottom: 1px solid #ff8040">
|
||||
<table cellpadding="0" cellspacing="0" style="position:relative; bottom:-1px;">
|
||||
<tr valign="bottom">
|
||||
<tal:tab repeat="widgetRow widget/widgets">
|
||||
<tal:id define="tabId python:'tab_%s_%d_%d' % (widget['name'], repeat['widgetRow'].number(), len(widget['widgets']))">
|
||||
<td><img tal:attributes="src string: $portal_url/skyn/tabLeft.png;
|
||||
id python: '%s_left' % tabId"/><td>
|
||||
<td tal:attributes="style python:'background-image: url(%s/skyn/tabBg.png)' % portal_url;
|
||||
id tabId">
|
||||
<a style="cursor:pointer"
|
||||
tal:content="python: tool.translate('%s_col%d' % (widget['labelId'], repeat['widgetRow'].number()))"
|
||||
tal:attributes="onClick python: 'javascript:showTab(\'%s_%d_%d\')' % (widget['name'], repeat['widgetRow'].number(), len(widget['widgets']))"></a>
|
||||
</td>
|
||||
<td><img tal:attributes="src string: $portal_url/skyn/tabRight.png;
|
||||
id python: '%s_right' % tabId"/><td>
|
||||
</tal:id>
|
||||
</tal:tab>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tal:comment replace="nothing">Other rows: the widgets.</tal:comment>
|
||||
<tr tal:repeat="widgetRow widget/widgets"
|
||||
tal:attributes="id python: 'tabcontent_%s_%d_%d' % (widget['name'], repeat['widgetRow'].number(), len(widget['widgets']));
|
||||
style python: test(repeat['widgetRow'].number()==1, 'display:table-row', 'display:none')">
|
||||
<td tal:define="widget python: widgetRow[0]">
|
||||
<tal:group condition="python: widget['type'] == 'group'">
|
||||
<metal:call use-macro="portal/skyn/widgets/show/macros/group"/>
|
||||
</tal:group>
|
||||
<tal:field condition="python: widget['type'] != 'group'">
|
||||
<metal:call use-macro="portal/skyn/widgets/show/macros/field"/>
|
||||
</tal:field>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script language="javascript"
|
||||
tal:content="python: 'initTab(\'tab_%s\', \'%s_1_%d\')' % (widget['name'], widget['name'], len(widget['widgets']))"></script>
|
||||
</tal:asTabs>
|
||||
</metal:group>
|
||||
|
||||
<tal:comment replace="nothing">
|
||||
This macro displays the content of a group of widgets.
|
||||
It is exclusively called by macro "group" above.
|
||||
</tal:comment>
|
||||
<table metal:define-macro="groupContent" align="center"
|
||||
tal:attributes="width python: test(widget['wide'], '100%', '')">
|
||||
<tal:comment replace="nothing">Display the title of the group if it is not rendered a fieldset.</tal:comment>
|
||||
<tr tal:condition="python: (widget['style'] != 'fieldset') and widget['hasLabel']">
|
||||
<td tal:attributes="colspan python: len(widget['columnsWidths']);
|
||||
class widget/style">
|
||||
<span tal:replace="structure python: contextObj.translate(widget['labelId'])"/>
|
||||
<tal:help condition="widget/hasHelp">
|
||||
<metal:call use-macro="portal/skyn/widgets/show/macros/help"/>
|
||||
</tal:help>
|
||||
</td>
|
||||
</tr>
|
||||
<tr tal:condition="python: (widget['style'] != 'fieldset') and widget['hasDescr']">
|
||||
<td tal:attributes="colspan python: len(widget['columnsWidths'])" class="discreet"
|
||||
tal:content="structure python: contextObj.translate(widget['descrId'])">
|
||||
</td>
|
||||
</tr>
|
||||
<tr> <tal:comment replace="nothing">The column headers</tal:comment>
|
||||
<th tal:repeat="colNb python:range(len(widget['columnsWidths']))"
|
||||
tal:attributes="width python:widget['columnsWidths'][colNb];
|
||||
align python:widget['columnsAligns'][colNb]"
|
||||
tal:content="structure python: test(widget['hasHeaders'], contextObj.translate('%s_col%d' % (widget['labelId'], colNb+1)), '')">
|
||||
</th>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">The rows of widgets</tal:comment>
|
||||
<tr valign="top" tal:repeat="widgetRow widget/widgets">
|
||||
<td tal:repeat="widget widgetRow"
|
||||
tal:attributes="colspan widget/colspan|python:1;
|
||||
style python: test(repeat['widget'].number() != len(widgetRow), 'padding-right: 0.6em', '')">
|
||||
<tal:showWidget condition="widget">
|
||||
<tal:group condition="python: widget['type'] == 'group'">
|
||||
<metal:call use-macro="portal/skyn/widgets/show/macros/group"/>
|
||||
</tal:group>
|
||||
<tal:field condition="python: widget['type'] != 'group'">
|
||||
<metal:call use-macro="portal/skyn/widgets/show/macros/field"/>
|
||||
</tal:field>
|
||||
</tal:showWidget>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<tal:comment replace="nothing">Displays a field label.</tal:comment>
|
||||
<tal:label metal:define-macro="label" condition="widget/hasLabel">
|
||||
<label tal:attributes="for widget/name"
|
||||
tal:condition="python: widget['type'] not in ('Action', 'Ref')"
|
||||
tal:content="structure python: contextObj.translate(widget['labelId'])"></label>
|
||||
</tal:label>
|
||||
|
||||
<tal:comment replace="nothing">Displays a field description.</tal:comment>
|
||||
<tal:description metal:define-macro="description" condition="widget/hasDescr">
|
||||
<span class="discreet" tal:content="structure python: contextObj.translate(widget['descrId'])"></span>
|
||||
</tal:description>
|
||||
|
||||
<tal:comment replace="nothing">Displays a field help.</tal:comment>
|
||||
<tal:help metal:define-macro="help">
|
||||
<acronym tal:attributes="title python: contextObj.translate(widget['helpId'])">
|
||||
<img tal:attributes="src string: $portal_url/skyn/help.png"/>
|
||||
</acronym>
|
||||
</tal:help>
|
||||
|
||||
<tal:comment replace="nothing">Displays validation-error-related info about a field.</tal:comment>
|
||||
<tal:validation metal:define-macro="validation">
|
||||
<acronym tal:condition="inError" tal:attributes="title python: errors[name]">
|
||||
<img tal:attributes="src string: $portal_url/skyn/warning.png"/>
|
||||
</acronym>
|
||||
<img tal:condition="not: inError" tal:attributes="src string: $portal_url/skyn/warning_no.png"/>
|
||||
</tal:validation>
|
||||
|
||||
<tal:comment replace="nothing">Displays the fact that a field is required.</tal:comment>
|
||||
<tal:required metal:define-macro="required"><img tal:attributes="src string: $portal_url/skyn/required.png"/></tal:required>
|
102
gen/plone25/skin/widgets/string.pt
Normal file
102
gen/plone25/skin/widgets/string.pt
Normal file
|
@ -0,0 +1,102 @@
|
|||
<tal:comment replace="nothing">View macro for a String.</tal:comment>
|
||||
<metal:view define-macro="view"
|
||||
tal:define="fmt widget/format;
|
||||
maxMult python: widget['multiplicity'][1];
|
||||
severalValues python: (maxMult == None) or (maxMult > 1)">
|
||||
<span tal:condition="python: fmt in (0, 3)"
|
||||
tal:attributes="class widget/master_css;
|
||||
id python: contextObj.getFormattedValue(name, forMasterId=True)">
|
||||
<ul class="appyList" tal:condition="python: value and severalValues">
|
||||
<li class="appyBullet" tal:repeat="sv value"><i tal:content="structure sv"></i></li>
|
||||
</ul>
|
||||
<tal:singleValue condition="python: value and not severalValues">
|
||||
<span tal:condition="python: fmt != 3" tal:replace="structure value"/>
|
||||
<span tal:condition="python: fmt == 3">********</span>
|
||||
</tal:singleValue>
|
||||
</span>
|
||||
<tal:formattedString condition="python: fmt not in (0, 3)">
|
||||
<span tal:condition="python: value and (fmt == 1)"
|
||||
tal:replace="structure python: value.replace('\n', '<br>')"/>
|
||||
<span tal:condition="python: value and (fmt == 2)" tal:replace="structure value"/>
|
||||
</tal:formattedString>
|
||||
</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;
|
||||
isOneLine python: fmt in (0,3)">
|
||||
|
||||
<tal:choice condition="isSelect">
|
||||
<select tal:define="possibleValues python:contextObj.getPossibleValues(name, withTranslations=True, withBlankValue=True)"
|
||||
tal:attributes="name name;
|
||||
id name;
|
||||
multiple python: test(widget['multiplicity'][1] != 1, 'multiple', '');
|
||||
onchange python: test(isMaster, 'javascript:updateSlaves(getMasterValue(this), \'%s\')' % widget['id'], '');
|
||||
class widget/master_css">
|
||||
<option tal:repeat="possibleValue possibleValues"
|
||||
tal:attributes="value python: possibleValue[0];
|
||||
selected python:contextObj.fieldValueSelected(name, possibleValue[0])"
|
||||
tal:content="python:tool.truncateValue(possibleValue[1], widget)"></option>
|
||||
</select>
|
||||
</tal:choice>
|
||||
<tal:line condition="python: isOneLine and not isSelect">
|
||||
<input tal:attributes="id name; name name; size widget/width;
|
||||
value python: test(inRequest, requestValue, value)" type="text"/>
|
||||
</tal:line>
|
||||
<tal:textarea condition="python: fmt == 1">
|
||||
<textarea tal:attributes="id name; name name;
|
||||
cols widget/width;
|
||||
rows widget/height;"
|
||||
tal:content="python: test(inRequest, requestValue, value)">
|
||||
</textarea>
|
||||
<input type="hidden" value="text/plain" originalvalue="text/plain"
|
||||
tal:attributes="name python: '%s_text_format' % name"/>
|
||||
</tal:textarea>
|
||||
<tal:rich condition="python: fmt == 2">
|
||||
<tal:editor define="editor python: member.getProperty('wysiwyg_editor','').lower();
|
||||
macrosFile python: path('nocall:here/%s_wysiwyg_support' % editor);
|
||||
fieldName name;
|
||||
inputname name;
|
||||
inputvalue python: test(inRequest, requestValue, value);
|
||||
dummy python: request.set('%s_text_format' % name, 'text/html')">
|
||||
<metal:box use-macro="macrosFile/macros/wysiwygEditorBox"/>
|
||||
</tal:editor>
|
||||
</tal:rich>
|
||||
</metal:edit>
|
||||
|
||||
<tal:comment replace="nothing">Cell macro for a String.</tal:comment>
|
||||
<metal:cell define-macro="cell">
|
||||
<metal:call use-macro="portal/skyn/widgets/string/macros/view"/>
|
||||
</metal:cell>
|
||||
|
||||
<tal:comment replace="nothing">Search macro for a String.</tal:comment>
|
||||
<metal:search define-macro="search">
|
||||
<label tal:attributes="for widgetName" tal:content="python: tool.translate(widget['labelId'])"></label><br>
|
||||
<tal:comment replace="nothing">Show a simple search field for most String fields.</tal:comment>
|
||||
<tal:simpleSearch condition="not: widget/isSelect">
|
||||
<input type="text" tal:attributes="name python: '%s*string-%s' % (widgetName, widget['transform']);
|
||||
style python: 'text-transform:%s' % widget['transform']"/>
|
||||
</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>
|
||||
<tal:operator define="operName python: 'o_%s' % fieldName;
|
||||
orName python: '%s_or' % operName;
|
||||
andName python: '%s_and' % operName;"
|
||||
condition="python: widget['multiplicity'][1]!=1">
|
||||
<input type="radio" class="noborder" tal:attributes="name operName; id orName" checked="checked" value="or"/>
|
||||
<label tal:attributes="for orName" tal:content="python: tool.translate('search_or')"></label>
|
||||
<input type="radio" class="noborder" tal:attributes="name operName; id andName" value="and"/>
|
||||
<label tal:attributes="for andName" tal:content="python: tool.translate('search_and')"></label><br/>
|
||||
</tal:operator>
|
||||
<tal:comment replace="nothing">The list of values</tal:comment>
|
||||
<select tal:attributes="name widgetName" multiple="multiple" size="5">
|
||||
<option tal:repeat="v python:tool.getPossibleValues(name, withTranslations=True, withBlankValue=False, className=contentType)"
|
||||
tal:attributes="value python:v[0]" tal:content="python: v[1]">
|
||||
</option>
|
||||
</select>
|
||||
</tal:selectSearch><br/>
|
||||
</metal:search>
|
Loading…
Add table
Add a link
Reference in a new issue