line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormWidgets::Cloud; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
670
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
4
|
use parent 'HTML::FormWidgets'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw( data height width ) ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1
|
|
|
1
|
1
|
1
|
my ($self, $args) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
7
|
$self->class ( 'cloud' ); |
13
|
1
|
|
|
|
|
8
|
$self->container( 0 ); |
14
|
1
|
|
|
|
|
6
|
$self->data ( [] ); |
15
|
1
|
|
|
|
|
5
|
$self->height ( 18 ); |
16
|
1
|
|
|
|
|
8
|
$self->width ( undef ); |
17
|
1
|
|
|
|
|
6
|
return; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub render_field { |
21
|
1
|
|
|
1
|
1
|
2
|
my ($self, $args) = @_; my $hacc = $self->hacc; my $html; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
3
|
for my $item (@{ $self->data }) { |
|
1
|
|
|
|
|
3
|
|
24
|
2
|
|
50
|
|
|
45
|
my $ref = $item->{value} || {}; |
25
|
2
|
|
33
|
|
|
7
|
my $id = $ref->{id } || $item->{tag}; |
26
|
2
|
|
|
|
|
4
|
my $style = $ref->{style}; |
27
|
2
|
|
|
|
|
11
|
my $href = $self->uri_for( $ref->{href} ); |
28
|
2
|
|
50
|
|
|
8
|
my $attrs = { class => $self->class.'_header fade live_grid', |
29
|
|
|
|
|
|
|
href => $href || 'javascript:Expand_Collapse()', |
30
|
|
|
|
|
|
|
id => $id }; |
31
|
|
|
|
|
|
|
|
32
|
2
|
50
|
|
|
|
28
|
if ($item->{size}) { |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
7
|
my $mult = 1 + int (10 * $item->{size} / $self->height); |
35
|
2
|
|
|
|
|
16
|
my $height = $mult * $self->height; |
36
|
2
|
|
|
|
|
12
|
my $line_height = (int 0.5 + (100 * $height / $item->{size})) / 1000; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
14
|
$style .= 'font-size: '.$item->{size}.'em; '; |
39
|
2
|
|
|
|
|
19
|
$style .= "line-height: ${line_height}em; "; |
40
|
2
|
|
|
|
|
5
|
$style .= "height: ${height}px; "; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
2
|
50
|
|
|
|
7
|
$item->{colour} and $style .= 'color: '.$item->{colour}.'; '; |
44
|
2
|
50
|
|
|
|
6
|
$style and $attrs->{style} = $style; |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
6
|
my $text = $item->{tag}.'('.$item->{count}.')'; |
47
|
2
|
|
|
|
|
13
|
my $anchor = $hacc->a( $attrs, "\n".$text ); |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
61
|
$attrs = { class => $self->class.'_header' }; |
50
|
2
|
|
|
|
|
20
|
$html .= $hacc->div( $attrs, "\n".$anchor )."\n"; |
51
|
|
|
|
|
|
|
|
52
|
2
|
50
|
|
|
|
47
|
$ref->{href} and next; |
53
|
|
|
|
|
|
|
|
54
|
2
|
50
|
|
|
|
7
|
$style = defined $self->width ? 'width: '.$self->width.'px;' : q(); |
55
|
2
|
|
|
|
|
12
|
$html .= $hacc->div( { class => $self->class.'_panel', |
56
|
|
|
|
|
|
|
id => "${id}Disp", |
57
|
|
|
|
|
|
|
style => $style }, 'Loading...' ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
37
|
return $html; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|