Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r19241: LJSUP-8957: Add months and years calenda...

Committer: gariev
LJSUP-8957: Add months and years calendars to all s2 style pages
U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2011-06-06 10:45:37 UTC (rev 19240)
+++ trunk/cgi-bin/LJ/User.pm	2011-06-07 03:08:53 UTC (rev 19241)
@@ -7715,7 +7715,8 @@
 
 ## input: $u, $remote, $year, $month
 ## output: hashref with data for rendering calendar for given month,
-##      days:       hashref { day: count of entries for this day }
+##      days:       arrayref [ count of entries for each day]
+##                  days[1] = count of entries for the 1st day, days[0] is always null
 ##      prev_month: arrayref [year, month] - previous month that has entries
 ##      next_month, prev_year, next_year - arrayref of the same format
 ##
@@ -7734,7 +7735,7 @@
     foreach my $d (@$days) {
         ## @$d = ($y, $m, $d, $count)
         if ($d->[0]==$year && $d->[1]==$month) {
-            $ret{days}->{ $d->[2] } = $d->[3];
+            $ret{days}->[ $d->[2] ] = $d->[3]+0;
         }
     }
     ## $prev_month  = max(  grep { $day < Date($year, $month) }  @$days  );
@@ -7746,7 +7747,12 @@
     $ret{'next_month'}  = List::Util::reduce { $less->($a, $b) ? $b : $a }  grep { $less->($current_month, $_) }        @$days;
     $ret{'prev_year'}   = List::Util::reduce { $less->($a, $b) ? $a : $b }  grep { $less_year->($_, $current_month) }   @$days;
     $ret{'next_year'}   = List::Util::reduce { $less->($a, $b) ? $b : $a }  grep { $less_year->($current_month, $_) }   @$days;
-    
+    foreach my $k (qw/prev_month next_month prev_year next_year/) {
+        if ($ret{$k}) {
+            $ret{$k} = [ $ret{$k}->[0]+0, $ret{$k}->[1]+0];
+        }
+    }
+ 
     return \%ret;
 }
 

Tags: gariev, livejournal, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments