Debian Codegraph @

Embperl/Form/Control/inputlist.pm

raw
1
2 ###################################################################################
3 #
4 # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de
5 # Embperl - Copyright (c) 2008-2014 Gerald Richter
6 #
7 # You may distribute under the terms of either the GNU General Public
8 # License or the Artistic License, as specified in the Perl README file.
9 #
10 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
11 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12 # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 #
14 # $Id$
15 #
16 ###################################################################################
17
18 package Embperl::Form::Control::inputlist ;
19
20 use strict ;
21 use base 'Embperl::Form::Control' ;
22
23 use Embperl::Inline ;
24
25 use vars qw{%fdat} ;
26
27 1 ;
28
29 __EMBPERL__
30
31 [# ---------------------------------------------------------------------------
32 #
33 # show_control - output the control
34 #]
35
36 [$ sub show_control ($self)
37
38 my $class = $self -> {class} ;
39 my $opts = $self -> {options} ;
40 my $vals = $self -> {values} ;
41 my $sep = $self -> {separator} || $self -> {seperator};
42 my $sizes = $self -> {sizes} ;
43 $sizes ||= [];
44 $sep ||= ' ';
45 $opts ||= $vals;
46 my $i = 0;
47 $]
48 [$ while ($i < @$vals) $][-$size = $sizes->[$i] ; $size ||= $self->{size} -]
49 <input type="text" class="cBase cControl [+ $class +]" name="[+ $vals->[$i]+]" id="[+ $vals->[$i]+]"
50 [$if $size $]size="[+ $size +]" maxlength="[+$size+]" [$endif$]
51 [+ do { local $escmode = 0 ; $self -> {eventattrs} } +]>[+ ($i +1) < @$vals?$sep:'' +]
52 [- $i++ -]
53 [$endwhile$]
54 [$endsub$]
55
56 __END__
57
58 =pod
59
60 =head1 NAME
61
62 Embperl::Form::Control::inputjoin - A number of text input controls inside an Embperl Form
63
64
65 =head1 SYNOPSIS
66
67 {
68 type => 'inputlist',
69 text => 'blabla',
70 name => 'foo',
71 size => 10,
72 class => 'bar',
73 separator => '.',
74 sizes => [2,4,5],
75 }
76
77 =head1 DESCRIPTION
78
79 Used to create a number of input controls inside an Embperl Form.
80 See Embperl::Form on how to specify parameters.
81
82 =head2 PARAMETER
83
84 =head3 type
85
86 Needs to be 'inputlist'
87
88 =head3 name
89
90 Specifies the name of the control
91
92 =head3 text
93
94 Will be used as label for the text input control
95
96 =head3 size
97
98 Gives the default size in characters
99
100 =head3 sizes
101
102 Gives the size in characters for each input field, this parameter has to be given as an array reference
103
104 =head3 class
105
106 Alternative CSS class name
107
108 =head3 values
109
110 Gives the names for each input field, this parameter has to be given as an array reference
111
112 =head3 separator
113
114 String to display between the input boxes
115
116 =head1 Author
117
118 H. Jung ([email protected])
119
120 =head1 See Also
121
122 perl(1), Embperl, Embperl::Form
123
124