line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Labyrinth::Plugin::Articles::Site; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
3793
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
68
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my $VERSION = '5.18'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Labyrinth::Plugin::Articles::Site - Site Pages handler plugin for Labyrinth |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Contains all the site pages handling functionality for the Labyrinth |
15
|
|
|
|
|
|
|
framework. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# ------------------------------------- |
20
|
|
|
|
|
|
|
# Library Modules |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
6
|
use base qw(Labyrinth::Plugin::Articles); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
112
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use Clone qw(clone); |
25
|
|
|
|
|
|
|
use Time::Local; |
26
|
|
|
|
|
|
|
use Data::Dumper; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use Labyrinth::Audit; |
29
|
|
|
|
|
|
|
use Labyrinth::DBUtils; |
30
|
|
|
|
|
|
|
use Labyrinth::DTUtils; |
31
|
|
|
|
|
|
|
use Labyrinth::Globals; |
32
|
|
|
|
|
|
|
use Labyrinth::MLUtils; |
33
|
|
|
|
|
|
|
use Labyrinth::Session; |
34
|
|
|
|
|
|
|
use Labyrinth::Support; |
35
|
|
|
|
|
|
|
use Labyrinth::Variables; |
36
|
|
|
|
|
|
|
use Labyrinth::Writer; |
37
|
|
|
|
|
|
|
use Labyrinth::Metadata; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# ------------------------------------- |
40
|
|
|
|
|
|
|
# Variables |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# type: 0 = optional, 1 = mandatory |
43
|
|
|
|
|
|
|
# html: 0 = none, 1 = text, 2 = textarea |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my %fields = ( |
46
|
|
|
|
|
|
|
articleid => { type => 0, html => 0 }, |
47
|
|
|
|
|
|
|
quickname => { type => 1, html => 0 }, |
48
|
|
|
|
|
|
|
title => { type => 1, html => 1 }, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my (@mandatory,@allfields); |
52
|
|
|
|
|
|
|
for(keys %fields) { |
53
|
|
|
|
|
|
|
push @mandatory, $_ if($fields{$_}->{type}); |
54
|
|
|
|
|
|
|
push @allfields, $_; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $SECTIONID = 3; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# ------------------------------------- |
60
|
|
|
|
|
|
|
# The Subs |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 PUBLIC INTERFACE METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=over 4 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item Archive |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Retrieves a list of the volumes available. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item List |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Retrieves a list of site pages. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item Meta |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Retrieves pages based on given meta tag. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item Cloud |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Provides a tag cloud for the current site pages. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item Search |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Retrieves a list of site pages based on a given search string. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item Item |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Provides the content of a named site page. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub Archive { |
95
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
96
|
|
|
|
|
|
|
$cgiparams{section} = 'site'; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
shift->SUPER::Archive(); |
99
|
|
|
|
|
|
|
$tvars{articles} = undef; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub List { |
103
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
104
|
|
|
|
|
|
|
$settings{limit} = 1; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
shift->SUPER::List(); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub Meta { |
110
|
|
|
|
|
|
|
return unless($cgiparams{data}); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
113
|
|
|
|
|
|
|
$settings{limit} = 10; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
shift->SUPER::Meta(); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub Cloud { |
119
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
120
|
|
|
|
|
|
|
$cgiparams{actcode} = 'site-meta'; |
121
|
|
|
|
|
|
|
shift->SUPER::Cloud(); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub Search { |
125
|
|
|
|
|
|
|
return unless($cgiparams{data}); |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
128
|
|
|
|
|
|
|
$settings{limit} = 10; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
shift->SUPER::Search(); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub Item { |
134
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
135
|
|
|
|
|
|
|
shift->SUPER::Item(); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 ADMIN INTERFACE METHODS |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Standard actions to administer the section content. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=over 4 |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item Access |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Determine with user has access to administration features. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item Admin |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Provide list of the site pages currently available. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item Add |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Add a new site page. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item Edit |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Edit an existing site page. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item Save |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Save the current site page. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item Delete |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Delete a site page. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=back |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub Access { Authorised(EDITOR) } |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub Admin { |
175
|
|
|
|
|
|
|
return unless AccessUser(EDITOR); |
176
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
177
|
|
|
|
|
|
|
shift->SUPER::Admin(); |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub Add { |
181
|
|
|
|
|
|
|
return unless AccessUser(EDITOR); |
182
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
183
|
|
|
|
|
|
|
my $self = shift; |
184
|
|
|
|
|
|
|
$self->SUPER::Add(); |
185
|
|
|
|
|
|
|
$self->SUPER::Tags(); |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub Edit { |
189
|
|
|
|
|
|
|
return unless AccessUser(EDITOR); |
190
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
191
|
|
|
|
|
|
|
my $self = shift; |
192
|
|
|
|
|
|
|
$self->SUPER::Edit(); |
193
|
|
|
|
|
|
|
$self->SUPER::Tags(); |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
sub Save { |
197
|
|
|
|
|
|
|
return unless AccessUser(EDITOR); |
198
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
199
|
|
|
|
|
|
|
$cgiparams{quickname} ||= formatDate(0); |
200
|
|
|
|
|
|
|
shift->SUPER::Save(); |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub Delete { |
204
|
|
|
|
|
|
|
return unless AccessUser(ADMIN); |
205
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
206
|
|
|
|
|
|
|
shift->SUPER::Delete(); |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
1; |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
__END__ |