Created
February 14, 2013 20:19
-
-
Save tomgross/4956024 to your computer and use it in GitHub Desktop.
Plone HTML5 calendar_macros. Be careful! This does not work aout of the box. It needs a slightly modified date_components_support-view and process_form-method of the widget.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html xmlns:tal="http://xml.zope.org/namespaces/tal" | |
xmlns:metal="http://xml.zope.org/namespaces/metal" | |
xmlns:i18n="http://xml.zope.org/namespaces/i18n" | |
i18n:domain="plone"> | |
<body> | |
<tal:comment tal:condition="nothing"> | |
The calendar date picker. | |
</tal:comment> | |
<div metal:define-macro="calendarDatePickerBox" tal:define=" | |
uniqueItemIndex context/@@plone/uniqueItemIndex; | |
inputIndex uniqueItemIndex/next; | |
show_hm show_hm | python:1; | |
show_ymd show_ymd | python:1; | |
starting_year starting_year | nothing; | |
ending_year ending_year | nothing; | |
future_years future_years | nothing; | |
minute_step minute_step | python: 5; | |
input_id string:${formname}_${inputname}_${inputIndex}; | |
date_components_support_view context/@@date_components_support2; | |
values python:date_components_support_view.result(inputvalue, 0, starting_year, ending_year, future_years, minute_step); | |
inputdate values/date; | |
years values/years; | |
hours values/hours; | |
minutes values/minutes; | |
ampm values/ampm;"> | |
<input type="hidden" tal:attributes="name string:$inputname; | |
id input_id; | |
value inputdate" /> | |
<input type="hidden" tal:attributes="id inputname;" /> | |
<input type="hidden" | |
id="ic_date" | |
value="1900-02-16" | |
tal:attributes="id string:${input_id}_date;" | |
tal:condition="not:show_ymd" /> | |
<tal:ymd condition="show_ymd"> | |
<label tal:attributes="for string:${input_id}_year" class="hiddenStructure" style="float:left" i18n:translate="">Year</label> | |
<input type="date" name="" tal:attributes="name string:${inputname}_date; id string:${input_id}_date; value inputdate;"/> | |
</tal:ymd> | |
| |
<span tal:condition="show_hm"> | |
<label tal:attributes="for string:${input_id}_hour" class="hiddenStructure" style="float:left" i18n:translate="">Hour</label> | |
<select name="ic_hour" | |
id="ic_hour" | |
size="1" | |
tal:attributes="name string:${inputname}_hour; | |
id string:${input_id}_hour; | |
onfocus onfocus|nothing; | |
onblur onblur|nothing;"> | |
<option value="subj" | |
tal:repeat="hour hours" | |
tal:attributes="value hour/value; selected hour/selected" | |
tal:content="hour/id">hour</option> | |
</select> | |
</span> | |
<span tal:condition="not: show_hm"> | |
<input name="ic_hour" | |
type="hidden" | |
id="ic_hour" | |
size="1" | |
value="00" | |
tal:attributes="name string:${inputname}_hour; | |
id string:${input_id}_hour;" /> | |
</span> | |
<span i18n:translate="time_separator" | |
tal:condition="show_hm">:</span> | |
<span tal:condition="show_hm"> | |
<label tal:attributes="for string:${input_id}_minute" class="hiddenStructure" style="float:left" i18n:translate="">Minute</label> | |
<select name="ic_minute" | |
id="ic_minute" | |
size="1" | |
tal:attributes="name string:${inputname}_minute; | |
id string:${input_id}_minute; | |
onfocus onfocus|nothing; | |
onblur onblur|nothing;"> | |
<option value="subj" | |
tal:repeat="minute minutes" | |
tal:attributes="value minute/value; selected minute/selected" | |
tal:content="minute/id">hour</option> | |
</select> | |
</span> | |
<span tal:condition="not: show_hm"> | |
<input name="ic_minute" | |
type="hidden" | |
id="ic_minute" | |
size="1" | |
value="00" | |
tal:attributes="name string:${inputname}_minute; | |
id string:${input_id}_minute;"/> | |
</span> | |
<span tal:condition="python: ampm and show_hm"> | |
<label tal:attributes="for string:${input_id}_ampm" class="hiddenStructure" style="float:left" i18n:translate="">AM/PM</label> | |
<select name="ic_ampm" | |
id="ic_ampm" | |
size="1" | |
tal:attributes="name string:${inputname}_ampm; | |
id string:${input_id}_ampm; | |
onfocus onfocus|nothing; | |
onblur onblur|nothing;"> | |
<option value="subj" | |
tal:repeat="ampm ampm" | |
tal:attributes="value ampm/value; selected ampm/selected" | |
i18n:translate="" | |
tal:content="ampm/id">ampm</option> | |
</select> | |
</span> | |
<span tal:condition="python:not ampm or not show_hm"> | |
<input name="ic_ampm" | |
type="hidden" | |
id="ic_ampm" | |
size="1" | |
tal:attributes="name string:${inputname}_ampm; | |
id string:${input_id}_ampm; | |
value python:''" | |
/> | |
</span> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment