Quiq/Html/FrameSet.pm

filter: Statementstmt 100% 34 / 34 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 95.7% 45 / 47 CC 5 SCAR 8.3
CC
5
Cov
95%
html
4.0
new
2.0
BEGIN
1.0
CRAP 2.3
« Quiq/PostgreSql/CopyFormat.pm ↑ Summary Quiq/Test/Class/Method.pm »
1 # -----------------------------------------------------------------------------
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 Quiq::Html::FrameSet - HTML-Frameset
8  
9 =head1 BASE CLASS
10  
11 L<Quiq::Html::Base>
12  
13 =head1 SYNOPSIS
14  
15 use Quiq::Html::FrameSet;
16
17 $h = Quiq::Html::Producer->new;
18
19 $obj = Quiq::Html::FrameSet->new(
20 comment => $comment,
21 frames => [{
22 size => $size,
23 title => $title,
24 url => $url,
25 },
26 ...
27 ],
28 orientation => $orientation,
29 title => $title,
30 );
31
32 $html = $obj->html($h);
33  
34 =head1 ATTRIBUTES
35  
36 =over 4
37  
38 =item comment => $comment (Default: undef))
39  
40 ]:
41 Kommentar am Anfang der Frameset-Seite.
42  
43 =item frames => \@frames (Default: [])
44  
45 Liste der Frameset-Zeilen bzw. -Kolumnen. Ein Element besitzt
46 folgende Attribute:
47  
48 =item orientation => $orientation (Default: 'v'
49  
50 Ob die Frames in Zeilen (orientation => 'v') oder Kolumnen
51  
52 (orientation => 'h') angeordnet werden sollen.
53
54 [name => $name (Default: '')]:
55 Bezeichnung des Frames..
56
57 [size => $size]:
58 Die Höhe bzw. Breite $size des Frames in Pixeln (Integer),
59 in Prozent ('N%') oder variabel ('*').
60
61 [url => $url]:
62 Der URL $url der Seite, die initial in den Frame geladen wird.
63  
64 =item title => $title (Default: '')
65  
66 Titel der Frameset-Seite.
67  
68 =back
69  
70 =cut
71  
72 # -----------------------------------------------------------------------------
73  
74 package Quiq::Html::FrameSet;
75 1 ▶use base qw/Quiq::Html::Base/;
Subroutine BEGIN: called CC=1 SCAR=0.0
76  
77 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
78 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
79 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
80  
81 1 our $VERSION = '1.240';
82  
83 1 ▶use Quiq::Hash;
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 # -----------------------------------------------------------------------------
86  
87 =head1 METHODS
88  
89 =head2 Konstruktor
90  
91 =head3 new() - Konstruktor
92  
93 =head4 Synopsis
94  
95 $obj = $class->new(@keyVal);
96  
97 =cut
98  
99 # -----------------------------------------------------------------------------
100  
101 1 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
102 1 my $class = shift;
103 # @_: @keyVal
104  
105 1 my $self = $class->SUPER::new(
106 border => 1,
107 comment => undef,
108 frames => [],
109 orientation => 'v',
110 title => '',
111 );
112 1 $self->set(@_);
113  
114 # Mache aus den Frame-Hashes Objekte mit den vorgegebenen Attributen
115  
116 1 for (@{$self->frames}) {
117 2 $_ = Quiq::Hash->new($_,
118 name => undef,
119 size => undef,
120 url => undef,
121 );
122 }
123  
124 1 return $self;
125 }
126  
127 # -----------------------------------------------------------------------------
128  
129 =head2 Objektmethoden
130  
131 =head3 html() - Generiere HTML
132  
133 =head4 Synopsis
134  
135 $html = $obj->html($h);
136 $html = $class->html($h,@keyVal);
137  
138 =cut
139  
140 # -----------------------------------------------------------------------------
141  
142 1 ▶sub html {
Subroutine html: called CC=4 SCAR=14.0
Pod documented
143 1 my $this = shift;
144 1 my $h = shift;
145  
146 1 ▶ my $self = ref $this? $this: $this->new(@_);
Branch: 1 branch
BranchTrueFalseTotal
ref $this ? : 0 1 1
147  
148 1 my ($border,$comment,$frameA,$orientation,$title) =
149 $self->get(qw/border comment frames orientation title/);
150  
151 my $html = $h->cat(
152 $h->doctype,
153 $h->comment(-nl=>2,$comment),
154 $h->tag('html',
155 '-',
156 $h->tag('head',
157 '-',
158 $h->tag('title',
159 -ignoreIf => !$title,
160 '-',
161 $title,
162 ),
163 ),
164 $h->tag('frameset',
165 border => $border,
166 ($orientation eq 'v'? 'rows': 'cols') =>
167 2 join(',',map {$_->size} @$frameA),
168 '-',
169 1 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$orientation eq 'v' ? : 1 0 1
170 1 my @arr;
171 1 for (@$frameA) {
172 2 push @arr,$h->tag('frame',
173 name => $_->name,
174 src => $_->url,
175 );
176 }
177 1 @arr;
178 },
179 ),
180 ),
181 );
182  
183 1 return $html;
184 }
185  
186 # -----------------------------------------------------------------------------
187  
188 =head1 VERSION
189  
190 1.240
191  
192 =head1 AUTHOR
193  
194 Frank Seitz, L<http://fseitz.de/>
195  
196 =head1 COPYRIGHT
197  
198 Copyright (C) 2026 Frank Seitz
199  
200 =head1 LICENSE
201  
202 This code is free software; you can redistribute it and/or modify
203 it under the same terms as Perl itself.
204  
205 =cut
206  
207 # -----------------------------------------------------------------------------
208  
209 1 1;
210  
211 # eof
« Quiq/PostgreSql/CopyFormat.pm ↑ Summary Quiq/Test/Class/Method.pm »