~kosova/+junk/tuxfamily-twiki

« back to all changes in this revision

Viewing changes to foswiki/lib/Foswiki/Configure/Types/BOOLEAN.pm

  • Committer: James Michael DuPont
  • Date: 2009-07-18 19:58:49 UTC
  • Revision ID: jamesmikedupont@gmail.com-20090718195849-vgbmaht2ys791uo2
added foswiki

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# See bottom of file for license and copyright information
 
2
 
 
3
package Foswiki::Configure::Types::BOOLEAN;
 
4
 
 
5
use strict;
 
6
 
 
7
use Foswiki::Configure::Type;
 
8
 
 
9
use base 'Foswiki::Configure::Type';
 
10
 
 
11
sub prompt {
 
12
    my ( $this, $id, $opts, $value ) = @_;
 
13
    return CGI::checkbox(
 
14
        -name    => $id,
 
15
        -checked => ( $value ? 1 : 0 ),
 
16
        -value   => 1,
 
17
        -label   => ''
 
18
    );
 
19
}
 
20
 
 
21
sub string2value {
 
22
    my ( $this, $val ) = @_;
 
23
    return ( $val ? 1 : 0 );
 
24
}
 
25
 
 
26
sub equals {
 
27
    my ( $this, $val, $def ) = @_;
 
28
 
 
29
    return ( ( $val && $def ) || ( !$val && !$def ) );
 
30
}
 
31
 
 
32
1;
 
33
__DATA__
 
34
#
 
35
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
 
36
#
 
37
# Copyright (C) 2008 Foswiki Contributors. All Rights Reserved.
 
38
# Foswiki Contributors are listed in the AUTHORS file in the root
 
39
# of this distribution. NOTE: Please extend that file, not this notice.
 
40
#
 
41
# Additional copyrights apply to some or all of the code in this
 
42
# file as follows:
 
43
#
 
44
# Copyright (C) 2000-2006 TWiki Contributors. All Rights Reserved.
 
45
# TWiki Contributors are listed in the AUTHORS file in the root
 
46
# of this distribution. NOTE: Please extend that file, not this notice.
 
47
#
 
48
# This program is free software; you can redistribute it and/or
 
49
# modify it under the terms of the GNU General Public License
 
50
# as published by the Free Software Foundation; either version 2
 
51
# of the License, or (at your option) any later version. For
 
52
# more details read LICENSE in the root of this distribution.
 
53
#
 
54
# This program is distributed in the hope that it will be useful,
 
55
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
56
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
57
#
 
58
# As per the GPL, removal of this notice is prohibited.