mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-06-07 02:46 am

[dw-free] Adding Calendar Function To Site Menu

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

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

Add link to the current month's archive page.

Patch by [personal profile] kareila.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/DW/Logic/MenuNav.pm
  • cgi-bin/LJ/User.pm
--------------------------------------------------------------------------------
diff -r 928985fb4aaa -r b956808a3d76 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Sun Jun 06 21:16:42 2010 -0500
+++ b/bin/upgrading/en.dat	Mon Jun 07 02:46:41 2010 +0000
@@ -2177,6 +2177,8 @@ menunav.organize.selectstyle=Select Styl
 
 menunav.read=Read
 
+menunav.read.archive=Archive
+
 menunav.read.inbox.nounread=Inbox
 
 menunav.read.inbox.unread2=Inbox [[num]]
diff -r 928985fb4aaa -r b956808a3d76 cgi-bin/DW/Logic/MenuNav.pm
--- a/cgi-bin/DW/Logic/MenuNav.pm	Sun Jun 06 21:16:42 2010 -0500
+++ b/cgi-bin/DW/Logic/MenuNav.pm	Mon Jun 07 02:46:41 2010 +0000
@@ -178,6 +178,11 @@ sub get_menu_navigation {
                     display => $loggedin_hasnetwork,
                 },
                 {
+                    url => $u ? $u->archive_current_month : "",
+                    text => "menunav.read.archive",
+                    display => $loggedin_hasjournal,
+                },
+                {
                     url => "$LJ::SITEROOT/tools/recent_comments",
                     text => "menunav.read.recentcomments",
                     display => $loggedin,
diff -r 928985fb4aaa -r b956808a3d76 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Sun Jun 06 21:16:42 2010 -0500
+++ b/cgi-bin/LJ/User.pm	Mon Jun 07 02:46:41 2010 +0000
@@ -1781,6 +1781,15 @@ sub allow_search_by {
 }
 
 
+# returns a link to the current year and month in the user's archive
+sub archive_current_month {
+    my ( $u ) = @_;
+    return '' if $u->is_identity;  # no archive to read
+    my $t = $u->time_now;
+    return sprintf( "%s/%02d/%02d/", $u->journal_base, $t->year, $t->mon );
+}
+
+
 sub caps {
     my $u = shift;
     return $u->{caps};
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org