line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
15
|
|
|
15
|
|
9335
|
use strict; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
359
|
|
2
|
15
|
|
|
15
|
|
72
|
use warnings; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
697
|
|
3
|
|
|
|
|
|
|
package HTML::Widget::Plugin::Textarea; |
4
|
|
|
|
|
|
|
# ABSTRACT: a widget for a large text entry box |
5
|
|
|
|
|
|
|
$HTML::Widget::Plugin::Textarea::VERSION = '0.204'; |
6
|
15
|
|
|
15
|
|
72
|
use parent 'HTML::Widget::Plugin'; |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
80
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
9
|
|
|
|
|
|
|
#pod |
10
|
|
|
|
|
|
|
#pod $widget_factory->textarea({ |
11
|
|
|
|
|
|
|
#pod id => 'elem-id', # also used as control name, if no name given |
12
|
|
|
|
|
|
|
#pod value => $big_hunk_of_text, |
13
|
|
|
|
|
|
|
#pod }); |
14
|
|
|
|
|
|
|
#pod |
15
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod This plugin provides a text-entry area widget. |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod The C attribute may be used to add a default class to every |
20
|
|
|
|
|
|
|
#pod produced input. This class cannot be overridden. |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod my $plugin = HTML::Widget::Factory::Input->new({ |
23
|
|
|
|
|
|
|
#pod default_classes => [ qw(foo bar) ], |
24
|
|
|
|
|
|
|
#pod }); |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod =head1 METHODS |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod =head2 C< provided_widgets > |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod This plugin provides the following widgets: textarea |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod =cut |
33
|
|
|
|
|
|
|
|
34
|
17
|
|
|
17
|
1
|
51
|
sub provided_widgets { qw(textarea) } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#pod =head2 C< textarea > |
37
|
|
|
|
|
|
|
#pod |
38
|
|
|
|
|
|
|
#pod This method returns a text-entry area widget. |
39
|
|
|
|
|
|
|
#pod |
40
|
|
|
|
|
|
|
#pod In addition to the generic L attributes, the following |
41
|
|
|
|
|
|
|
#pod are valid arguments: |
42
|
|
|
|
|
|
|
#pod |
43
|
|
|
|
|
|
|
#pod =over |
44
|
|
|
|
|
|
|
#pod |
45
|
|
|
|
|
|
|
#pod =item disabled |
46
|
|
|
|
|
|
|
#pod |
47
|
|
|
|
|
|
|
#pod If true, this option indicates that the widget can't be changed by the user. |
48
|
|
|
|
|
|
|
#pod |
49
|
|
|
|
|
|
|
#pod =item value |
50
|
|
|
|
|
|
|
#pod |
51
|
|
|
|
|
|
|
#pod If this argument is given and defined, the widget will be initially populated |
52
|
|
|
|
|
|
|
#pod by its value. |
53
|
|
|
|
|
|
|
#pod |
54
|
|
|
|
|
|
|
#pod =back |
55
|
|
|
|
|
|
|
#pod |
56
|
|
|
|
|
|
|
#pod =cut |
57
|
|
|
|
|
|
|
|
58
|
15
|
|
|
15
|
|
1175
|
use HTML::Element; |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
97
|
|
59
|
|
|
|
|
|
|
|
60
|
17
|
|
|
17
|
|
71
|
sub _attribute_args { qw(disabled id) } |
61
|
34
|
|
|
34
|
|
113
|
sub _boolean_args { qw(disabled) } |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub textarea { |
64
|
5
|
|
|
5
|
1
|
9
|
my ($self, $factory, $arg) = @_; |
65
|
|
|
|
|
|
|
|
66
|
5
|
100
|
|
|
|
17
|
$arg->{attr}{name} = $arg->{attr}{id} if not defined $arg->{attr}{name}; |
67
|
|
|
|
|
|
|
|
68
|
5
|
|
|
|
|
20
|
my $widget = HTML::Element->new('textarea'); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$widget->attr($_ => $arg->{attr}{$_}) |
71
|
5
|
|
|
|
|
112
|
for grep {; defined $arg->{attr}{$_} } keys %{ $arg->{attr} }; |
|
10
|
|
|
|
|
35
|
|
|
5
|
|
|
|
|
15
|
|
72
|
|
|
|
|
|
|
|
73
|
5
|
100
|
|
|
|
128
|
$widget->push_content($arg->{value}) if defined $arg->{value}; |
74
|
|
|
|
|
|
|
|
75
|
5
|
|
|
|
|
66
|
return $widget->as_XML; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub rewrite_arg { |
79
|
5
|
|
|
5
|
1
|
10
|
my ($self, $arg, @rest) = @_; |
80
|
|
|
|
|
|
|
|
81
|
5
|
|
|
|
|
20
|
$arg = $self->SUPER::rewrite_arg($arg, @rest); |
82
|
|
|
|
|
|
|
|
83
|
5
|
100
|
|
|
|
14
|
if ($self->{default_classes}) { |
84
|
2
|
|
|
|
|
4
|
my $class = join q{ }, @{ $self->{default_classes} }; |
|
2
|
|
|
|
|
6
|
|
85
|
|
|
|
|
|
|
$arg->{attr}{class} = defined $arg->{attr}{class} |
86
|
2
|
100
|
|
|
|
9
|
? "$class $arg->{attr}{class}" |
87
|
|
|
|
|
|
|
: $class; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
5
|
|
|
|
|
14
|
return $arg; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |