afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-04-08 04:17 pm

[dw-free] Add "edit your answers" link to filled-out polls

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

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

Add "Change Your Vote" and "See Results" links to polls.

Patch by [staff profile] denise.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/LJ/Poll.pm
--------------------------------------------------------------------------------
diff -r 362861aaac65 -r 4583d743243b bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Wed Apr 08 15:33:12 2009 +0000
+++ b/bin/upgrading/en.dat	Wed Apr 08 16:16:29 2009 +0000
@@ -2259,6 +2259,8 @@ pingback.public.comment.text=Pingback fr
 
 pingback.sourceuri.default_title=No title
 
+poll.changevote=Change Your Vote
+
 poll.dberror=Database error: [[errmsg]]
 
 poll.dberror.items=Database error inserting items: [[errmsg]]
@@ -2346,6 +2348,8 @@ poll.security.trusted=Access List
 poll.security.trusted=Access List
 
 poll.security2=Open to: <b>[[whovote]]</b>, detailed results viewable to: <b>[[whoview]]</b>
+
+poll.seeresults=See Results
 
 poll.submit=Submit Poll
 
diff -r 362861aaac65 -r 4583d743243b cgi-bin/LJ/Poll.pm
--- a/cgi-bin/LJ/Poll.pm	Wed Apr 08 15:33:12 2009 +0000
+++ b/cgi-bin/LJ/Poll.pm	Wed Apr 08 16:16:29 2009 +0000
@@ -961,6 +961,14 @@ sub render {
     }
     $ret .= LJ::Lang::ml('poll.security2', { 'whovote' => LJ::Lang::ml('poll.security.'.$self->whovote),
                                        'whoview' => LJ::Lang::ml('poll.security.'.$whoview) });
+    $ret .= "<br />\n";
+
+
+    if ( $mode eq 'enter' ) {
+        $ret .= "[ <a href='$LJ::SITEROOT/poll/?id=$pollid&amp;mode=results'>" . BML::ml( 'poll.seeresults' ) . "</a> ]  " if $self->can_view( $remote );
+    } elsif ( $mode eq 'results' ) {
+        $ret .= "[ <a href='$LJ::SITEROOT/poll/?id=$pollid&amp;mode=enter'>" . BML::ml( 'poll.changevote' ) . "</a> ]" if $self->can_vote( $remote ) && !$self->is_closed;
+    }
 
     ## go through all questions, adding to buffer to return
     foreach my $q (@qs) {
--------------------------------------------------------------------------------