line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Test::Form::Widget::Menu::List; |
2
|
14
|
|
|
14
|
|
45
|
use strict; |
|
14
|
|
|
|
|
19
|
|
|
14
|
|
|
|
|
328
|
|
3
|
14
|
|
|
14
|
|
41
|
use warnings; |
|
14
|
|
|
|
|
12
|
|
|
14
|
|
|
|
|
241
|
|
4
|
|
|
|
|
|
|
################################################################## |
5
|
|
|
|
|
|
|
# $Id: List.pm 411 2011-09-26 11:19:30Z nohuhu@nohuhu.org $ |
6
|
|
|
|
|
|
|
# $Name: cgi-test_0-104_t1 $ |
7
|
|
|
|
|
|
|
################################################################## |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Copyright (c) 2001, Raphael Manfredi |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# You may redistribute only under the terms of the Artistic License, |
12
|
|
|
|
|
|
|
# as specified in the README file that comes with the distribution. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
|
15
|
14
|
|
|
14
|
|
269
|
use Carp; |
|
14
|
|
|
|
|
21
|
|
|
14
|
|
|
|
|
595
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
# This class models a FORM scrollable list. |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
|
21
|
14
|
|
|
14
|
|
53
|
use base qw(CGI::Test::Form::Widget::Menu); |
|
14
|
|
|
|
|
12
|
|
|
14
|
|
|
|
|
4830
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
# %attr |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# Defines which HTML attributes we should look at within the node, and how |
27
|
|
|
|
|
|
|
# to translate that into class attributes. |
28
|
|
|
|
|
|
|
# |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my %attr = ('name' => 'name', |
31
|
|
|
|
|
|
|
'size' => 'size', |
32
|
|
|
|
|
|
|
'multiple' => 'multiple', |
33
|
|
|
|
|
|
|
'disabled' => 'is_disabled', |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
# ->_init |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
# Per-widget initialization routine. |
40
|
|
|
|
|
|
|
# Parse HTML node to determine our specific parameters. |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
sub _init |
43
|
|
|
|
|
|
|
{ |
44
|
16
|
|
|
16
|
|
27
|
my $this = shift; |
45
|
16
|
|
|
|
|
33
|
my ($node) = shift; |
46
|
16
|
|
|
|
|
78
|
$this->_parse_attr($node, \%attr); |
47
|
16
|
|
|
|
|
101
|
$this->_parse_options($node); |
48
|
16
|
|
|
|
|
33
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
# ->submit_tuples -- redefined |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
# Returns list of (name => value) tuples that should be part of the |
55
|
|
|
|
|
|
|
# submitted form data. |
56
|
|
|
|
|
|
|
# |
57
|
|
|
|
|
|
|
sub submit_tuples |
58
|
|
|
|
|
|
|
{ |
59
|
19
|
|
|
19
|
1
|
39
|
my $this = shift; |
60
|
|
|
|
|
|
|
|
61
|
19
|
|
|
|
|
28
|
return map {$this->name => $_} keys %{$this->selected()}; |
|
29
|
|
|
|
|
83
|
|
|
19
|
|
|
|
|
78
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# |
65
|
|
|
|
|
|
|
# Attribute access |
66
|
|
|
|
|
|
|
# |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub size |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
0
|
1
|
0
|
my $this = shift; |
71
|
0
|
|
|
|
|
0
|
return $this->{size}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub gui_type |
75
|
|
|
|
|
|
|
{ |
76
|
0
|
|
|
0
|
1
|
0
|
"scrolling list" |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# |
80
|
|
|
|
|
|
|
# Defined predicates |
81
|
|
|
|
|
|
|
# |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub is_popup |
84
|
|
|
|
|
|
|
{ |
85
|
1
|
|
|
1
|
1
|
179
|
return 0; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 NAME |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
CGI::Test::Form::Widget::Menu::List - A scrolling list menu |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SYNOPSIS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# Inherits from CGI::Test::Form::Widget::Menu |
97
|
|
|
|
|
|
|
# $form is a CGI::Test::Form |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my $action = $form->menu_by_name("action"); |
100
|
|
|
|
|
|
|
$action->unselect("allow-gracetime"); |
101
|
|
|
|
|
|
|
$action->select("reboot"); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 DESCRIPTION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This class models a scrolling list menu, from which items may be selected |
106
|
|
|
|
|
|
|
and unselected. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 INTERFACE |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The interface is the same as the one described in |
111
|
|
|
|
|
|
|
L, with the following additional attribute: |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=over 4 |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item C |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
The amount of choices displayed. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHORS |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
The original author is Raphael Manfredi. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Steven Hilton was long time maintainer of this module. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Current maintainer is Alexander Tokarev Ftokarev@cpan.orgE>. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SEE ALSO |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
CGI::Test::Form::Widget::Menu(3). |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
134
|
|
|
|
|
|
|
|