| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::Widget::Element::Button; |
|
2
|
|
|
|
|
|
|
|
|
3
|
88
|
|
|
88
|
|
239979
|
use warnings; |
|
|
88
|
|
|
|
|
269
|
|
|
|
88
|
|
|
|
|
4124
|
|
|
4
|
88
|
|
|
88
|
|
761
|
use strict; |
|
|
88
|
|
|
|
|
219
|
|
|
|
88
|
|
|
|
|
3327
|
|
|
5
|
88
|
|
|
88
|
|
540
|
use base 'HTML::Widget::Element'; |
|
|
88
|
|
|
|
|
194
|
|
|
|
88
|
|
|
|
|
59182
|
|
|
6
|
88
|
|
|
88
|
|
704
|
use NEXT; |
|
|
88
|
|
|
|
|
191
|
|
|
|
88
|
|
|
|
|
438
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( |
|
9
|
|
|
|
|
|
|
qw/value content type _src height width |
|
10
|
|
|
|
|
|
|
retain_default/ |
|
11
|
|
|
|
|
|
|
); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# alias |
|
14
|
|
|
|
|
|
|
*label = \&value; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
HTML::Widget::Element::Button - Button Element |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$e = $widget->element( 'Button', 'foo' ); |
|
23
|
|
|
|
|
|
|
$e->value('bar'); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Button Element. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 METHODS |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 new |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
|
36
|
25
|
|
|
25
|
1
|
13342
|
return shift->NEXT::new(@_)->type('button'); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 value |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 label |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The value of this Button element. Is also used by the browser as the |
|
44
|
|
|
|
|
|
|
button label. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
L is an alias for L. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 content |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
If set, the element will use a C |
|
51
|
|
|
|
|
|
|
tag. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The value of C will be used between the C |
|
54
|
|
|
|
|
|
|
This means that any html markup may be used to display the button. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 type |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Valid values are C |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 src |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
If set, the element will be rendered as an image button, using this url as |
|
63
|
|
|
|
|
|
|
the image. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Automatically sets L to C. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub src { |
|
70
|
67
|
|
|
67
|
1
|
166
|
my $self = shift; |
|
71
|
|
|
|
|
|
|
|
|
72
|
67
|
100
|
|
|
|
225
|
$self->type('image') if @_; |
|
73
|
|
|
|
|
|
|
|
|
74
|
67
|
|
|
|
|
301
|
return $self->_src(@_); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 retain_default |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
If true, overrides the default behaviour, so that after a field is missing |
|
80
|
|
|
|
|
|
|
from the form submission, the xml output will contain the default value, |
|
81
|
|
|
|
|
|
|
rather than be empty. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 render |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 containerize |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub containerize { |
|
90
|
55
|
|
|
55
|
1
|
121
|
my ( $self, $w, $value, $errors, $args ) = @_; |
|
91
|
|
|
|
|
|
|
|
|
92
|
55
|
50
|
|
|
|
175
|
$value = ref $value eq 'ARRAY' ? shift @$value : $value; |
|
93
|
|
|
|
|
|
|
|
|
94
|
55
|
100
|
100
|
|
|
352
|
$value = $self->value |
|
|
|
|
66
|
|
|
|
|
|
95
|
|
|
|
|
|
|
if ( not defined $value ) |
|
96
|
|
|
|
|
|
|
and $self->retain_default || not $args->{submitted}; |
|
97
|
|
|
|
|
|
|
|
|
98
|
55
|
|
|
|
|
637
|
my $i; |
|
99
|
55
|
|
|
|
|
207
|
my %args = ( |
|
100
|
|
|
|
|
|
|
type => $self->type, |
|
101
|
|
|
|
|
|
|
value => $value, |
|
102
|
|
|
|
|
|
|
); |
|
103
|
|
|
|
|
|
|
|
|
104
|
55
|
100
|
|
|
|
560
|
$args{src} = $self->src if defined $self->src; |
|
105
|
55
|
100
|
|
|
|
540
|
$args{height} = $self->height if defined $self->height; |
|
106
|
55
|
100
|
|
|
|
490
|
$args{width} = $self->width if defined $self->width; |
|
107
|
|
|
|
|
|
|
|
|
108
|
55
|
100
|
66
|
|
|
469
|
if ( defined $self->content && length $self->content ) { |
|
109
|
4
|
|
|
|
|
75
|
$i = $self->mk_tag( $w, 'button', \%args ); |
|
110
|
4
|
|
|
|
|
15
|
$i->push_content( |
|
111
|
|
|
|
|
|
|
HTML::Element->new( '~literal', text => $self->content ) ); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
else { |
|
114
|
51
|
|
|
|
|
551
|
$i = $self->mk_input( $w, \%args ); |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
55
|
|
|
|
|
541
|
return $self->container( { element => $i } ); |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
L |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHOR |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Marcus Ramberg, C |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 LICENSE |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
|
131
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |