bugfixes
parent
b1a0a59212
commit
fc11e4ad81
|
@ -94,6 +94,7 @@ sub cgi ($) { #{{{
|
||||||
if (defined $oldchoice && $oldchoice eq $choice) {
|
if (defined $oldchoice && $oldchoice eq $choice) {
|
||||||
# Same vote; no-op.
|
# Same vote; no-op.
|
||||||
IkiWiki::redirect($cgi, "$config{url}/".htmlpage($page));
|
IkiWiki::redirect($cgi, "$config{url}/".htmlpage($page));
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $content=readfile(srcfile($pagesources{$page}));
|
my $content=readfile(srcfile($pagesources{$page}));
|
||||||
|
@ -104,28 +105,13 @@ sub cgi ($) { #{{{
|
||||||
my $escape=shift;
|
my $escape=shift;
|
||||||
my $params=shift;
|
my $params=shift;
|
||||||
return "\\[[poll $params]]" if $escape;
|
return "\\[[poll $params]]" if $escape;
|
||||||
return $params unless --$num == 0;
|
if (--$num == 0) {
|
||||||
my @bits=split(' ', $params);
|
$params=~s/(^|\s+)(\d+)\s+"?\Q$choice\E"?(\s+|$)/$1.($2+1)." \"$choice\"".$3/se;
|
||||||
my @ret;
|
if (defined $oldchoice) {
|
||||||
while (@bits) {
|
$params=~s/(^|\s+)(\d+)\s+"?\Q$oldchoice\E"?(\s+|$)/$1.($2-1)." \"$oldchoice\"".$3/se;
|
||||||
my $n=shift @bits;
|
|
||||||
if ($n=~/=/) {
|
|
||||||
# val=param setting
|
|
||||||
push @ret, $n;
|
|
||||||
next;
|
|
||||||
}
|
}
|
||||||
my $c=shift @bits;
|
|
||||||
$c=~s/^"(.*)"/$1/g;
|
|
||||||
next unless defined $n && defined $c;
|
|
||||||
if ($c eq $choice) {
|
|
||||||
$n++;
|
|
||||||
}
|
}
|
||||||
if (defined $oldchoice && $c eq $oldchoice) {
|
return "[[poll $params]]";
|
||||||
$n--;
|
|
||||||
}
|
|
||||||
push @ret, $n, "\"$c\"";
|
|
||||||
}
|
|
||||||
return "[[poll ".join(" ", @ret)."]]";
|
|
||||||
};
|
};
|
||||||
$content =~ s{(\\?)\[\[poll\s+([^]]+)\s*\]\]}{$edit->($1, $2)}seg;
|
$content =~ s{(\\?)\[\[poll\s+([^]]+)\s*\]\]}{$edit->($1, $2)}seg;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@ log back in, try out the OpenID signup process if you don't already have an
|
||||||
OpenID, and see how OpenID works for you. And let me know your feelings about
|
OpenID, and see how OpenID works for you. And let me know your feelings about
|
||||||
making such a switch.
|
making such a switch.
|
||||||
|
|
||||||
[[poll 0 ""Accept" only "OpenID" for "logins"" 0 ""Accept" only "password" logins" "0" "Accept "both""]]
|
[[poll 0 "Accept only OpenID for logins" 0 "Accept only password logins" 0 "Accept both"]]
|
||||||
|
|
||||||
--[[Joey]]
|
--[[Joey]]
|
||||||
|
|
Loading…
Reference in New Issue