[dw-free] Backed out changeset fce23e6b8dfe
[commit: http://hg.dwscoalition.org/dw-free/rev/c44f65ea9357]
Backed out changeset fce23e6b8dfe
Files modified:
Backed out changeset fce23e6b8dfe
Files modified:
- bin/upgrading/update-db-general.pl
- cgi-bin/LJ/Poll.pm
- cgi-bin/LJ/Poll/Question.pm
- htdocs/poll/create.bml
- htdocs/poll/create.bml.text
--------------------------------------------------------------------------------
diff -r fce23e6b8dfe -r c44f65ea9357 bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl Wed Dec 07 22:41:45 2011 +0800
+++ b/bin/upgrading/update-db-general.pl Wed Dec 07 22:43:21 2011 +0800
@@ -2441,7 +2441,7 @@
pollqid TINYINT UNSIGNED NOT NULL,
sortorder TINYINT UNSIGNED NOT NULL DEFAULT '0',
type ENUM('check','radio','drop','text','scale') NOT NULL,
- opts VARCHAR(255) DEFAULT NULL,
+ opts VARCHAR(20) DEFAULT NULL,
qtext TEXT,
PRIMARY KEY (journalid,pollid,pollqid)
@@ -4026,12 +4026,6 @@
"MODIFY COLUMN value VARCHAR(1024) DEFAULT NULL");
}
- # changes opts size of pollquestion2 to 255 in order to accommodate labels
- if ( column_type( 'pollquestion2', 'opts' ) eq "varchar(20)" ) {
- do_alter( 'pollquestion2',
- "ALTER TABLE pollquestion2 MODIFY COLUMN opts VARCHAR(255) DEFAULT NULL");
- }
-
});
diff -r fce23e6b8dfe -r c44f65ea9357 cgi-bin/LJ/Poll.pm
--- a/cgi-bin/LJ/Poll.pm Wed Dec 07 22:41:45 2011 +0800
+++ b/cgi-bin/LJ/Poll.pm Wed Dec 07 22:43:21 2011 +0800
@@ -327,8 +327,6 @@
my $from = 1;
my $to = 10;
my $by = 1;
- my $lowlabel = "";
- my $highlabel = "";
if (defined $opts->{'from'}) {
$from = int($opts->{'from'});
@@ -339,12 +337,6 @@
if (defined $opts->{'by'}) {
$by = int($opts->{'by'});
}
- if ( defined $opts->{'lowlabel'} ) {
- $lowlabel = LJ::strip_html( $opts->{'lowlabel'} );
- }
- if ( defined $opts->{'highlabel'} ) {
- $highlabel = LJ::strip_html( $opts->{'highlabel'} );
- }
if ($by < 1) {
return $err->('poll.error.scaleincrement');
}
@@ -355,7 +347,7 @@
if ( $scaleoptions > 21 ) {
return $err->( 'poll.error.scaletoobig1', { 'maxselections' => 21, 'selections' => $scaleoptions - 21 } );
}
- $qopts{'opts'} = "$from/$to/$by/$lowlabel/$highlabel";
+ $qopts{'opts'} = "$from/$to/$by";
}
$qopts{'type'} = lc($opts->{'type'}) || "text";
@@ -1115,7 +1107,7 @@
'selected' => $prevanswer }, @optlist);
} elsif ($q->type eq "scale" && $do_form) {
#### scales (from 1-10) questions
- my ( $from, $to, $by, $lowlabel, $highlabel ) = split( m!/!, $q->opts );
+ my ($from, $to, $by) = split(m!/!, $q->opts);
$by ||= 1;
my $count = int(($to-$from)/$by) + 1;
my $do_radios = ($count <= 11);
@@ -1125,9 +1117,6 @@
$results_table .= "<table summary=''><tr valign='top' align='center'>";
- # appends the lower end
- $results_table .= "<td style='padding-right: 5px;'><b>$lowlabel</b></td>" if defined $lowlabel;
-
for (my $at=$from; $at<=$to; $at+=$by) {
my $selectedanswer = !$clearanswers && ( defined $preval{$qid} && $at == $preval{$qid});
@@ -1138,9 +1127,6 @@
$results_table .= "<br /><label for='pollq-$pollid-$qid-$at'>$at</label></td>";
}
- # appends the higher end
- $results_table .= "<td style='padding-left: 5px;'><b>$highlabel</b></td>" if defined $highlabel;
-
$results_table .= "</tr></table>\n";
# many opts, display select
@@ -1149,15 +1135,9 @@
$prevanswer = $clearanswers ? "" : $preval{$qid};
my @optlist = ('', '');
- push @optlist, ( $from, $from . " " . $lowlabel );
-
- my $at = 0;
- for ( $at=$from+$by; $at<=$to-$by; $at+=$by ) {
+ for (my $at=$from; $at<=$to; $at+=$by) {
push @optlist, ($at, $at);
}
-
- push @optlist, ( $at, $at . " " . $highlabel );
-
$results_table .= LJ::html_select({ 'name' => "pollq-$qid", 'class'=>"poll-$pollid", 'selected' => $prevanswer }, @optlist);
}
@@ -1179,14 +1159,11 @@
# generate poll items dynamically if this is a scale
if ($q->type eq 'scale') {
- my ( $from, $to, $by, $lowlabel, $highlabel ) = split( m!/!, $q->opts );
+ my ($from, $to, $by) = split(m!/!, $q->opts);
$by = 1 unless ($by > 0 and int($by) == $by);
-
- push @items, [ $from, "$lowlabel $from" ];
- for (my $at=$from+$by; $at<=$to-$by; $at+=$by) {
- push @items, [$at, $at]; # note: fake itemid, doesn't matter, but needed to be unique
+ for (my $at=$from; $at<=$to; $at+=$by) {
+ push @items, [$at, $at]; # note: fake itemid, doesn't matter, but needed to be uniqeu
}
- push @items, [ $to, "$highlabel $to" ];
}
foreach my $item (@items) {
@@ -1571,7 +1548,7 @@
}
}
if ($q->type eq "scale") {
- my ( $from, $to, $by, $lowlabel, $highlabel ) = split( m!/!, $q->opts );
+ my ($from, $to, $by) = split(m!/!, $q->opts);
if ($val < $from || $val > $to) {
# bogus! cheating?
$val = "";
diff -r fce23e6b8dfe -r c44f65ea9357 cgi-bin/LJ/Poll/Question.pm
--- a/cgi-bin/LJ/Poll/Question.pm Wed Dec 07 22:41:45 2011 +0800
+++ b/cgi-bin/LJ/Poll/Question.pm Wed Dec 07 22:43:21 2011 +0800
@@ -105,7 +105,7 @@
# scale questions
} elsif ($type eq 'scale') {
- my ( $from, $to, $by, $lowlabel, $highlabel ) = split( m!/!, $opts );
+ my ($from, $to, $by) = split(m!/!, $opts);
$by ||= 1;
my $count = int(($to-$from)/$by) + 1;
my $do_radios = ($count <= 11);
@@ -113,25 +113,17 @@
# few opts, display radios
if ($do_radios) {
$ret .= "<table summary=''><tr valign='top' align='center'>\n";
- $ret .= "<td style='padding-right: 5px;'><b>$lowlabel</b></td>";
for (my $at = $from; $at <= $to; $at += $by) {
$ret .= "<td>" . LJ::html_check({ 'type' => 'radio' }) . "<br />$at</td>\n";
}
- $ret .= "<td style='padding-left: 5px;'><b>$highlabel</b></td>";
$ret .= "</tr></table>\n";
# many opts, display select
} else {
- my @optlist = ( '', ' ' );
- push @optlist, ( $from, $from . " " . $lowlabel );
-
- my $at = 0;
- for ( $at=$from+$by; $at<=$to-$by; $at+=$by ) {
+ my @optlist = ();
+ for (my $at = $from; $at <= $to; $at += $by) {
push @optlist, ('', $at);
}
-
- push @optlist, ( $at, $at . " " . $highlabel );
-
$ret .= LJ::html_select({}, @optlist);
}
diff -r fce23e6b8dfe -r c44f65ea9357 htdocs/poll/create.bml
--- a/htdocs/poll/create.bml Wed Dec 07 22:41:45 2011 +0800
+++ b/htdocs/poll/create.bml Wed Dec 07 22:43:21 2011 +0800
@@ -184,7 +184,7 @@
my $qrec = {};
# validate question attributes
- foreach my $atr (qw(type question opts size maxlength from to by checkmin checkmax lowlabel highlabel)) {
+ foreach my $atr (qw(type question opts size maxlength from to by checkmin checkmax)) {
my $val = $POST{"pq_${q}_$atr"};
next unless defined $val;
@@ -603,21 +603,12 @@
# scale type
} elsif ($elem->{'type'} eq 'scale') {
- $ret .= "<br/>\n";
foreach my $atr ( qw(from to by) ) {
$ret .= ' ' . ucfirst($atr) . ": ";
$ret .= LJ::html_text({ 'name' => "pq_${q}_$atr",
'value' => defined $elem->{$atr} ? $elem->{$atr} : $RULES{'scale'}->{$atr},
'size' => '3', 'maxlength' => '9' }) . "\n";
}
- $ret .= "<br />";
- foreach my $atr ( qw(lowlabel highlabel) ) {
- $ret .= $ML{'.scale.' . $atr};
- $ret .= LJ::html_text({ 'name' => "pq_${q}_$atr",
- 'value' => defined $elem->{$atr} ? $elem->{$atr} : "",
- 'size' => '20', 'maxlength' => '50' }) . " \n";
- }
-
foreach my $atr ( qw(from to by items) ) {
$ret .= "<br /><font size='1'><b>[$err->{$q}->{$atr}]</b></font>\n"
if $err->{$q}->{$atr};
@@ -671,7 +662,7 @@
$ret .= " $el='" . LJ::ehtml($elem->{$el}) . "'";
}
} elsif ($elem->{'type'} eq 'scale') {
- foreach my $el ( qw(from to by lowlabel highlabel) ) {
+ foreach my $el ( qw(from to by) ) {
$ret .= " $el='" . LJ::ehtml($elem->{$el}) . "'";
}
} elsif ($elem->{'type'} eq 'check') {
diff -r fce23e6b8dfe -r c44f65ea9357 htdocs/poll/create.bml.text
--- a/htdocs/poll/create.bml.text Wed Dec 07 22:41:45 2011 +0800
+++ b/htdocs/poll/create.bml.text Wed Dec 07 22:43:21 2011 +0800
@@ -63,10 +63,6 @@
.questions=Poll Questions
-.scale.lowlabel=Low label:
-
-.scale.highlabel=High label:
-
.seecode.desc=This is the code for your poll. Use the buttons below to go back and make changes, or to post it to your journal.
.title=Poll Creator
--------------------------------------------------------------------------------
