line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Labyrinth::Plugin::Review::Types; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
3901
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
65
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
100
|
|
7
|
|
|
|
|
|
|
$VERSION = '1.01'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Labyrinth::Plugin::Review::Types - Review Types plugin for the Labyrinth framework |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Contains all the functionality for managing review types for reviews. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# ------------------------------------- |
20
|
|
|
|
|
|
|
# Library Modules |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
9
|
use base qw(Labyrinth::Plugin::Base); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
608
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use Labyrinth::Audit; |
25
|
|
|
|
|
|
|
use Labyrinth::MLUtils; |
26
|
|
|
|
|
|
|
use Labyrinth::Variables; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use Data::Dumper; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# ------------------------------------- |
31
|
|
|
|
|
|
|
# Variables |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# type: 0 = optional, 1 = mandatory |
34
|
|
|
|
|
|
|
# html: 0 = none, 1 = text, 2 = textarea |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my %fields = ( |
37
|
|
|
|
|
|
|
reviewtypeid => { type => 0, html => 0 }, |
38
|
|
|
|
|
|
|
typename => { type => 1, html => 1 }, |
39
|
|
|
|
|
|
|
typeabbr => { type => 1, html => 1 }, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my (@mandatory,@allfields); |
43
|
|
|
|
|
|
|
for(keys %fields) { |
44
|
|
|
|
|
|
|
push @mandatory, $_ if($fields{$_}->{type}); |
45
|
|
|
|
|
|
|
push @allfields, $_; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# ------------------------------------- |
49
|
|
|
|
|
|
|
# The Subs |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 ADMIN INTERFACE METHODS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=over 4 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item * Access |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Check default access to the Admin methods |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item * Admin |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
List entries for administration purposes. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item * Add |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Add a review type. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * Edit |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Edit a review type. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * Save |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Save a review type. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * Delete |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Delete one or more review types. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub Access { Authorised(PUBLISHER) } |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub Admin { |
86
|
|
|
|
|
|
|
return unless AccessUser(PUBLISHER); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
if($cgiparams{doaction}) { |
89
|
|
|
|
|
|
|
if($cgiparams{doaction} eq 'Delete') { Delete(); } |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my @rows = $dbi->GetQuery('hash','AllReviewTypes'); |
93
|
|
|
|
|
|
|
$tvars{data} = \@rows if(@rows); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub Add { |
97
|
|
|
|
|
|
|
return unless AccessUser(PUBLISHER); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub Edit { |
101
|
|
|
|
|
|
|
return unless AccessUser(PUBLISHER); |
102
|
|
|
|
|
|
|
return unless AuthorCheck('GetReviewTypeByID','reviewtypeid',PUBLISHER); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub Save { |
106
|
|
|
|
|
|
|
return unless AuthorCheck('GetReviewTypeByID','reviewtypeid',PUBLISHER); |
107
|
|
|
|
|
|
|
return if FieldCheck(\@allfields,\@mandatory); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
for(keys %fields) { |
110
|
|
|
|
|
|
|
if($fields{$_}->{html} == 1) { $tvars{data}->{$_} = CleanHTML($tvars{data}->{$_}) } |
111
|
|
|
|
|
|
|
elsif($fields{$_}->{html} == 2) { $tvars{data}->{$_} = CleanTags($tvars{data}->{$_}) } |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my @fields = ( |
115
|
|
|
|
|
|
|
$tvars{data}->{typename}, |
116
|
|
|
|
|
|
|
$tvars{data}->{typeabbr} |
117
|
|
|
|
|
|
|
); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# store review details |
120
|
|
|
|
|
|
|
if($tvars{data}->{reviewtypeid}) |
121
|
|
|
|
|
|
|
{ $dbi->DoQuery('SaveReviewType',@fields,$tvars{data}->{reviewtypeid}); } |
122
|
|
|
|
|
|
|
else { $cgiparams{reviewtypeid} = $dbi->IDQuery('AddReviewType',@fields); } |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
$tvars{thanks} = 1; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub Delete { |
128
|
|
|
|
|
|
|
return unless AccessUser(PUBLISHER); |
129
|
|
|
|
|
|
|
my @ids = CGIArray('LISTED'); |
130
|
|
|
|
|
|
|
return unless @ids; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
$dbi->DoQuery('DeleteReviewTypes',{ ids => join(',',@ids) }); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
__END__ |