[freeside-commits] freeside/rt/share/html/Search Calendar.html, 1.1, 1.2
Ivan,,,
ivan at wavetail.420.am
Wed May 19 12:04:54 PDT 2010
Update of /home/cvs/cvsroot/freeside/rt/share/html/Search
In directory wavetail.420.am:/tmp/cvs-serv24842/share/html/Search
Modified Files:
Calendar.html
Log Message:
week view on calendars from Sunday -> Saturday
Index: Calendar.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/share/html/Search/Calendar.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- Calendar.html 19 May 2010 02:32:01 -0000 1.1
+++ Calendar.html 19 May 2010 19:04:52 -0000 1.2
@@ -46,7 +46,7 @@
<thead>
<tr>
<th></th>
-% for (1 .. 6, 0) {
+% for ( @{$week{$weekstart}} ) {
<th width="14%"><%$rtdate->GetWeekday($_)%></th>
% }
</tr>
@@ -54,7 +54,7 @@
<tbody>
<tr>
% while ($date <= $end) {
-% if ( $date->day_of_week == 1) {
+% if ( $date->day_of_week == $startday_of_week ) {
<th><% $date->week_number %></th>
% }
<td class="<% $date->month != ($Month + 1) ? 'oddline' : '' %>"
@@ -66,7 +66,7 @@
% }
</td>
% $date = $set->next($date);
-% if ( $date->day_of_week == 1) {
+% if ( $date->day_of_week == $startday_of_week ) {
</tr><tr>
% }
% }
@@ -125,7 +125,7 @@
</html>
<%INIT>
-use RTx::Calendar;
+use RTx::Calendar qw(FirstDay LastDay);
my $title = loc("Calendar");
@@ -133,9 +133,18 @@
my $rtdate = RT::Date->new($session{'CurrentUser'});
+my $weekstart = 'Sunday'; #RT::SiteConfig? user pref?
+my %week = (
+ 'Saturday' => [6,0..5],
+ 'Sunday' => [0..6],
+ 'Monday' => [1..6,0],
+);
+my $startday_of_week = ${$week{$weekstart}}[0] || 7;
+my $endday_of_week = ${$week{$weekstart}}[-1] || 7;
+
my $today = DateTime->today;
-my $date = RTx::Calendar::FirstMonday($Year, $Month + 1);
-my $end = RTx::Calendar::LastSunday($Year, $Month + 1);
+my $date = FirstDay($Year, $Month + 1, $startday_of_week );
+my $end = LastDay ($Year, $Month + 1, $endday_of_week );
# use this to loop over days until $end
my $set = DateTime::Set->from_recurrence(
More information about the freeside-commits
mailing list