2010-08-05 11:23:17 -05:00
|
|
|
<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"
|
2011-03-25 12:03:45 -05:00
|
|
|
tal:define="years python: contextObj.getSelectableYears(widget['name']);
|
2010-08-05 11:23:17 -05:00
|
|
|
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;
|
2010-08-12 04:56:42 -05:00
|
|
|
selected python:contextObj.dateValueSelected(name, 'day', day, rawValue)"
|
2010-08-05 11:23:17 -05:00
|
|
|
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;
|
2010-08-12 04:56:42 -05:00
|
|
|
selected python:contextObj.dateValueSelected(name, 'month', month, rawValue)"
|
2010-08-05 11:23:17 -05:00
|
|
|
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;
|
2010-08-12 04:56:42 -05:00
|
|
|
selected python:contextObj.dateValueSelected(name, 'year', year, rawValue)"
|
2010-08-05 11:23:17 -05:00
|
|
|
tal:content="year"></option>
|
|
|
|
</select>
|
2010-08-27 01:59:53 -05:00
|
|
|
<tal:comment replace="nothing">The icon for displaying the calendar (=date chooser)</tal:comment>
|
|
|
|
<a tal:condition="widget/calendar"
|
2011-09-18 08:00:05 -05:00
|
|
|
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: $appUrl/calendar.gif"/></a>
|
2010-08-05 11:23:17 -05:00
|
|
|
|
|
|
|
<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;
|
2010-08-12 04:56:42 -05:00
|
|
|
selected python:contextObj.dateValueSelected(name, 'hour', hour, rawValue)"
|
2010-08-05 11:23:17 -05:00
|
|
|
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;
|
2010-08-12 04:56:42 -05:00
|
|
|
selected python:contextObj.dateValueSelected(name, 'minute', minute, rawValue)"
|
2010-08-05 11:23:17 -05:00
|
|
|
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">
|
2011-11-25 11:01:20 -06:00
|
|
|
<metal:call use-macro="app/ui/widgets/date/macros/view"/>
|
2010-08-05 11:23:17 -05:00
|
|
|
</metal:cell>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Search macro for an Date.</tal:comment>
|
2010-12-17 07:46:55 -06:00
|
|
|
<metal:search define-macro="search"
|
|
|
|
tal:define="years python:range(widget['startYear'], widget['endYear']+1)">
|
2010-08-05 11:23:17 -05:00
|
|
|
<label tal:content="python: tool.translate(widget['labelId'])"></label>
|
2011-10-04 13:12:58 -05:00
|
|
|
<table>
|
2010-08-05 11:23:17 -05:00
|
|
|
<tal:comment replace="nothing">From</tal:comment>
|
2010-12-17 07:46:55 -06:00
|
|
|
<tr tal:define="yearFromName python: '%s*date' % widgetName;
|
|
|
|
monthFromName python: '%s_from_month' % name;
|
|
|
|
dayFromName python: '%s_from_day' % name;
|
|
|
|
dummyFromName python: '_d_ummy_from_%s' % name;">
|
2010-08-05 11:23:17 -05:00
|
|
|
<td width="10px"> </td>
|
|
|
|
<td>
|
|
|
|
<label tal:content="python: tool.translate('search_from')"></label>
|
|
|
|
</td>
|
|
|
|
<td>
|
2010-12-17 07:46:55 -06:00
|
|
|
<input type="hidden" tal:attributes="id dummyFromName; name dummyFromName" originalvalue=""/>
|
|
|
|
<select tal:attributes="id dayFromName; name dayFromName">
|
2010-08-05 11:23:17 -05:00
|
|
|
<option value="">--</option>
|
2010-12-17 07:46:55 -06:00
|
|
|
<option tal:repeat="value python: [str(v).zfill(2) for v in range(1, 32)]"
|
2010-08-05 11:23:17 -05:00
|
|
|
tal:content="value" tal:attributes="value value"></option>
|
2010-12-17 07:46:55 -06:00
|
|
|
</select> /
|
|
|
|
<select tal:attributes="id monthFromName; name monthFromName">
|
2010-08-05 11:23:17 -05:00
|
|
|
<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> /
|
2010-12-17 07:46:55 -06:00
|
|
|
<select tal:attributes="id yearFromName; name yearFromName">
|
2010-08-05 11:23:17 -05:00
|
|
|
<option value="">--</option>
|
2010-12-17 07:46:55 -06:00
|
|
|
<option tal:repeat="value python:range(widget['startYear'], widget['endYear']+1)"
|
2010-08-05 11:23:17 -05:00
|
|
|
tal:content="value" tal:attributes="value value"></option>
|
|
|
|
</select>
|
2010-12-17 07:46:55 -06:00
|
|
|
<tal:comment replace="nothing">The icon for displaying the calendar (=date chooser)</tal:comment>
|
|
|
|
<a tal:condition="widget/calendar"
|
|
|
|
tal:attributes="onclick python: 'return showJsCalendar(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', null, null, %d, %d)' % (monthFromName, dummyFromName, yearFromName, monthFromName, dayFromName, years[0], years[-1])">
|
2011-09-18 08:00:05 -05:00
|
|
|
<img tal:attributes="src string: $appUrl/calendar.gif"/></a>
|
2010-08-05 11:23:17 -05:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tal:comment replace="nothing">To</tal:comment>
|
2010-12-17 07:46:55 -06:00
|
|
|
<tr tal:define="dummyToName python: '_d_ummy_to_%s' % name;
|
|
|
|
yearToName python: '%s_to_year' % name;
|
|
|
|
monthToName python: '%s_to_month' % name;
|
|
|
|
dayToName python: '%s_to_day' % name">
|
2010-08-05 11:23:17 -05:00
|
|
|
<td></td>
|
|
|
|
<td>
|
2010-12-17 07:46:55 -06:00
|
|
|
<label tal:content="python: tool.translate('search_to')"></label>
|
2010-08-05 11:23:17 -05:00
|
|
|
</td>
|
2010-12-17 07:46:55 -06:00
|
|
|
<td height="20px;">
|
|
|
|
<input type="hidden" tal:attributes="id dummyToName; name dummyToName" originalvalue=""/>
|
|
|
|
<select tal:attributes="id dayToName; name dayToName">
|
2010-08-05 11:23:17 -05:00
|
|
|
<option value="">--</option>
|
2010-12-17 07:46:55 -06:00
|
|
|
<option tal:repeat="value python: [str(v).zfill(2) for v in range(1, 32)]"
|
|
|
|
tal:content="value" tal:attributes="value value"></option>
|
2010-08-05 11:23:17 -05:00
|
|
|
</select> /
|
2010-12-17 07:46:55 -06:00
|
|
|
<select tal:attributes="id monthToName; name monthToName">
|
2010-08-05 11:23:17 -05:00
|
|
|
<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> /
|
2010-12-17 07:46:55 -06:00
|
|
|
<select tal:attributes="id yearToName; name yearToName">
|
2010-08-05 11:23:17 -05:00
|
|
|
<option value="">--</option>
|
2010-12-17 07:46:55 -06:00
|
|
|
<option tal:repeat="value python:range(widget['startYear'], widget['endYear']+1)"
|
|
|
|
tal:content="value" tal:attributes="value value"></option>
|
2010-08-05 11:23:17 -05:00
|
|
|
</select>
|
2010-12-17 07:46:55 -06:00
|
|
|
<a tal:condition="widget/calendar"
|
|
|
|
tal:attributes="onclick python: 'return showJsCalendar(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', null, null, %d, %d)' % (monthToName, dummyToName, yearToName, monthToName, dayToName, years[0], years[-1])">
|
2011-09-18 08:00:05 -05:00
|
|
|
<img tal:attributes="src string: $appUrl/calendar.gif"/></a>
|
2010-08-05 11:23:17 -05:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</metal:search>
|