[interchange-cvs] interchange - jon modified lib/Vend/Form.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Fri Jul 18 17:06:00 EDT 2003
User: jon
Date: 2003-07-18 20:06:56 GMT
Modified: lib/Vend Form.pm
Log:
Add display type "labels" that is like "options" except it displays the
labels instead of their codes.
Revision Changes Path
2.37 +9 -3 interchange/lib/Vend/Form.pm
rev 2.37, prev_rev 2.36
Index: Form.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Form.pm,v
retrieving revision 2.36
retrieving revision 2.37
diff -u -u -r2.36 -r2.37
--- Form.pm 15 Jul 2003 02:06:05 -0000 2.36
+++ Form.pm 18 Jul 2003 20:06:55 -0000 2.37
@@ -1,6 +1,6 @@
# Vend::Form - Generate Form widgets
#
-# $Id: Form.pm,v 2.36 2003/07/15 02:06:05 jon Exp $
+# $Id: Form.pm,v 2.37 2003/07/18 20:06:55 jon Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -38,7 +38,7 @@
require Exporter;
@ISA = qw(Exporter);
-$VERSION = substr(q$Revision: 2.36 $, 10);
+$VERSION = substr(q$Revision: 2.37 $, 10);
@EXPORT = qw (
display
@@ -235,15 +235,20 @@
sub show_options {
my $opt = shift;
my $ary = shift;
+ my $idx = shift || 0;
return undef if ! $ary;
my @out;
eval {
- @out = map {$_->[0]} @$ary;
+ @out = map {$_->[$idx]} @$ary;
};
my $delim = Vend::Interpolate::get_joiner($opt->{delimiter}, ',');
return join $delim, @out;
}
+sub show_labels {
+ return show_options($_[0], $_[1], 1);
+}
+
sub template_sub {
my $opt = shift;
return attr_list($Template{$opt->{type}} || $Template{default}, $opt);
@@ -1196,6 +1201,7 @@
noyes => \&noyes,
option_format => \&option_widget,
options => \&show_options,
+ labels => \&show_labels,
radio => \&box,
select => \&dropdown,
show => \&show_data,
More information about the interchange-cvs
mailing list