line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
2
|
|
|
|
|
|
|
# DBO::Visitor::RenderHTML - render record as HTML |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# DESCRIPTION |
5
|
|
|
|
|
|
|
# A visitor class that renders a record as HTML. |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# AUTHOR |
8
|
|
|
|
|
|
|
# Gareth Rees |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# COPYRIGHT |
11
|
|
|
|
|
|
|
# Copyright (c) 1999 Canon Research Centre Europe Ltd/ |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# $Id$ |
14
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
597
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
17
|
|
|
|
|
|
|
package DBO::Visitor::RenderHTML; |
18
|
1
|
|
|
1
|
|
7
|
use base qw(DBO::Visitor); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
572
|
|
19
|
1
|
|
|
1
|
|
7
|
use Class::Multimethods; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
20
|
1
|
|
|
1
|
|
952
|
use HTML::FromText 'text2html'; |
|
1
|
|
|
|
|
28777
|
|
|
1
|
|
|
|
|
458
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
multimethod visit_table => |
23
|
|
|
|
|
|
|
qw(DBO::Visitor::RenderHTML DBO::Table DBO::Handle) => |
24
|
|
|
|
|
|
|
sub { |
25
|
|
|
|
|
|
|
my ($vis, $table, $handle) = @_; |
26
|
|
|
|
|
|
|
my @html = ("\n");
27
|
|
|
|
|
|
|
$vis->{html} = \@html; |
28
|
|
|
|
|
|
|
# visit_table(superclass($vis), $table, $handle); |
29
|
|
|
|
|
|
|
call_next_method(); |
30
|
|
|
|
|
|
|
push @html, " | \n"; |
31
|
|
|
|
|
|
|
join '', @html; |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
multimethod visit_column => |
35
|
|
|
|
|
|
|
qw(DBO::Visitor::RenderHTML DBO::Column::String DBO::Handle) => |
36
|
|
|
|
|
|
|
sub { |
37
|
|
|
|
|
|
|
my ($vis, $col, $handle) = @_; |
38
|
|
|
|
|
|
|
my $name = defined $col->{print_name} ? $col->{print_name} : $col->{name}; |
39
|
|
|
|
|
|
|
my $value = $vis->{record}{$col->{name}}; |
40
|
|
|
|
|
|
|
push @{$vis->{html}}, |
41
|
|
|
|
|
|
|
(" |
", |
42
|
|
|
|
|
|
|
text2html($name), " | \n", |
43
|
|
|
|
|
|
|
text2html($value), " |
\n") if defined $value;
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
multimethod visit_column => |
47
|
|
|
|
|
|
|
qw(DBO::Visitor::RenderHTML DBO::Column::Number DBO::Handle) => |
48
|
|
|
|
|
|
|
sub { |
49
|
|
|
|
|
|
|
my ($vis, $col, $handle) = @_; |
50
|
|
|
|
|
|
|
my $name = defined $col->{print_name} ? $col->{print_name} : $col->{name}; |
51
|
|
|
|
|
|
|
my $value = $vis->{record}{$col->{name}}; |
52
|
|
|
|
|
|
|
push @{$vis->{html}}, |
53
|
|
|
|
|
|
|
(" |
", |
54
|
|
|
|
|
|
|
text2html($name), " | \n", |
55
|
|
|
|
|
|
|
$vis->{record}{$col->{name}}, " |
\n") if defined $value;
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |