line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rose::HTML::Form::Field::Group::OnOff; |
2
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
106
|
use strict; |
|
13
|
|
|
|
|
34
|
|
|
13
|
|
|
|
|
373
|
|
4
|
|
|
|
|
|
|
|
5
|
13
|
|
|
13
|
|
66
|
use Carp(); |
|
13
|
|
|
|
|
28
|
|
|
13
|
|
|
|
|
174
|
|
6
|
|
|
|
|
|
|
|
7
|
13
|
|
|
13
|
|
514
|
use Rose::HTML::Util(); |
|
13
|
|
|
|
|
28
|
|
|
13
|
|
|
|
|
216
|
|
8
|
|
|
|
|
|
|
|
9
|
13
|
|
|
13
|
|
62
|
use base 'Rose::HTML::Form::Field::Group'; |
|
13
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
6682
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.606'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $Debug = undef; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub resync_name |
16
|
|
|
|
|
|
|
{ |
17
|
628
|
|
|
628
|
0
|
1185
|
my($self) = shift; |
18
|
|
|
|
|
|
|
|
19
|
628
|
|
|
|
|
1972
|
$self->SUPER::resync_name(); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Resync item names too |
22
|
628
|
|
|
|
|
1787
|
my $name = $self->local_name; |
23
|
|
|
|
|
|
|
|
24
|
628
|
|
|
|
|
1760
|
foreach my $item ($self->items) |
25
|
|
|
|
|
|
|
{ |
26
|
971
|
|
|
|
|
2697
|
$item->name($name); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub name |
31
|
|
|
|
|
|
|
{ |
32
|
3466
|
|
|
3466
|
1
|
9232
|
my($self) = shift; |
33
|
|
|
|
|
|
|
|
34
|
3466
|
100
|
|
|
|
7138
|
if(@_) |
35
|
|
|
|
|
|
|
{ |
36
|
50
|
|
|
|
|
254
|
$self->local_name(shift); |
37
|
|
|
|
|
|
|
|
38
|
50
|
|
|
|
|
171
|
my $name = $self->local_name; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# All items in the group must have the same name |
41
|
50
|
|
|
|
|
249
|
foreach my $item ($self->items) |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
|
|
0
|
$item->name($name); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
3466
|
|
|
|
|
8005
|
my $name = $self->html_attr('name'); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# The name HTML attr will be an empty string if it's a required attr, |
50
|
|
|
|
|
|
|
# so use length() and not defined() |
51
|
13
|
|
|
13
|
|
115
|
no warnings 'uninitialized'; |
|
13
|
|
|
|
|
37
|
|
|
13
|
|
|
|
|
23112
|
|
52
|
3466
|
100
|
|
|
|
7532
|
unless(length $name) |
53
|
|
|
|
|
|
|
{ |
54
|
744
|
|
|
|
|
2165
|
return $self->html_attr('name', $self->fq_name); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
2722
|
|
|
|
|
7435
|
return $name; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub defaults |
61
|
|
|
|
|
|
|
{ |
62
|
73
|
|
|
73
|
0
|
829
|
my($self) = shift; |
63
|
|
|
|
|
|
|
|
64
|
73
|
50
|
|
|
|
257
|
if(@_) |
65
|
|
|
|
|
|
|
{ |
66
|
73
|
50
|
33
|
|
|
504
|
if(@_ == 1 && ref $_[0] eq 'ARRAY') |
|
|
100
|
|
|
|
|
|
67
|
|
|
|
|
|
|
{ |
68
|
0
|
|
|
|
|
0
|
$self->{'defaults'} = { map { $_ => 1 } @{$_[0]} }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
elsif(defined $_[0]) |
71
|
|
|
|
|
|
|
{ |
72
|
70
|
|
|
|
|
197
|
$self->{'defaults'} = { map { $_ => 1 } @_ }; |
|
70
|
|
|
|
|
430
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
else |
75
|
|
|
|
|
|
|
{ |
76
|
3
|
|
|
|
|
16
|
$self->{'defaults'} = { }; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
73
|
|
|
|
|
438
|
$self->init_items; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
73
|
50
|
|
|
|
269
|
return (wantarray) ? sort keys %{$self->{'defaults'}} : [ sort keys %{$self->{'defaults'}} ]; |
|
0
|
|
|
|
|
0
|
|
|
73
|
|
|
|
|
491
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
*default = \&defaults; |
86
|
|
|
|
|
|
|
*default_value = \&defaults; |
87
|
|
|
|
|
|
|
*default_values = \&defaults; |
88
|
|
|
|
|
|
|
|
89
|
178
|
50
|
|
178
|
0
|
509
|
sub default_values_hash { (wantarray) ? %{$_[0]->{'defaults'}} : $_[0]->{'defaults'} } |
|
0
|
|
|
|
|
0
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _args_to_items |
92
|
|
|
|
|
|
|
{ |
93
|
37
|
|
|
37
|
|
105
|
my($self) = shift; |
94
|
|
|
|
|
|
|
|
95
|
37
|
|
|
|
|
256
|
my $items = $self->SUPER::_args_to_items(@_); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# All items in the group must have the same name |
98
|
37
|
|
|
|
|
116
|
foreach my $item (@$items) |
99
|
|
|
|
|
|
|
{ |
100
|
87
|
|
|
|
|
267
|
$item->name($self->local_name); |
101
|
|
|
|
|
|
|
#$item->name($self->name); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
37
|
100
|
|
|
|
222
|
return (wantarray) ? @$items : $items; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub item |
108
|
|
|
|
|
|
|
{ |
109
|
70
|
|
|
70
|
0
|
591
|
my($self, $value) = @_; |
110
|
|
|
|
|
|
|
|
111
|
70
|
|
|
|
|
231
|
my $group_class = $self->_item_group_class; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Dumb linear search for now |
114
|
70
|
|
|
|
|
252
|
foreach my $item ($self->items) |
115
|
|
|
|
|
|
|
{ |
116
|
168
|
100
|
|
|
|
721
|
if($item->isa($group_class)) |
117
|
|
|
|
|
|
|
{ |
118
|
6
|
|
|
|
|
22
|
foreach my $subitem ($item->items) |
119
|
|
|
|
|
|
|
{ |
120
|
12
|
100
|
|
|
|
35
|
return $subitem if($subitem->html_attr('value') eq $value); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
else |
124
|
|
|
|
|
|
|
{ |
125
|
162
|
100
|
|
|
|
387
|
return $item if($item->html_attr('value') eq $value); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
4
|
|
|
|
|
26
|
return undef; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub item_group |
133
|
|
|
|
|
|
|
{ |
134
|
3
|
|
|
3
|
0
|
13
|
my($self, $label) = @_; |
135
|
|
|
|
|
|
|
|
136
|
3
|
|
|
|
|
12
|
my $group_class = $self->_item_group_class; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# Dumb linear search for now |
139
|
3
|
|
|
|
|
12
|
foreach my $item ($self->items) |
140
|
|
|
|
|
|
|
{ |
141
|
12
|
100
|
66
|
|
|
58
|
return $item if($item->isa($group_class) && $item->label eq $label); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
0
|
return undef; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub is_selected |
148
|
|
|
|
|
|
|
{ |
149
|
19
|
|
|
19
|
0
|
72
|
my($self, $value) = @_; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
# Dumb linear search for now |
152
|
19
|
|
|
|
|
65
|
foreach my $item ($self->items) |
153
|
|
|
|
|
|
|
{ |
154
|
52
|
100
|
100
|
|
|
129
|
if($item->html_attr('value') eq $value && $item->internal_value) |
155
|
|
|
|
|
|
|
{ |
156
|
8
|
|
|
|
|
55
|
return 1; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
11
|
|
|
|
|
57
|
return 0; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
*is_checked = \&is_selected; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub is_empty |
166
|
|
|
|
|
|
|
{ |
167
|
6
|
|
|
6
|
1
|
26
|
my($self) = shift; |
168
|
|
|
|
|
|
|
|
169
|
6
|
|
|
|
|
22
|
foreach my $item ($self->items) |
170
|
|
|
|
|
|
|
{ |
171
|
13
|
100
|
|
|
|
46
|
return 0 if($item->is_on); |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
1
|
|
|
|
|
5
|
return 1; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub add_values |
178
|
|
|
|
|
|
|
{ |
179
|
13
|
|
|
13
|
0
|
29
|
my($self) = shift; |
180
|
|
|
|
|
|
|
|
181
|
13
|
|
|
|
|
41
|
$self->input_value($self->internal_value, @_); |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
8
|
|
|
8
|
0
|
35
|
sub add_value { shift->add_values(@_) } |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub input_value |
187
|
|
|
|
|
|
|
{ |
188
|
132
|
|
|
132
|
1
|
1041
|
my($self) = shift; |
189
|
|
|
|
|
|
|
|
190
|
132
|
|
|
|
|
258
|
my %values; |
191
|
|
|
|
|
|
|
|
192
|
132
|
100
|
|
|
|
337
|
if(@_) |
193
|
|
|
|
|
|
|
{ |
194
|
119
|
|
|
|
|
479
|
$self->clear(); |
195
|
119
|
|
|
|
|
997
|
$self->is_cleared(0); |
196
|
|
|
|
|
|
|
|
197
|
119
|
50
|
66
|
|
|
1101
|
if(@_ == 1 && ref $_[0] eq 'ARRAY') |
|
|
100
|
66
|
|
|
|
|
198
|
|
|
|
|
|
|
{ |
199
|
0
|
|
|
|
|
0
|
%values = map { $_ => 1 } @{$_[0]}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
elsif(@_ && defined $_[0]) |
202
|
|
|
|
|
|
|
{ |
203
|
94
|
|
|
|
|
281
|
%values = map { $_ => 1 } @_; |
|
115
|
|
|
|
|
501
|
|
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
119
|
100
|
|
|
|
330
|
unless(%values) |
207
|
|
|
|
|
|
|
{ |
208
|
25
|
|
|
|
|
98
|
$self->clear(); |
209
|
25
|
|
|
|
|
195
|
$self->is_cleared(0); |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
else |
212
|
|
|
|
|
|
|
{ |
213
|
94
|
|
|
|
|
230
|
$self->{'values'} = \%values; |
214
|
94
|
|
|
|
|
243
|
$self->init_items; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
119
|
100
|
|
|
|
523
|
if(my $parent = $self->parent_field) |
218
|
|
|
|
|
|
|
{ |
219
|
25
|
100
|
|
|
|
78
|
if($parent->_is_full) |
220
|
|
|
|
|
|
|
{ |
221
|
14
|
|
|
|
|
43
|
$parent->is_cleared(0); |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
25
|
100
|
|
|
|
197
|
if($self->auto_invalidate_parent) |
225
|
|
|
|
|
|
|
{ |
226
|
8
|
|
|
|
|
39
|
$parent->invalidate_value; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
else |
231
|
|
|
|
|
|
|
{ |
232
|
13
|
100
|
|
|
|
25
|
if(keys %{$self->{'values'}}) |
|
13
|
|
|
|
|
48
|
|
233
|
|
|
|
|
|
|
{ |
234
|
12
|
|
|
|
|
41
|
my $group_class = $self->_item_group_class; |
235
|
|
|
|
|
|
|
|
236
|
12
|
|
|
|
|
46
|
foreach my $item ($self->items) |
237
|
|
|
|
|
|
|
{ |
238
|
56
|
100
|
|
|
|
201
|
if($item->isa($group_class)) |
239
|
|
|
|
|
|
|
{ |
240
|
4
|
|
|
|
|
10
|
foreach my $value ($item->internal_value) |
241
|
|
|
|
|
|
|
{ |
242
|
4
|
|
|
|
|
14
|
$values{$value} = 1; |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
else |
246
|
|
|
|
|
|
|
{ |
247
|
52
|
100
|
|
|
|
125
|
if($item->is_on) |
248
|
|
|
|
|
|
|
{ |
249
|
16
|
|
|
|
|
48
|
$values{$item->html_attr('value')} = 1; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
|
256
|
132
|
100
|
|
|
|
867
|
return (wantarray) ? sort keys %values : [ sort keys %values ]; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub value_labels |
260
|
|
|
|
|
|
|
{ |
261
|
2
|
|
|
2
|
0
|
7
|
my($self) = shift; |
262
|
|
|
|
|
|
|
|
263
|
2
|
|
|
|
|
4
|
my @labels; |
264
|
|
|
|
|
|
|
|
265
|
2
|
|
|
|
|
10
|
foreach my $value ($self->internal_value) |
266
|
|
|
|
|
|
|
{ |
267
|
2
|
50
|
|
|
|
18
|
next unless(defined $value); |
268
|
2
|
|
|
|
|
18
|
push(@labels, $self->item($value)->label); |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
2
|
50
|
|
|
|
19
|
return wantarray ? @labels : \@labels; |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub value_label |
275
|
|
|
|
|
|
|
{ |
276
|
5
|
|
|
5
|
0
|
27
|
my($self) = shift; |
277
|
|
|
|
|
|
|
|
278
|
5
|
100
|
|
|
|
23
|
unless(@_) |
279
|
|
|
|
|
|
|
{ |
280
|
2
|
|
|
|
|
15
|
return $self->value_labels->[0]; |
281
|
|
|
|
|
|
|
} |
282
|
|
|
|
|
|
|
|
283
|
3
|
|
|
|
|
9
|
my $value = shift; |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
# Dumb linear search for now |
286
|
3
|
|
|
|
|
15
|
foreach my $item ($self->items) |
287
|
|
|
|
|
|
|
{ |
288
|
3
|
50
|
|
|
|
18
|
if($item->html_attr('value') eq $value) |
289
|
|
|
|
|
|
|
{ |
290
|
3
|
50
|
|
|
|
16
|
return $item-label(@_) if(@_); |
291
|
3
|
50
|
|
|
|
16
|
return ($item->label) ? $item->label : $value; |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
0
|
|
|
|
|
0
|
return undef; |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
#sub value_label { shift->value_labels->[0] } |
299
|
|
|
|
|
|
|
|
300
|
5
|
|
|
5
|
1
|
24
|
sub value { shift->input_value(@_) } |
301
|
8
|
|
|
8
|
0
|
36
|
sub values { shift->input_value(@_) } |
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
0
|
0
|
0
|
sub is_on { Carp::croak "Override in subclass!" } |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
sub internal_value |
306
|
|
|
|
|
|
|
{ |
307
|
759
|
|
|
759
|
1
|
1408
|
my($self) = shift; |
308
|
|
|
|
|
|
|
|
309
|
759
|
|
|
|
|
1221
|
my @values; |
310
|
|
|
|
|
|
|
|
311
|
759
|
|
|
|
|
1903
|
my $group_class = $self->_item_group_class; |
312
|
|
|
|
|
|
|
|
313
|
759
|
|
|
|
|
2102
|
foreach my $item ($self->items) |
314
|
|
|
|
|
|
|
{ |
315
|
2377
|
100
|
|
|
|
12463
|
if($item->isa($group_class)) |
316
|
|
|
|
|
|
|
{ |
317
|
6
|
50
|
|
|
|
16
|
push(@values, $item->internal_value) if(defined $item->internal_value); |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
else |
320
|
|
|
|
|
|
|
{ |
321
|
2371
|
100
|
|
|
|
5087
|
push(@values, $item->value) if($item->is_on); |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
|
325
|
759
|
|
|
|
|
3881
|
@values = sort @values; # Makes tests easier to write... :-/ |
326
|
|
|
|
|
|
|
|
327
|
759
|
100
|
|
|
|
2467
|
return wantarray ? @values : \@values; |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
*output_value = \&internal_value; |
331
|
|
|
|
|
|
|
|
332
|
678
|
50
|
|
678
|
0
|
2712
|
sub input_values_hash { (wantarray) ? %{$_[0]->{'values'}} : $_[0]->{'values'} } |
|
0
|
|
|
|
|
0
|
|
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
sub has_value |
335
|
|
|
|
|
|
|
{ |
336
|
19
|
|
|
19
|
0
|
69
|
my($self, $find_value) = @_; |
337
|
|
|
|
|
|
|
|
338
|
19
|
|
|
|
|
52
|
foreach my $value ($self->output_value) |
339
|
|
|
|
|
|
|
{ |
340
|
28
|
100
|
|
|
|
114
|
return 1 if($value eq $find_value); |
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
|
343
|
11
|
|
|
|
|
59
|
return 0; |
344
|
|
|
|
|
|
|
} |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
sub init_items |
347
|
|
|
|
|
|
|
{ |
348
|
678
|
|
|
678
|
0
|
1310
|
my($self) = shift; |
349
|
|
|
|
|
|
|
|
350
|
678
|
|
100
|
|
|
1517
|
my $values = $self->input_values_hash || {}; |
351
|
|
|
|
|
|
|
|
352
|
678
|
100
|
|
|
|
2252
|
if(%$values) |
|
|
100
|
|
|
|
|
|
353
|
|
|
|
|
|
|
{ |
354
|
107
|
|
|
|
|
379
|
my $group_class = $self->_item_group_class; |
355
|
|
|
|
|
|
|
|
356
|
107
|
|
|
|
|
376
|
foreach my $item ($self->items) |
357
|
|
|
|
|
|
|
{ |
358
|
401
|
|
|
|
|
1065
|
local $item->{'auto_invalidate_parent'} = $self->auto_invalidate_parent; |
359
|
|
|
|
|
|
|
|
360
|
401
|
100
|
|
|
|
1596
|
if($item->isa($group_class)) |
361
|
|
|
|
|
|
|
{ |
362
|
4
|
|
|
|
|
15
|
foreach my $subitem ($item->items) |
363
|
|
|
|
|
|
|
{ |
364
|
8
|
100
|
|
|
|
20
|
if(exists $values->{$subitem->html_attr('value')}) |
365
|
|
|
|
|
|
|
{ |
366
|
3
|
|
|
|
|
8
|
$subitem->input_value(1); |
367
|
|
|
|
|
|
|
} |
368
|
|
|
|
|
|
|
else |
369
|
|
|
|
|
|
|
{ |
370
|
5
|
|
|
|
|
15
|
$subitem->input_value(0); |
371
|
|
|
|
|
|
|
} |
372
|
|
|
|
|
|
|
} |
373
|
|
|
|
|
|
|
} |
374
|
|
|
|
|
|
|
else |
375
|
|
|
|
|
|
|
{ |
376
|
397
|
100
|
|
|
|
969
|
if(exists $values->{$item->html_attr('value')}) |
377
|
|
|
|
|
|
|
{ |
378
|
126
|
|
|
|
|
379
|
$item->input_value(1); |
379
|
|
|
|
|
|
|
} |
380
|
|
|
|
|
|
|
else |
381
|
|
|
|
|
|
|
{ |
382
|
271
|
|
|
|
|
755
|
$item->input_value(0); |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
} |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
elsif(!$self->is_cleared) |
388
|
|
|
|
|
|
|
{ |
389
|
178
|
|
|
|
|
1479
|
my $defaults = $self->default_values_hash; |
390
|
|
|
|
|
|
|
|
391
|
178
|
|
|
|
|
662
|
foreach my $item ($self->items) |
392
|
|
|
|
|
|
|
{ |
393
|
506
|
|
|
|
|
1230
|
my $value = $item->html_attr('value'); |
394
|
|
|
|
|
|
|
|
395
|
506
|
100
|
100
|
|
|
1866
|
if(defined $value && exists $defaults->{$value}) |
396
|
|
|
|
|
|
|
{ |
397
|
81
|
|
|
|
|
318
|
$item->default_value(1); |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
else |
400
|
|
|
|
|
|
|
{ |
401
|
425
|
|
|
|
|
1108
|
$item->default_value(0); |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
} |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
} |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
1; |