line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gantry::Utils::HTML; |
2
|
|
|
|
|
|
|
require Exporter; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
1049
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
99
|
|
5
|
3
|
|
|
3
|
|
36
|
use Carp qw( croak ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
155
|
|
6
|
3
|
|
|
3
|
|
17
|
use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS ); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
6941
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
############################################################ |
9
|
|
|
|
|
|
|
# Variables # |
10
|
|
|
|
|
|
|
############################################################ |
11
|
|
|
|
|
|
|
@ISA = qw( Exporter ); |
12
|
|
|
|
|
|
|
@EXPORT = qw(); |
13
|
|
|
|
|
|
|
@EXPORT_OK = qw( ht_a |
14
|
|
|
|
|
|
|
ht_b ht_br |
15
|
|
|
|
|
|
|
ht_checkbox |
16
|
|
|
|
|
|
|
ht_div ht_udiv |
17
|
|
|
|
|
|
|
ht_form ht_form_js |
18
|
|
|
|
|
|
|
ht_h |
19
|
|
|
|
|
|
|
ht_help |
20
|
|
|
|
|
|
|
ht_i ht_img ht_input |
21
|
|
|
|
|
|
|
ht_lines |
22
|
|
|
|
|
|
|
ht_p ht_popup |
23
|
|
|
|
|
|
|
ht_qt |
24
|
|
|
|
|
|
|
ht_radio |
25
|
|
|
|
|
|
|
ht_select ht_submit |
26
|
|
|
|
|
|
|
ht_table ht_tr ht_td ht_utd |
27
|
|
|
|
|
|
|
ht_uform ht_up ht_uqt ht_utable ht_utr ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
%EXPORT_TAGS =( 'common' => [qw/ ht_a ht_br ht_img ht_lines ht_qt ht_uqt/ ], |
30
|
|
|
|
|
|
|
'style' => [qw/ ht_div ht_udiv ht_b ht_h ht_i ht_p ht_up/], |
31
|
|
|
|
|
|
|
'form' => [qw/ ht_checkbox ht_form ht_form_js |
32
|
|
|
|
|
|
|
ht_input ht_radio ht_select |
33
|
|
|
|
|
|
|
ht_submit ht_uform / ], |
34
|
|
|
|
|
|
|
'table' => [qw/ ht_table ht_tr ht_td ht_utd ht_utr |
35
|
|
|
|
|
|
|
ht_utable / ], |
36
|
|
|
|
|
|
|
'jscript' => [qw/ ht_help ht_popup / ], |
37
|
|
|
|
|
|
|
'all' => [qw/ ht_a |
38
|
|
|
|
|
|
|
ht_div ht_udiv |
39
|
|
|
|
|
|
|
ht_b ht_br |
40
|
|
|
|
|
|
|
ht_checkbox |
41
|
|
|
|
|
|
|
ht_form ht_form_js |
42
|
|
|
|
|
|
|
ht_h |
43
|
|
|
|
|
|
|
ht_help |
44
|
|
|
|
|
|
|
ht_i ht_img ht_input |
45
|
|
|
|
|
|
|
ht_lines |
46
|
|
|
|
|
|
|
ht_p ht_popup |
47
|
|
|
|
|
|
|
ht_qt |
48
|
|
|
|
|
|
|
ht_radio |
49
|
|
|
|
|
|
|
ht_select ht_submit |
50
|
|
|
|
|
|
|
ht_table ht_tr ht_td ht_utd |
51
|
|
|
|
|
|
|
ht_uform ht_up ht_uqt ht_utable ht_utr / ]); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
############################################################ |
54
|
|
|
|
|
|
|
# Functions # |
55
|
|
|
|
|
|
|
############################################################ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
#------------------------------------------------- |
58
|
|
|
|
|
|
|
# ht_a( $url, $text, @extras ) |
59
|
|
|
|
|
|
|
#------------------------------------------------- |
60
|
|
|
|
|
|
|
sub ht_a { |
61
|
0
|
|
|
0
|
1
|
|
my ( $url, $text, @extras ) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return( join( ' ', qq!$text! ) ); |
64
|
|
|
|
|
|
|
} # END ht_a |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
#------------------------------------------------- |
67
|
|
|
|
|
|
|
# ht_b( @inside ) |
68
|
|
|
|
|
|
|
#------------------------------------------------- |
69
|
|
|
|
|
|
|
sub ht_b { |
70
|
0
|
|
|
0
|
1
|
|
return( join( '', '', @_, '' ) ); |
71
|
|
|
|
|
|
|
} # END ht_b |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#------------------------------------------------- |
74
|
|
|
|
|
|
|
# ht_br() |
75
|
|
|
|
|
|
|
#------------------------------------------------- |
76
|
|
|
|
|
|
|
sub ht_br { |
77
|
0
|
|
|
0
|
1
|
|
return( ' ' ); |
78
|
|
|
|
|
|
|
} # END ht_br |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#------------------------------------------------- |
81
|
|
|
|
|
|
|
# ht_div( $options, @data ) |
82
|
|
|
|
|
|
|
#------------------------------------------------- |
83
|
|
|
|
|
|
|
sub ht_div { |
84
|
0
|
|
|
0
|
1
|
|
my ( $options, @data ) = @_; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my @params = ( '
|
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
for my $option ( keys %{$options} ) { |
|
0
|
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
next if ( ! defined $$options{$option} ); |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
push( @params, qq!$option="$$options{$option}"! ); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
if ( scalar( @data ) > 0 ) { |
95
|
0
|
|
|
|
|
|
return( join( ' ', @params, '>' ), @data, '' ); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
return( join( ' ', @params, '>' ) ); |
99
|
|
|
|
|
|
|
} # END ht_div |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
#------------------------------------------------- |
102
|
|
|
|
|
|
|
# ht_udiv( ) |
103
|
|
|
|
|
|
|
#------------------------------------------------- |
104
|
|
|
|
|
|
|
sub ht_udiv { |
105
|
0
|
|
|
0
|
1
|
|
return( '' ); |
106
|
|
|
|
|
|
|
} # END ht_udiv |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# START alphabetizing here. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
#------------------------------------------------- |
111
|
|
|
|
|
|
|
# ht_qt( $string ) |
112
|
|
|
|
|
|
|
#------------------------------------------------- |
113
|
|
|
|
|
|
|
sub ht_qt { |
114
|
0
|
|
0
|
0
|
1
|
|
my $string = shift || ''; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# This removes possibly unsafe characters from this to be outputted. |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
$string =~ s/&/&/g; |
119
|
0
|
|
|
|
|
|
$string =~ s/"/"/g; |
120
|
0
|
|
|
|
|
|
$string =~ s/</g; |
121
|
0
|
|
|
|
|
|
$string =~ s/>/>/g; |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
return( $string ); |
124
|
|
|
|
|
|
|
} # END of ht_qt |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
#------------------------------------------------- |
127
|
|
|
|
|
|
|
# ht_uqt |
128
|
|
|
|
|
|
|
#------------------------------------------------- |
129
|
|
|
|
|
|
|
sub ht_uqt { |
130
|
0
|
|
|
0
|
1
|
|
my $string = shift; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# Puts the bad characters back, for editing. |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
$string =~ s/"/"/g; |
135
|
0
|
|
|
|
|
|
$string =~ s/</
|
136
|
0
|
|
|
|
|
|
$string =~ s/>/>/g; |
137
|
0
|
|
|
|
|
|
$string =~ s/&/&/g; |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
return( $string ); |
140
|
|
|
|
|
|
|
} # END of ht_qt |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
#------------------------------------------------- |
143
|
|
|
|
|
|
|
# ht_lines( @lines ) |
144
|
|
|
|
|
|
|
#------------------------------------------------- |
145
|
|
|
|
|
|
|
sub ht_lines { |
146
|
0
|
|
|
0
|
1
|
|
return( join( "\n", @_, "\n" ) ); |
147
|
|
|
|
|
|
|
} # END ht_lines |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
#------------------------------------------------- |
150
|
|
|
|
|
|
|
# ht_img( $url, @extras ) |
151
|
|
|
|
|
|
|
#------------------------------------------------- |
152
|
|
|
|
|
|
|
sub ht_img { |
153
|
0
|
|
|
0
|
1
|
|
my ( $url, @extra ) = @_; |
154
|
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
|
return( join( ' ', qq!' ) ); |
156
|
|
|
|
|
|
|
} # END ht_img |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
#------------------------------------------------- |
159
|
|
|
|
|
|
|
# ht_p() |
160
|
|
|
|
|
|
|
#------------------------------------------------- |
161
|
|
|
|
|
|
|
sub ht_p { |
162
|
0
|
|
|
0
|
1
|
|
return( ' ' ); |
163
|
|
|
|
|
|
|
} # END ht_p |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
#------------------------------------------------- |
166
|
|
|
|
|
|
|
# ht_up() |
167
|
|
|
|
|
|
|
#------------------------------------------------- |
168
|
|
|
|
|
|
|
sub ht_up { |
169
|
0
|
|
|
0
|
1
|
|
return( '' ); |
170
|
|
|
|
|
|
|
} # END ht_up |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
#------------------------------------------------- |
173
|
|
|
|
|
|
|
# ht_i( @inside ) |
174
|
|
|
|
|
|
|
#------------------------------------------------- |
175
|
|
|
|
|
|
|
sub ht_i { |
176
|
0
|
|
|
0
|
1
|
|
return( join( '', '', @_, '' ) ); |
177
|
|
|
|
|
|
|
} # END ht_i |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
#------------------------------------------------- |
180
|
|
|
|
|
|
|
# ht_h( $level, @text ) |
181
|
|
|
|
|
|
|
#------------------------------------------------- |
182
|
|
|
|
|
|
|
sub ht_h { |
183
|
0
|
|
|
0
|
1
|
|
my ( $level, @text ) = @_; |
184
|
|
|
|
|
|
|
|
185
|
0
|
0
|
0
|
|
|
|
$level = 3 if ( ( ! defined $level ) || ( $level eq '' ) ); |
186
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
|
return( join( '', "", @text, "" ) ); |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
} # END ht_h |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
#------------------------------------------------- |
192
|
|
|
|
|
|
|
# ht_form( $action, @params ) |
193
|
|
|
|
|
|
|
#------------------------------------------------- |
194
|
|
|
|
|
|
|
sub ht_form { |
195
|
0
|
|
|
0
|
1
|
|
my ( $action, @params ) = @_; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
# Starts a HTML form, check to make sure we have an action to |
198
|
|
|
|
|
|
|
# perform |
199
|
|
|
|
|
|
|
|
200
|
0
|
0
|
|
|
|
|
croak 'No action in ht_form()' if ( ! defined $action ); |
201
|
|
|
|
|
|
|
|
202
|
0
|
|
|
|
|
|
return( qq! |
203
|
|
|
|
|
|
|
join( ' ', @params ). '>' ); |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
} # END ht_form |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
#------------------------------------------------- |
208
|
|
|
|
|
|
|
# ht_form_js( $action, @params ) |
209
|
|
|
|
|
|
|
#------------------------------------------------- |
210
|
|
|
|
|
|
|
sub ht_form_js { |
211
|
0
|
|
|
0
|
1
|
|
my ( $action, @params ) = @_; |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
# This form inserts some JavaScript to make sure we handle the case |
214
|
|
|
|
|
|
|
# if someone clicks the submit button twice really quickly |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
# Take the js out of this and make it a ht_js function and get rid |
217
|
|
|
|
|
|
|
# of this routine ? |
218
|
|
|
|
|
|
|
|
219
|
0
|
0
|
|
|
|
|
croak 'No action in ht_form_js' if ( ! defined $action ); |
220
|
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
|
push( @params, 'onsubmit="return AntiClicker()"' ); |
222
|
|
|
|
|
|
|
|
223
|
0
|
|
|
|
|
|
return( q!!, |
235
|
|
|
|
|
|
|
qq! |
236
|
|
|
|
|
|
|
join( ' ', @params ) . ' > ' ); |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
} # END ht_form_js |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
#------------------------------------------------- |
241
|
|
|
|
|
|
|
# ht_uform() |
242
|
|
|
|
|
|
|
#------------------------------------------------- |
243
|
|
|
|
|
|
|
sub ht_uform () { |
244
|
0
|
|
|
0
|
1
|
|
return( '' ); |
245
|
|
|
|
|
|
|
} # END ht_uform |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
#------------------------------------------------- |
248
|
|
|
|
|
|
|
# ht_input( $name, $type, $vals, @params ) |
249
|
|
|
|
|
|
|
#------------------------------------------------- |
250
|
|
|
|
|
|
|
sub ht_input { |
251
|
0
|
|
|
0
|
1
|
|
my ( $name, $type, $vals, @params ) = @_; |
252
|
|
|
|
|
|
|
|
253
|
0
|
|
|
|
|
|
my $in = ''; |
254
|
|
|
|
|
|
|
|
255
|
0
|
0
|
0
|
|
|
|
if ( ref( $vals ) eq 'HASH' || ref( $vals ) eq 'Apache::Request::Table' ) { |
256
|
0
|
0
|
|
|
|
|
$in = ( exists $vals->{$name} ) ? $vals->{$name} : ''; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
else { |
259
|
0
|
0
|
|
|
|
|
$in = ( defined $vals ) ? $vals : '' ; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
0
|
|
|
|
|
|
$in = ht_qt( $in ); |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
# Handle text areas |
265
|
0
|
0
|
|
|
|
|
if ( $type =~ /^textarea$/i ) { |
266
|
0
|
|
|
|
|
|
return( join( ' ', " |
267
|
|
|
|
|
|
|
">$in" ); |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
0
|
|
|
|
|
|
my $params = join( ' ', @params ); |
271
|
0
|
0
|
|
|
|
|
$params = '' if ( $params =~ /^\s+$/ ); |
272
|
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
return( qq!! ); #/ |
274
|
|
|
|
|
|
|
} # END ht_input |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
#------------------------------------------------- |
277
|
|
|
|
|
|
|
# ht_checkbox( $name, $value, $checked, @params ) |
278
|
|
|
|
|
|
|
#------------------------------------------------- |
279
|
|
|
|
|
|
|
sub ht_checkbox { |
280
|
0
|
|
|
0
|
1
|
|
my ( $name, $value, $check, @params ) = @_; |
281
|
|
|
|
|
|
|
|
282
|
0
|
|
|
|
|
|
my $in = ''; |
283
|
|
|
|
|
|
|
|
284
|
0
|
0
|
0
|
|
|
|
if ( ref( $check ) eq 'HASH' || ref($check) eq 'Apache::Request::Table' ) { |
285
|
0
|
0
|
|
|
|
|
$in = ( exists $check->{$name} ) ? $check->{$name} : ''; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
else { |
288
|
0
|
0
|
|
|
|
|
$in = ( defined $check ) ? $check : '' ; |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
0
|
0
|
|
|
|
|
my $chk = ( $value eq $in ) ? 'checked="checked"' : ''; |
292
|
0
|
|
|
|
|
|
my $params = join( ' ', @params ); |
293
|
0
|
0
|
0
|
|
|
|
$params = '' if ( ! defined $params || $params =~ /^\s+$/ ); |
294
|
|
|
|
|
|
|
|
295
|
0
|
|
|
|
|
|
return( qq!
|
296
|
|
|
|
|
|
|
qq!$params />! ); #/ |
297
|
|
|
|
|
|
|
} # END ht_checkbox |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
#------------------------------------------------- |
300
|
|
|
|
|
|
|
# ht_radio( $name, $value, $checked, @params ) |
301
|
|
|
|
|
|
|
#------------------------------------------------- |
302
|
|
|
|
|
|
|
sub ht_radio { |
303
|
0
|
|
|
0
|
1
|
|
my ( $name, $value, $check, @params ) = @_; |
304
|
|
|
|
|
|
|
|
305
|
0
|
|
|
|
|
|
my $in = ''; |
306
|
|
|
|
|
|
|
|
307
|
0
|
0
|
0
|
|
|
|
if ( ref( $check ) eq 'HASH' || ref( $check ) eq 'Apache::Request::Table' ) { |
308
|
0
|
0
|
|
|
|
|
$in = ( exists $check->{$name} ) ? $check->{$name} : ''; |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
else { |
311
|
0
|
0
|
|
|
|
|
$in = ( defined $check ) ? $check : '' ; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
0
|
0
|
|
|
|
|
my $chk = ( $value eq $in ) ? 'checked="checked"' : ''; |
315
|
0
|
|
|
|
|
|
my $params = join( ' ', @params ); |
316
|
0
|
0
|
0
|
|
|
|
$params = '' if ( ! defined $params || $params =~ /^\s+$/ ); |
317
|
|
|
|
|
|
|
|
318
|
0
|
|
|
|
|
|
return( qq!
|
319
|
|
|
|
|
|
|
qq!$params />! ); #/ |
320
|
|
|
|
|
|
|
} # END ht_radio |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
#------------------------------------------------- |
323
|
|
|
|
|
|
|
# ht_select( $name, $size, $value, @items ) |
324
|
|
|
|
|
|
|
#------------------------------------------------- |
325
|
|
|
|
|
|
|
sub ht_select { |
326
|
0
|
|
|
0
|
1
|
|
my ( $name, $size, $vals, $multiple, $opts, @items ) = @_; |
327
|
|
|
|
|
|
|
|
328
|
0
|
|
|
|
|
|
my ( @names, $lines ); |
329
|
|
|
|
|
|
|
|
330
|
0
|
|
|
|
|
|
my $value = ''; |
331
|
0
|
0
|
|
|
|
|
$opts = '' if ( ! defined $opts ); |
332
|
|
|
|
|
|
|
|
333
|
0
|
0
|
0
|
|
|
|
if ( ref( $vals ) eq 'HASH' || ref( $vals ) eq 'Apache::Request::Table' ) { |
334
|
0
|
0
|
|
|
|
|
$value = ( exists $vals->{$name} ) ? $vals->{$name} : ''; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
else { |
337
|
0
|
0
|
|
|
|
|
$value = ( defined $vals ) ? $vals : '' ; |
338
|
|
|
|
|
|
|
} |
339
|
|
|
|
|
|
|
|
340
|
0
|
|
|
|
|
|
while ( @items ) { |
341
|
0
|
|
|
|
|
|
my $opt_value = shift( @items ); |
342
|
0
|
|
|
|
|
|
my $opt_name = shift( @items ); |
343
|
|
|
|
|
|
|
|
344
|
0
|
0
|
|
|
|
|
my $sltd = ( $opt_value eq $value ) ? ' selected' : ''; |
345
|
|
|
|
|
|
|
|
346
|
0
|
|
|
|
|
|
$lines .= qq!\n!; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
0
|
0
|
0
|
|
|
|
$multiple = ( ( defined $multiple && $multiple ) ? ' MULTIPLE ' : ' ' ); |
350
|
|
|
|
|
|
|
|
351
|
0
|
|
|
|
|
|
return( qq! |
352
|
|
|
|
|
|
|
$lines, '' ); |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
} # END ht_select |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
#------------------------------------------------- |
357
|
|
|
|
|
|
|
# ht_submit( $name, $value ) |
358
|
|
|
|
|
|
|
#------------------------------------------------- |
359
|
|
|
|
|
|
|
sub ht_submit { |
360
|
0
|
|
|
0
|
1
|
|
my ( $name, $value ) = @_; |
361
|
|
|
|
|
|
|
|
362
|
0
|
|
|
|
|
|
return( qq!! ); #/ |
363
|
|
|
|
|
|
|
} # END ht_submit |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
#------------------------------------------------- |
366
|
|
|
|
|
|
|
# ht_help( $help_root, $type, $ident ) |
367
|
|
|
|
|
|
|
#------------------------------------------------- |
368
|
|
|
|
|
|
|
sub ht_help { |
369
|
0
|
|
|
0
|
1
|
|
my ( $help_root, $type, $ident ) = @_; |
370
|
|
|
|
|
|
|
|
371
|
0
|
0
|
0
|
|
|
|
$type = ( defined $type && $type =~ /cat/ ) ? 'category' : 'item'; |
372
|
0
|
|
|
|
|
|
my $url = "$help_root/$type/$ident"; |
373
|
|
|
|
|
|
|
|
374
|
0
|
|
|
|
|
|
return( join( '', '[', |
375
|
|
|
|
|
|
|
ht_a( 'javascript://', ' ? ', |
376
|
|
|
|
|
|
|
qq!onClick="window.open('$url', 'helpwindow', !, |
377
|
|
|
|
|
|
|
q! 'height=300,width=400' + !, |
378
|
|
|
|
|
|
|
q! ',screenX=' + (window.screenX+150) + !, |
379
|
|
|
|
|
|
|
q! ',screenY=' + (window.screenY+100) + !, |
380
|
|
|
|
|
|
|
q! ',scrollbars,resizable' );"!, |
381
|
|
|
|
|
|
|
'class="help"' ), |
382
|
|
|
|
|
|
|
']' ) ); |
383
|
|
|
|
|
|
|
} # END ht_help |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
#------------------------------------------------- |
386
|
|
|
|
|
|
|
# ht_popup( $url, $text, $winname, $x, $y ) |
387
|
|
|
|
|
|
|
#------------------------------------------------- |
388
|
|
|
|
|
|
|
sub ht_popup { |
389
|
0
|
|
|
0
|
1
|
|
my ( $url, $text, $winname, $height, $width ) = @_; |
390
|
|
|
|
|
|
|
|
391
|
0
|
0
|
|
|
|
|
$height = '250' if ( ! defined $height ); |
392
|
0
|
0
|
|
|
|
|
$width = '250' if ( ! defined $width ); |
393
|
|
|
|
|
|
|
|
394
|
0
|
|
|
|
|
|
return( ht_a( 'javascript://', $text, |
395
|
|
|
|
|
|
|
qq!onClick="window.open('$url', '$winname', !, |
396
|
|
|
|
|
|
|
qq! 'height=$height,width=$width' + !, |
397
|
|
|
|
|
|
|
q! ',screenX=' + (window.screenX+150) + !, |
398
|
|
|
|
|
|
|
q! ',screenY=' + (window.screenY+100) + !, |
399
|
|
|
|
|
|
|
q! ',scrollbars,resizable' );"! ) ); |
400
|
|
|
|
|
|
|
} # END ht_popup |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
#------------------------------------------------- |
403
|
|
|
|
|
|
|
# ht_table( $options ) |
404
|
|
|
|
|
|
|
#------------------------------------------------- |
405
|
|
|
|
|
|
|
sub ht_table { |
406
|
0
|
|
|
0
|
1
|
|
my $options = shift; |
407
|
|
|
|
|
|
|
|
408
|
0
|
|
|
|
|
|
my @params; |
409
|
|
|
|
|
|
|
|
410
|
0
|
|
|
|
|
|
for my $option ( keys %{$options} ) { |
|
0
|
|
|
|
|
|
|
411
|
0
|
|
|
|
|
|
push( @params, "$option='$$options{$option}'" ); |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
|
414
|
0
|
|
|
|
|
|
return( join( ' ', '' ) );
415
|
|
|
|
|
|
|
} # END ht_table |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
#------------------------------------------------- |
418
|
|
|
|
|
|
|
# ht_tr( $options ) |
419
|
|
|
|
|
|
|
#------------------------------------------------- |
420
|
|
|
|
|
|
|
sub ht_tr { |
421
|
0
|
|
|
0
|
1
|
|
my $options = shift; |
422
|
|
|
|
|
|
|
|
423
|
0
|
|
|
|
|
|
my @params; |
424
|
|
|
|
|
|
|
|
425
|
0
|
|
|
|
|
|
for my $option ( keys %{$options} ) { |
|
0
|
|
|
|
|
|
|
426
|
0
|
|
|
|
|
|
push( @params, "$option='$$options{$option}'" ); |
427
|
|
|
|
|
|
|
} |
428
|
|
|
|
|
|
|
|
429
|
0
|
|
|
|
|
|
return( join( ' ', ' | ' ) );
430
|
|
|
|
|
|
|
} # END ht_tr |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
#------------------------------------------------- |
433
|
|
|
|
|
|
|
# ht_td( $options, @data ) |
434
|
|
|
|
|
|
|
#------------------------------------------------- |
435
|
|
|
|
|
|
|
sub ht_td { |
436
|
0
|
|
|
0
|
1
|
|
my ( $options, @data ) = @_; |
437
|
|
|
|
|
|
|
|
438
|
0
|
|
|
|
|
|
my @params; |
439
|
|
|
|
|
|
|
|
440
|
0
|
|
|
|
|
|
for my $option ( keys %{$options} ) { |
|
0
|
|
|
|
|
|
|
441
|
0
|
0
|
|
|
|
|
if ( $option !~ /nowrap/i ) { |
442
|
0
|
|
|
|
|
|
push( @params, qq!$option="$$options{$option}"! ); |
443
|
|
|
|
|
|
|
} |
444
|
|
|
|
|
|
|
else { |
445
|
0
|
|
|
|
|
|
push( @params, 'NOWRAP' ); |
446
|
|
|
|
|
|
|
} |
447
|
|
|
|
|
|
|
} |
448
|
|
|
|
|
|
|
|
449
|
0
|
0
|
|
|
|
|
if ( scalar( @data ) > 0 ) { |
450
|
0
|
|
|
|
|
|
return( join( ' ', ' | ' ), @data, ' | ' );
451
|
|
|
|
|
|
|
} |
452
|
|
|
|
|
|
|
|
453
|
0
|
|
|
|
|
|
return( join( ' ', ' | ' ) ); |
454
|
|
|
|
|
|
|
} # END ht_td |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
#------------------------------------------------- |
457
|
|
|
|
|
|
|
# ht_utd() |
458
|
|
|
|
|
|
|
#------------------------------------------------- |
459
|
|
|
|
|
|
|
sub ht_utd () { |
460
|
0
|
|
|
0
|
1
|
|
return( ' | ' );
461
|
|
|
|
|
|
|
} # END ht_utr |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
#------------------------------------------------- |
464
|
|
|
|
|
|
|
# ht_utr() |
465
|
|
|
|
|
|
|
#------------------------------------------------- |
466
|
|
|
|
|
|
|
sub ht_utr () { |
467
|
0
|
|
|
0
|
1
|
|
return( ' | ' );
468
|
|
|
|
|
|
|
} # END ht_utr |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
#------------------------------------------------- |
471
|
|
|
|
|
|
|
# ht_utable() |
472
|
|
|
|
|
|
|
#------------------------------------------------- |
473
|
|
|
|
|
|
|
sub ht_utable () { |
474
|
0
|
|
|
0
|
1
|
|
return( ' | ' ); |
475
|
|
|
|
|
|
|
} # END ht_utable |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
# EOF |
478
|
|
|
|
|
|
|
1; |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
__END__ |