kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2010-06-10 12:45 pm

[dw-free] Context-sensitive view journal link post-update for backdated entries

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

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

Add a link, "View all entries from the same date" to the success page shown
after posting a backdated entry.

Patch by [personal profile] kareila.

Files modified:
  • htdocs/update.bml
  • htdocs/update.bml.text
--------------------------------------------------------------------------------
diff -r 7ecfb426864e -r 59641e57d208 htdocs/update.bml
--- a/htdocs/update.bml	Thu Jun 10 07:24:36 2010 -0500
+++ b/htdocs/update.bml	Thu Jun 10 07:45:01 2010 -0500
@@ -518,8 +518,18 @@ _c?>
                     my @after_entry_post_extra_options = LJ::Hooks::run_hooks('after_entry_post_extra_options', user => $ju, itemlink => $itemlink);
                     my $after_entry_post_extra_options = join('', map {$_->[0]} @after_entry_post_extra_options) || '';
 
+                    my $backdatedlink = '';
+                    if ( $POST{prop_opt_backdated} or $GET{prop_opt_backdated} ) {
+                        # we have to do some gymnastics to figure out the entry date
+                        my $e = LJ::Entry->new_from_url( $itemlink );
+                        my ( $y, $m, $d ) = ( $e->{eventtime} =~ /^(\d+)-(\d+)-(\d+)/ );
+                        my $url = $ju->journal_base . "/$y/$m/$d/";
+                        $backdatedlink = "<li><a href=\"$url\">"
+                                       . "$ML{'.success.links.backdated'}</a></li>";
+                    }
+
                     $$body .= " p?><?p $ML{'.success.links'} p?><ul>" . $writersblocklink .
-                        "<li><a href=\"$itemlink\">$ML{'.success.links.view'}</a></li>" .
+                        "<li><a href=\"$itemlink\">$ML{'.success.links.view'}</a></li>" . $backdatedlink .
                         "<li><a href=\"$edititemlink\">$ML{'.success.links.edit'}</a></li>" .
                         "<li><a href=\"/tools/memadd?journal=$juser&itemid=$itemid\">$ML{'.success.links.memories'}</a></li>" .
                         "<li><a href=\"/edittags?journal=$juser&itemid=$itemid\">$ML{'.success.links.tags'}</a></li>" .
diff -r 7ecfb426864e -r 59641e57d208 htdocs/update.bml.text
--- a/htdocs/update.bml.text	Thu Jun 10 07:24:36 2010 -0500
+++ b/htdocs/update.bml.text	Thu Jun 10 07:45:01 2010 -0500
@@ -109,6 +109,8 @@
 
 .success.links=Now that you've posted, you can:
 
+.success.links.backdated=View all entries from the same date
+
 .success.links.edit=Edit the entry
 
 .success.links.memories=Add the entry to your memories
--------------------------------------------------------------------------------