[Jifty-commit] r585 - in jifty/trunk: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Feb 14 21:00:24 EST 2006
Author: trs
Date: Tue Feb 14 21:00:23 2006
New Revision: 585
Added:
jifty/trunk/share/web/templates/helpers/
jifty/trunk/share/web/templates/helpers/calendar.html
Modified:
jifty/trunk/ (props changed)
Log:
r8586 at wintermute: tom | 2006-02-14 20:59:29 -0500
Add in the missing calender helper
Added: jifty/trunk/share/web/templates/helpers/calendar.html
==============================================================================
--- (empty file)
+++ jifty/trunk/share/web/templates/helpers/calendar.html Tue Feb 14 21:00:23 2006
@@ -0,0 +1,89 @@
+<& /_elements/header, title => 'Calendar' &>
+<body class="calpopup">
+
+<a href="#" onclick="window.close(); return false;">Close window</a>
+
+<div class="calendar">
+ <table>
+ <caption>
+ <a class="prev" href="calendar.html?DisplayedMonth=<%$prev_month%>&DisplayedYear=<%$prev_year%>&field=<%$field%>">Prev</a>
+ <span class="month"><% $months[$DisplayedMonth-1] %> <% $DisplayedYear %></span>
+ <a class="next" href="calendar.html?DisplayedMonth=<%$next_month%>&DisplayedYear=<%$next_year%>&field=<%$field%>">Next</a>
+ </caption>
+ <tr>
+% foreach my $wday (@weekdays) {
+ <th><%$wday%></th>
+% }
+ </tr>
+% foreach my $week (@cal) {
+ <tr>
+% foreach my $day (@{$week}) {
+ <td>
+% if ($day) {
+% my $datestr = sprintf('%04d-%02d-%02d', $DisplayedYear, $DisplayedMonth, $day);
+ <a href="#" onclick="updateParentField('<% $field %>','<% $datestr %>'); return false;"><% $day %></a>
+% } else {
+
+% }
+ </td>
+% } #foreach $day
+ </tr>
+% } # foreach $week
+ </table>
+ <span class="calendar today">
+% my $datestr = sprintf('%04d-%02d-%02d', $today[5]+1900,$today[4]+1, $today[3]);
+ <a href="#" onclick="updateParentField('<% $field %>','<% $datestr %>'); return false;">Today</a>
+
+ </span>
+ <span class="calendar tomorrow">
+% my @tomorrow = localtime(time()+86400);
+% $datestr = sprintf('%04d-%02d-%02d', $tomorrow[5]+1900,$tomorrow[4]+1, $tomorrow[3]);
+ <a href="#" onclick="updateParentField('<% $field %>','<% $datestr %>'); return false;">Tomorrow</a>
+ </span>
+</div>
+</div>
+</body>
+</html>
+% $m->abort();
+<%init>
+my @today = localtime(time());
+
+my @weekdays;
+push @weekdays, $_
+ for qw(Sun Mon Tue Wed Thu Fri Sat);
+
+my @months;
+push @months, $_
+ for qw(January February March April May June July August
+ September October November December);
+
+unless ($DisplayedYear) {
+ $DisplayedMonth = $today[4] + 1;
+ $DisplayedYear = ($today[5] + 1900);
+}
+
+my ($prev_year, $next_year, $prev_month, $next_month);
+$prev_month = $next_month = $DisplayedMonth;
+$prev_year = $next_year = $DisplayedYear;
+
+$next_month++;
+$prev_month--;
+
+if ($DisplayedMonth == 12) {
+ $next_year++;
+ $next_month = 1;
+}
+elsif ($DisplayedMonth == 1) {
+ $prev_month = 12;
+ $prev_year--;
+}
+
+use Calendar::Simple;
+my @cal = Calendar::Simple::calendar($DisplayedMonth, $DisplayedYear);
+</%init>
+
+<%args>
+$field => 'none'
+$DisplayedMonth => undef
+$DisplayedYear => undef
+</%args>
More information about the Jifty-commit
mailing list