| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Labyrinth::Plugin::Articles::Sections; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
6466
|
use warnings; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
57
|
|
|
4
|
2
|
|
|
2
|
|
8
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
51
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
7
|
use vars qw($VERSION $ALLSQL $SECTIONID); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
134
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '5.17'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Labyrinth::Plugin::Articles::Sections - Sections handler plugin for Labyrinth |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Contains all the section handling functionality for the Labyrinth |
|
16
|
|
|
|
|
|
|
framework. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# ------------------------------------- |
|
21
|
|
|
|
|
|
|
# Library Modules |
|
22
|
|
|
|
|
|
|
|
|
23
|
2
|
|
|
2
|
|
11
|
use base qw(Labyrinth::Plugin::Articles); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
224
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Clone qw(clone); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use Labyrinth::Audit; |
|
28
|
|
|
|
|
|
|
use Labyrinth::DBUtils; |
|
29
|
|
|
|
|
|
|
use Labyrinth::DTUtils; |
|
30
|
|
|
|
|
|
|
use Labyrinth::MLUtils; |
|
31
|
|
|
|
|
|
|
use Labyrinth::Session; |
|
32
|
|
|
|
|
|
|
use Labyrinth::Support; |
|
33
|
|
|
|
|
|
|
use Labyrinth::Variables; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# ------------------------------------- |
|
36
|
|
|
|
|
|
|
# Variables |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# type: 0 = optional, 1 = mandatory |
|
39
|
|
|
|
|
|
|
# html: 0 = none, 1 = text, 2 = textarea |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my %fields = ( |
|
42
|
|
|
|
|
|
|
articleid => { type => 0, html => 0 }, |
|
43
|
|
|
|
|
|
|
quickname => { type => 1, html => 0 }, |
|
44
|
|
|
|
|
|
|
title => { type => 1, html => 1 }, |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my (@mandatory,@allfields); |
|
48
|
|
|
|
|
|
|
for(keys %fields) { |
|
49
|
|
|
|
|
|
|
push @mandatory, $_ if($fields{$_}->{type}); |
|
50
|
|
|
|
|
|
|
push @allfields, $_; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$ALLSQL = 'AllArticles'; |
|
54
|
|
|
|
|
|
|
$SECTIONID = 2; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# ------------------------------------- |
|
57
|
|
|
|
|
|
|
# The Subs |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 PUBLIC INTERFACE METHODS |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=over 4 |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item GetSection |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Retrieves the section articles used for introductory passages. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
GetSection can be called with a named section, or it will use the section |
|
68
|
|
|
|
|
|
|
of the current request. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub GetSection { |
|
75
|
|
|
|
|
|
|
my ($self, $section) = @_; |
|
76
|
|
|
|
|
|
|
my $name = $cgiparams{name}; |
|
77
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
if($section) { |
|
80
|
|
|
|
|
|
|
$cgiparams{name} = $section; |
|
81
|
|
|
|
|
|
|
} else { |
|
82
|
|
|
|
|
|
|
my $request = $cgiparams{act} || 'home-public'; |
|
83
|
|
|
|
|
|
|
$request = 'home-public' if($request eq 'user-logout'); |
|
84
|
|
|
|
|
|
|
($cgiparams{name}) = split("-",$request); |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
$self->SUPER::Item(); |
|
88
|
|
|
|
|
|
|
$tvars{page}->{section} = $tvars{articles}->{$cgiparams{name}} if($tvars{articles}->{$cgiparams{name}}); |
|
89
|
|
|
|
|
|
|
$cgiparams{name} = $name; # revert back to what it should be! |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 ADMIN INTERFACE METHODS |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Standard actions to administer the section content. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=over 4 |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item Access |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Determine with user has access to administration features. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item Admin |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Provide list of the sections currently available. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item Add |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Add a new section article. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item Edit |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Edit an existing section article. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item Save |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Save the current section article. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item Delete |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Delete a section article. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=back |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub Access { Authorised(MASTER) } |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub Admin { |
|
129
|
|
|
|
|
|
|
return unless AccessUser(MASTER); |
|
130
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
|
131
|
|
|
|
|
|
|
shift->SUPER::Admin(); |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub Add { |
|
135
|
|
|
|
|
|
|
return unless AccessUser(MASTER); |
|
136
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
|
137
|
|
|
|
|
|
|
shift->SUPER::Add(); |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub Edit { |
|
141
|
|
|
|
|
|
|
return unless AccessUser(MASTER); |
|
142
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
|
143
|
|
|
|
|
|
|
shift->SUPER::Edit(); |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub Save { |
|
147
|
|
|
|
|
|
|
return unless AccessUser(MASTER); |
|
148
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
|
149
|
|
|
|
|
|
|
shift->SUPER::Save(); |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub Delete { |
|
153
|
|
|
|
|
|
|
return unless AccessUser(MASTER); |
|
154
|
|
|
|
|
|
|
$cgiparams{sectionid} = $SECTIONID; |
|
155
|
|
|
|
|
|
|
shift->SUPER::Delete(); |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
1; |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
__END__ |