602
|
1 |
# Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
# All rights reserved.
|
|
3 |
# This component and the accompanying materials are made available
|
|
4 |
# under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
# which accompanies this distribution, and is available
|
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
#
|
|
8 |
# Initial Contributors:
|
|
9 |
# Nokia Corporation - initial contribution.
|
|
10 |
#
|
|
11 |
# Contributors:
|
|
12 |
#
|
|
13 |
# Description:
|
|
14 |
#
|
|
15 |
#
|
|
16 |
# Description:
|
|
17 |
# TableFormatter/Html.pm
|
|
18 |
#
|
|
19 |
|
|
20 |
package TableFormatter::Html;
|
|
21 |
|
|
22 |
use strict;
|
|
23 |
use Utils;
|
|
24 |
use TableFormatter;
|
|
25 |
use vars qw/@ISA/;
|
|
26 |
@ISA = qw(TableFormatter);
|
|
27 |
|
|
28 |
sub PrintTable {
|
|
29 |
my $self = shift;
|
|
30 |
my $data = shift;
|
|
31 |
my $hasHeader = shift;
|
|
32 |
|
|
33 |
my $location = Utils::PrependEpocRoot("\\epoc32\\relinfo\\temp-table.html");
|
|
34 |
open(HTML, ">$location") or die "Couldn't open \"$location\" for writing because $!";
|
|
35 |
print HTML <<ENDHEAD;
|
|
36 |
<html>
|
|
37 |
<head>
|
|
38 |
<title>Release tools command output</title>
|
|
39 |
</head>
|
|
40 |
<body>
|
|
41 |
<table border>
|
|
42 |
ENDHEAD
|
|
43 |
foreach my $row (@$data) {
|
|
44 |
print HTML " <tr>\n";
|
|
45 |
my $celltype = "td";
|
|
46 |
if ($hasHeader) {
|
|
47 |
$celltype = "th";
|
|
48 |
$hasHeader = 0; # only first row gets header cells
|
|
49 |
}
|
|
50 |
foreach my $cell (@$row) {
|
|
51 |
$cell =~ s/\&/\&/g;
|
|
52 |
$cell =~ s/\</\</g;
|
|
53 |
$cell =~ s/\>/\>/g;
|
|
54 |
print HTML " <$celltype>$cell</$celltype>\n";
|
|
55 |
}
|
|
56 |
print HTML " </tr>\n";
|
|
57 |
}
|
|
58 |
print HTML "</table>\n</body>\n</html>\n";
|
|
59 |
close HTML;
|
|
60 |
system ($location);
|
|
61 |
}
|
|
62 |
|
|
63 |
1;
|
|
64 |
|
|
65 |
__END__
|
|
66 |
|
|
67 |
=head1 NAME
|
|
68 |
|
|
69 |
TableFormatter/Html.pm - Formats tables in HTML format
|
|
70 |
|
|
71 |
=head1 INTERFACE
|
|
72 |
|
|
73 |
=head2 New
|
|
74 |
|
|
75 |
Creates a formatter.
|
|
76 |
|
|
77 |
=head2 PrintTable
|
|
78 |
|
|
79 |
Prints the table. Two arguments: firstly, a 2D array of the data. Secondly, a Boolean specifying whether the first row is a header row.
|
|
80 |
|
|
81 |
=head1 KNOWN BUGS
|
|
82 |
|
|
83 |
The name of this file (i.e. Html.pm) must be in that capitalisation, for IniData.pm to be able to find it.
|
|
84 |
|
|
85 |
No actual bugs.
|
|
86 |
|
|
87 |
=head1 COPYRIGHT
|
|
88 |
|
|
89 |
Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
90 |
All rights reserved.
|
|
91 |
This component and the accompanying materials are made available
|
|
92 |
under the terms of the License "Eclipse Public License v1.0"
|
|
93 |
which accompanies this distribution, and is available
|
|
94 |
at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
95 |
|
|
96 |
Initial Contributors:
|
|
97 |
Nokia Corporation - initial contribution.
|
|
98 |
|
|
99 |
Contributors:
|
|
100 |
|
|
101 |
Description:
|
|
102 |
|
|
103 |
|
|
104 |
=cut
|