Revert "Embed Safe 2.07 into Vend::Safe to avoid various problems with recent version...
[interchange.git] / code / UI_Tag / widget.coretag
1 # Copyright 2002-2007 Interchange Development Group and others
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.  See the LICENSE file for details.
7
8 # $Id: widget.coretag,v 1.6 2007-03-30 23:40:54 pajamian Exp $
9
10 UserTag widget Order       name
11 UserTag widget PosNumber   1
12 UserTag widget attrAlias   db table
13 UserTag widget attrAlias   column field
14 UserTag widget attrAlias   outboard key
15 UserTag widget addAttr
16 UserTag widget HasEndTag   1
17 UserTag widget Interpolate 1
18 UserTag widget Version     $Revision: 1.6 $
19 UserTag widget Routine     <<EOR
20 sub {
21         my($name, $opt, $string) = @_;
22         #my($name, $type, $value, $table, $column, $key, $data, $string) = @_;
23         my $value;
24         
25         if(defined $opt->{set}) {
26                 $value = $opt->{set};
27         }
28         else {
29                 $value = $::Values->{$name} || $opt->{default};
30         }
31         if($opt->{pre_filter}) {
32 #::logDebug("pre-filter with $opt->{pre_filter}");
33                 $value = $Tag->filter($opt->{pre_filter}, $value);
34         }
35         my $ref = {
36                                 attribute       => $opt->{attribute} || 'attribute',
37                                 db                      => $opt->{table},
38                                 field           => $opt->{field},
39                                 extra           => $opt->{extra} || $opt->{js},
40                                 cols            => $opt->{cols},
41                                 delimiter       => $opt->{delimiter},
42                                 rows            => $opt->{rows} || undef,
43                                 name            => $name,
44                                 outboard        => $opt->{key},
45                                 passed          => $opt->{data} || $opt->{passed} || $string,
46                                 type            => $opt->{type} || 'select',
47                                 value           => $value,
48                                 };
49
50         my $w = Vend::Form::display($ref);
51         if($opt->{filter}) {
52                 $w .= qq{<INPUT TYPE=hidden NAME="ui_filter:$name" VALUE="};
53                 $w .= $opt->{filter};
54                 $w .= '">';
55         }
56         return $w;
57 }
58 EOR