option_format —
Interchange 5.9.0:
Source: code/Widget/option_format.widget
Lines: 12
# Copyright 2005-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. # # $Id: option_format.widget,v 1.3 2007-03-30 23:40:58 pajamian Exp $ CodeDef option_format Widget 1 CodeDef option_format Description Option formatter CodeDef option_format MapRoutine Vend::Form::option_widget
Source: lib/Vend/Form.pm
Lines: 680
sub option_widget {
my($opt) = @_;
my($name, $val) = ($opt->{name}, $opt->{value});
my $width = $opt->{width} || 16;
$opt->{filter} = 'option_format'
unless length($opt->{filter});
$val = Vend::Interpolate::filter_value($opt->{filter}, $val);
my @opts = split /\s*,\s*/, $val;
my $out = qq{<table cellpadding="0" cellspacing="0"><tr><th><small>};
$out .= errmsg('Value');
$out .= qq{</small></th><th align="left" colspan="2"><small>};
$out .= errmsg('Label');
$out .= qq{</small></th></tr>};
my $done;
my $height = $opt->{height} || 5;
$height -= 2;
for(@opts) {
my ($v,$l) = split /\s*=\s*/, $_, 2;
next unless $l || length($v);
$done++;
my $default;
($l =~ s/\*$// or ! $l && $v =~ s/\*$//)
and $default = 1;
$out .= option_widget_box($name, $v, $l, $default, $width);
}
while($done++ < $height) {
$out .= option_widget_box($name, '', '', '', $width);
}
$out .= option_widget_box($name, '', '', '', $width);
$out .= option_widget_box($name, '', '', '', $width);
$out .= "</table>";
}