line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormWidgets::Freelist; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
755
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
5
|
1
|
|
|
1
|
|
5
|
use parent 'HTML::FormWidgets'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw( height values width ) ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $TTS = q( ~ ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
12
|
1
|
|
|
1
|
1
|
1
|
my ($self, $args) = @_; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
6
|
$self->container_class( q(freelist_container) ); |
15
|
1
|
|
|
|
|
6
|
$self->height ( 5 ); |
16
|
1
|
|
|
|
|
6
|
$self->values ( [] ); |
17
|
1
|
|
|
|
|
6
|
return; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub render_field { |
21
|
1
|
|
|
1
|
1
|
2
|
my ($self, $args) = @_; my $hacc = $self->hacc; |
|
1
|
|
|
|
|
4
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
6
|
my $add_tip = $self->hint_title.$TTS.$self->loc( q(freelistAddTip) ); |
24
|
1
|
|
|
|
|
4
|
my $remove_tip = $self->hint_title.$TTS.$self->loc( q(freelistRemoveTip) ); |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
3
|
$args = {}; |
27
|
1
|
|
|
|
|
3
|
$args->{class } .= q( ifield freelist); |
28
|
1
|
|
|
|
|
4
|
$args->{id } = $self->id; |
29
|
1
|
|
|
|
|
6
|
$args->{name } = q(_).$self->name; |
30
|
1
|
50
|
|
|
|
6
|
$args->{size } = $self->width if (defined $self->width); |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
9
|
my $html = $hacc->textfield( $args ); |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
49
|
$args = {}; |
35
|
1
|
|
|
|
|
3
|
$args->{class } = q( ifield freelist); |
36
|
1
|
|
|
|
|
4
|
$args->{id } = $self->id.q(_list); |
37
|
1
|
|
|
|
|
5
|
$args->{multiple} = q(true); |
38
|
1
|
|
|
|
|
3
|
$args->{name } = q(_).$self->name.q(_list); |
39
|
1
|
|
|
|
|
7
|
$args->{size } = $self->height; |
40
|
1
|
|
|
|
|
6
|
$args->{values } = $self->values; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
7
|
$html .= $hacc->scrolling_list( $args ); |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
49
|
for my $val (@{ $self->{values} }) { |
|
1
|
|
|
|
|
3
|
|
45
|
0
|
|
|
|
|
0
|
$html .= $hacc->hidden( { name => $self->name, value => $val } ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
7
|
$html = $hacc->span( { class => q(freelist_ifields) }, $html ); |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
28
|
my $text = $hacc->span( { class => q(add_item_icon) }, q( ) ); |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
38
|
$args = { class => q(icon_button tips add), |
53
|
|
|
|
|
|
|
id => $self->id.q(_add), |
54
|
|
|
|
|
|
|
title => $add_tip }; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
12
|
my $text1 = $hacc->span( $args, $text ); |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
28
|
$text = $hacc->span( { class => q(remove_item_icon) }, q( ) ); |
59
|
1
|
|
|
|
|
23
|
$args = { class => q(icon_button tips remove), |
60
|
|
|
|
|
|
|
id => $self->id.q(_remove), |
61
|
|
|
|
|
|
|
title => $remove_tip }; |
62
|
1
|
|
|
|
|
10
|
$text1 .= $hacc->span( $args, $text ); |
63
|
1
|
|
|
|
|
28
|
$html .= $hacc->span( { class => q(freelist_buttons) }, $text1 ); |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
25
|
return $html; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|