Thursday 05 January 2006 8:46:29 pm
Hi Fraser Fantastic extension. Currently if you reedit an object and click on the calendar it will display the current date. Heres a patch to set the default date/time to the stored date/time for ezdatetime.tpl --- ezdatetime.tpl.orig Fri Jan 6 15:44:22 2006
+++ ezdatetime.tpl Fri Jan 6 16:16:19 2006
@@ -39,8 +39,8 @@
style="cursor: pointer; border: 1px solid blue; margin-top:20px;"
title="Date & Time selector"
alt="Select Date & Time"
-onmouseover="this.style.background=blue;"
-onmouseout="this.style.background=" />
+onmouseover="this.style.background='blue';"
+onmouseout="this.style.background=''" />
<div class="break"></div>
@@ -49,11 +49,21 @@
{literal}
<script type="text/javascript">
+var year = document.getElementById("{/literal}{$attribute_base}_datetime_year_{$attribute.id}{literal}");
+var month= document.getElementById("{/literal}{$attribute_base}_datetime_month_{$attribute.id}{literal}");
+var day= document.getElementById("{/literal}{$attribute_base}_datetime_day_{$attribute.id}{literal}");
+var hour= document.getElementById("{/literal}{$attribute_base}_datetime_hour_{$attribute.id}{literal}");
+var minute= document.getElementById("{/literal}{$attribute_base}_datetime_minute_{$attribute.id}{literal}");
+var datetime = year.value + '/' + month.value + '/' + day.value + ' ' + hour.value + ':' + minute.value;
+if (datetime == '// :')
+ datetime=null;
+
Calendar.setup(
{
onSelect: OnSelectDateTime{/literal}{$attribute.id}{literal},
showsTime: true,
-button : "trigger{/literal}{$attribute.id}{literal}"
+button : "trigger{/literal}{$attribute.id}{literal}",
+date: datetime
}
);
function OnSelectDateTime{/literal}{$attribute.id}{literal}(calendar, date)
and for ezdate.tpl --- ezdate.tpl.orig Fri Jan 6 16:04:31 2006
+++ ezdate.tpl Fri Jan 6 16:16:18 2006
@@ -21,8 +21,8 @@
style="cursor: pointer; border: 1px solid blue; margin-top:20px;"
title="Date selector"
alt="Select Date"
-onmouseover="this.style.background=blue;"
-onmouseout="this.style.background=" />
+onmouseover="this.style.background='blue';"
+onmouseout="this.style.background=''" />
<div class="break"></div>
</div>
@@ -31,10 +31,18 @@
{literal}
<script type="text/javascript">
+var year = document.getElementById("{/literal}{$attribute_base}_date_year_{$attribute.id}{literal}");
+var month= document.getElementById("{/literal}{$attribute_base}_date_month_{$attribute.id}{literal}");
+var day= document.getElementById("{/literal}{$attribute_base}_date_day_{$attribute.id}{literal}");
+var datetime = year.value + '/' + month.value + '/' + day.value;
+if (datetime == '//')
+ datetime=null;
+
Calendar.setup(
{
onSelect: OnSelectDate{/literal}{$attribute.id}{literal},
-button : "trigger{/literal}{$attribute.id}{literal}"
+button : "trigger{/literal}{$attribute.id}{literal}",
+date: datetime
}
);
function OnSelectDate{/literal}{$attribute.id}{literal}(calendar, date)
I can email you a new version to update the contribution if you like - contact me on bruce@designit.com.au
Cheers Bruce
My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish
|