line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormWidgets::PopupMenu; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1177
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
48
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
6
|
use parent 'HTML::FormWidgets'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw( classes labels values ) ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1
|
|
|
1
|
1
|
3
|
my ($self, $args) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
4
|
$self->classes( undef ); |
13
|
1
|
|
|
|
|
7
|
$self->labels ( undef ); |
14
|
1
|
|
|
|
|
6
|
$self->values ( [] ); |
15
|
1
|
|
|
|
|
5
|
return; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub render_field { |
19
|
1
|
|
|
1
|
1
|
2
|
my ($self, $args) = @_; |
20
|
|
|
|
|
|
|
|
21
|
1
|
50
|
|
|
|
7
|
$self->class =~ m{ chzn-select }msx |
22
|
|
|
|
|
|
|
and $self->add_optional_js( q(chosen.js) ); |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
50
|
|
|
9
|
$args->{class} .= q( ).($self->class || q(ifield)); |
25
|
1
|
50
|
|
|
|
10
|
$self->classes and $args->{classes } = $self->classes; |
26
|
1
|
50
|
|
|
|
10
|
$self->onchange and $args->{onchange} = $self->onchange; |
27
|
|
|
|
|
|
|
|
28
|
1
|
50
|
|
|
|
7
|
if ($self->labels) { |
29
|
1
|
|
|
|
|
8
|
my $labels = $args->{labels} = $self->labels; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
50
|
|
|
32
|
$args->{values} = [ sort { |
|
|
|
50
|
|
|
|
|
32
|
1
|
|
|
|
|
3
|
($labels->{ $a } || q()) |
33
|
1
|
|
|
|
|
5
|
cmp ($labels->{ $b } || q()) } @{ $self->values } ]; |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
0
|
else { $args->{values} = $self->values } |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
6
|
return $self->hacc->popup_menu( $args ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|