| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CGI::AppBuilder::Frame; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Perl standard modules |
|
4
|
1
|
|
|
1
|
|
28236
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
48
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
6
|
1
|
|
|
1
|
|
3317
|
use Getopt::Std; |
|
|
1
|
|
|
|
|
59
|
|
|
|
1
|
|
|
|
|
74
|
|
|
7
|
1
|
|
|
1
|
|
948
|
use POSIX qw(strftime); |
|
|
1
|
|
|
|
|
9421
|
|
|
|
1
|
|
|
|
|
8
|
|
|
8
|
1
|
|
|
1
|
|
1492
|
use Carp; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
178
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = 0.10; |
|
11
|
|
|
|
|
|
|
require Exporter; |
|
12
|
|
|
|
|
|
|
our @ISA = qw(Exporter CGI::AppBuilder); |
|
13
|
|
|
|
|
|
|
our @EXPORT = qw(); |
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(frame_set frameset |
|
15
|
|
|
|
|
|
|
); |
|
16
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
|
17
|
|
|
|
|
|
|
frame => [qw(frame_set frameset)], |
|
18
|
|
|
|
|
|
|
all => [@EXPORT_OK] |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
1970
|
use CGI::AppBuilder; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use CGI::AppBuilder::Message qw(:all); |
|
23
|
|
|
|
|
|
|
use CGI::AppBuilder::Table qw(:all); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
CGI::AppBuilder::Frame - Configuration initializer |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use CGI::AppBuilder::Frame; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $ab = CGI::AppBuilder::Frame->new( |
|
34
|
|
|
|
|
|
|
'ifn', 'my_init.cfg', 'opt', 'vhS:a:'); |
|
35
|
|
|
|
|
|
|
my ($q, $ar, $ar_log) = $ab->start_app($0, \%ARGV); |
|
36
|
|
|
|
|
|
|
print $ab->disp_form($q, $ar); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This class provides methods for reading and parsing configuration |
|
41
|
|
|
|
|
|
|
files. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 new (ifn => 'file.cfg', opt => 'hvS:') |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This is a inherited method from CGI::AppBuilder. See the same method |
|
48
|
|
|
|
|
|
|
in CGI::AppBuilder for more details. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub new { |
|
53
|
|
|
|
|
|
|
my ($s, %args) = @_; |
|
54
|
|
|
|
|
|
|
return $s->SUPER::new(%args); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 frame_set ($fr, $pr) |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Input variables: |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$fr - frame set definiton array reference. The $fr contains two |
|
62
|
|
|
|
|
|
|
elements [$hr, $ar]: |
|
63
|
|
|
|
|
|
|
$hr - a hash ref containing the frame set attributes |
|
64
|
|
|
|
|
|
|
$ar - a array ref containing hash references defining each |
|
65
|
|
|
|
|
|
|
frames in the frame set. |
|
66
|
|
|
|
|
|
|
$pr - tag attribute array ref. It contains three elements: |
|
67
|
|
|
|
|
|
|
class - CSS class name |
|
68
|
|
|
|
|
|
|
attr - attribute string such as 'width=5 onChange=js_func' |
|
69
|
|
|
|
|
|
|
hr - hash ref with key and value pairs. This will be obtained |
|
70
|
|
|
|
|
|
|
from $fr for each frame set and frame. |
|
71
|
|
|
|
|
|
|
pretty - whether to add line breaks |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Variables used or methods called: |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
CGI::AppBuilder::Table |
|
76
|
|
|
|
|
|
|
html_tag - generate HTML tags |
|
77
|
|
|
|
|
|
|
CGI::AppBuilder::Message |
|
78
|
|
|
|
|
|
|
echo_msg - display message |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
How to use: |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The following shows how to define the frame array ($fr): |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
+-+----+ The following defines the left layout: |
|
85
|
|
|
|
|
|
|
| | T | |
|
86
|
|
|
|
|
|
|
| +----+ [{cols=>"150,*"},[ |
|
87
|
|
|
|
|
|
|
| | | {src=>"left.htm",name=>"L"}, |
|
88
|
|
|
|
|
|
|
|L| C | [{rows=>"100,*,50"},[ |
|
89
|
|
|
|
|
|
|
| | | {src=>"top.htm",name=>"T"}, |
|
90
|
|
|
|
|
|
|
| |----| {src=>"main.htm",name=>"C"}, |
|
91
|
|
|
|
|
|
|
| | B | {src=>"bottom.htm",name=>"B"}]]] |
|
92
|
|
|
|
|
|
|
+-+----+ ] |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
In YAML, here is how it looks like: |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
--- |
|
97
|
|
|
|
|
|
|
cols: 150,\* |
|
98
|
|
|
|
|
|
|
- src: left.htm |
|
99
|
|
|
|
|
|
|
name: L |
|
100
|
|
|
|
|
|
|
- rows: 100,\*,50 |
|
101
|
|
|
|
|
|
|
- src: top.htm |
|
102
|
|
|
|
|
|
|
name: T |
|
103
|
|
|
|
|
|
|
- src: main.htm |
|
104
|
|
|
|
|
|
|
name: C |
|
105
|
|
|
|
|
|
|
- src: bottom.htm |
|
106
|
|
|
|
|
|
|
name: B |
|
107
|
|
|
|
|
|
|
... |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
+-+------+ The following defines the left layout: |
|
110
|
|
|
|
|
|
|
| | T | |
|
111
|
|
|
|
|
|
|
| +----+-+ [{cols=>"150,*"},[ |
|
112
|
|
|
|
|
|
|
| | | | {src=>"left.htm",name=>"L"}, |
|
113
|
|
|
|
|
|
|
|L| C |R| [{rows=>"100,*,50"},[ |
|
114
|
|
|
|
|
|
|
| | | | {src=>"top.htm",name=>"T"}, |
|
115
|
|
|
|
|
|
|
| | | | [{cols=>"*,100"},[ |
|
116
|
|
|
|
|
|
|
| |----+-+ {src=>"main.htm",name=>"C"}, |
|
117
|
|
|
|
|
|
|
| | | {src=>"right.htm",name=>"R"}] ] ], |
|
118
|
|
|
|
|
|
|
| | B | {src=>"bottom.htm",name=>"B"}]] |
|
119
|
|
|
|
|
|
|
+-+----+-+ ] |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
In YAML, here is how it looks like: |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
--- |
|
124
|
|
|
|
|
|
|
cols: 150,\* |
|
125
|
|
|
|
|
|
|
- src: left.htm |
|
126
|
|
|
|
|
|
|
name: L |
|
127
|
|
|
|
|
|
|
- rows: 100,\*,50 |
|
128
|
|
|
|
|
|
|
- src: top.htm |
|
129
|
|
|
|
|
|
|
name: T |
|
130
|
|
|
|
|
|
|
- cols: \*,100 |
|
131
|
|
|
|
|
|
|
- src: main.htm |
|
132
|
|
|
|
|
|
|
name: C |
|
133
|
|
|
|
|
|
|
- src: right.htm |
|
134
|
|
|
|
|
|
|
name: R |
|
135
|
|
|
|
|
|
|
- src: bottom.htm |
|
136
|
|
|
|
|
|
|
name: B |
|
137
|
|
|
|
|
|
|
... |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Here is the testing codes: |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
my $fr = [{cols=>"150,*"},[ |
|
142
|
|
|
|
|
|
|
{src=>"left.htm",name=>"L"}, |
|
143
|
|
|
|
|
|
|
[{rows=>"100,*,50"},[ |
|
144
|
|
|
|
|
|
|
{src=>"top.htm",name=>"T"}, |
|
145
|
|
|
|
|
|
|
{src=>"main.htm",name=>"C"}, |
|
146
|
|
|
|
|
|
|
{src=>"bottom.htm",name=>"B"}] |
|
147
|
|
|
|
|
|
|
]] |
|
148
|
|
|
|
|
|
|
]; |
|
149
|
|
|
|
|
|
|
my $pr = {pretty=>1}; |
|
150
|
|
|
|
|
|
|
print $obj->frame_set($fr,$pr); |
|
151
|
|
|
|
|
|
|
# the following is the result: |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
$pr->{_frameset_count} = 0; # reset frame set counter |
|
163
|
|
|
|
|
|
|
my $f2 = [ {cols=>"150,*"},[ |
|
164
|
|
|
|
|
|
|
{src=>"left.htm",name=>"L"}, |
|
165
|
|
|
|
|
|
|
[{rows=>"100,*,50"},[ |
|
166
|
|
|
|
|
|
|
{src=>"top.htm",name=>"T"}, |
|
167
|
|
|
|
|
|
|
[{cols=>"*,100"},[ |
|
168
|
|
|
|
|
|
|
{src=>"main.htm",name=>"C"}, |
|
169
|
|
|
|
|
|
|
{src=>"right.htm",name=>"R"}] |
|
170
|
|
|
|
|
|
|
], |
|
171
|
|
|
|
|
|
|
{src=>"bottom.htm",name=>"B"}] |
|
172
|
|
|
|
|
|
|
]] |
|
173
|
|
|
|
|
|
|
]; |
|
174
|
|
|
|
|
|
|
print $obj->frame_set($f2,$pr); |
|
175
|
|
|
|
|
|
|
# the following is the result: |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Return: HTML codes. |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
This method generates HTML codes based on the information provided. |
|
192
|
|
|
|
|
|
|
This method is also called frameset. |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
sub frameset { |
|
197
|
|
|
|
|
|
|
my $s = shift; |
|
198
|
|
|
|
|
|
|
return $s->frame_set(@_); |
|
199
|
|
|
|
|
|
|
} |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub frame_set { |
|
202
|
|
|
|
|
|
|
my $s = shift; |
|
203
|
|
|
|
|
|
|
my ($fr, $pr) = @_; |
|
204
|
|
|
|
|
|
|
$s->echo_msg("Frame set is not in ARRAY",1) |
|
205
|
|
|
|
|
|
|
if $fr && $fr !~ /ARRAY/; |
|
206
|
|
|
|
|
|
|
return if $fr && $fr !~ /ARRAY/; |
|
207
|
|
|
|
|
|
|
$pr = {} if ! defined($pr) || ! $pr; |
|
208
|
|
|
|
|
|
|
my ($p, $v) = (@$fr); |
|
209
|
|
|
|
|
|
|
$s->echo_msg("Frame set attribute is not defined.", 2) |
|
210
|
|
|
|
|
|
|
if ref($p) !~ /HASH/; |
|
211
|
|
|
|
|
|
|
$pr->{hr} = $p; |
|
212
|
|
|
|
|
|
|
++$pr->{_frameset_count}; |
|
213
|
|
|
|
|
|
|
my ($t,$idt) = ("", " "); |
|
214
|
|
|
|
|
|
|
$t .= $idt x ($pr->{_frameset_count}-1) if $pr->{_frameset_count}>1; |
|
215
|
|
|
|
|
|
|
$t .= $s->html_tag('frameset',$pr); |
|
216
|
|
|
|
|
|
|
# $t .= "\n" if exists $pr->{pretty} && $pr->{pretty}; |
|
217
|
|
|
|
|
|
|
foreach my $k (@$v) { |
|
218
|
|
|
|
|
|
|
$pr->{hr} = $k; |
|
219
|
|
|
|
|
|
|
if (ref($k) =~ /ARRAY/) { |
|
220
|
|
|
|
|
|
|
$t .= $s->frame_set($k,$pr); |
|
221
|
|
|
|
|
|
|
--$pr->{_frameset_count}; |
|
222
|
|
|
|
|
|
|
next; |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
$s->echo_msg("Frame attribute is not defined.", 2) |
|
225
|
|
|
|
|
|
|
if ref($k) !~ /HASH/; |
|
226
|
|
|
|
|
|
|
$t .= $idt x $pr->{_frameset_count}; |
|
227
|
|
|
|
|
|
|
$t .= $s->html_tag('frame',$pr); |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
if ($pr->{_frameset_count} > 1) { |
|
230
|
|
|
|
|
|
|
$t .= ($idt x ($pr->{_frameset_count}-1)) . "\n"; |
|
231
|
|
|
|
|
|
|
} else { |
|
232
|
|
|
|
|
|
|
$t .= "\n"; |
|
233
|
|
|
|
|
|
|
} |
|
234
|
|
|
|
|
|
|
return $t; |
|
235
|
|
|
|
|
|
|
} |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
1; |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head1 HISTORY |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=over 4 |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=item * Version 0.10 |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
This version includes the frame_set method. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item * Version 0.20 |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=cut |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head1 SEE ALSO (some of docs that I check often) |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Oracle::Loader, Oracle::Trigger, CGI::Getopt, File::Xcopy, |
|
254
|
|
|
|
|
|
|
CGI::AppBuilder, CGI::AppBuilder::Message, CGI::AppBuilder::Log, |
|
255
|
|
|
|
|
|
|
CGI::AppBuilder::Config, etc. |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head1 AUTHOR |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
Copyright (c) 2005 Hanming Tu. All rights reserved. |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
This package is free software and is provided "as is" without express |
|
262
|
|
|
|
|
|
|
or implied warranty. It may be used, redistributed and/or modified |
|
263
|
|
|
|
|
|
|
under the terms of the Perl Artistic License (see |
|
264
|
|
|
|
|
|
|
http://www.perl.com/perl/misc/Artistic.html) |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=cut |
|
267
|
|
|
|
|
|
|
|