[interchange-cvs] interchange - heins modified lib/Vend/Form.pm
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Thu Apr 10 13:39:00 2003
User: heins
Date: 2003-04-10 17:38:14 GMT
Modified: lib/Vend Form.pm
Log:
* Allow merge of passed and looked-up options when lookup_merge
parameter is set. This allows a lookup for values in the
table *plus* an options line, without duplicated entries.
First use is to display widget types in Options -- allows setting
of entries like "radio_left_5" without losing them at edit, while
still providing canned options.
Revision Changes Path
2.30 +17 -3 interchange/lib/Vend/Form.pm
rev 2.30, prev_rev 2.29
Index: Form.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Form.pm,v
retrieving revision 2.29
retrieving revision 2.30
diff -u -r2.29 -r2.30
--- Form.pm 30 Mar 2003 22:05:20 -0000 2.29
+++ Form.pm 10 Apr 2003 17:38:14 -0000 2.30
@@ -1,6 +1,6 @@
# Vend::Form - Generate Form widgets
#
-# $Id: Form.pm,v 2.29 2003/03/30 22:05:20 mheins Exp $
+# $Id: Form.pm,v 2.30 2003/04/10 17:38:14 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -37,7 +37,7 @@
require Exporter;
@ISA = qw(Exporter);
-$VERSION = substr(q$Revision: 2.29 $, 10);
+$VERSION = substr(q$Revision: 2.30 $, 10);
@EXPORT = qw (
display
@@ -1107,7 +1107,21 @@
} @$data;
}
}
- unshift @$data, @$ary if $ary;
+
+ unless($opt->{lookup_merge}) {
+ unshift @$data, @$ary if $ary;
+ }
+ elsif($ary) {
+ my %existing;
+ for(@$ary) {
+ $existing{$_->[0]}++;
+ }
+ for(@$data) {
+ next if $existing{$_->[0]};
+ push @$ary, $_;
+ }
+ $data = $ary;
+ }
}
## Some legacy stuff, has to do with default behavior when called from