line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
XAO::DO::Web::SetArg - sets base object arguments |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Currently is only useful in XAO::Web site context. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Sets argument in parent object. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
To be used in situations like the following to set default values. Or in |
14
|
|
|
|
|
|
|
general to set or modify current arguments. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Master template: |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
<%Page path="/bits/image-template" NAME="abc"%> |
19
|
|
|
|
|
|
|
<%Page path="/bits/image-template" NAME="def" WIDTH=123%> |
20
|
|
|
|
|
|
|
<%Page path="/bits/image-template" NAME="efg" HEIGHT=432%> |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
/bits/image-template: |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
<%SetArg name="WIDTH" value="999"%> |
25
|
|
|
|
|
|
|
<%SetArg name="HEIGHT" value="777"%> |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Actual output would be: |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
I Because of extra new-line characters in the template after both |
35
|
|
|
|
|
|
|
SetArg lines actual output would be slightly different. Pay attention to |
36
|
|
|
|
|
|
|
this if your HTML code is space-sensitive. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
By default it does not override existing values. Use non-zero "override" |
39
|
|
|
|
|
|
|
argument to override. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 METHODS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
No publicly available methods except overriden display() method. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
############################################################################### |
48
|
|
|
|
|
|
|
package XAO::DO::Web::SetArg; |
49
|
5
|
|
|
5
|
|
3480
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
135
|
|
50
|
5
|
|
|
5
|
|
25
|
use Error; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
40
|
|
51
|
5
|
|
|
5
|
|
255
|
use XAO::Utils; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
305
|
|
52
|
5
|
|
|
5
|
|
29
|
use XAO::Errors qw(XAO::DO::Web::SetArg); |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
47
|
|
53
|
5
|
|
|
5
|
|
1775
|
use XAO::Objects; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
127
|
|
54
|
5
|
|
|
5
|
|
22
|
use base XAO::Objects->load(objname => 'Web::Page'); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
21
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
our $VERSION='2.002'; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
############################################################################### |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Setting arguments. Actual merging is done in Page object. We just set |
61
|
|
|
|
|
|
|
# merge_args here. |
62
|
|
|
|
|
|
|
# |
63
|
|
|
|
|
|
|
sub display ($;%) { |
64
|
213
|
|
|
213
|
1
|
346
|
my $self=shift; |
65
|
213
|
|
|
|
|
439
|
my $args=get_args(\@_); |
66
|
|
|
|
|
|
|
|
67
|
213
|
|
33
|
|
|
1724
|
my $name=$args->{'name'} || |
68
|
|
|
|
|
|
|
throw XAO::E::DO::Web::SetArg |
69
|
|
|
|
|
|
|
"display - pointless without 'name' argument"; |
70
|
|
|
|
|
|
|
|
71
|
213
|
50
|
|
|
|
458
|
my $value=defined($args->{'value'}) ? $args->{'value'} : "on"; |
72
|
|
|
|
|
|
|
|
73
|
213
|
|
33
|
|
|
381
|
my $parent=$self->{'parent'} || |
74
|
|
|
|
|
|
|
throw $self 'display - SetArg is pointless when orphan'; |
75
|
|
|
|
|
|
|
|
76
|
213
|
100
|
100
|
|
|
531
|
return if defined($parent->{'args'}->{$name}) && !$args->{'override'}; |
77
|
|
|
|
|
|
|
|
78
|
181
|
|
|
|
|
617
|
$parent->{'merge_args'}->{$name}=$value; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
############################################################################### |
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
__END__ |