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
|
|
3949
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
156
|
|
50
|
5
|
|
|
5
|
|
47
|
use Error; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
42
|
|
51
|
5
|
|
|
5
|
|
282
|
use XAO::Utils; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
340
|
|
52
|
5
|
|
|
5
|
|
37
|
use XAO::Errors qw(XAO::DO::Web::SetArg); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
74
|
|
53
|
5
|
|
|
5
|
|
2134
|
use XAO::Objects; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
174
|
|
54
|
5
|
|
|
5
|
|
28
|
use base XAO::Objects->load(objname => 'Web::Page'); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
23
|
|
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
|
328
|
my $self=shift; |
65
|
213
|
|
|
|
|
486
|
my $args=get_args(\@_); |
66
|
|
|
|
|
|
|
|
67
|
213
|
|
33
|
|
|
2131
|
my $name=$args->{'name'} || |
68
|
|
|
|
|
|
|
throw XAO::E::DO::Web::SetArg |
69
|
|
|
|
|
|
|
"display - pointless without 'name' argument"; |
70
|
|
|
|
|
|
|
|
71
|
213
|
50
|
|
|
|
3281
|
my $value=defined($args->{'value'}) ? $args->{'value'} : "on"; |
72
|
|
|
|
|
|
|
|
73
|
213
|
|
33
|
|
|
439
|
my $parent=$self->{'parent'} || |
74
|
|
|
|
|
|
|
throw $self 'display - SetArg is pointless when orphan'; |
75
|
|
|
|
|
|
|
|
76
|
213
|
100
|
100
|
|
|
617
|
return if defined($parent->{'args'}->{$name}) && !$args->{'override'}; |
77
|
|
|
|
|
|
|
|
78
|
181
|
|
|
|
|
633
|
$parent->{'merge_args'}->{$name}=$value; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
############################################################################### |
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
__END__ |