fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-04-19 02:27 pm

[dw-free] Poll answer redirection in the same style

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

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

Redirect the poll results to the appropriate style=... if applicable.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/Entry.pm
  • cgi-bin/LJ/Poll.pm
  • htdocs/poll/index.bml
--------------------------------------------------------------------------------
diff -r 5fc0877f7daa -r 73973c3e26ea cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm	Tue Apr 19 21:56:07 2011 +0800
+++ b/cgi-bin/LJ/Entry.pm	Tue Apr 19 22:27:40 2011 +0800
@@ -225,7 +225,11 @@ sub reply_url {
 # returns permalink url
 sub url {
     my ( $self, %opts ) = @_;
+    my %style_args = %{ delete $opts{style_args} || {} };
+
     my %args = %opts; # used later
+    @args{keys %style_args} = values %style_args;
+
     my $u = $self->{u};
     my $view = delete $opts{view};
     my $anchor = delete $opts{anchor};
diff -r 5fc0877f7daa -r 73973c3e26ea cgi-bin/LJ/Poll.pm
--- a/cgi-bin/LJ/Poll.pm	Tue Apr 19 21:56:07 2011 +0800
+++ b/cgi-bin/LJ/Poll.pm	Tue Apr 19 22:27:40 2011 +0800
@@ -893,7 +893,8 @@ sub render {
             $preval{$qid} = $value;
         }
 
-        $ret .= "<div id='poll-$pollid-container'><form class='LJ_PollForm' action='$LJ::SITEROOT/poll/?id=$pollid' method='post'>";
+        my $url = LJ::create_url( "/poll/", host => $LJ::DOMAIN_WEB, viewing_style => 1, args => { id => $pollid } );
+        $ret .= "<div id='poll-$pollid-container'><form class='LJ_PollForm' action='$url' method='post'>";
         $ret .= LJ::form_auth();
         $ret .= LJ::html_hidden('pollid', $pollid);
         $ret .= LJ::html_hidden('id', $pollid);    #for the ajax request
diff -r 5fc0877f7daa -r 73973c3e26ea htdocs/poll/index.bml
--- a/htdocs/poll/index.bml	Tue Apr 19 21:56:07 2011 +0800
+++ b/htdocs/poll/index.bml	Tue Apr 19 22:27:40 2011 +0800
@@ -15,7 +15,7 @@ _c?>
 <?_code
 {
     use strict;
-    use vars qw(%FORM $title $body);
+    use vars qw(%FORM $title $body %GET);
     use LJ::Poll;
 
     $title = $ML{'.title'};
@@ -122,7 +122,7 @@ _c?>
             $body .= $error;
             return;
         }
-        return BML::redirect($entry->url);
+        return BML::redirect( $entry->url( style_args => LJ::viewing_style_opts( %GET ) ) );
     }
 
     $body .= $poll->render(mode => $mode, qid => $FORM{qid},
--------------------------------------------------------------------------------

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