Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (45 sloc) 1.49 KB
# Copyright 2002-2007 Interchange Development Group and others
#
# 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. See the LICENSE file for details.
UserTag checked Order name value
UserTag checked addAttr
UserTag checked Implicit multiple multiple
UserTag checked Implicit default default
UserTag checked PosNumber 2
UserTag checked Version 1.9
UserTag checked Routine <<EOR
sub {
my ($field,$value,$opt) = @_;
$value = 'on' unless defined $value;
my $ref = $opt->{cgi} ? $CGI::values{$field} : $::Values->{$field};
return ' checked="checked"' if ! length($ref) and $opt->{default};
if(! $opt->{case}) {
$ref = lc($ref);
$value = lc($value);
}
return ' checked="checked"' if $ref eq $value;
if ($opt->{delimiter}) {
$opt->{multiple} = 1;
}
if ($opt->{multiple}) {
my $be;
my $ee;
$opt->{delimiter} = "\0" unless defined $opt->{delimiter};
if (length $opt->{delimiter}) {
my $del = Vend::Interpolate::get_joiner($opt->{delimiter}, "\0");
$be = '(?:^|' . $del . ')'; ;
$ee = '(?:$|' . $del . ')'; ;
}
else {
$be = '';
$ee = '';
}
my $regex = qr/$be\Q$value\E$ee/;
return ' checked="checked"' if $ref =~ $regex;
}
return '';
}
EOR
You can’t perform that action at this time.