kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2011-10-18 03:20 pm

[dw-free] fix warnings in poll creation code

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

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

Remove trailing whitespace from poll/create.bml and LJ/Poll.pm

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/Poll.pm
  • htdocs/poll/create.bml
--------------------------------------------------------------------------------
diff -r b7cc5145da60 -r bcf5b08d50e7 cgi-bin/LJ/Poll.pm
--- a/cgi-bin/LJ/Poll.pm	Tue Oct 18 19:42:48 2011 +0800
+++ b/cgi-bin/LJ/Poll.pm	Tue Oct 18 10:21:14 2011 -0500
@@ -78,7 +78,7 @@
         $journalid = $opts{journalid} or croak "No journalid";
         $posterid  = $opts{posterid} or croak "No posterid";
     }
-    
+
     my $isanon = $opts{isanon} or croak "No isanon";
     my $whovote = $opts{whovote} or croak "No whovote";
     my $whoview = $opts{whoview} or croak "No whoview";
@@ -244,9 +244,9 @@
                     $popts{props}->{createdate} = $opts->{createdate} || undef;
                 }
                 LJ::Hooks::run_hook('get_more_options_from_poll', finalopts => \%popts, givenopts => $opts, journalu => $journal);
-                
+
                 $popts{'isanon'} = "no" unless ($popts{'isanon'} eq "yes");
-                
+
                 if ($popts{'whovote'} ne "all" &&
                     $popts{'whovote'} ne "trusted")
                 {
@@ -305,7 +305,7 @@
                 if ($qopts{'type'} eq "check") {
                     my $checkmin = 0;
                     my $checkmax = 255;
-                    
+
                     if (defined $opts->{'checkmin'}) {
                         $checkmin = int($opts->{'checkmin'});
                     }
@@ -320,7 +320,7 @@
                     }
 
                     $qopts{'opts'} = "$checkmin/$checkmax";
-                    
+
                 }
                 if ($qopts{'type'} eq "scale")
                 {
@@ -839,7 +839,7 @@
 # opts:
 #   mode => enter|results|ans
 #   qid  => show a specific question
-#   page => page 
+#   page => page
 sub render {
     my ($self, %opts) = @_;
 
@@ -935,7 +935,7 @@
     $ret .= "<span style='font-family: monospace; font-weight: bold; font-size: 1.2em;'>" .
             LJ::Lang::ml( 'poll.isclosed' ) . "</span><br />\n"
         if ($self->is_closed);
-    
+
     $ret .= LJ::Lang::ml( 'poll.isanonymous2' ) . "<br />\n"
         if ($self->isanon eq "yes");
 
@@ -949,9 +949,9 @@
     $ret .= LJ::Lang::ml('poll.participants', { 'total' => $self->num_participants });
     if ( $mode eq 'enter' && $self->can_view( $remote ) ) {
         $ret .= "<br />\n";
-        $ret .= "[ <a href='$LJ::SITEROOT/poll/?id=$pollid&amp;mode=results' class='LJ_PollDisplayLink' 
+        $ret .= "[ <a href='$LJ::SITEROOT/poll/?id=$pollid&amp;mode=results' class='LJ_PollDisplayLink'
             id='LJ_PollDisplayLink_${pollid}' lj_pollid='$pollid' >" . LJ::Lang::ml( 'poll.seeresults' ) . "</a> ]  ";
-        $ret .= "&nbsp&nbsp;[ <a href='$LJ::SITEROOT/poll/?id=$pollid&amp;mode=clear' 
+        $ret .= "&nbsp&nbsp;[ <a href='$LJ::SITEROOT/poll/?id=$pollid&amp;mode=clear'
             class='LJ_PollClearLink' id='LJ_PollClearLink_${pollid}' lj_pollid='$pollid'>  " . BML::ml('poll.clear') ."</a> ]";
     } elsif ( $mode eq 'results' ) {
         $ret .= "<br />\n";
@@ -968,13 +968,13 @@
         my $text = $q->text;
         LJ::Poll->clean_poll(\$text);
         $results_table .= "<p>$text</p>";
-        
+
         # shows how many options a user must/can choose if that restriction applies
         if ($q->type eq 'check' && $do_form) {
             my ($mincheck, $maxcheck) = split(m!/!, $q->opts);
             $mincheck ||= 0;
             $maxcheck ||= 255;
-            
+
             if ($mincheck > 0 && $mincheck eq $maxcheck ) {
                 $results_table .= "<i>". LJ::Lang::ml( "poll.checkexact", { options => $mincheck } ). "</i><br />\n";
             }
@@ -982,13 +982,13 @@
                 if ($mincheck > 0) {
                     $results_table .= "<i>". LJ::Lang::ml( "poll.checkmin", { options => $mincheck } ). "</i><br />\n";
                 }
-            
+
                 if ($maxcheck < 255) {
                     $results_table .= "<i>". LJ::Lang::ml( "poll.checkmax", { options => $maxcheck } ). "</i><br />\n";
                 }
             }
         }
-        
+
         $results_table .= "<div style='margin: 10px 0 10px 40px'>";
 
         ### get statistics, for scale questions
@@ -1080,7 +1080,7 @@
                 LJ::Poll->clean_poll(\$item);
                 push @optlist, ($itid, $item);
             }
-            $prevanswer = $clearanswers ? 0 : $preval{$qid}; 
+            $prevanswer = $clearanswers ? 0 : $preval{$qid};
             $results_table .= LJ::html_select({ 'name' => "pollq-$qid", 'class'=>"poll-$pollid",
                                       'selected' => $prevanswer }, @optlist);
         } elsif ($q->type eq "scale" && $do_form) {
@@ -1468,7 +1468,7 @@
                 my ($checkmin, $checkmax) = split(m!/!, $q->opts);
                 $checkmin ||= 0;
                 $checkmax ||= 255;
-            
+
                 if($num_opts < $checkmin) {
                     $$error = LJ::Lang::ml( 'poll.error.checkfewoptions2', {'question' => $qid, 'options' => $checkmin} );
                     $error_code = 2;
diff -r b7cc5145da60 -r bcf5b08d50e7 htdocs/poll/create.bml
--- a/htdocs/poll/create.bml	Tue Oct 18 19:42:48 2011 +0800
+++ b/htdocs/poll/create.bml	Tue Oct 18 10:21:14 2011 -0500
@@ -58,7 +58,7 @@
                   "maxitems" => 21,         # maximum number of items allowed in a scale
               },
               "checkbox" => {
-                  "checkmin" => 0,      # number of checkboxes a user must tick in that question (default 0: no limit)  
+                  "checkmin" => 0,      # number of checkboxes a user must tick in that question (default 0: no limit)
                   "checkmax" => 255,    # maximum number of checkboxes a user is allowed to tick in that question
               },
               );
@@ -255,7 +255,7 @@
 
                     next;
                 }
-                
+
                 if ($atr eq 'checkmin') {
                     $qrec->{'checkmin'} = int($POST{"pq_${q}_checkmin"}) || 0;
                     $qrec->{'checkmax'} = int($POST{"pq_${q}_checkmax"}) || 255;
@@ -290,13 +290,13 @@
             }
 
             # checks if minimum and maximum options for checkboxes are OK
-            
+
             if ($qrec->{'type'} == 'check') {
                 my $checkmin = $qrec->{'checkmin'};
                 if ($checkmin > $num_opts) {
                     $err->{$q}->{'checkmin'} = LJ::Lang::ml( ".error.checkmintoohigh2" );
                 }
-                
+
                 my $checkmax = $qrec->{'checkmax'};
                 if ($checkmax < $checkmin) {
                     $err->{$q}->{'checkmax'} = LJ::Lang::ml( ".error.checkmaxtoolow2" );
@@ -450,15 +450,15 @@
         $ret .= "<?h1 $ML{'.properties'} h1?>\n";
 
         $ret .= "<div style='margin-left: 40px; margin-bottom: 20px'>\n";
-        
+
         $ret .= "<p>" . LJ::html_check({
             name => 'isanon',
             id => 'isanon',
-            label => $ML{'.isanon'}, 
+            label => $ML{'.isanon'},
             value => "yes",
             selected => ( $poll->{isanon} eq "yes" )
         }) . "</p>\n";
-        
+
         $ret .= "<p>$ML{'.whoview2'}<br /><select name='whoview'>\n";
         foreach my $sec ( qw(all trusted none) ) {
             $ret .= "<option value='$sec'";
@@ -574,7 +574,7 @@
                 $ret .= $elem->{'opts'} < $RULES{'items'}->{'max'}
                     ? "<br />" . LJ::html_submit("request:$q:do", undef, { 'raw' => " value='More &gt;&gt;'" }) . "\n"
                     : "<br />" . LJ::Lang::ml ( ".options.limitreached2" ) . "\n";
-                
+
                 if ($elem->{'type'} eq 'check') {
                     $ret .= "<br/>";
                     my $minnumber .= LJ::html_text({ 'name' => "pq_${q}_checkmin",
@@ -588,7 +588,7 @@
                        $ret .= "<br /><font size='1'><b>$err->{$q}->{$atr}</b></font>\n"
                             if $err->{$q}->{$atr};
                     }
-                } 
+                }
 
             # text type
             } elsif ($elem->{'type'} eq 'text') {
--------------------------------------------------------------------------------