1 # Copyright (C) 2006 Alex Schroeder <alex@emacswiki.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the
15 # Free Software Foundation, Inc.
16 # 59 Temple Place, Suite 330
17 # Boston, MA 02111-1307 USA
19 $ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/checkbox.pl">checkbox.pl</a>, see <a href="http://www.oddmuse.org/cgi-bin/oddmuse/Checklist_Extension">Checklist Extension</a></p>';
25 push(@MyRules, \
&CheckBoxRule
);
28 if ($bol and /\G\[\[( |x):([^]]+)\]\]/cgi) {
30 if (not InElement
('form')) {
31 # We want to use GetFormStart so we have to trade-off using
33 $html = CloseHtmlEnvironments
()
34 . GetFormStart
(undef, 'get', 'checkboxes');
35 unshift(@HtmlStack, 'form');
36 $html .= AddHtmlEnvironment
('p');
38 $html .= $q->checkbox(-name
=> FreeToNormal
($2),
39 -checked
=> ($1 eq ' '?
0 : 1),
43 } elsif (/\G\[\[save:([^]]+)\]\]/cgi) {
44 if (InElement
('form')) {
45 return ($q->input({-type
=> 'hidden',
47 -value
=> 'checkbox'})
48 . $q->input({-type
=> 'hidden',
50 -value
=> $OpenPageName})
51 . $q->submit(-name
=> $1));
59 $Action{checkbox
} = \
&DoCheckBox
;
64 my $text = $Page{text
};
66 $text =~ s
{(\A
|\n)\
[\
[( |x
):([^]]+)\
]\
]}{
67 # no search and replace in this loop
68 if (GetParam
(FreeToNormal
($3))) {
69 $summary{$3} = 1 if $2 eq ' ';
72 $summary{$3} = 0 if $2 eq 'x' or $2 eq 'X';
76 SetParam
('text', $text);
77 SetParam
('summary', join(', ', map {