line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::HTMLTable; |
2
|
|
|
|
|
|
|
$VERSION=0.24; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
@EXPORT_OK=qw(&HTMLTable &HTMLTableByRef); |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Table Options |
7
|
|
|
|
|
|
|
my @options = qw(caption nullfield rs fs); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# HTML 4.0 attributes for table tag. |
10
|
|
|
|
|
|
|
my @tableattribs = qw(align width cols id class dir title |
11
|
|
|
|
|
|
|
style onclick ondbclick onmousedown |
12
|
|
|
|
|
|
|
onmouseup onmouseover onmousemove |
13
|
|
|
|
|
|
|
onmouseout onkeypress onkeydown |
14
|
|
|
|
|
|
|
onkeyup bgcolor frame rules border |
15
|
|
|
|
|
|
|
cellspacing cellpadding); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $nullfield = ' '; |
18
|
|
|
|
|
|
|
my $rs = "\n"; |
19
|
|
|
|
|
|
|
my $fs = ","; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub HTMLTable { |
22
|
0
|
|
|
0
|
0
|
|
my ($data, @args) = @_; |
23
|
0
|
|
|
|
|
|
my ($i, $j, @cols, @theads, @trows, $thead,$topdatarow); |
24
|
0
|
|
|
|
|
|
&table_opts (@args); |
25
|
0
|
|
|
|
|
|
my @rows = split /$options->{rs}/, $data; |
26
|
0
|
|
|
|
|
|
@cols = split /$options->{fs}/, $rows[0]; |
27
|
0
|
|
|
|
|
|
$thead = $rows[0]; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $cols = $#cols; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $table = &table_tag; |
32
|
0
|
|
|
|
|
|
print $table."\n"; |
33
|
0
|
|
|
|
|
|
print qq|\n|; |
34
|
0
|
|
|
|
|
|
foreach my $row (@rows) { |
35
|
0
|
|
|
|
|
|
print qq| |
\n|;
36
|
0
|
|
|
|
|
|
my @trow = split /\,/, $row; |
37
|
0
|
|
|
|
|
|
foreach my $col (@trow) { |
38
|
0
|
|
|
|
|
|
print qq| | |; |
39
|
0
|
0
|
0
|
|
|
|
if ($col and length $col) { |
40
|
0
|
|
|
|
|
|
print $col; |
41
|
|
|
|
|
|
|
} else { |
42
|
0
|
|
|
|
|
|
print $options->{nullfield}; |
43
|
|
|
|
|
|
|
} |
44
|
0
|
|
|
|
|
|
print qq| | \n|;
45
|
|
|
|
|
|
|
} |
46
|
0
|
|
|
|
|
|
print qq| |
\n|;
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
print qq|\n|; |
49
|
0
|
|
|
|
|
|
print qq| |
\n|;