<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html
    xmlns:tal="http://xml.zope.org/namespaces/tal"
    xmlns:metal="http://xml.zope.org/namespaces/metal"
    i18n:domain="plone">
<body>

<metal:view_macro define-macro="view">
	<div metal:use-macro="here/widgets/string/macros/view" />
</metal:view_macro>

<metal:search_macro define-macro="search">
	<div metal:use-macro="here/widgets/string/macros/edit"/>
</metal:search_macro>

<metal:edit_macro define-macro="edit">
  	<metal:use use-macro="field_macro | context/widgets/field/macros/edit">
		<metal:body_macro fill-slot="widget_body"
			tal:define="value python: (value and len(value)>0) and value[0] or {}">
			
			<!-- From -->
	     	<input type="checkbox"
	     		tal:attributes="name python:fieldName+'_fromenabled';
	     						id python:fieldName+'_fromenabled';
	     						checked python: 'fromenabled' in value and value['fromenabled'] or False;"/>&nbsp;
			<label tal:attributes="for python:fieldName+'_fromdate';"  i18n:translate="">From</label>:&nbsp;
			<input type="text" size="15"
				class="blurrable firstToFocus"
				tal:attributes="name python:fieldName+'_fromdate';
	     	   			   		id python:fieldName+'_fromdate';
	     	   			  		value python: 'fromdate' in value and widget.ulocalized_time(value['fromdate'], long_format=0, context=context) or '';
	     	   			  		DatePicker python:fieldName+'_fromdate';
	     	   			  		readonly python: ('fromenabled' in value and value['fromenabled']==True) and False or True"/>&nbsp;
	     	   			  		
	     	<!-- Repeat every -->
 		    <input type="checkbox"
	     		tal:attributes="name python:fieldName+'_repeatenabled';
	     						id python:fieldName+'_repeatenabled';
	     						checked python: 'repeatenabled' in value and value['repeatenabled'] or False;"/>&nbsp;
	     	<label tal:attributes="for python:fieldName+'_repeatunit';"  i18n:translate="">Repeat every</label>:&nbsp;
	     	<input type="text" size="2" maxlength="2"
     	   		tal:attributes="name python:fieldName+'_repeatunit';
	     	   				   	id python:fieldName+'_repeatunit';
	     	   				   	value python: 'repeatunit' in value and value['repeatunit'] or '';
	     	   				   	readonly python: ('repeatenabled' in value and value['repeatenabled']==True) and False or True;"/>&nbsp;
	     	<select tal:define="values python:['Days','Weeks','Months','Years']"
	     			tal:attributes="name python:fieldName+'_repeatperiod';
	     							id python:fieldName+'_repeatperiod';
	     							disabled python: ('repeatenabled' in value and value['repeatenabled']==True) and False or True;">
			    <option name="foo:list" value="1"
			            tal:repeat="val values"
			            tal:attributes="value val;
			                            selected python:('repeatperiod' in value and val==value['repeatperiod']) and True or False" >
			        <span tal:replace="val" /></option>
			</select>
	     	
	     	<!-- Until -->
	     	<input type="checkbox"
	     		tal:attributes="name python:fieldName+'_repeatuntilenabled';
	     						id python:fieldName+'_repeatuntilenabled';
	     						checked python: 'repeatuntilenabled' in value and value['repeatuntilenabled'] or False;"/>&nbsp;
	     	<label tal:attributes="for python:fieldName+'_repeatuntil';" i18n:translate="">Until</label>:&nbsp;
			<input type="text" size="15"
				class="blurrable firstToFocus"
				tal:attributes="name python:fieldName+'_repeatuntil';
	     	   			   		id python:fieldName+'_repeatuntil';
	     	   			  		value python: 'repeatuntil' in value and widget.ulocalized_time(value['repeatuntil'], long_format=0, context=context) or '';
	     	   			  		DatePicker python:fieldName+'_repeatuntil';
	     	   			  		readonly python: ('repeatuntilenabled' in value and value['repeatuntilenabled']==True) and False or True;"/>&nbsp;
	     	 
	     	<!-- Hidden widget params accessed by js -->
	     	<input type="hidden" tal:attributes="name python: fieldName+'_repeatperiodselected';
	     					    				id python: fieldName+'_repeatperiodselected';
	     					    				value python: 'repeatperiod' in value and value['repeatperiod'] or None;" />
	     	<input type="hidden" id="fieldName" name="fieldName"
	     						tal:attributes="value python:fieldName;"/>	  		
		</metal:body_macro>
	</metal:use>
</metal:edit_macro>

</body>
</html>
