fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-01-06 09:53 am

[dw-free] Option to make archive and calendar week start on a Monday

[commit: http://hg.dwscoalition.org/dw-free/rev/9116da4d0096]

http://bugs.dwscoalition.org/show_bug.cgi?id=3859

Allow the calendar to start with "Monday".

Patch by [personal profile] fu.

Files modified:
  • bin/upgrading/s2layers/bases/layout.s2
  • bin/upgrading/s2layers/blanket/layout.s2
  • bin/upgrading/s2layers/brittle/layout.s2
  • bin/upgrading/s2layers/core2.s2
  • bin/upgrading/s2layers/core2base/layout.s2
  • bin/upgrading/s2layers/drifting/layout.s2
  • bin/upgrading/s2layers/easyread/layout.s2
  • bin/upgrading/s2layers/negatives/layout.s2
  • bin/upgrading/s2layers/skittlishdreams/layout.s2
  • cgi-bin/LJ/S2.pm
  • cgi-bin/LJ/S2/YearPage.pm
--------------------------------------------------------------------------------
diff -r d7b44a73ad87 -r 9116da4d0096 bin/upgrading/s2layers/bases/layout.s2
--- a/bin/upgrading/s2layers/bases/layout.s2	Fri Jan 06 17:51:43 2012 +0800
+++ b/bin/upgrading/s2layers/bases/layout.s2	Fri Jan 06 17:54:14 2012 +0800
@@ -25,6 +25,7 @@
     property use userlite_interaction_links;
     property use entry_management_links;
     property use comment_management_links;
+    property use reg_firstdayofweek;
     property use entry_datetime_format_group;
     property use comment_datetime_format_group;
 }
diff -r d7b44a73ad87 -r 9116da4d0096 bin/upgrading/s2layers/blanket/layout.s2
--- a/bin/upgrading/s2layers/blanket/layout.s2	Fri Jan 06 17:51:43 2012 +0800
+++ b/bin/upgrading/s2layers/blanket/layout.s2	Fri Jan 06 17:54:14 2012 +0800
@@ -25,6 +25,7 @@
     property use userlite_interaction_links;
     property use entry_management_links;
     property use comment_management_links;
+    property use reg_firstdayofweek;
     property use entry_datetime_format_group;
     property use comment_datetime_format_group;
 }
diff -r d7b44a73ad87 -r 9116da4d0096 bin/upgrading/s2layers/brittle/layout.s2
--- a/bin/upgrading/s2layers/brittle/layout.s2	Fri Jan 06 17:51:43 2012 +0800
+++ b/bin/upgrading/s2layers/brittle/layout.s2	Fri Jan 06 17:54:14 2012 +0800
@@ -29,6 +29,7 @@
     property use userlite_interaction_links;
     property use entry_management_links;
     property use comment_management_links;
+    property use reg_firstdayofweek;
     property use entry_datetime_format_group;
     property use comment_datetime_format_group;
 }
diff -r d7b44a73ad87 -r 9116da4d0096 bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2	Fri Jan 06 17:51:43 2012 +0800
+++ b/bin/upgrading/s2layers/core2.s2	Fri Jan 06 17:54:14 2012 +0800
@@ -1305,9 +1305,7 @@
 set time_ago_hours = "1 hour // # hours";
 set time_ago_days = "1 day // # days";
 
-# FIXME: this is not currently implemented, so not showing it in the UI yet
 property string reg_firstdayofweek {
-    noui = 1;
     des = "The day of the week the calendar weeks starts on.";
     doc = "The day of the week the calendar weeks starts on.  Either 'sunday' or 'monday'. Not currently implemented";
     doc_flags = "[construct]";
diff -r d7b44a73ad87 -r 9116da4d0096 bin/upgrading/s2layers/core2base/layout.s2
--- a/bin/upgrading/s2layers/core2base/layout.s2	Fri Jan 06 17:51:43 2012 +0800
+++ b/bin/upgrading/s2layers/core2base/layout.s2	Fri Jan 06 17:54:14 2012 +0800
@@ -24,6 +24,7 @@
     property use userlite_interaction_links;
     property use entry_management_links;
     property use comment_management_links;
+    property use reg_firstdayofweek;
     property use entry_datetime_format_group;
     property use comment_datetime_format_group;
 }
diff -r d7b44a73ad87 -r 9116da4d0096 bin/upgrading/s2layers/drifting/layout.s2
--- a/bin/upgrading/s2layers/drifting/layout.s2	Fri Jan 06 17:51:43 2012 +0800
+++ b/bin/upgrading/s2layers/drifting/layout.s2	Fri Jan 06 17:54:14 2012 +0800
@@ -37,6 +37,7 @@
     property use userlite_interaction_links;
     property use entry_management_links;
     property use comment_management_links;
+    property use reg_firstdayofweek;
     property use entry_datetime_format_group;
     property use comment_datetime_format_group;
 }
diff -r d7b44a73ad87 -r 9116da4d0096 bin/upgrading/s2layers/easyread/layout.s2
--- a/bin/upgrading/s2layers/easyread/layout.s2	Fri Jan 06 17:51:43 2012 +0800
+++ b/bin/upgrading/s2layers/easyread/layout.s2	Fri Jan 06 17:54:14 2012 +0800
@@ -27,6 +27,7 @@
     property use userlite_interaction_links;
     property use entry_management_links;
     property use comment_management_links;
+    property use reg_firstdayofweek;
     property use entry_datetime_format_group;
     property use comment_datetime_format_group;
 }
diff -r d7b44a73ad87 -r 9116da4d0096 bin/upgrading/s2layers/negatives/layout.s2
--- a/bin/upgrading/s2layers/negatives/layout.s2	Fri Jan 06 17:51:43 2012 +0800
+++ b/bin/upgrading/s2layers/negatives/layout.s2	Fri Jan 06 17:54:14 2012 +0800
@@ -27,6 +27,7 @@
     property use userlite_interaction_links;
     property use entry_management_links;
     property use comment_management_links;
+    property use reg_firstdayofweek;
     property use entry_datetime_format_group;
     property use comment_datetime_format_group;
 }
diff -r d7b44a73ad87 -r 9116da4d0096 bin/upgrading/s2layers/skittlishdreams/layout.s2
--- a/bin/upgrading/s2layers/skittlishdreams/layout.s2	Fri Jan 06 17:51:43 2012 +0800
+++ b/bin/upgrading/s2layers/skittlishdreams/layout.s2	Fri Jan 06 17:54:14 2012 +0800
@@ -41,6 +41,7 @@
     property use userlite_interaction_links;
     property use entry_management_links;
     property use comment_management_links;
+    property use reg_firstdayofweek;
     property use entry_datetime_format_group;
     property use comment_datetime_format_group;
     property bool use_action_links_images {
diff -r d7b44a73ad87 -r 9116da4d0096 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Fri Jan 06 17:51:43 2012 +0800
+++ b/cgi-bin/LJ/S2.pm	Fri Jan 06 17:54:14 2012 +0800
@@ -2908,7 +2908,7 @@
 sub weekdays
 {
     my ($ctx) = @_;
-    return [ 1..7 ];  # FIXME: make this conditionally monday first: [ 2..7, 1 ]
+    return S2::get_property_value($ctx, 'reg_firstdayofweek') eq "monday" ? [ 2..7, 1 ] : [ 1..7 ];
 }
 
 sub journal_current_datetime {
@@ -4265,7 +4265,7 @@
     return $this->{'_latest_month'} = LJ::S2::YearMonth($this, {
         'year' => $year,
         'month' => $month,
-    });
+    }, S2::get_property_value($ctx, 'reg_firstdayofweek') eq "monday" ? 1 : 0);
 }
 *RecentPage__get_latest_month = \&Page__get_latest_month;
 *DayPage__get_latest_month = \&Page__get_latest_month;
diff -r d7b44a73ad87 -r 9116da4d0096 cgi-bin/LJ/S2/YearPage.pm
--- a/cgi-bin/LJ/S2/YearPage.pm	Fri Jan 06 17:51:43 2012 +0800
+++ b/cgi-bin/LJ/S2/YearPage.pm	Fri Jan 06 17:54:14 2012 +0800
@@ -76,14 +76,14 @@
         push @{$p->{'months'}}, YearMonth($p, {
             'month' => $month,
             'year' => $year,
-        });
+        }, S2::get_property_value($opts->{ctx}, 'reg_firstdayofweek') eq "monday" ? 1 : 0);
     }
 
     return $p;
 }
 
 sub YearMonth {
-    my ($p, $calmon) = @_;
+    my ($p, $calmon, $start_monday) = @_;
 
     my ($month, $year) = ($calmon->{'month'}, $calmon->{'year'});
     $calmon->{'_type'} = 'YearMonth';
@@ -94,7 +94,6 @@
     my $has_entries = $count->{$year} && $count->{$year}->{$month} ? 1 : 0;
     $calmon->{'has_entries'} = $has_entries;
 
-    my $start_monday = 0;  # FIXME: check some property to see if weeks start on monday
     my $week = undef;
 
     my $flush_week = sub {
--------------------------------------------------------------------------------
av8rmike: 10 HOME; 20 SWEET; 30 GOTO 10 (home sweet goto)

[personal profile] av8rmike 2012-01-06 06:03 pm (UTC)(link)
HOLY CRAP. This had never been done before? Also, that looks easy. I may have to point the SUP people this way from the corresponding Jira ticket.
kareila: Rosie the Riveter "We Can Do It!" with a DW swirl (dw)

[personal profile] kareila 2012-01-06 06:03 pm (UTC)(link)
Well, LJ still has to worry about people using S1. DW has only ever supported S2.
av8rmike: (styles)

[personal profile] av8rmike 2012-01-06 06:12 pm (UTC)(link)
Actually, they have pretty much no interest in supporting S1. If they implemented this feature, there wouldn't be much compulsion to add it to S1, if that's what you're suggesting.
av8rmike: Futurama's Bender in Jeffries tube, text: I'm done reconfoobling the energymotron (energymotron)

[personal profile] av8rmike 2012-01-06 06:16 pm (UTC)(link)
Another Mart bug death?
ninetydegrees: Text: I came to dance (dance)

[personal profile] ninetydegrees 2012-01-06 07:50 pm (UTC)(link)
Hurrah!!!

Thank you, thank you, thank you!!!

*jumps up and down*
ninetydegrees: Art: self-portrait (Default)

[personal profile] ninetydegrees 2012-01-19 03:18 pm (UTC)(link)
des = "The day of the week the calendar weeks starts on.";

I believe there may be a typo: I think it should either be 'the calendar week starts on' or 'the calendar weeks start on'. Also, other descriptions don't have full stops unless there are more than one sentence.

But what about something shorter like "Day the calendar weeks start on"?