diff options
Diffstat (limited to 'httemplate/elements/tr-input-date-field.html')
-rw-r--r-- | httemplate/elements/tr-input-date-field.html | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/httemplate/elements/tr-input-date-field.html b/httemplate/elements/tr-input-date-field.html new file mode 100644 index 000000000..11581d5bc --- /dev/null +++ b/httemplate/elements/tr-input-date-field.html @@ -0,0 +1,40 @@ + +<LINK REL="stylesheet" TYPE="text/css" HREF="<%$fsurl%>elements/calendar-win2k-2.css" TITLE="win2k-2"> +<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar_stripped.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-en.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-setup.js"></SCRIPT> + +<TR> + <TD ALIGN="right"><% $label %></TD> + <TD> + <INPUT TYPE="text" NAME="<% $name %>" ID="<% $name %>_text" VALUE="<% $value %>"> + <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $name %>_button" STYLE="cursor: pointer" TITLE="Select date"> + </TD> +</TR> + +<SCRIPT TYPE="text/javascript"> + Calendar.setup({ + inputField: "<% $name %>_text", + ifFormat: "<% $format %>", + button: "<% $name %>_button", + align: "BR" + }); +</SCRIPT> + + +<%init> +my($name, $value, $label, $format, $usedatetime) = @_; + +$format = "%m/%d/%Y" unless $format; +$label = $name unless $label; + +if ($usedatetime) { + my $dt = DateTime->from_epoch(epoch => $value, time_zone => 'floating'); + $value = $dt->strftime($format) + unless $value eq ''; +}else{ + $value = time2str($format, $value); +} + +</%init> + |