line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Controller::HTML::FormFu::ActionBase::Form; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
4959
|
use strict; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
360
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '2.02'; # VERSION |
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
50
|
use Moose; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
118
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
53417
|
use namespace::autoclean; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
70
|
|
10
|
|
|
|
|
|
|
|
11
|
9
|
|
|
9
|
|
692
|
BEGIN { extends 'Catalyst::Action'; } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _form_action_regex { |
14
|
46
|
|
|
46
|
|
784
|
return qr/_FORM_(RENDER|(NOT_)?(VALID|COMPLETE|SUBMITTED))\z/; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub dispatch { |
18
|
34
|
|
|
34
|
1
|
104554
|
my $self = shift; |
19
|
34
|
|
|
|
|
123
|
my ($c) = @_; |
20
|
|
|
|
|
|
|
|
21
|
34
|
|
|
|
|
254
|
$self->next::method( @_ ); |
22
|
|
|
|
|
|
|
|
23
|
34
|
|
|
|
|
636030
|
my $controller = $c->component( $self->class ); |
24
|
34
|
|
|
|
|
5758
|
my $config = $controller->_html_formfu_config; |
25
|
|
|
|
|
|
|
|
26
|
34
|
|
|
|
|
125
|
my $multi = $c->stash->{ $config->{multiform_stash} }; |
27
|
34
|
|
|
|
|
1983
|
my $form = $c->stash->{ $config->{form_stash} }; |
28
|
|
|
|
|
|
|
|
29
|
34
|
|
|
|
|
1812
|
my $run_form_render_action = 1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# _FORM_COMPLETE |
32
|
|
|
|
|
|
|
|
33
|
34
|
|
|
|
|
779
|
my $complete_method = $self->name . "_FORM_COMPLETE"; |
34
|
|
|
|
|
|
|
|
35
|
34
|
0
|
33
|
|
|
432
|
if ( defined $multi |
|
|
|
33
|
|
|
|
|
36
|
|
|
|
|
|
|
&& ( my $code = $controller->can( $complete_method ) ) |
37
|
|
|
|
|
|
|
&& $multi->complete ) |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
|
|
0
|
my @reverse = split /\//, $self->reverse; |
40
|
0
|
|
|
|
|
0
|
$reverse[-1] = $complete_method; |
41
|
0
|
|
|
|
|
0
|
local $self->{reverse} = join '/', @reverse; |
42
|
0
|
|
|
|
|
0
|
local $self->{code} = $code; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
0
|
$run_form_render_action = 0; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
$c->execute( $self->class, $self, @{ $c->req->args } ); |
|
0
|
|
|
|
|
0
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# _FORM_SUBMITTED |
50
|
|
|
|
|
|
|
|
51
|
34
|
|
|
|
|
652
|
my $submitted_method = $self->name . "_FORM_SUBMITTED"; |
52
|
|
|
|
|
|
|
|
53
|
34
|
100
|
100
|
|
|
588
|
if ( ( my $code = $controller->can( $submitted_method ) ) |
54
|
|
|
|
|
|
|
&& $form->submitted ) |
55
|
|
|
|
|
|
|
{ |
56
|
3
|
|
|
|
|
90
|
my @reverse = split /\//, $self->reverse; |
57
|
3
|
|
|
|
|
36
|
$reverse[-1] = $submitted_method; |
58
|
3
|
|
|
|
|
15
|
local $self->{reverse} = join '/', @reverse; |
59
|
3
|
|
|
|
|
10
|
local $self->{code} = $code; |
60
|
|
|
|
|
|
|
|
61
|
3
|
|
|
|
|
61
|
$c->execute( $self->class, $self, @{ $c->req->args } ); |
|
3
|
|
|
|
|
25
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# _FORM_VALID |
65
|
|
|
|
|
|
|
|
66
|
34
|
|
|
|
|
1155
|
my $valid_method = $self->name . "_FORM_VALID"; |
67
|
|
|
|
|
|
|
|
68
|
34
|
100
|
100
|
|
|
435
|
if ( ( my $code = $controller->can( $valid_method ) ) |
69
|
|
|
|
|
|
|
&& $form->submitted_and_valid ) |
70
|
|
|
|
|
|
|
{ |
71
|
1
|
|
|
|
|
493
|
my @reverse = split /\//, $self->reverse; |
72
|
1
|
|
|
|
|
10
|
$reverse[-1] = $valid_method; |
73
|
1
|
|
|
|
|
6
|
local $self->{reverse} = join '/', @reverse; |
74
|
1
|
|
|
|
|
3
|
local $self->{code} = $code; |
75
|
|
|
|
|
|
|
|
76
|
1
|
50
|
|
|
|
4
|
$run_form_render_action = 0 |
77
|
|
|
|
|
|
|
if !defined $multi; |
78
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
22
|
$c->execute( $self->class, $self, @{ $c->req->args } ); |
|
1
|
|
|
|
|
9
|
|
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# _FORM_NOT_COMPLETE |
83
|
|
|
|
|
|
|
|
84
|
34
|
|
|
|
|
2115
|
my $not_complete_method = $self->name . "_FORM_NOT_COMPLETE"; |
85
|
|
|
|
|
|
|
|
86
|
34
|
0
|
33
|
|
|
321
|
if ( defined $multi && |
|
|
|
33
|
|
|
|
|
|
|
|
0
|
|
|
|
|
87
|
|
|
|
|
|
|
( my $code = $controller->can( $not_complete_method ) ) |
88
|
|
|
|
|
|
|
&& $form->submitted && !$multi->complete ) |
89
|
|
|
|
|
|
|
{ |
90
|
0
|
|
|
|
|
0
|
my @reverse = split /\//, $self->reverse; |
91
|
0
|
|
|
|
|
0
|
$reverse[-1] = $not_complete_method; |
92
|
0
|
|
|
|
|
0
|
local $self->{reverse} = join '/', @reverse; |
93
|
0
|
|
|
|
|
0
|
local $self->{code} = $code; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
0
|
$c->execute( $self->class, $self, @{ $c->req->args } ); |
|
0
|
|
|
|
|
0
|
|
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# _FORM_NOT_VALID |
99
|
|
|
|
|
|
|
|
100
|
34
|
|
|
|
|
652
|
my $not_valid_method = $self->name . "_FORM_NOT_VALID"; |
101
|
|
|
|
|
|
|
|
102
|
34
|
100
|
100
|
|
|
460
|
if ( ( my $code = $controller->can( $not_valid_method ) ) |
|
|
|
100
|
|
|
|
|
103
|
|
|
|
|
|
|
&& $form->submitted && $form->has_errors ) |
104
|
|
|
|
|
|
|
{ |
105
|
2
|
|
|
|
|
1160
|
my @reverse = split /\//, $self->reverse; |
106
|
2
|
|
|
|
|
22
|
$reverse[-1] = $not_valid_method; |
107
|
2
|
|
|
|
|
10
|
local $self->{reverse} = join '/', @reverse; |
108
|
2
|
|
|
|
|
6
|
local $self->{code} = $code; |
109
|
|
|
|
|
|
|
|
110
|
2
|
|
|
|
|
51
|
$c->execute( $self->class, $self, @{ $c->req->args } ); |
|
2
|
|
|
|
|
17
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# _FORM_NOT_SUBMITTED |
114
|
|
|
|
|
|
|
|
115
|
34
|
|
|
|
|
1455
|
my $not_submitted_method = $self->name . "_FORM_NOT_SUBMITTED"; |
116
|
|
|
|
|
|
|
|
117
|
34
|
100
|
100
|
|
|
480
|
if ( ( my $code = $controller->can( $not_submitted_method ) ) |
118
|
|
|
|
|
|
|
&& !$form->submitted ) |
119
|
|
|
|
|
|
|
{ |
120
|
2
|
|
|
|
|
55
|
my @reverse = split /\//, $self->reverse; |
121
|
2
|
|
|
|
|
23
|
$reverse[-1] = $not_submitted_method; |
122
|
2
|
|
|
|
|
11
|
local $self->{reverse} = join '/', @reverse; |
123
|
2
|
|
|
|
|
8
|
local $self->{code} = $code; |
124
|
|
|
|
|
|
|
|
125
|
2
|
|
|
|
|
39
|
$c->execute( $self->class, $self, @{ $c->req->args } ); |
|
2
|
|
|
|
|
18
|
|
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# _RENDER |
129
|
|
|
|
|
|
|
|
130
|
34
|
|
|
|
|
1044
|
my $render_method = $self->name . "_FORM_RENDER"; |
131
|
|
|
|
|
|
|
|
132
|
34
|
100
|
100
|
|
|
450
|
if ( $run_form_render_action |
133
|
|
|
|
|
|
|
&& ( my $code = $controller->can( $render_method ) ) ) |
134
|
|
|
|
|
|
|
{ |
135
|
4
|
|
|
|
|
80
|
my @reverse = split /\//, $self->reverse; |
136
|
4
|
|
|
|
|
37
|
$reverse[-1] = $render_method; |
137
|
4
|
|
|
|
|
17
|
local $self->{reverse} = join '/', @reverse; |
138
|
4
|
|
|
|
|
9
|
local $self->{code} = $code; |
139
|
|
|
|
|
|
|
|
140
|
4
|
|
|
|
|
81
|
$c->execute( $self->class, $self, @{ $c->req->args } ); |
|
4
|
|
|
|
|
31
|
|
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
34
|
|
|
|
|
838
|
return; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
1; |