line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Application::Plugin::Feedback; |
2
|
1
|
|
|
1
|
|
29654
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
69
|
|
3
|
|
|
|
|
|
|
require Exporter; |
4
|
|
|
|
|
|
|
require CGI::Application; |
5
|
|
|
|
|
|
|
require CGI::Application::Plugin::Session; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use vars qw/@ISA @EXPORT_OK %EXPORT_TAGS $VERSION/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
643
|
|
8
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)/g; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# export ... |
11
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
@EXPORT_OK = qw(feedback get_feedback_prepped feedback_exists get_feedback_html get_feedback_text); |
13
|
|
|
|
|
|
|
%EXPORT_TAGS = ( |
14
|
|
|
|
|
|
|
all => \@EXPORT_OK , |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub import { |
18
|
1
|
|
|
1
|
|
205
|
__PACKAGE__->export_to_level(1,@_,@EXPORT_OK); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub feedback { |
26
|
7
|
|
|
7
|
1
|
5850
|
my $self = shift; |
27
|
7
|
|
|
|
|
12
|
my $add = shift; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
7
|
|
|
|
|
97
|
my $feedback = $self->session->param('feedback'); |
31
|
|
|
|
|
|
|
|
32
|
7
|
100
|
|
|
|
151921
|
if ($add){ |
33
|
6
|
|
|
|
|
8
|
push @{$feedback}, $add; |
|
6
|
|
|
|
|
14
|
|
34
|
6
|
|
|
|
|
57
|
$self->session->param(feedback=> $feedback); |
35
|
6
|
|
|
|
|
296
|
return 1; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
1
|
50
|
|
|
|
9
|
$feedback or return []; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# clear it |
41
|
1
|
|
|
|
|
4
|
$self->session->param(feedback=> []); |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
38
|
return $feedback; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub feedback_exists { |
48
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
49
|
1
|
50
|
50
|
|
|
4
|
if ( defined $self->session->param('feedback') |
|
1
|
|
|
|
|
27
|
|
50
|
|
|
|
|
|
|
and scalar @{$self->session->param('feedback')} |
51
|
|
|
|
|
|
|
){ |
52
|
1
|
|
|
|
|
21
|
return 1; |
53
|
|
|
|
|
|
|
} |
54
|
0
|
|
|
|
|
0
|
return 0; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub get_feedback_html { |
58
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
59
|
0
|
0
|
|
|
|
0
|
$self->feedback_exists or return ''; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
my $html; |
62
|
0
|
|
|
|
|
0
|
for( @{$self->feedback} ){ |
|
0
|
|
|
|
|
0
|
|
63
|
0
|
|
|
|
|
0
|
$html.= " $_ "; |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
0
|
return $html; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub get_feedback_text { |
69
|
1
|
|
|
1
|
1
|
159
|
my $self = shift; |
70
|
1
|
50
|
|
|
|
6
|
$self->feedback_exists or return ''; |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
3
|
my $text = join("\n\n", @{$self->feedback} ); |
|
1
|
|
|
|
|
4
|
|
73
|
1
|
|
|
|
|
5
|
return $text; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub get_feedback_prepped { |
77
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
78
|
0
|
|
|
|
|
|
my @prepped; |
79
|
0
|
|
|
|
|
|
for (@{$self->feedback}){ |
|
0
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
push @prepped, { FEEDBACK => $_ }; |
81
|
|
|
|
|
|
|
} |
82
|
0
|
|
|
|
|
|
return \@prepped; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |