Skip to content

Commit

Permalink
Item12952: re-instate the BOOLGROUP type, which I erroneously thought…
Browse files Browse the repository at this point in the history
… was unused

git-svn-id: http://svn.foswiki.org/trunk@17849 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Aug 1, 2014
1 parent 3a0bf34 commit bf40769
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions ConfigureContrib/lib/Foswiki/Configure/TypeUIs/BOOLGROUP.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# See bottom of file for license and copyright information
package Foswiki::Configure::TypeUIs::BOOLGROUP;

use strict;
use warnings;

use Foswiki::Configure::TypeUI ();
our @ISA = ('Foswiki::Configure::TypeUI');

sub prompt {
my ( $this, $model, $value, $class ) = @_;

my @selected;
if ( defined($value) ) {
foreach my $sel ( split( /,\s*/, $value ) ) {
push @selected, $sel;
}
}

return CGI::checkbox_group(
-name => $model->{keys},
-values => \@{$model->{select_from}},
-default => \@selected,
-label => '',
-onchange => 'valueChanged(this)',
-rows => 1,
-columns => scalar @{$model->{select_from}},
);
}

sub string2value {
my ( $this, @vals ) = @_;

return join( ',', @vals );
}

sub equals {
my ( $this, $val, $def ) = @_;

return ( $val eq $def );
}

1;

__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2012-2014 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read LICENSE in the root of this distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As per the GPL, removal of this notice is prohibited.

0 comments on commit bf40769

Please sign in to comment.