the table we are creating a form to update
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
I the primary key of this table. Caveat Programmor: There is |
|
89
|
|
|
|
|
|
|
no checking done to enforce that the column provided as I is |
|
90
|
|
|
|
|
|
|
a primary key. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Optional parameters: |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
I the URL to a custom stylesheet file. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
I the path to a custom template file. To get a |
|
97
|
|
|
|
|
|
|
template file to start with, you can do this: |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
perl -MHTML::DBForm -e 'print HTML::DBForm::TEMPLATE()' > sample.tmpl |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
I a boolean parameter that determines whether |
|
102
|
|
|
|
|
|
|
or not the module displays verbose error messages to the |
|
103
|
|
|
|
|
|
|
browser, this is set to 0 by default for security reasons. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
I a callback that is triggered any time an |
|
106
|
|
|
|
|
|
|
exception occurs. The callback is passed a list of errors, |
|
107
|
|
|
|
|
|
|
and the results of the callback are presented as an error |
|
108
|
|
|
|
|
|
|
message to the user. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
B |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my $editor = HTML::DBForm->new( |
|
115
|
|
|
|
|
|
|
table => 'table_to_update', |
|
116
|
|
|
|
|
|
|
primary_key => 'id', |
|
117
|
|
|
|
|
|
|
); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
my $editor = HTML::DBForm->new( |
|
121
|
|
|
|
|
|
|
table => 'table_to_update', |
|
122
|
|
|
|
|
|
|
primary_key => 'id', |
|
123
|
|
|
|
|
|
|
stylesheet => '/styles/custom.css', |
|
124
|
|
|
|
|
|
|
verbose_errors => 1, |
|
125
|
|
|
|
|
|
|
error_handler => sub { notify_admin(localtime); return @_ }, |
|
126
|
|
|
|
|
|
|
); |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub new { |
|
132
|
|
|
|
|
|
|
|
|
133
|
1
|
|
|
1
|
1
|
14
|
my $type = shift; |
|
134
|
1
|
|
|
|
|
3
|
my $self = {}; |
|
135
|
|
|
|
|
|
|
|
|
136
|
1
|
50
|
|
|
|
8
|
$self->_err_msg("new() got an odd number of parameters!") |
|
137
|
|
|
|
|
|
|
unless ((@_ % 2) == 0); |
|
138
|
|
|
|
|
|
|
|
|
139
|
1
|
|
|
|
|
9
|
my %params = @_; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
my $tmpl_ref = $params{'template'} |
|
142
|
1
|
50
|
|
|
|
8
|
? do { open(FH, "< $params{'template'}"); local $/; } |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
143
|
|
|
|
|
|
|
: &TEMPLATE; |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
|
146
|
1
|
|
|
|
|
12
|
$self->{template} = HTML::Template->new( |
|
147
|
|
|
|
|
|
|
scalarref => \$tmpl_ref, |
|
148
|
|
|
|
|
|
|
die_on_bad_params => 0, |
|
149
|
|
|
|
|
|
|
loop_context_vars => 1, |
|
150
|
|
|
|
|
|
|
); |
|
151
|
|
|
|
|
|
|
|
|
152
|
1
|
|
|
|
|
3421
|
$self->{params} = ['type','label','value','column']; |
|
153
|
1
|
|
|
|
|
4
|
$self->{table} = $params{'table'}; |
|
154
|
1
|
|
|
|
|
4
|
$self->{pk} = $params{'primary_key'}; |
|
155
|
1
|
|
|
|
|
14
|
$self->{query} = CGI->new; |
|
156
|
1
|
|
|
|
|
33367
|
$self->{form} = HTML::SuperForm->new; |
|
157
|
1
|
|
|
|
|
63
|
$self->{elements} = []; |
|
158
|
1
|
|
|
|
|
7
|
$self->{verbose} = $params{'verbose_errors'}; |
|
159
|
1
|
|
|
|
|
2
|
$self->{err_handler}= $params{'error_handler'}; |
|
160
|
1
|
|
|
|
|
4
|
$self->{css} = $params{'stylesheet'}; |
|
161
|
|
|
|
|
|
|
|
|
162
|
1
|
|
|
|
|
8
|
bless $self, $type; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 element |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Adds a new element to your editor object. Elements are created |
|
171
|
|
|
|
|
|
|
as HTML::SuperForm objects |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Required parameters: |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
I the column that this form element represents |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Optional parameters: |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
I |
|
180
|
|
|
|
|
|
|
this will default to the name of the column. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
I the type of form element that will be displayed. |
|
183
|
|
|
|
|
|
|
Currently, the available options are 'text', 'textarea', 'radio', |
|
184
|
|
|
|
|
|
|
'select', 'checkbox', and 'date'. The default is 'text'. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
I this is required for elements of type 'radio', |
|
187
|
|
|
|
|
|
|
'select', and 'checkbox'. This parameter should hold the values |
|
188
|
|
|
|
|
|
|
used to create the choice options. This parameter can be one of |
|
189
|
|
|
|
|
|
|
4 types of parameters: |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
scalar: this should be a SQL SELECT statement that returns 2 columns. |
|
192
|
|
|
|
|
|
|
The first column will be the value, the next will be the label. This |
|
193
|
|
|
|
|
|
|
SQL statement can SELECT from any table(s). |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
array: a reference to an array of scalars that will be used as both |
|
196
|
|
|
|
|
|
|
values and labels |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
array of arrays: a reference to an array of two-element arrays that |
|
199
|
|
|
|
|
|
|
will be used to populate the values and labels respectively. |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
hash: a reference to a hash who's keys will be the HTML element's values, |
|
202
|
|
|
|
|
|
|
and values will be the HTML element's labels. |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Any other parameter pairs will be passed unchanged to the HTML::SuperForm |
|
205
|
|
|
|
|
|
|
object that creates the actual form element HTML. Please see the |
|
206
|
|
|
|
|
|
|
HTML::SuperForm Documentation for details. Some common examples are: |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
disabled => 1, this creates a read-only field. |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
onclick => "alert('some javascript behavior goes here!'" |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
size => 50 |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
maxlength => 50 |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
B |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
$editor->element( column => 'Name' ); |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
$editor->element( |
|
224
|
|
|
|
|
|
|
column => 'sex', |
|
225
|
|
|
|
|
|
|
type => 'radio', |
|
226
|
|
|
|
|
|
|
options => {M => 'Male', F => 'Female'} |
|
227
|
|
|
|
|
|
|
); |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
$editor->element( |
|
230
|
|
|
|
|
|
|
column => 'color_id', |
|
231
|
|
|
|
|
|
|
label => 'Product Color' |
|
232
|
|
|
|
|
|
|
type => 'select', |
|
233
|
|
|
|
|
|
|
options => 'SELECT id, color FROM colors ORDER BY color' |
|
234
|
|
|
|
|
|
|
); |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=cut |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
sub element { |
|
239
|
|
|
|
|
|
|
|
|
240
|
1
|
|
|
1
|
1
|
426
|
my $self = shift; |
|
241
|
|
|
|
|
|
|
|
|
242
|
1
|
50
|
|
|
|
8
|
$self->_err_msg("element() got an odd number of parameters!") |
|
243
|
|
|
|
|
|
|
unless ((@_ % 2) == 0); |
|
244
|
|
|
|
|
|
|
|
|
245
|
1
|
|
|
|
|
6
|
my %params = @_; |
|
246
|
|
|
|
|
|
|
|
|
247
|
1
|
|
|
|
|
3
|
push (@{$self->{'elements'}}, \%params); |
|
|
1
|
|
|
|
|
9
|
|
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
} |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head2 connect |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
connects to the database. |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Required parameters: |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
I a DBI database handle |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
I |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
I, I, and I |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
B |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
$editor->connect( dbh => $dbh ); |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
$editor->connect( |
|
272
|
|
|
|
|
|
|
datasource => 'dbi:mysql:my_database', |
|
273
|
|
|
|
|
|
|
username => 'krailey' |
|
274
|
|
|
|
|
|
|
password => 'secret' |
|
275
|
|
|
|
|
|
|
); |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=cut |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub connect { |
|
280
|
|
|
|
|
|
|
|
|
281
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
282
|
|
|
|
|
|
|
|
|
283
|
0
|
0
|
|
|
|
0
|
$self->_err_msg("connect() got an odd number of parameters!") |
|
284
|
|
|
|
|
|
|
unless ((@_ % 2) == 0); |
|
285
|
|
|
|
|
|
|
|
|
286
|
0
|
|
|
|
|
0
|
my %params = @_; |
|
287
|
|
|
|
|
|
|
|
|
288
|
0
|
0
|
|
|
|
0
|
if ($params{dbh}){ |
|
289
|
0
|
|
|
|
|
0
|
$self->{dbh} = $params{dbh}; |
|
290
|
|
|
|
|
|
|
} else { |
|
291
|
0
|
0
|
|
|
|
0
|
$self->{dbh} = DBI->connect("$params{datasource}", |
|
292
|
|
|
|
|
|
|
"$params{username}", |
|
293
|
|
|
|
|
|
|
"$params{password}", |
|
294
|
|
|
|
|
|
|
{RaiseError => 1}, |
|
295
|
|
|
|
|
|
|
) |
|
296
|
|
|
|
|
|
|
or $self->_err_msg($DBI::errstr); |
|
297
|
|
|
|
|
|
|
} |
|
298
|
|
|
|
|
|
|
} |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head2 run |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
runs the object |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Required parameters: |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
I a DBForm::Search object that will create |
|
310
|
|
|
|
|
|
|
a search interface for the current table |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
I |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
I the value of the primary key for one |
|
315
|
|
|
|
|
|
|
row that can be updated through the form |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
B |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
$search = HTML::DBForm::Search->new('dropdown', |
|
321
|
|
|
|
|
|
|
{ columns => ['id', 'name']}, |
|
322
|
|
|
|
|
|
|
); |
|
323
|
|
|
|
|
|
|
$editor->run(search => $search); |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
$editor->run(primary_key => '1234'); |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=cut |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub run { |
|
330
|
|
|
|
|
|
|
|
|
331
|
0
|
|
|
0
|
1
|
0
|
my ($self, %params) = @_; |
|
332
|
|
|
|
|
|
|
|
|
333
|
0
|
|
|
|
|
0
|
$self->{search} = $params{search}; |
|
334
|
|
|
|
|
|
|
|
|
335
|
0
|
0
|
|
|
|
0
|
my $default = ($params{primary_key}) ? 'display':'search'; |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
# dispatch table |
|
338
|
0
|
|
|
0
|
|
0
|
my %mode = ( |
|
339
|
|
|
|
|
|
|
search => sub {$self->{search}->run($self)}, |
|
340
|
0
|
|
|
0
|
|
0
|
display => sub {$self->_display_form($params{primary_key})}, |
|
341
|
0
|
|
|
0
|
|
0
|
insert => sub {$self->_insert_row}, |
|
342
|
0
|
|
|
0
|
|
0
|
update => sub {$self->_update_row}, |
|
343
|
0
|
|
|
0
|
|
0
|
delete => sub {$self->_delete_row}, |
|
344
|
0
|
|
|
|
|
0
|
); |
|
345
|
|
|
|
|
|
|
|
|
346
|
0
|
|
0
|
|
|
0
|
my $rm = $mode{$self->{query}->param('rm') || $default}; |
|
347
|
|
|
|
|
|
|
|
|
348
|
0
|
|
|
|
|
0
|
print $self->{query}->header; |
|
349
|
0
|
|
|
|
|
0
|
print $rm->(); |
|
350
|
|
|
|
|
|
|
} |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
# PRIVATE METHODS BELOW |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
# create an HTML form |
|
358
|
|
|
|
|
|
|
# for adding or updating a record |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
sub _display_form { |
|
361
|
|
|
|
|
|
|
|
|
362
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
363
|
|
|
|
|
|
|
|
|
364
|
0
|
|
0
|
|
|
0
|
my $pk_val = shift || $self->{query}->param($self->{pk}); |
|
365
|
|
|
|
|
|
|
|
|
366
|
0
|
|
|
|
|
0
|
my (@form_loop, $db_row); |
|
367
|
|
|
|
|
|
|
|
|
368
|
0
|
0
|
|
|
|
0
|
if ($pk_val){ |
|
369
|
0
|
|
|
|
|
0
|
my $SQL = "SELECT * FROM $self->{table} WHERE $self->{pk} = ?"; |
|
370
|
0
|
|
|
|
|
0
|
$db_row = $self->{dbh}->selectrow_hashref($SQL, undef, $pk_val); |
|
371
|
|
|
|
|
|
|
|
|
372
|
0
|
|
|
|
|
0
|
$self->{template}->param( |
|
373
|
|
|
|
|
|
|
DELETE => 1, |
|
374
|
|
|
|
|
|
|
PK => $self->{pk}, |
|
375
|
|
|
|
|
|
|
ID => $pk_val, |
|
376
|
|
|
|
|
|
|
); |
|
377
|
|
|
|
|
|
|
} |
|
378
|
|
|
|
|
|
|
|
|
379
|
0
|
|
|
|
|
0
|
for my $element(@{$self->{elements}}){ |
|
|
0
|
|
|
|
|
0
|
|
|
380
|
|
|
|
|
|
|
|
|
381
|
0
|
|
|
|
|
0
|
my %row; |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
# set the defaults |
|
384
|
0
|
|
0
|
|
|
0
|
$element->{type} ||= 'text'; |
|
385
|
|
|
|
|
|
|
|
|
386
|
0
|
|
|
|
|
0
|
$element->{label} ||= join(' ', |
|
387
|
0
|
|
0
|
|
|
0
|
map {ucfirst($_)} split(/_/,$element->{column})); |
|
388
|
|
|
|
|
|
|
|
|
389
|
0
|
|
|
|
|
0
|
$element->{value} = $db_row->{$element->{column}}; |
|
390
|
|
|
|
|
|
|
|
|
391
|
0
|
|
|
|
|
0
|
$row{LABEL} = $element->{label}; |
|
392
|
0
|
|
|
|
|
0
|
$row{ELEMENT} = $self->_build_element($element); |
|
393
|
|
|
|
|
|
|
|
|
394
|
0
|
|
|
|
|
0
|
push(@form_loop, \%row); |
|
395
|
|
|
|
|
|
|
} |
|
396
|
|
|
|
|
|
|
|
|
397
|
0
|
0
|
|
|
|
0
|
my $next_mode = ($pk_val) ? 'update' : 'insert'; |
|
398
|
|
|
|
|
|
|
|
|
399
|
0
|
|
|
|
|
0
|
my $rm = { name => 'rm', default => $next_mode }; |
|
400
|
0
|
|
|
|
|
0
|
my $id = { name => $self->{pk}, default => $pk_val }; |
|
401
|
|
|
|
|
|
|
|
|
402
|
0
|
|
|
|
|
0
|
$self->{template}->param( HIDDEN_LOOP => [ |
|
403
|
|
|
|
|
|
|
{ELEMENT => $self->_build_hidden($rm)}, |
|
404
|
|
|
|
|
|
|
{ELEMENT => $self->_build_hidden($id)}, |
|
405
|
|
|
|
|
|
|
]); |
|
406
|
|
|
|
|
|
|
|
|
407
|
0
|
0
|
|
|
|
0
|
$self->{template}->param( |
|
408
|
|
|
|
|
|
|
CUSTOM_CSS => "$self->{css}", |
|
409
|
|
|
|
|
|
|
FORM_LOOP => \@form_loop, |
|
410
|
|
|
|
|
|
|
URL => $self->{query}->url, |
|
411
|
|
|
|
|
|
|
) unless $self->{error}; |
|
412
|
|
|
|
|
|
|
|
|
413
|
0
|
|
|
|
|
0
|
$self->{template}->output; |
|
414
|
|
|
|
|
|
|
} |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
# create an HTML::SuperForm object |
|
420
|
|
|
|
|
|
|
# for each form element |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
sub _build_element { |
|
423
|
|
|
|
|
|
|
|
|
424
|
0
|
|
|
0
|
|
0
|
my ($self, $element) = @_; |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
# avoid unlikely (but possible) recursion |
|
427
|
0
|
0
|
|
|
|
0
|
return if $element->{type} eq 'element'; |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
# simple dispatch table |
|
430
|
|
|
|
|
|
|
# for html builder methods |
|
431
|
|
|
|
|
|
|
my %methods = ( |
|
432
|
0
|
|
|
0
|
|
0
|
checkbox => sub{ $self->_select_builder('checkbox_group', $element) }, |
|
433
|
0
|
|
|
0
|
|
0
|
radio => sub{ $self->_select_builder('radio_group', $element) }, |
|
434
|
0
|
|
|
0
|
|
0
|
select => sub{ $self->_select_builder('select', $element) }, |
|
435
|
0
|
|
|
0
|
|
0
|
text => sub{ $self->_build_text($element) }, |
|
436
|
0
|
|
|
0
|
|
0
|
textarea => sub{ $self->_build_textarea($element) }, |
|
437
|
0
|
|
|
0
|
|
0
|
hidden => sub{ $self->_build_hidden($element) }, |
|
438
|
0
|
|
|
0
|
|
0
|
date => sub{ $self->_build_date($element) }, |
|
439
|
0
|
|
|
|
|
0
|
); |
|
440
|
|
|
|
|
|
|
|
|
441
|
0
|
|
|
|
|
0
|
my $method = $methods{$element->{type}}; |
|
442
|
0
|
|
|
|
|
0
|
$self->$method; |
|
443
|
|
|
|
|
|
|
} |
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
# create a text field form element |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
sub _build_text { |
|
451
|
|
|
|
|
|
|
|
|
452
|
0
|
|
|
0
|
|
0
|
my ($self, $element) = @_; |
|
453
|
|
|
|
|
|
|
|
|
454
|
0
|
|
|
|
|
0
|
return $self->{form}->text( |
|
455
|
|
|
|
|
|
|
name => $element->{column}, |
|
456
|
|
|
|
|
|
|
default => $element->{value}, |
|
457
|
|
|
|
|
|
|
$self->_pass_through($element) |
|
458
|
|
|
|
|
|
|
); |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
} |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
# create a textarea form element |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
sub _build_textarea { |
|
467
|
|
|
|
|
|
|
|
|
468
|
0
|
|
|
0
|
|
0
|
my ($self, $element) = @_; |
|
469
|
|
|
|
|
|
|
|
|
470
|
0
|
|
|
|
|
0
|
return $self->{form}->textarea( |
|
471
|
|
|
|
|
|
|
name => $element->{column}, |
|
472
|
|
|
|
|
|
|
default => $element->{value}, |
|
473
|
|
|
|
|
|
|
$self->_pass_through($element) |
|
474
|
|
|
|
|
|
|
); |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
} |
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
# create a hidden form element |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
sub _build_hidden { |
|
483
|
|
|
|
|
|
|
|
|
484
|
0
|
|
|
0
|
|
0
|
my ($self, $element) = @_; |
|
485
|
|
|
|
|
|
|
|
|
486
|
0
|
|
|
|
|
0
|
return $self->{form}->hidden($element); |
|
487
|
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
} |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
# build a date form element |
|
493
|
|
|
|
|
|
|
# (MM DD YYYY text fields) |
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
sub _build_date { |
|
496
|
|
|
|
|
|
|
|
|
497
|
0
|
|
|
0
|
|
0
|
my ($self, $element) = @_; |
|
498
|
|
|
|
|
|
|
|
|
499
|
0
|
|
|
|
|
0
|
my ($YY,$MM,$DD) = ($element->{value} =~ /(\d{4})-(\d\d)-(\d\d)/); |
|
500
|
|
|
|
|
|
|
|
|
501
|
0
|
|
|
|
|
0
|
my $form ='Month '; |
|
502
|
0
|
|
|
|
|
0
|
$form .= $self->{form}->text( |
|
503
|
|
|
|
|
|
|
name => $element->{column} .'_MM', |
|
504
|
|
|
|
|
|
|
default => $MM, |
|
505
|
|
|
|
|
|
|
size => 2, |
|
506
|
|
|
|
|
|
|
); |
|
507
|
|
|
|
|
|
|
|
|
508
|
0
|
|
|
|
|
0
|
$form .=' Day '; |
|
509
|
0
|
|
|
|
|
0
|
$form .= $self->{form}->text( |
|
510
|
|
|
|
|
|
|
name => $element->{column} .'_DD', |
|
511
|
|
|
|
|
|
|
default => $DD, |
|
512
|
|
|
|
|
|
|
size => 2, |
|
513
|
|
|
|
|
|
|
); |
|
514
|
|
|
|
|
|
|
|
|
515
|
0
|
|
|
|
|
0
|
$form .=' Year '; |
|
516
|
0
|
|
|
|
|
0
|
$form .= $self->{form}->text( |
|
517
|
|
|
|
|
|
|
name => $element->{column} .'_YY', |
|
518
|
|
|
|
|
|
|
default => $YY, |
|
519
|
|
|
|
|
|
|
size => 4, |
|
520
|
|
|
|
|
|
|
); |
|
521
|
|
|
|
|
|
|
|
|
522
|
0
|
|
|
|
|
0
|
return $form; |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
} |
|
525
|
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
# build and populate multiple |
|
529
|
|
|
|
|
|
|
# option form elements |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
sub _select_builder { |
|
532
|
|
|
|
|
|
|
|
|
533
|
0
|
|
|
0
|
|
0
|
my ($self, $type, $element) = @_; |
|
534
|
|
|
|
|
|
|
|
|
535
|
0
|
|
|
|
|
0
|
my (@values, %labels); |
|
536
|
|
|
|
|
|
|
|
|
537
|
0
|
|
|
|
|
0
|
my $o_type; |
|
538
|
|
|
|
|
|
|
|
|
539
|
0
|
|
|
|
|
0
|
eval{ |
|
540
|
0
|
|
|
|
|
0
|
$o_type = ref $element->{options}; |
|
541
|
0
|
0
|
|
|
|
0
|
$o_type = 'SQL' unless $o_type; |
|
542
|
0
|
0
|
|
|
|
0
|
$o_type = 'AOA' if $element->{options}->[0][1]; |
|
543
|
|
|
|
|
|
|
}; |
|
544
|
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
# load values from an array |
|
547
|
0
|
0
|
|
|
|
0
|
if ($o_type eq 'ARRAY'){ |
|
548
|
|
|
|
|
|
|
|
|
549
|
0
|
|
|
|
|
0
|
my @labels; |
|
550
|
0
|
|
|
|
|
0
|
for my $item (@{$element->{options}}){ |
|
|
0
|
|
|
|
|
0
|
|
|
551
|
0
|
|
|
|
|
0
|
push @values, $item; |
|
552
|
0
|
|
|
|
|
0
|
push @labels, $item; |
|
553
|
|
|
|
|
|
|
} |
|
554
|
0
|
|
|
|
|
0
|
@labels{@values} = @labels; |
|
555
|
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
} |
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
# load values from a hash |
|
560
|
0
|
0
|
|
|
|
0
|
if ($o_type eq 'HASH'){ |
|
561
|
0
|
|
|
|
|
0
|
@values = keys %{$element->{options}}; |
|
|
0
|
|
|
|
|
0
|
|
|
562
|
0
|
|
|
|
|
0
|
%labels = %{$element->{options}}; |
|
|
0
|
|
|
|
|
0
|
|
|
563
|
|
|
|
|
|
|
} |
|
564
|
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
# load values from a AoA |
|
567
|
0
|
0
|
|
|
|
0
|
if ($o_type eq 'AOA'){ |
|
568
|
|
|
|
|
|
|
|
|
569
|
0
|
|
|
|
|
0
|
my @labels; |
|
570
|
0
|
|
|
|
|
0
|
for my $lr (@{$element->{options}}){ |
|
|
0
|
|
|
|
|
0
|
|
|
571
|
0
|
|
|
|
|
0
|
push @values, $lr->[0]; |
|
572
|
0
|
|
|
|
|
0
|
push @labels, $lr->[1]; |
|
573
|
|
|
|
|
|
|
} |
|
574
|
0
|
|
|
|
|
0
|
@labels{@values} = @labels; |
|
575
|
|
|
|
|
|
|
} |
|
576
|
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
# if param is not a reference |
|
578
|
|
|
|
|
|
|
# assume that it is SQL and |
|
579
|
|
|
|
|
|
|
# load values from a database |
|
580
|
0
|
0
|
|
|
|
0
|
if ($o_type eq 'SQL'){ |
|
581
|
|
|
|
|
|
|
|
|
582
|
0
|
|
|
|
|
0
|
my $db_return; |
|
583
|
|
|
|
|
|
|
|
|
584
|
0
|
0
|
|
|
|
0
|
eval { |
|
585
|
0
|
|
|
|
|
0
|
$db_return = $self->{dbh}->selectall_arrayref($element->{options}); 1 |
|
|
0
|
|
|
|
|
0
|
|
|
586
|
|
|
|
|
|
|
} or $self->_err_msg($@); |
|
587
|
|
|
|
|
|
|
|
|
588
|
0
|
|
|
|
|
0
|
my @labels; |
|
589
|
0
|
|
|
|
|
0
|
for my $lr (@{$db_return}){ |
|
|
0
|
|
|
|
|
0
|
|
|
590
|
0
|
|
|
|
|
0
|
push @values, $lr->[0]; |
|
591
|
0
|
|
|
|
|
0
|
push @labels, $lr->[1]; |
|
592
|
|
|
|
|
|
|
} |
|
593
|
0
|
|
|
|
|
0
|
@labels{@values} = @labels; |
|
594
|
|
|
|
|
|
|
} |
|
595
|
|
|
|
|
|
|
|
|
596
|
0
|
|
|
|
|
0
|
return $self->{form}->$type( |
|
597
|
|
|
|
|
|
|
name => $element->{column}, |
|
598
|
|
|
|
|
|
|
values => \@values, |
|
599
|
|
|
|
|
|
|
labels => \%labels, |
|
600
|
|
|
|
|
|
|
default => $element->{value}, |
|
601
|
|
|
|
|
|
|
$self->_pass_through($element) |
|
602
|
|
|
|
|
|
|
); |
|
603
|
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
} |
|
605
|
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
# pass any unwanted parameters |
|
609
|
|
|
|
|
|
|
# through to HTML::SuperForm |
|
610
|
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
sub _pass_through { |
|
612
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
613
|
0
|
|
|
|
|
0
|
my $element = shift; |
|
614
|
|
|
|
|
|
|
|
|
615
|
0
|
|
|
|
|
0
|
my %params; |
|
616
|
0
|
|
|
|
|
0
|
for my $param (keys %$element){ |
|
617
|
0
|
0
|
|
|
|
0
|
next if grep(/$param/, @{$self->{params}}); |
|
|
0
|
|
|
|
|
0
|
|
|
618
|
0
|
|
|
|
|
0
|
$params{$param} = $element->{$param}; |
|
619
|
|
|
|
|
|
|
} |
|
620
|
|
|
|
|
|
|
|
|
621
|
0
|
|
|
|
|
0
|
return %params; |
|
622
|
|
|
|
|
|
|
} |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
# add a new row |
|
627
|
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
sub _insert_row { |
|
629
|
|
|
|
|
|
|
|
|
630
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
631
|
|
|
|
|
|
|
|
|
632
|
0
|
|
|
|
|
0
|
my $placeholder_count; |
|
633
|
|
|
|
|
|
|
my @values; |
|
634
|
|
|
|
|
|
|
|
|
635
|
0
|
|
|
|
|
0
|
my $SQL = "INSERT into $self->{table} ("; |
|
636
|
|
|
|
|
|
|
|
|
637
|
0
|
|
|
|
|
0
|
for my $element(@{$self->{elements}}){ |
|
|
0
|
|
|
|
|
0
|
|
|
638
|
|
|
|
|
|
|
|
|
639
|
0
|
|
|
|
|
0
|
$SQL .= $element->{column} . ","; |
|
640
|
|
|
|
|
|
|
|
|
641
|
0
|
|
|
|
|
0
|
$placeholder_count++; |
|
642
|
|
|
|
|
|
|
|
|
643
|
0
|
0
|
|
|
|
0
|
if ($element->{type} eq 'date'){ |
|
644
|
0
|
|
|
|
|
0
|
my $val = $self->{query}->param("$element->{column}_YY") .'-'; |
|
645
|
0
|
|
|
|
|
0
|
$val .= $self->{query}->param("$element->{column}_MM") .'-'; |
|
646
|
0
|
|
|
|
|
0
|
$val .= $self->{query}->param("$element->{column}_DD"); |
|
647
|
|
|
|
|
|
|
|
|
648
|
0
|
|
|
|
|
0
|
push @values, $val; |
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
} else { |
|
651
|
0
|
|
|
|
|
0
|
push @values, $self->{query}->param($element->{column}); |
|
652
|
|
|
|
|
|
|
} |
|
653
|
|
|
|
|
|
|
} |
|
654
|
|
|
|
|
|
|
|
|
655
|
0
|
|
|
|
|
0
|
chop ($SQL); |
|
656
|
|
|
|
|
|
|
|
|
657
|
0
|
|
|
|
|
0
|
$SQL .= ") VALUES ("; |
|
658
|
|
|
|
|
|
|
|
|
659
|
0
|
|
|
|
|
0
|
for (1 .. $placeholder_count){ |
|
660
|
0
|
|
|
|
|
0
|
$SQL .="?,"; |
|
661
|
|
|
|
|
|
|
} |
|
662
|
0
|
|
|
|
|
0
|
chop ($SQL); |
|
663
|
|
|
|
|
|
|
|
|
664
|
0
|
|
|
|
|
0
|
$SQL .= ")"; |
|
665
|
|
|
|
|
|
|
|
|
666
|
0
|
0
|
|
|
|
0
|
eval{ $self->{dbh}->do($SQL, undef, @values); 1} |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
667
|
|
|
|
|
|
|
or $self->_err_msg($@); |
|
668
|
|
|
|
|
|
|
|
|
669
|
0
|
|
|
|
|
0
|
my $id = $self->{dbh}->{mysql_insertid}; |
|
670
|
|
|
|
|
|
|
|
|
671
|
0
|
|
|
|
|
0
|
$self->{primary_key} = $id; |
|
672
|
|
|
|
|
|
|
|
|
673
|
0
|
0
|
|
|
|
0
|
$self->{template}->param( |
|
674
|
|
|
|
|
|
|
MESSAGE => 'New Record Created.', |
|
675
|
|
|
|
|
|
|
URL=> $self->{query}->url, |
|
676
|
|
|
|
|
|
|
) unless $self->{error}; |
|
677
|
|
|
|
|
|
|
|
|
678
|
0
|
|
|
|
|
0
|
$self->{template}->output; |
|
679
|
|
|
|
|
|
|
} |
|
680
|
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
# update an existing row |
|
684
|
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
sub _update_row { |
|
686
|
|
|
|
|
|
|
|
|
687
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
688
|
0
|
|
|
|
|
0
|
my $placeholder_count; |
|
689
|
0
|
|
|
|
|
0
|
my @values = (); |
|
690
|
|
|
|
|
|
|
|
|
691
|
0
|
|
|
|
|
0
|
my $SQL = "UPDATE $self->{table} set "; |
|
692
|
0
|
|
|
|
|
0
|
my $q = $self->{query}; |
|
693
|
|
|
|
|
|
|
|
|
694
|
0
|
|
|
|
|
0
|
for my $element(@{$self->{elements}}){ |
|
|
0
|
|
|
|
|
0
|
|
|
695
|
|
|
|
|
|
|
|
|
696
|
0
|
|
|
|
|
0
|
$SQL .= $element->{column} . "=?,"; |
|
697
|
|
|
|
|
|
|
|
|
698
|
0
|
|
|
|
|
0
|
$placeholder_count++; |
|
699
|
|
|
|
|
|
|
|
|
700
|
0
|
0
|
|
|
|
0
|
if ($element->{type} eq 'date'){ |
|
701
|
0
|
|
|
|
|
0
|
my $val = $q->param("$element->{column}_YY") .'-'; |
|
702
|
0
|
|
|
|
|
0
|
$val .= $q->param("$element->{column}_MM") .'-'; |
|
703
|
0
|
|
|
|
|
0
|
$val .= $q->param("$element->{column}_DD"); |
|
704
|
|
|
|
|
|
|
|
|
705
|
0
|
|
|
|
|
0
|
push @values, $val; |
|
706
|
|
|
|
|
|
|
} else { |
|
707
|
0
|
|
|
|
|
0
|
push @values, $q->param($element->{column}); |
|
708
|
|
|
|
|
|
|
} |
|
709
|
|
|
|
|
|
|
} |
|
710
|
0
|
|
|
|
|
0
|
chop ($SQL); |
|
711
|
|
|
|
|
|
|
|
|
712
|
0
|
|
|
|
|
0
|
$SQL .= " WHERE $self->{pk}=?"; |
|
713
|
|
|
|
|
|
|
|
|
714
|
0
|
|
|
|
|
0
|
push @values, $q->param($self->{pk}); |
|
715
|
|
|
|
|
|
|
|
|
716
|
0
|
|
|
|
|
0
|
my $sth = $self->{dbh}->prepare($SQL); |
|
717
|
|
|
|
|
|
|
|
|
718
|
0
|
0
|
|
|
|
0
|
eval { $sth->execute(@values); 1 } or $self->_err_msg($@, $SQL); |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
719
|
|
|
|
|
|
|
|
|
720
|
0
|
0
|
|
|
|
0
|
$self->{template}->param( |
|
721
|
|
|
|
|
|
|
MESSAGE => 'Record Updated.', |
|
722
|
|
|
|
|
|
|
URL=> $self->{query}->url |
|
723
|
|
|
|
|
|
|
) unless $self->{error}; |
|
724
|
|
|
|
|
|
|
|
|
725
|
0
|
|
|
|
|
0
|
$self->{template}->output; |
|
726
|
|
|
|
|
|
|
} |
|
727
|
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
# delete an existing row |
|
731
|
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
sub _delete_row { |
|
733
|
|
|
|
|
|
|
|
|
734
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
735
|
|
|
|
|
|
|
|
|
736
|
0
|
|
|
|
|
0
|
my $SQL = "DELETE FROM $self->{table} WHERE $self->{pk}=?"; |
|
737
|
|
|
|
|
|
|
|
|
738
|
0
|
|
|
|
|
0
|
my $sth = $self->{dbh}->prepare($SQL); |
|
739
|
|
|
|
|
|
|
|
|
740
|
0
|
0
|
|
|
|
0
|
eval { |
|
741
|
0
|
|
|
|
|
0
|
$sth->execute($self->{query}->param($self->{pk})); |
|
742
|
0
|
|
|
|
|
0
|
1 } or $self->_err_msg($@); |
|
743
|
|
|
|
|
|
|
|
|
744
|
0
|
0
|
|
|
|
0
|
$self->{template}->param( |
|
745
|
|
|
|
|
|
|
MESSAGE => 'Record Deleted.', |
|
746
|
|
|
|
|
|
|
URL => $self->{query}->url |
|
747
|
|
|
|
|
|
|
) unless $self->{error}; |
|
748
|
|
|
|
|
|
|
|
|
749
|
0
|
|
|
|
|
0
|
$self->{template}->output; |
|
750
|
|
|
|
|
|
|
} |
|
751
|
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
# display an error message |
|
755
|
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
sub _err_msg { |
|
757
|
|
|
|
|
|
|
|
|
758
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
759
|
0
|
|
|
|
|
0
|
my @errs = @_; |
|
760
|
|
|
|
|
|
|
|
|
761
|
0
|
|
|
|
|
0
|
carp(@errs); |
|
762
|
|
|
|
|
|
|
|
|
763
|
0
|
|
|
|
|
0
|
$self->{error}++; |
|
764
|
0
|
|
|
|
|
0
|
$self->{err_msg} = 'Please try again.'; |
|
765
|
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
# call optional error handler |
|
767
|
0
|
0
|
|
|
|
0
|
if ($self->{err_handler}){ |
|
768
|
0
|
|
|
|
|
0
|
$self->{err_msg} = $self->{err_handler}->(@errs); |
|
769
|
|
|
|
|
|
|
} else { |
|
770
|
0
|
0
|
|
|
|
0
|
$self->{err_msg} = join(' ', @errs) if $self->{verbose}; |
|
771
|
|
|
|
|
|
|
} |
|
772
|
|
|
|
|
|
|
|
|
773
|
0
|
|
|
|
|
0
|
$self->{template}->param( |
|
774
|
|
|
|
|
|
|
ERROR_MSG => $self->{err_msg}, |
|
775
|
|
|
|
|
|
|
URL => $self->{query}->url |
|
776
|
|
|
|
|
|
|
); |
|
777
|
|
|
|
|
|
|
} |
|
778
|
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
781
|
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
HTML::SuperForm |
|
783
|
|
|
|
|
|
|
HTML::DBForm::Search |
|
784
|
|
|
|
|
|
|
HTML::DBForm::Search::DropDown |
|
785
|
|
|
|
|
|
|
HTML::DBForm::Search::TableList |
|
786
|
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
=head1 AUTHOR |
|
789
|
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
Ken Railey, Eken_railey@yahoo.comE |
|
791
|
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
793
|
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
Copyright 2004 by Ken Railey |
|
795
|
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
797
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
798
|
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
=cut |
|
800
|
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
sub TEMPLATE { |
|
803
|
|
|
|
|
|
|
|
|
804
|
1
|
|
|
1
|
0
|
3
|
qq( |
|
805
|
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
|
|
911
|
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
I'm sorry, but there was an error processing your request. |
|
967
|
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
|
|
970
|
|
|
|
|
|
|
Contact the administrator for more information. |
|
971
|
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
|
|
982
|
|
|
|
|
|
|
|
|
983
|
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
Your request was processed successfully. |
|
986
|
|
|
|
|
|
|
Click Here |
|
987
|
|
|
|
|
|
|
to continue. |
|
988
|
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
|
|
991
|
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
); |
|
994
|
|
|
|
|
|
|
} |
|
995
|
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
1; |
|
997
|
|
|
|
|
|
|
|