line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Widget::JavaScript::Constraint::In;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1122
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'HTML::Widget::Constraint::In';
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
482
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
HTML::Widget::JavaScript::Constraint::In - JavaScript In Constraint
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.02
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.02';
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
JavaScript In Constraint.
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 METHODS
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
See L.
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 $self->emit_javascript($var_name)
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Emits this constraint's JavaScript validation code.
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub emit_javascript {
|
35
|
|
|
|
|
|
|
my ($self, $var_name) = @_;
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my @js_constraints;
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $not = $self->not ? '' : '!';
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
for my $param (@{$self->names}) {
|
42
|
|
|
|
|
|
|
push(@js_constraints, "($not(${var_name}.${param}.value != '' && (" . join(' || ', map {"${var_name}.${param}.value == '$_'"} @{$self->in}) . ")))");
|
43
|
|
|
|
|
|
|
}
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
return @js_constraints;
|
46
|
|
|
|
|
|
|
}
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 AUTHOR
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Nilson Santos Figueiredo Júnior, C<< >>
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 BUGS
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Please report any bugs or feature requests directly to the author.
|
55
|
|
|
|
|
|
|
If you ask nicely it will probably get fixed or implemented.
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Copyright 2006, 2009 Nilson Santos Figueiredo Júnior, all rights reserved.
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
62
|
|
|
|
|
|
|
under the same terms as Perl itself.
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; # End of HTML::Widget::JavaScript::Constraint
|