line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Lazy::Template::Boilerplate; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use CGI::Lazy::Globals; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3276
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $datasetMultipleStartBegin = <
|
8
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
END |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
our $cssClean = <
|
178
|
|
|
|
|
|
|
div#__WIDGETID__ { |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
END |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
our $datasetSingleStart = <
|
185
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
END |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
our $datasetMultipleHeaderStart = <
|
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
END |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
our $controllerStart = <
|
236
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
END |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
our $tdPrototypeControllerSelect = <
|
248
|
|
|
|
|
|
|
| |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
name="" |
251
|
|
|
|
|
|
|
id="" |
252
|
|
|
|
|
|
|
onchange="__WIDGETID__Controller.select();" |
253
|
|
|
|
|
|
|
/> |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
END |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
our $tdPrototypeControllerCheckbox = <
|
262
|
|
|
|
|
|
|
| |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
type="checkbox" |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
name="" |
267
|
|
|
|
|
|
|
value="" |
268
|
|
|
|
|
|
|
id="" |
269
|
|
|
|
|
|
|
onchange="__WIDGETID__Controller.select();" |
270
|
|
|
|
|
|
|
/> |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
END |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
our $tdPrototypeControllerRadio = <
|
275
|
|
|
|
|
|
|
| |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
type="radio" |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
name="" |
282
|
|
|
|
|
|
|
value="" |
283
|
|
|
|
|
|
|
id="" |
284
|
|
|
|
|
|
|
onchange="__WIDGETID__Controller.select();" |
285
|
|
|
|
|
|
|
/> |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
END |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
our $tdPrototypeControllerText = <
|
292
|
|
|
|
|
|
|
| |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
type="text" |
295
|
|
|
|
|
|
|
name="" |
296
|
|
|
|
|
|
|
value="" |
297
|
|
|
|
|
|
|
id="" |
298
|
|
|
|
|
|
|
onchange="__WIDGETID__Controller.select();" |
299
|
|
|
|
|
|
|
/> |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
END |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
304
|
|
|
|
|
|
|
sub buildTmplController { |
305
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
306
|
|
|
|
|
|
|
|
307
|
0
|
|
|
|
|
|
my $tmpl = $controllerStart; |
308
|
|
|
|
|
|
|
|
309
|
0
|
|
|
|
|
|
foreach my $control (@{$self->controls}) { |
|
0
|
|
|
|
|
|
|
310
|
0
|
|
|
|
|
|
my $type = $control->{type}; |
311
|
|
|
|
|
|
|
|
312
|
0
|
0
|
|
|
|
|
if ($type eq 'select') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
313
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($control->{name}, $tdPrototypeControllerSelect); |
314
|
|
|
|
|
|
|
} elsif ($type eq 'checkbox') { |
315
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($control->{name}, $tdPrototypeControllerCheckbox); |
316
|
|
|
|
|
|
|
} elsif ($type eq 'radio') { |
317
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($control->{name}, $tdPrototypeControllerRadio); |
318
|
|
|
|
|
|
|
} else { |
319
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($control->{name}, $tdPrototypeControllerText); |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
0
|
|
|
|
|
|
$tmpl .= $controllerEnd; |
324
|
|
|
|
|
|
|
|
325
|
0
|
|
|
|
|
|
return $self->outputTmpl($tmpl, 'Controller'); |
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
329
|
|
|
|
|
|
|
sub buildTmplDatasetMultiple { |
330
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
331
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
my $tmpl = $self->parse4ID($datasetMultipleStartBegin); |
333
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($_, $datasetMultipleHDR) for $self->widget->recordset->visibleFields; |
334
|
0
|
|
|
|
|
|
$tmpl .= $datasetMultipleStartEnd; |
335
|
|
|
|
|
|
|
|
336
|
0
|
|
|
|
|
|
foreach my $fieldname (@{$self->fieldlist}) { |
|
0
|
|
|
|
|
|
|
337
|
0
|
0
|
|
|
|
|
if ($self->widget->recordset->webcontrol($fieldname)) { |
338
|
0
|
|
|
|
|
|
my $webcontrol = $self->widget->recordset->webcontrol($fieldname); |
339
|
0
|
|
|
|
|
|
my $type = $webcontrol->{type}; |
340
|
|
|
|
|
|
|
|
341
|
0
|
0
|
|
|
|
|
if ($type eq 'select') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
342
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($fieldname, $tdPrototypeMultiSelect); |
343
|
|
|
|
|
|
|
} elsif ($type eq 'checkbox') { |
344
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($fieldname, $tdPrototypeMultiCheckbox); |
345
|
|
|
|
|
|
|
} elsif ($type eq 'radio') { |
346
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($fieldname, $tdPrototypeMultiRadio); |
347
|
|
|
|
|
|
|
} else { |
348
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($fieldname, $tdPrototypeMultiText); |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
} else { |
351
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($fieldname, $tdPrototypeMultiText); |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
} |
354
|
|
|
|
|
|
|
|
355
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4ID($datasetDeleteTd); |
356
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4ID($datasetMultipleEnd); |
357
|
|
|
|
|
|
|
|
358
|
0
|
|
|
|
|
|
$self->outputTmpl($tmpl); |
359
|
|
|
|
|
|
|
} |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
362
|
|
|
|
|
|
|
sub buildTmplDatasetMultipleHeadings { |
363
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
364
|
|
|
|
|
|
|
|
365
|
0
|
|
|
|
|
|
my $tmpl = $self->parse4ID($datasetMultipleHeaderStart); |
366
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($_, $datasetMultipleHDR) for @{$self->fieldlist}; |
|
0
|
|
|
|
|
|
|
367
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4ID($datasetMultipleHeaderDeleteTd); |
368
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4ID($datasetMultipleHeaderEnd); |
369
|
|
|
|
|
|
|
|
370
|
0
|
|
|
|
|
|
$self->outputTmpl($tmpl, 'HDR'); |
371
|
|
|
|
|
|
|
} |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
374
|
|
|
|
|
|
|
sub buildTmplDatasetMultipleRO { |
375
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
376
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
my $tmpl = $self->parse4ID($datasetMultipleStartBegin); |
378
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($_, $datasetMultipleHDR) for $self->widget->recordset->visibleFields; |
379
|
0
|
|
|
|
|
|
$tmpl .= $datasetMultipleStartEnd; |
380
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4FieldAndID($_, $tdPrototypeMultiRO) for @{$self->fieldlist}; |
|
0
|
|
|
|
|
|
|
381
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4ID($datasetMultipleEnd); |
382
|
|
|
|
|
|
|
|
383
|
0
|
|
|
|
|
|
$self->outputTmpl($tmpl, 'RO'); |
384
|
|
|
|
|
|
|
} |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
387
|
|
|
|
|
|
|
sub buildTmplDatasetSingle { |
388
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
389
|
|
|
|
|
|
|
|
390
|
0
|
|
|
|
|
|
my $widgetID = $self->widgetID; |
391
|
0
|
|
|
|
|
|
my $fieldlist = $self->fieldlist; |
392
|
0
|
|
|
|
|
|
my $fields = scalar @$fieldlist; |
393
|
0
|
0
|
|
|
|
|
my $rows = ($fields / 5 == int $fields) ? $fields / 5 : int $fields / 5 + 1; |
394
|
|
|
|
|
|
|
|
395
|
0
|
|
|
|
|
|
my $tmpl = $self->parse4ID($datasetSingleStart); |
396
|
|
|
|
|
|
|
|
397
|
0
|
|
|
|
|
|
my $field = 0; |
398
|
0
|
|
|
|
|
|
for (my $i = 0; $i < $rows; $i++) { |
399
|
0
|
|
|
|
|
|
my $column = 0; |
400
|
0
|
|
|
|
|
|
$tmpl .= $datasetSingleRowStart; |
401
|
0
|
|
|
|
|
|
while ($column < 6) { |
402
|
0
|
0
|
|
|
|
|
if ($fieldlist->[$field]) { |
403
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($fieldlist->[$field], $datasetSingleLableTd); |
404
|
|
|
|
|
|
|
|
405
|
0
|
0
|
|
|
|
|
if ($self->widget->recordset->webcontrol($fieldlist->[$field])) { |
406
|
0
|
|
|
|
|
|
my $webcontrol = $self->widget->recordset->webcontrol($fieldlist->[$field]); |
407
|
0
|
|
|
|
|
|
my $type = $webcontrol->{type}; |
408
|
|
|
|
|
|
|
|
409
|
0
|
0
|
|
|
|
|
if ($type eq 'select') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
410
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($fieldlist->[$field], $self->parse4ID($tdPrototypeSingleSelect)); |
411
|
|
|
|
|
|
|
} elsif ($type eq 'checkbox') { |
412
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($fieldlist->[$field], $self->parse4ID($tdPrototypeSingleCheckbox)); |
413
|
|
|
|
|
|
|
} elsif ($type eq 'radio') { |
414
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($fieldlist->[$field], $self->parse4ID($tdPrototypeSingleRadio)); |
415
|
|
|
|
|
|
|
} else { |
416
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($fieldlist->[$field], $self->parse4ID($tdPrototypeSingleText)); |
417
|
|
|
|
|
|
|
} |
418
|
|
|
|
|
|
|
} else { |
419
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($fieldlist->[$field], $self->parse4ID($tdPrototypeSingleText)); |
420
|
|
|
|
|
|
|
} |
421
|
|
|
|
|
|
|
} |
422
|
0
|
|
|
|
|
|
$column++; |
423
|
0
|
|
|
|
|
|
$field++; |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
|
426
|
0
|
|
|
|
|
|
$tmpl .= $datasetSingleRowEnd; |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
} |
429
|
|
|
|
|
|
|
|
430
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4ID($datasetSingleEnd); |
431
|
|
|
|
|
|
|
|
432
|
0
|
|
|
|
|
|
$self->outputTmpl($tmpl); |
433
|
|
|
|
|
|
|
} |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
436
|
|
|
|
|
|
|
sub buildTmplDatasetSingleRO { |
437
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
438
|
|
|
|
|
|
|
|
439
|
0
|
|
|
|
|
|
my $widgetID = $self->widgetID; |
440
|
0
|
|
|
|
|
|
my $fieldlist = $self->fieldlist; |
441
|
0
|
|
|
|
|
|
my $fields = scalar @$fieldlist; |
442
|
0
|
0
|
|
|
|
|
my $rows = ($fields / 5 == int $fields) ? $fields / 5 : int $fields / 5 + 1; |
443
|
|
|
|
|
|
|
|
444
|
0
|
|
|
|
|
|
my $tmpl = $self->parse4ID($datasetSingleStart); |
445
|
|
|
|
|
|
|
|
446
|
0
|
|
|
|
|
|
my $field = 0; |
447
|
0
|
|
|
|
|
|
for (my $i = 0; $i < $rows; $i++) { |
448
|
0
|
|
|
|
|
|
my $column = 0; |
449
|
0
|
|
|
|
|
|
$tmpl .= $datasetSingleRowStart; |
450
|
0
|
|
|
|
|
|
while ($column < 6) { |
451
|
0
|
0
|
|
|
|
|
if ($fieldlist->[$field]) { |
452
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($fieldlist->[$field], $datasetSingleLableTd); |
453
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($fieldlist->[$field], $self->parse4ID($tdPrototypeSingleRO)); |
454
|
|
|
|
|
|
|
} |
455
|
0
|
|
|
|
|
|
$column++; |
456
|
0
|
|
|
|
|
|
$field++; |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
|
459
|
0
|
|
|
|
|
|
$tmpl .= $datasetSingleRowEnd; |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4ID($datasetSingleEnd); |
464
|
|
|
|
|
|
|
|
465
|
0
|
|
|
|
|
|
$self->outputTmpl($tmpl, 'RO'); |
466
|
|
|
|
|
|
|
} |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
469
|
|
|
|
|
|
|
sub buildTmplDatasetSingleMulti { |
470
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
471
|
|
|
|
|
|
|
|
472
|
0
|
|
|
|
|
|
my $tmpl = $self->parse4ID($datasetMultipleStartBegin); |
473
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($_, $datasetMultipleHDR) for $self->widget->recordset->multipleFieldList; |
474
|
0
|
|
|
|
|
|
$tmpl .= $datasetMultipleStartEnd; |
475
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4Field($_, $tdPrototypeSingleMulti) for @{$self->fieldlist}; |
|
0
|
|
|
|
|
|
|
476
|
0
|
|
|
|
|
|
$tmpl .= $self->parse4ID($datasetMultipleEnd); |
477
|
|
|
|
|
|
|
|
478
|
0
|
|
|
|
|
|
$self->outputTmpl($tmpl, 'Multi'); |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
481
|
|
|
|
|
|
|
sub buildTemplates { |
482
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
483
|
|
|
|
|
|
|
|
484
|
0
|
0
|
|
|
|
|
if ($self->{_composite} ) { |
485
|
0
|
|
|
|
|
|
$_->buildTemplates foreach (@{$self->{_members}}); |
|
0
|
|
|
|
|
|
|
486
|
0
|
|
|
|
|
|
return; |
487
|
|
|
|
|
|
|
} |
488
|
|
|
|
|
|
|
|
489
|
0
|
0
|
|
|
|
|
if ($self->type eq 'Dataset-single') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
490
|
0
|
|
|
|
|
|
$self->buildTmplDatasetSingle; |
491
|
0
|
|
|
|
|
|
$self->buildTmplDatasetSingleMulti; |
492
|
0
|
|
|
|
|
|
$self->buildTmplDatasetSingleRO; |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
} elsif ($self->type eq 'Dataset-multi') { |
495
|
0
|
|
|
|
|
|
$self->buildTmplDatasetMultiple; |
496
|
0
|
|
|
|
|
|
$self->buildTmplDatasetMultipleRO; |
497
|
0
|
|
|
|
|
|
$self->buildTmplDatasetMultipleHeadings; |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
} elsif ($self->type eq 'Controller') { |
500
|
0
|
|
|
|
|
|
$self->buildTmplController; |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
} |
503
|
|
|
|
|
|
|
|
504
|
0
|
|
|
|
|
|
return; |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
508
|
|
|
|
|
|
|
sub controls { |
509
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
510
|
|
|
|
|
|
|
|
511
|
0
|
|
|
|
|
|
return $self->{_controls}; |
512
|
|
|
|
|
|
|
} |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
515
|
|
|
|
|
|
|
sub fieldlist { |
516
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
517
|
|
|
|
|
|
|
|
518
|
0
|
|
|
|
|
|
return $self->{_fieldlist}; |
519
|
|
|
|
|
|
|
} |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
522
|
|
|
|
|
|
|
sub new { |
523
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
524
|
0
|
|
|
|
|
|
my $template = shift; |
525
|
0
|
|
|
|
|
|
my $widget = shift; |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
|
528
|
0
|
0
|
|
|
|
|
die "Boilerplate called with no widget!" unless $widget; |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
|
531
|
0
|
|
|
|
|
|
my $self = { |
532
|
|
|
|
|
|
|
_template => $template, |
533
|
|
|
|
|
|
|
_widget => $widget, |
534
|
|
|
|
|
|
|
}; |
535
|
|
|
|
|
|
|
|
536
|
0
|
0
|
|
|
|
|
if (ref $widget eq 'CGI::Lazy::Widget::Dataset') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
537
|
0
|
|
|
|
|
|
$self->{_widgetID} = $widget->widgetID; |
538
|
0
|
|
|
|
|
|
$self->{_fieldlist} = $widget->recordset->visibleFields; |
539
|
0
|
|
|
|
|
|
$self->{_type} = 'Dataset-'.$widget->type; |
540
|
0
|
|
|
|
|
|
$self->{_style} = $widget->vars->{style}; |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
} elsif (ref $widget eq 'CGI::Lazy::Widget::Controller') { |
543
|
0
|
|
|
|
|
|
$self->{_widgetID} = $widget->widgetID; |
544
|
0
|
|
|
|
|
|
$self->{_type} = 'Controller'; |
545
|
0
|
|
|
|
|
|
$self->{_controls} = $widget->controls; |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
} elsif (ref $widget eq 'CGI::Lazy::Widget::Composite') { |
548
|
0
|
|
|
|
|
|
$self->{_widgetID} = $widget->widgetID; |
549
|
0
|
|
|
|
|
|
$self->{_composite} = 1; |
550
|
|
|
|
|
|
|
|
551
|
0
|
|
|
|
|
|
foreach (@{$widget->memberarray}) { |
|
0
|
|
|
|
|
|
|
552
|
0
|
|
|
|
|
|
push @{$self->{_members}}, $template->boilerplate($_); |
|
0
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
} |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
|
557
|
0
|
|
|
|
|
|
return bless $self, $class; |
558
|
|
|
|
|
|
|
} |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
561
|
|
|
|
|
|
|
sub output { |
562
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
563
|
0
|
|
|
|
|
|
my $text = shift; |
564
|
0
|
|
|
|
|
|
my $type = shift; |
565
|
0
|
|
|
|
|
|
my $extra = shift; |
566
|
|
|
|
|
|
|
|
567
|
0
|
|
|
|
|
|
my $filename = $self->widgetID; |
568
|
0
|
0
|
|
|
|
|
$filename .= $extra if $extra; |
569
|
0
|
|
|
|
|
|
$filename .=".$type"; |
570
|
|
|
|
|
|
|
|
571
|
0
|
|
|
|
|
|
my $file = $self->q->config->buildDir."/".$filename; |
572
|
|
|
|
|
|
|
|
573
|
0
|
0
|
|
|
|
|
open OF, "+> $file" or die "Couldn't open $file for writing: $!"; |
574
|
0
|
|
|
|
|
|
print OF $text; |
575
|
0
|
|
|
|
|
|
close OF; |
576
|
|
|
|
|
|
|
} |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
579
|
|
|
|
|
|
|
sub outputTmpl { |
580
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
581
|
0
|
|
|
|
|
|
my $text = shift; |
582
|
0
|
|
|
|
|
|
my $type = shift; |
583
|
|
|
|
|
|
|
|
584
|
0
|
|
|
|
|
|
$self->output($text, "tmpl", $type); |
585
|
|
|
|
|
|
|
} |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
588
|
|
|
|
|
|
|
sub parse4ID { |
589
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
590
|
0
|
|
|
|
|
|
my $text = shift; |
591
|
|
|
|
|
|
|
|
592
|
0
|
|
|
|
|
|
my $widgetID = $self->widgetID; |
593
|
|
|
|
|
|
|
|
594
|
0
|
|
|
|
|
|
$text =~ s/__WIDGETID__/$widgetID/gs; |
595
|
|
|
|
|
|
|
|
596
|
0
|
|
|
|
|
|
return $text; |
597
|
|
|
|
|
|
|
} |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
600
|
|
|
|
|
|
|
sub parse4Field { |
601
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
602
|
0
|
|
|
|
|
|
my $fieldname = shift; |
603
|
0
|
|
|
|
|
|
my $text = shift; |
604
|
|
|
|
|
|
|
|
605
|
0
|
|
|
|
|
|
$text =~ s/__FIELDNAME__/$fieldname/gs; |
606
|
|
|
|
|
|
|
|
607
|
0
|
|
|
|
|
|
return $text; |
608
|
|
|
|
|
|
|
} |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
611
|
|
|
|
|
|
|
sub parse4FieldAndID { |
612
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
613
|
0
|
|
|
|
|
|
my $fieldname = shift; |
614
|
0
|
|
|
|
|
|
my $text = shift; |
615
|
|
|
|
|
|
|
|
616
|
0
|
|
|
|
|
|
$text = $self->parse4Field($fieldname, $text); |
617
|
0
|
|
|
|
|
|
$text = $self->parse4ID($text); |
618
|
|
|
|
|
|
|
|
619
|
0
|
|
|
|
|
|
return $text; |
620
|
|
|
|
|
|
|
} |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
623
|
|
|
|
|
|
|
sub q { |
624
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
625
|
|
|
|
|
|
|
|
626
|
0
|
|
|
|
|
|
return $self->template->q; |
627
|
|
|
|
|
|
|
} |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
630
|
|
|
|
|
|
|
sub style { |
631
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
632
|
|
|
|
|
|
|
|
633
|
0
|
|
|
|
|
|
return $self->{_style}; |
634
|
|
|
|
|
|
|
} |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
637
|
|
|
|
|
|
|
sub template { |
638
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
639
|
|
|
|
|
|
|
|
640
|
0
|
|
|
|
|
|
return $self->{_template}; |
641
|
|
|
|
|
|
|
} |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
644
|
|
|
|
|
|
|
sub type { |
645
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
646
|
|
|
|
|
|
|
|
647
|
0
|
|
|
|
|
|
return $self->{_type}; |
648
|
|
|
|
|
|
|
} |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
651
|
|
|
|
|
|
|
sub widget { |
652
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
653
|
|
|
|
|
|
|
|
654
|
0
|
|
|
|
|
|
return $self->{_widget}; |
655
|
|
|
|
|
|
|
} |
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------------------- |
658
|
|
|
|
|
|
|
sub widgetID { |
659
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
660
|
|
|
|
|
|
|
|
661
|
0
|
|
|
|
|
|
return $self->{_widgetID}; |
662
|
|
|
|
|
|
|
} |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
1 |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
__END__ |