Articles.pm

filter: Statementstmt 17.2% 92 / 532 Branchbran 0.8% 2 / 242 Conditioncond 0.0% 0 / 188 MC/DCmcdc 0.0% 0 / 107 Subroutinesub 50.0% 25 / 50 Podpod 100% 24 / 24 totaltotal 12.5% 143 / 1143 CC 217 SCAR 64.8
CC
217
Cov
10%
Save
2070.0
LoadContent
1332.0
Admin
462.0
CRAP 651.1
↑ Summary Menus.pm »
1 package Labyrinth::Plugin::Articles;
2  
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 our $VERSION = '5.19';
7  
8 =head1 NAME
9  
10 Labyrinth::Plugin::Articles - Plugin Articles handler for Labyrinth
11  
12 =head1 DESCRIPTION
13  
14 Contains all the default article handling functionality for the Labyrinth
15 framework.
16  
17 =cut
18  
19 # -------------------------------------
20 # Library Modules
21  
22 4 ▶use base qw(Labyrinth::Plugin::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 4 ▶use Clone qw(clone);
Subroutine BEGIN: called CC=1 SCAR=0.0
25 4 ▶use Data::Pageset;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 4 ▶use Labyrinth::Audit;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 4 ▶use Labyrinth::DBUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 4 ▶use Labyrinth::DTUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 4 ▶use Labyrinth::Media;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 4 ▶use Labyrinth::Metadata;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 4 ▶use Labyrinth::MLUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 4 ▶use Labyrinth::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 4 ▶use Labyrinth::Support;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 4 ▶use Labyrinth::Users;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 4 ▶use Labyrinth::Variables;
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 # -------------------------------------
39 # Constants
40  
41 4 ▶use constant MaxArticleWidth => 400;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 4 ▶use constant MaxArticleHeight => 400;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 4 ▶use constant IMAGE => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 4 ▶use constant PARA => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 4 ▶use constant LINK => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 4 ▶use constant MFILE => 4; # Media File
Subroutine BEGIN: called CC=1 SCAR=0.0
48 4 ▶use constant DFILE => 5; # Download File
Subroutine BEGIN: called CC=1 SCAR=0.0
49 4 ▶use constant VIDEO => 6;
Subroutine BEGIN: called CC=1 SCAR=0.0
50  
51 4 ▶use constant MAINPAGE => 5;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 4 ▶use constant LIMIT_LATEST => 20;
Subroutine BEGIN: called CC=1 SCAR=0.0
53  
54 # -------------------------------------
55 # Variables
56  
57 # type: 0 = optional, 1 = mandatory
58 # html: 0 = none, 1 = text, 2 = textarea
59  
60 4 my %fields = (
61 articleid => { type => 0, html => 0 },
62 postdate => { type => 0, html => 1 },
63 quickname => { type => 1, html => 1 },
64 title => { type => 1, html => 1 },
65 publish => { type => 1, html => 1 },
66 folderid => { type => 0, html => 0 },
67 userid => { type => 0, html => 0 },
68 snippet => { type => 0, html => 2 },
69 front => { type => 0, html => 1 },
70 latest => { type => 0, html => 1 },
71 sectionid => { type => 0, html => 0 },
72 width => { type => 0, html => 1 },
73 height => { type => 0, html => 1 },
74 body => { type => 0, html => 2 },
75 metadata => { type => 0, html => 1 },
76 );
77  
78 4 my (@mandatory,@allfields);
79 4 for(keys %fields) {
80 60 ▶ push @mandatory, $_ if($fields{$_}->{type});
Branch: 1 branch
BranchTrueFalseTotal
if $fields{$_}{"type"} 12 48 60
81 60 push @allfields, $_;
82 }
83  
84 4 our $INDEXKEY = 'articleid';
85 4 our $ALLSQL = 'AllArticles';
86 4 our $SAVESQL = 'SaveArticle';
87 4 our $ADDSQL = 'AddArticle';
88 4 our $GETSQL = 'GetArticleByID';
89 4 our $DELETESQL = 'DeleteRecords';
90 4 our $PROMOTESQL = 'PromoteArticle';
91 4 our $LEVEL = EDITOR;
92 4 our $LEVEL2 = PUBLISHER;
93  
94 # sectionid is used to reference different types of articles,
95 # however, the default is also a standard article.
96 4 my $SECTIONID = 1;
97  
98 =head1 CONFIGURATION
99  
100 The Articles package is meant to be used as a base package providing default
101 configuration and functionality for article based content. It is expected that
102 that a plugin will use this package as a base, and override configuration and
103 methods as required.
104  
105 =head2 Section IDs
106  
107 It is recommended that the following be used to differentiate the types of
108 sections, for which articles are used to provide the underlying structure.
109 If you wish to add your own plugins, it is recommended that you use a Section
110 ID that is greater than 99 to avoid clashing with any potential standard
111 plugins.
112  
113 1 = page article, traditional articles
114 2 = section entries, for sites that require intro text for each section
115 (see Articles::Section)
116 3 = site content, such as 'About' or 'Home' fixed layout content
117 (see Articles::Site)
118 4 = products (see Articles::Products)
119 5 = profiles (see Articles::Profiles)
120 6 = diary (see Articles::Diary)
121 7 = lyrics (see Articles::Lyrics)
122 8 = liner notes (see Release)
123  
124 Note that some plugins mentioned above may not be currently available, however
125 all are planned for release.
126  
127 =head2 SQL Phrases
128  
129 Several keys used to access SQL phrases can be overriden. These default keys
130 are used in the event that only basic configuration overrides are needed, such
131 as the Section ID.
132  
133 Key variables available are:
134  
135 our $INDEXKEY = 'articleid';
136 our $ALLSQL = 'AllArticles';
137 our $SAVESQL = 'SaveArticle';
138 our $ADDSQL = 'AddArticle';
139 our $GETSQL = 'GetArticleByID';
140 our $DELETESQL = 'DeleteRecords';
141 our $PROMOTESQL = 'PromoteArticle';
142 our $LEVEL = EDITOR; # for normal admin actions
143 our $LEVEL2 = PUBLISHER; # for delete actions
144  
145 =cut
146  
147 # -------------------------------------
148 # The Subs
149  
150 =head1 PUBLIC INTERFACE METHODS
151  
152 =over 4
153  
154 =item LatestArticles
155  
156 Retrieves a list of the latest article titles
157  
158 =item Archive
159  
160 Retrieves a list of the volumes available.
161  
162 =item Page
163  
164 Retrieves an set of articles, for a given page. Default to first page.
165  
166 =item List
167  
168 Retrieves an initial list of articles. Primarily used to prepare a front page.
169  
170 =item Meta
171  
172 Retrieves a list of articles based on given meta tags.
173  
174 =item Search
175  
176 Retrieves a list of articles based on a given search string.
177  
178 =item Cloud
179  
180 Provides the current tag cloud.
181  
182 =item Tags
183  
184 Retrieves the current list of meta tags
185  
186 =item Item
187  
188 Provides a single article.
189  
190 =back
191  
192 =cut
193  
194 0 ▶sub LatestArticles {
Subroutine LatestArticles: not called CC=4 SCAR=30.0
Pod documented
195 # latest Articles list
196 0 ▶ my $limit = $settings{article_latest} || LIMIT_LATEST;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'article_latest'} || 20
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'article_latest'} || 20
$Labyrinth::Plugin::Articles::settings{'article_latest'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'article_latest'}
Aresult
11
00
197 0 my @rows = $dbi->GetQuery('hash','GetArticlesLatest',{limit => $limit});
198 0 LogDebug("Latest:rows=".scalar(@rows));
199 0 for my $row (@rows) {
200 0 $row->{postdate} = formatDate(19,$row->{createdate});
201 0 $row->{name} = UserName($row->{userid});
202 }
203 0 ▶ $tvars{latest}->{articles} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
204 }
205  
206 0 ▶sub Archive {
Subroutine Archive: not called CC=4 SCAR=30.0
Pod documented
207 0 ▶ $cgiparams{sectionid} ||= $SECTIONID;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{"sectionid"} ||= $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{"sectionid"} ||= $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{"sectionid"} $SECTIONID
Truth table0%0/3
A ||= B
A= $Labyrinth::Plugin::Articles::cgiparams{"sectionid"}B= $SECTIONID
ABresult
1X1
011
000
208 0 ▶ $cgiparams{section} ||= 'articles';
Condition0%0/2
$Labyrinth::Plugin::Articles::cgiparams{"section"} ||= "articles"
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::cgiparams{"section"} ||= "articles"
$Labyrinth::Plugin::Articles::cgiparams{"section"}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::cgiparams{"section"}
Aresult
11
00
209  
210 0 my @rows = $dbi->GetQuery('hash','GetVolumes',$cgiparams{sectionid});
211 0 ▶ $tvars{archive}{$cgiparams{section}} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
212 }
213  
214 0 ▶sub Page {
Subroutine Page: not called CC=8 SCAR=42.8
Pod documented
215 0 my @mainarts;
216 0 $cgiparams{name} = undef;
217 0 ▶ my $page = $cgiparams{page} || 1;
Condition0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'page'} || 1
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::cgiparams{'page'} || 1
$Labyrinth::Plugin::Articles::cgiparams{'page'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::cgiparams{'page'}
Aresult
11
00
218
219 0 ▶ my $limit = $settings{data}{article_pageset} || $settings{article_pageset} || MAINPAGE;
Condition0%0/5
$Labyrinth::Plugin::Articles::settings{'data'}{'article_pageset'} || $Labyrinth::Plugin::Articles::settings{'article_pageset'} || 5
l!l
00
$Labyrinth::Plugin::Articles::settings{"data"}{"article_pageset"} or $Labyrinth::Plugin::Articles::settings{"article_pageset"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::settings{'data'}{'article_pageset'} || $Labyrinth::Plugin::Articles::settings{'article_pageset'} || 5
$Labyrinth::Plugin::Articles::settings{"data"}{"article_pageset"} $Labyrinth::Plugin::Articles::settings{"article_pageset"}
Truth table0%0/3
A or B
A= $Labyrinth::Plugin::Articles::settings{"data"}{"article_pageset"}B= $Labyrinth::Plugin::Articles::settings{"article_pageset"}
ABresult
1X1
011
000
220 0 ▶ my $sectionid = $cgiparams{sectionid} || $SECTIONID;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} $SECTIONID
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{'sectionid'}B= $SECTIONID
ABresult
1X1
011
000
221 0 my @where = ("sectionid=$sectionid","publish=3");
222 0 my $where = 'WHERE ' . join(' AND ',@where);
223 0 ▶ my $order = 'ORDER BY ' . ($settings{data}{order} || 'createdate DESC');
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'data'}{'order'} || 'createdate DESC'
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'data'}{'order'} || 'createdate DESC'
$Labyrinth::Plugin::Articles::settings{'data'}{'order'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'data'}{'order'}
Aresult
11
00
224 0 my @rows = $dbi->GetQuery('hash',$ALLSQL,{where=>$where,order=>$order});
225  
226 0 my $page_info = Data::Pageset->new({
227 'total_entries' => scalar(@rows),
228 'entries_per_page' => $limit,
229 # Optional, will use defaults otherwise.
230 'current_page' => $page,
231 #'pages_per_set' => $pages_per_set,
232 #'mode' => 'fixed', # default, or 'slide'
233 });
234  
235 0 $tvars{pages}{first} = $page_info->first_page;
236 0 $tvars{pages}{last} = $page_info->last_page;
237 0 $tvars{pages}{next} = $page_info->next_page;
238 0 $tvars{pages}{previous} = $page_info->previous_page;
239  
240 0 my @arts = splice(@rows, ($page - 1) * $limit, $limit);
241 0 for my $row (@arts) {
242 0 $cgiparams{articleid} = $row->{articleid};
243 0 Item();
244 0 push @mainarts, $tvars{articles}->{$tvars{primary}};
245 }
246 0 ▶ $tvars{mainarts} = \@mainarts if(@mainarts);
Branch: 1 branch
BranchTrueFalseTotal
if @mainarts 0 0 0
247 0 $cgiparams{sectionid} = undef;
248 }
249  
250 0 ▶sub List {
Subroutine List: not called CC=13 SCAR=52.0
Pod documented
251 0 my (@mainarts,@inbrief,@archive);
252 0 $cgiparams{name} = undef;
253  
254 0 ▶ my $limit = $settings{data}{article_limit} || $settings{article_limit};
Condition0%0/3
$Labyrinth::Plugin::Articles::settings{'data'}{'article_limit'} || $Labyrinth::Plugin::Articles::settings{'article_limit'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::settings{'data'}{'article_limit'} || $Labyrinth::Plugin::Articles::settings{'article_limit'}
$Labyrinth::Plugin::Articles::settings{'data'}{'article_limit'} $Labyrinth::Plugin::Articles::settings{'article_limit'}
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::settings{'data'}{'article_limit'}B= $Labyrinth::Plugin::Articles::settings{'article_limit'}
ABresult
1X1
011
000
255 0 ▶ my $step = "LIMIT $limit" if($limit);
Branch: 1 branch
BranchTrueFalseTotal
if $limit 0 0 0
256 0 ▶ my $stop = $settings{data}{article_stop} || MAINPAGE;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'data'}{'article_stop'} || 5
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'data'}{'article_stop'} || 5
$Labyrinth::Plugin::Articles::settings{'data'}{'article_stop'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'data'}{'article_stop'}
Aresult
11
00
257  
258 0 ▶ my $sectionid = $cgiparams{sectionid} || $SECTIONID;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} $SECTIONID
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{'sectionid'}B= $SECTIONID
ABresult
1X1
011
000
259  
260 0 my @where = ("sectionid=$sectionid","publish=3");
261 0 ▶ push @where, $settings{where} if($settings{where});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Articles::settings{"where"} 0 0 0
262 0 my $where = 'WHERE ' . join(' AND ',@where);
263 0 ▶ my $order = 'ORDER BY ' . ($settings{data}{order} || 'createdate DESC');
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'data'}{'order'} || 'createdate DESC'
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'data'}{'order'} || 'createdate DESC'
$Labyrinth::Plugin::Articles::settings{'data'}{'order'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'data'}{'order'}
Aresult
11
00
264  
265 0 my @rows = $dbi->GetQuery('hash',$ALLSQL,{where=>$where,limit=>$step,order=>$order});
266 0 for my $row (@rows) {
267 0 ▶ if($stop) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stop) 0 0 0
268 0 $cgiparams{articleid} = $row->{articleid};
269 0 Item();
270 0 push @mainarts, $tvars{articles}->{$tvars{primary}};
271 0 $stop--;
272 0 next;
273 }
274 0 push @inbrief, {name => $row->{quickname}, title => $row->{title}, snippet => _snippet($row,82)};
275 }
276 # archived articles
277 0 @where = ("sectionid=$sectionid","publish=4");
278 0 $where = 'WHERE ' . join(' AND ',@where);
279 0 @rows = $dbi->GetQuery('hash',$ALLSQL,{where=>$where,limit=>$limit,order=>$order});
280 0 for my $row (@rows) {
281 0 push @archive, {name => $row->{quickname}, title => $row->{title}, snippet => _snippet($row,82)};
282 }
283 0 ▶ $tvars{mainarts} = \@mainarts if(@mainarts);
Branch: 1 branch
BranchTrueFalseTotal
if @mainarts 0 0 0
284 0 ▶ $tvars{inbrief} = \@inbrief if(@inbrief);
Branch: 1 branch
BranchTrueFalseTotal
if @inbrief 0 0 0
285 0 ▶ $tvars{archive} = \@archive if(@archive);
Branch: 1 branch
BranchTrueFalseTotal
if @archive 0 0 0
286 0 $cgiparams{sectionid} = undef;
287 }
288  
289 0 ▶sub Meta {
Subroutine Meta: not called CC=6 SCAR=37.4
Pod documented
290 0 ▶ my $page = $cgiparams{page} || 1;
Condition0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'page'} || 1
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::cgiparams{'page'} || 1
$Labyrinth::Plugin::Articles::cgiparams{'page'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::cgiparams{'page'}
Aresult
11
00
291 0 ▶ my $limit = $settings{data}{article_pageset} || $settings{article_pageset} || MAINPAGE;
Condition0%0/5
$Labyrinth::Plugin::Articles::settings{'data'}{'article_pageset'} || $Labyrinth::Plugin::Articles::settings{'article_pageset'} || 5
l!l
00
$Labyrinth::Plugin::Articles::settings{"data"}{"article_pageset"} or $Labyrinth::Plugin::Articles::settings{"article_pageset"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::settings{'data'}{'article_pageset'} || $Labyrinth::Plugin::Articles::settings{'article_pageset'} || 5
$Labyrinth::Plugin::Articles::settings{"data"}{"article_pageset"} $Labyrinth::Plugin::Articles::settings{"article_pageset"}
Truth table0%0/3
A or B
A= $Labyrinth::Plugin::Articles::settings{"data"}{"article_pageset"}B= $Labyrinth::Plugin::Articles::settings{"article_pageset"}
ABresult
1X1
011
000
292 0 ▶ my $sectionid = $cgiparams{sectionid} || $SECTIONID;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} $SECTIONID
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{'sectionid'}B= $SECTIONID
ABresult
1X1
011
000
293  
294 0 my @data = split(qr/[ ,]+/,$cgiparams{data});
295 0 my @rows = MetaSearch( 'keys' => ['Art'],
296 'meta' => \@data,
297 'where' => "sectionid=$sectionid AND publish=3",
298 'limit' => '',
299 'order' => 'createdate',
300 'sort' => 'desc');
301  
302 0 my $page_info = Data::Pageset->new({
303 'total_entries' => scalar(@rows),
304 'entries_per_page' => $limit,
305 'current_page' => $page,
306 });
307  
308 0 my @arts = splice(@rows, ($page - 1) * $limit, $limit);
309 0 for my $row (@arts) {
310 0 $cgiparams{articleid} = $row->{articleid};
311 0 Item();
312 0 push @{$tvars{mainarts}}, $tvars{articles}{$tvars{primary}};
313 }
314  
315 0 $tvars{pages}{first} = $page_info->first_page;
316 0 $tvars{pages}{last} = $page_info->last_page;
317 0 $tvars{pages}{next} = $page_info->next_page;
318 0 $tvars{pages}{previous} = $page_info->previous_page;
319 0 $tvars{pages}{data} = $cgiparams{data};
320 }
321  
322 0 ▶sub Cloud {
Subroutine Cloud: not called CC=3 SCAR=24.8
Pod documented
323 0 ▶ my $sectionid = $cgiparams{sectionid} || $SECTIONID;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} $SECTIONID
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{'sectionid'}B= $SECTIONID
ABresult
1X1
011
000
324 0 ▶ my $actcode = $cgiparams{actcode} || 'arts-meta';
Condition0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'actcode'} || 'arts-meta'
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::cgiparams{'actcode'} || 'arts-meta'
$Labyrinth::Plugin::Articles::cgiparams{'actcode'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::cgiparams{'actcode'}
Aresult
11
00
325 0 $tvars{cloud} = MetaCloud(key => 'Art', sectionid => $sectionid, actcode => $actcode);
326 }
327  
328 0 ▶sub Tags {
Subroutine Tags: not called CC=3 SCAR=24.8
Pod documented
329 0 ▶ my $sectionid = $cgiparams{sectionid} || $SECTIONID;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} $SECTIONID
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{'sectionid'}B= $SECTIONID
ABresult
1X1
011
000
330 0 my @tags = MetaTags(key => 'Art', sectionid => $sectionid);
331 0 ▶ $tvars{metatags} = \@tags if(@tags);
Branch: 1 branch
BranchTrueFalseTotal
if @tags 0 0 0
332 }
333  
334 0 ▶sub Search {
Subroutine Search: not called CC=6 SCAR=37.4
Pod documented
335 0 ▶ my $page = $cgiparams{page} || 1;
Condition0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'page'} || 1
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::cgiparams{'page'} || 1
$Labyrinth::Plugin::Articles::cgiparams{'page'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::cgiparams{'page'}
Aresult
11
00
336 0 ▶ my $limit = $settings{data}{article_pageset} || $settings{article_pageset} || MAINPAGE;
Condition0%0/5
$Labyrinth::Plugin::Articles::settings{'data'}{'article_pageset'} || $Labyrinth::Plugin::Articles::settings{'article_pageset'} || 5
l!l
00
$Labyrinth::Plugin::Articles::settings{"data"}{"article_pageset"} or $Labyrinth::Plugin::Articles::settings{"article_pageset"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::settings{'data'}{'article_pageset'} || $Labyrinth::Plugin::Articles::settings{'article_pageset'} || 5
$Labyrinth::Plugin::Articles::settings{"data"}{"article_pageset"} $Labyrinth::Plugin::Articles::settings{"article_pageset"}
Truth table0%0/3
A or B
A= $Labyrinth::Plugin::Articles::settings{"data"}{"article_pageset"}B= $Labyrinth::Plugin::Articles::settings{"article_pageset"}
ABresult
1X1
011
000
337 0 ▶ my $sectionid = $cgiparams{sectionid} || $SECTIONID;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} $SECTIONID
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{'sectionid'}B= $SECTIONID
ABresult
1X1
011
000
338  
339 0 my @data = split(qr/[ ,]+/,$cgiparams{data});
340 0 my @rows = MetaSearch( 'keys' => ['Art'],
341 'meta' => \@data,
342 'full' => 1,
343 'where' => "sectionid=$sectionid AND publish=3",
344 'limit' => '',
345 'order' => 'createdate',
346 'sort' => 'desc');
347  
348 0 my $page_info = Data::Pageset->new({
349 'total_entries' => scalar(@rows),
350 'entries_per_page' => $limit,
351 'current_page' => $page,
352 });
353  
354 0 my @arts = splice(@rows, ($page - 1) * $limit, $limit);
355 0 for my $row (@arts) {
356 0 $cgiparams{articleid} = $row->{articleid};
357 0 Item();
358 0 push @{$tvars{mainarts}}, $tvars{articles}{$tvars{primary}};
359 }
360  
361 0 $tvars{pages}{first} = $page_info->first_page;
362 0 $tvars{pages}{last} = $page_info->last_page;
363 0 $tvars{pages}{next} = $page_info->next_page;
364 0 $tvars{pages}{previous} = $page_info->previous_page;
365 0 $tvars{pages}{data} = $cgiparams{data};
366 }
367  
368 0 ▶sub Item {
Subroutine Item: not called CC=19 SCAR=59.4
Pod documented
369 0 ▶ my $name = $cgiparams{'name'} || undef;
Condition0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'name'} || undef
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::cgiparams{'name'} || undef
$Labyrinth::Plugin::Articles::cgiparams{'name'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::cgiparams{'name'}
Aresult
11
00
370 0 ▶ my $naid = $cgiparams{articleid} || $cgiparams{id} || undef;
Condition0%0/5
$Labyrinth::Plugin::Articles::cgiparams{'articleid'} || $Labyrinth::Plugin::Articles::cgiparams{'id'} || undef
l!l
00
$Labyrinth::Plugin::Articles::cgiparams{"articleid"} or $Labyrinth::Plugin::Articles::cgiparams{"id"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'articleid'} || $Labyrinth::Plugin::Articles::cgiparams{'id'} || undef
$Labyrinth::Plugin::Articles::cgiparams{"articleid"} $Labyrinth::Plugin::Articles::cgiparams{"id"}
Truth table0%0/3
A or B
A= $Labyrinth::Plugin::Articles::cgiparams{"articleid"}B= $Labyrinth::Plugin::Articles::cgiparams{"id"}
ABresult
1X1
011
000
371  
372 0 ▶ my $maximagewidth = $settings{maximagewidth} || MaxArticleWidth;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
$Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Aresult
11
00
373 0 ▶ my $maximageheight = $settings{maximageheight} || MaxArticleHeight;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
$Labyrinth::Plugin::Articles::settings{'maximageheight'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximageheight'}
Aresult
11
00
374  
375 0 ▶ unless($name || $naid) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($name or $naid) 0 0 0
Condition0%0/3
$name or $naid
l!l&&r!l&&!r
000
MC/DC0%0/2
$name or $naid
$name $naid
Truth table0%0/3
A or B
A= $nameB= $naid
ABresult
1X1
011
000
376 0 $tvars{errcode} = 'ERROR';
377 0 return;
378 }
379  
380 # main article data
381 0 ▶ my ($key,$search) = $name ? ('GetArticleByName',$name) :
Branch: 1 branch
BranchTrueFalseTotal
$name ? : 0 0 0
382 ('GetArticleByID',$naid);
383 0 my @data = $dbi->GetQuery('hash',$key,$search);
384 0 ▶ return unless(@data);
Branch: 1 branch
BranchTrueFalseTotal
unless @data 0 0 0
385  
386 0 $data[0]->{postdate} = formatDate(19,$data[0]->{createdate});
387 0 $data[0]->{name} = UserName($data[0]->{userid});
388 0 $tvars{article} = $data[0];
389 0 ▶ if($data[0]->{imageid}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data[0]{"imageid"}) 0 0 0
390 0 my ($tag,$link,undef,$x) = GetImage($data[0]->{imageid});
391 0 $data[0]->{tag} = $tag;
392 0 $data[0]->{link} = $link;
393 0 ▶ $data[0]->{resize} = 1 if($x && $x > 100)
Branch: 1 branch
BranchTrueFalseTotal
if $x and $x > 100 0 0 0
Condition0%0/3
$x and $x > 100
!ll&&!rl&&r
000
MC/DC0%0/2
$x and $x > 100
$x $x > 100
Truth table0%0/3
A and B
A= $xB= $x > 100
ABresult
0X0
100
111
394 }
395  
396 # article content
397 0 my @body = $dbi->GetQuery('hash','GetContent',$data[0]->{$INDEXKEY});
398 0 foreach my $body (@body) {
399 0 ▶ if($body->{type} == IMAGE) {
Branch: 2 branches
BranchTrueFalseTotal
if ($body->{'type'} == 1) { } 0 0 0
elsif ($body->{'type'} == 2) { } 0 0 0
400 0 my @rows = $dbi->GetQuery('hash','GetImageByID',$body->{imageid});
401 0 $body->{link} = $rows[0]->{link};
402 0 $body->{alignclass} = AlignClass($body->{align});
403 ($body->{tag},$body->{width},$body->{height}) = split(qr/\|/,$body->{body})
404 0 ▶ if($body->{body});
Branch: 1 branch
BranchTrueFalseTotal
if $body->{"body"} 0 0 0
405  
406 0 ($body->{width},$body->{height}) = GetImageSize($body->{link},$rows[0]->{dimensions},$body->{width},$body->{height},$maximagewidth,$maximageheight);
407  
408 #LogDebug(sprintf "%d/%s [%d x %d]", ($body->{imageid}||0),($body->{link}||'-'),($body->{width}||0),($body->{height}||0));
409 } elsif($body->{type} == PARA) {
410 0 $body->{body} = LinkTitles($body->{body});
411 }
412 }
413  
414 0 ▶ $tvars{primary} = $data[0]->{quickname} || 'draft' . $data[0]->{articleid};
Condition0%0/2
$data[0]{'quickname'} || 'draft' . $data[0]{'articleid'}
l!l
00
MC/DC0%0/1
$data[0]{'quickname'} || 'draft' . $data[0]{'articleid'}
$data[0]{'quickname'}
Truth table0%0/2
A
A= $data[0]{'quickname'}
Aresult
11
00
415 $tvars{articles}->{$tvars{primary}} = {
416 0 data => $data[0],
417 body => \@body,
418 };
419  
420 0 $tvars{article} = $tvars{articles}->{$tvars{primary}};
421 0 $cgiparams{sectionid} = undef;
422 0 my @meta = MetaGet($data[0]->{articleid},'Art');
423 0 ▶ $tvars{articles}->{$tvars{primary}}->{meta} = \@meta if(scalar(@meta));
Branch: 1 branch
BranchTrueFalseTotal
if scalar @meta 0 0 0
424 0 $tvars{article} = $tvars{articles}->{$tvars{primary}};
425 }
426  
427 =head1 ADMIN INTERFACE METHODS
428  
429 =over 4
430  
431 =item Admin
432  
433 Lists the current set of articles for the given section.
434  
435 Also provides the delete, copy and promote functionality from the main
436 administration page for the given section.
437  
438 =item Add
439  
440 Add an article to the current section.
441  
442 =item Edit
443  
444 Edit an article within the current section.
445  
446 =item AddParagraph
447  
448 Add a text block to the current article.
449  
450 =item AddImage
451  
452 Add an image block to the current article.
453  
454 =item AddLink
455  
456 Add a link block to the current article.
457  
458 =item AddVideo
459  
460 Add a embedded video block to the current article.
461  
462 =item DeleteItem
463  
464 Delete an article.
465  
466 =item Relocate
467  
468 Relocate an article in a list, where an order is in use.
469  
470 =item LoadContent
471  
472 Load complete article from form fields, save all image and media files.
473  
474 =item EditAmendments
475  
476 Additional drop downs and fields prepared for edit form.
477  
478 =item Save
479  
480 Save an article within the current section.
481  
482 =item Promote
483  
484 Promote the given article within the current section.
485  
486 =item Copy
487  
488 Copy an article, to create a new article, within the current section.
489  
490 =item Delete
491  
492 Delete a given article within the current section.
493  
494 =back
495  
496 =cut
497  
498 0 ▶sub Admin {
Subroutine Admin: not called CC=21 SCAR=61.4
Pod documented
499 0 ▶ return unless AccessUser($LEVEL);
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($Labyrinth::Plugin::Articles::LEVEL) 0 0 0
500  
501 0 ▶ if($cgiparams{doaction}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Articles::cgiparams{"doaction"}) 0 0 0
502 0 ▶ if($cgiparams{doaction} eq 'Delete') { Delete() }
Branch: 3 branches
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'Delete') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'Copy') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'Promote') { } 0 0 0
503 0 elsif($cgiparams{doaction} eq 'Copy') { Copy() }
504 0 elsif($cgiparams{doaction} eq 'Promote') { Promote() }
505 }
506  
507 0 my @front = CGIArray('FRONT');
508 0 ▶ if(@front) {
Branch: 1 branch
BranchTrueFalseTotal
if (@front) 0 0 0
509 0 my @check = $dbi->GetQuery('hash','CheckFrontPageArticles');
510 0 my %check = map {$_->{articleid} => 1} @check;
511 0 for my $id (@front) {
512 0 ▶ if($check{$id}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($check{$id}) { } 0 0 0
513 0 $check{$id} = 0;
514 } else {
515 0 $dbi->DoQuery('SetFrontPageArticle',$id);
516 }
517 }
518 0 for my $id (keys %check) {
519 0 ▶ next unless($check{$id});
Branch: 1 branch
BranchTrueFalseTotal
unless $check{$id} 0 0 0
520 0 $dbi->DoQuery('ClearFrontPageArticle',$id);
521 }
522 }
523  
524 0 ▶ my $sectionid = $cgiparams{sectionid} || $SECTIONID;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} $SECTIONID
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{'sectionid'}B= $SECTIONID
ABresult
1X1
011
000
525 0 my @where = ("sectionid=$sectionid");
526 0 ▶ push @where, "publish<4" unless($cgiparams{publish});
Branch: 1 branch
BranchTrueFalseTotal
unless $Labyrinth::Plugin::Articles::cgiparams{"publish"} 0 0 0
527 0 ▶ push @where, "publish=$cgiparams{publish}" if($cgiparams{publish});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Articles::cgiparams{"publish"} 0 0 0
528 0 ▶ push @where, "userid=$tvars{'loginid'}" unless(Authorised(EDITOR));
Branch: 1 branch
BranchTrueFalseTotal
unless Authorised(2) 0 0 0
529 0 ▶ push @where, "quickname LIKE '%$cgiparams{'searchname'}%'" if($cgiparams{'searchname'});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Articles::cgiparams{"searchname"} 0 0 0
530 0 ▶ my $where = @where ? 'WHERE '.join(' AND ',@where) : '';
Branch: 1 branch
BranchTrueFalseTotal
@where ? : 0 0 0
531  
532 0 ▶ my @rows = sort {int($b->{createdate}||0) <=> int($a->{createdate}||0)}
Condition0%0/4
$Labyrinth::Plugin::Articles::b->{'createdate'} || 0
l!l
00
$Labyrinth::Plugin::Articles::a->{'createdate'} || 0
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::b->{'createdate'} || 0
$Labyrinth::Plugin::Articles::b->{'createdate'}
MC/DC0%0/1
$Labyrinth::Plugin::Articles::a->{'createdate'} || 0
$Labyrinth::Plugin::Articles::a->{'createdate'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::b->{'createdate'}
Aresult
11
00
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::a->{'createdate'}
Aresult
11
00
533 $dbi->GetQuery('hash',$ALLSQL,{where=>$where});
534 # LogDebug("Admin: rows=".scalar(@rows));
535 0 foreach my $row (@rows) {
536 0 $row->{publishstate} = PublishState($row->{publish});
537 0 $row->{name} = UserName($row->{userid});
538 0 $row->{postdate} = formatDate(3,$row->{createdate});
539 }
540 0 ▶ $tvars{data} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
541 0 $tvars{ddpublish} = PublishSelect($cgiparams{publish},1);
542 0 $tvars{sectionid} = $sectionid;
543 }
544  
545 0 ▶sub Add {
Subroutine Add: not called CC=3 SCAR=24.8
Pod documented
546 0 ▶ return unless AccessUser($LEVEL);
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($Labyrinth::Plugin::Articles::LEVEL) 0 0 0
547  
548 my %data = (
549 articleid => 0,
550 folderid => $tvars{user}->{folder},
551 userid => $tvars{loginid},
552 name => $tvars{user}->{name},
553 postdate => formatDate(3),
554 ddpublish => PublishSelect(1),
555 0 ▶ sectionid => $cgiparams{sectionid} || $SECTIONID, # default 1=article
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} $SECTIONID
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{'sectionid'}B= $SECTIONID
ABresult
1X1
011
000
556 );
557  
558 0 $tvars{primary} = 'draft' . $data{articleid};
559 my @fields = ( $data{folderid},
560 'DRAFT',
561 $data{userid},
562 $data{sectionid},
563 $tvars{primary},
564 0 1,
565 formatDate(0));
566 0 $data{articleid} = $dbi->IDQuery('AddArticle',@fields);
567 0 $data{quickname} = 'ID'.$data{articleid};
568  
569 @fields = ( $data{articleid},
570 0 1, # orderno
571 2, # type - paragraph
572 0, # imageid
573 '', # link
574 '', # body
575 '' # align
576 );
577 0 my $paraid = $dbi->IDQuery('AddContent',@fields);
578  
579 0 my @body = (
580 { paraid=>$paraid,orderno=>1,type=>PARA},
581 );
582  
583 $tvars{articles}->{$tvars{primary}} = {
584 0 blocks => '1', # '1,2'
585 data => \%data,
586 body => \@body,
587 htmltags => LegalTags(),
588 };
589  
590 0 $tvars{authors} = UserSelect($tvars{loginid},1);
591 0 $tvars{article} = $tvars{articles}{$tvars{primary}};
592 0 $tvars{preview} = $tvars{articles}{$tvars{primary}};
593 }
594  
595 0 ▶sub Edit {
Subroutine Edit: not called CC=14 SCAR=53.5
Pod documented
596 0 ▶ return unless AccessUser($LEVEL);
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($Labyrinth::Plugin::Articles::LEVEL) 0 0 0
597 0 ▶ return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL);
Branch: 1 branch
BranchTrueFalseTotal
unless AuthorCheck($Labyrinth::Plugin::Articles::GETSQL, $Labyrinth::Plugin::Articles::INDEXKEY, $Labyrinth::Plugin::Articles::LEVEL) 0 0 0
598 0 ▶ $tvars{primary} = $tvars{data}->{quickname} || 'draft' . ($tvars{data}->{articleid}||0);
Condition0%0/4
$Labyrinth::Plugin::Articles::tvars{'data'}{'quickname'} || 'draft' . ($Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'} || 0)
l!l
00
$Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'} || 0
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::tvars{'data'}{'quickname'} || 'draft' . ($Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'} || 0)
$Labyrinth::Plugin::Articles::tvars{'data'}{'quickname'}
MC/DC0%0/1
$Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'} || 0
$Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::tvars{'data'}{'quickname'}
Aresult
11
00
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'}
Aresult
11
00
599  
600 0 ▶ my $maximagewidth = $settings{maximagewidth} || MaxArticleWidth;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
$Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Aresult
11
00
601 0 ▶ my $maximageheight = $settings{maximageheight} || MaxArticleHeight;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
$Labyrinth::Plugin::Articles::settings{'maximageheight'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximageheight'}
Aresult
11
00
602  
603 # article content
604 0 my @blocks;
605 0 my $orderno = 1;
606 0 my @body = $dbi->GetQuery('hash','GetContent',$cgiparams{$INDEXKEY});
607 0 foreach my $body (@body) {
608 0 push @blocks, $orderno;
609 0 ▶ if($body->{type} == IMAGE
Branch: 1 branch
BranchTrueFalseTotal
if ($body->{"type"} == 1 or $body->{"type"} == 4 or $body->{"type"} == 5) 0 0 0
Condition0%0/6
$body->{"type"} == 1 or $body->{"type"} == 4 or $body->{"type"} == 5
l!l&&r!l&&!r
000
$body->{"type"} == 1 or $body->{"type"} == 4
l!l&&r!l&&!r
000
MC/DC0%0/3
$body->{"type"} == 1 or $body->{"type"} == 4 or $body->{"type"} == 5
$body->{"type"} == 1 $body->{"type"} == 4 $body->{"type"} == 5
Truth table0%0/4
A or B or C
A= $body->{"type"} == 1B= $body->{"type"} == 4C= $body->{"type"} == 5
ABCresult
1XX1
01X1
0011
0000
610 || $body->{type} == MFILE
611 || $body->{type} == DFILE) {
612 0 my @rows = $dbi->GetQuery('hash','GetImageByID',$body->{imageid});
613 0 ▶ $rows[0]->{body} ||= '';
Condition0%0/2
$rows[0]{"body"} ||= ""
l!l
00
MC/DC0%0/1
$rows[0]{"body"} ||= ""
$rows[0]{"body"}
Truth table0%0/2
A
A= $rows[0]{"body"}
Aresult
11
00
614 0 ($body->{tag},$body->{width},$body->{height}) = split(qr/\|/,$body->{body});
615 0 $body->{link} = $rows[0]->{link};
616 0 $body->{ddalign} = AlignSelect($body->{align},$orderno);
617 0 $body->{alignclass} = AlignClass($body->{align});
618  
619 0 ($body->{width},$body->{height}) = GetImageSize($body->{link},$rows[0]->{dimensions},$body->{width},$body->{height},$maximagewidth,$maximageheight);
620  
621 0 LogDebug("$body->{imageid}/$body->{link} [$body->{width} x $body->{height}]");
622 }
623  
624 0 $body->{orderno} = $orderno++;
625 }
626 $tvars{articles}->{$tvars{primary}} = {
627 data => $tvars{data},
628 0 blocks => join(",",@blocks),
629 body => \@body,
630 };
631 0 EditAmendments();
632  
633 0 ▶ $tvars{dimensions}->{width} = $settings{maximagewidth} || MaxArticleWidth;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
$Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Aresult
11
00
634 0 ▶ $tvars{dimensions}->{height} = $settings{maximageheight} || MaxArticleHeight;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
$Labyrinth::Plugin::Articles::settings{'maximageheight'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximageheight'}
Aresult
11
00
635 }
636  
637 0 ▶sub AddParagraph {
Subroutine AddParagraph: not called CC=2 SCAR=17.9
Pod documented
638 0 my ($blocks,$data) = LoadContent();
639 0 ▶ my $item = @$blocks ? (@$blocks)[-1] + 1 : 1;
Branch: 1 branch
BranchTrueFalseTotal
@$blocks ? : 0 0 0
640 0 $dbi->DoQuery('AddContent',$data->{articleid},$item,PARA,0,'','',0);
641 }
642  
643 0 ▶sub AddImage {
Subroutine AddImage: not called CC=2 SCAR=17.9
Pod documented
644 0 my ($blocks,$data) = LoadContent();
645 0 ▶ my $item = @$blocks ? (@$blocks)[-1] + 1 : 1;
Branch: 1 branch
BranchTrueFalseTotal
@$blocks ? : 0 0 0
646 0 $dbi->IDQuery('AddContent',$data->{articleid},$item,IMAGE,0,'','',1);
647 }
648  
649 0 ▶sub AddLink {
Subroutine AddLink: not called CC=2 SCAR=17.9
Pod documented
650 0 my ($blocks,$data,$body) = LoadContent();
651 0 ▶ my $item = @$blocks ? (@$blocks)[-1] + 1 : 1;
Branch: 1 branch
BranchTrueFalseTotal
@$blocks ? : 0 0 0
652 0 $dbi->IDQuery('AddContent',$data->{articleid},$item,LINK,0,'','',0);
653 }
654  
655 0 ▶sub AddVideo {
Subroutine AddVideo: not called CC=2 SCAR=17.9
Pod documented
656 0 my ($blocks,$data,$body) = LoadContent();
657 0 ▶ my $item = @$blocks ? (@$blocks)[-1] + 1 : 1;
Branch: 1 branch
BranchTrueFalseTotal
@$blocks ? : 0 0 0
658 0 $dbi->IDQuery('AddContent',$data->{articleid},$item,VIDEO,0,'','',0);
659 }
660  
661 0 ▶sub DeleteItem {
Subroutine DeleteItem: not called CC=3 SCAR=24.8
Pod documented
662 0 ▶ return unless AccessUser($LEVEL2);
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($Labyrinth::Plugin::Articles::LEVEL2) 0 0 0
663 0 ▶ return unless $cgiparams{'recordid'};
Branch: 1 branch
BranchTrueFalseTotal
unless $Labyrinth::Plugin::Articles::cgiparams{"recordid"} 0 0 0
664 0 $dbi->DoQuery('DeleteContent',$cgiparams{'recordid'});
665 }
666  
667 0 ▶sub Relocate {
Subroutine Relocate: not called CC=12 SCAR=50.5
Pod documented
668 0 ▶ return unless AccessUser($LEVEL);
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($Labyrinth::Plugin::Articles::LEVEL) 0 0 0
669 0 ▶ return unless $cgiparams{'recordid'};
Branch: 1 branch
BranchTrueFalseTotal
unless $Labyrinth::Plugin::Articles::cgiparams{"recordid"} 0 0 0
670 0 my $move = shift;
671  
672 0 my ($blocks,$data,$body) = LoadContent();
673 0 my $para = $cgiparams{'recordid'};
674  
675 0 my ($this,$that);
676 0 for my $block (@$blocks) {
677 0 ▶ if($body->[$block]->{paraid} == $para) {
Branch: 1 branch
BranchTrueFalseTotal
if ($body->[$block]{'paraid'} == $para) { } 0 0 0
678 0 $this = $block;
679 } else {
680 0 ▶ $that = $block if( $move && !$this); # before
Branch: 1 branch
BranchTrueFalseTotal
if $move and not $this 0 0 0
Condition0%0/3
$move and not $this
!ll&&!rl&&r
000
MC/DC0%0/2
$move and not $this
$move not $this
Truth table0%0/3
A and not(B)
A= $moveB= not $this
ABresult
0X0
100
111
681 0 ▶ $that = $block if(!$move && $this && !$that); # after
Branch: 1 branch
BranchTrueFalseTotal
if not $move and $this and not $that 0 0 0
Condition0%0/6
not $move and $this and not $that
!ll&&!rl&&r
000
not $move and $this
!ll&&!rl&&r
000
MC/DC0%0/3
not $move and $this and not $that
not $move $this not $that
Truth table0%0/4
not(A) and B and not(C)
A= not $moveB= $thisC= not $that
ABCresult
0XX0
10X0
1100
1111
682 }
683 }
684  
685 0 ▶ if($this && $that) {
Branch: 1 branch
BranchTrueFalseTotal
if ($this and $that) 0 0 0
Condition0%0/3
$this and $that
!ll&&!rl&&r
000
MC/DC0%0/2
$this and $that
$this $that
Truth table0%0/3
A and B
A= $thisB= $that
ABresult
0X0
100
111
686 0 $dbi->DoQuery('Relocate',$that,$body->[$this]->{paraid});
687 0 $dbi->DoQuery('Relocate',$this,$body->[$that]->{paraid});
688 }
689 }
690  
691 # list=1,2,3,4
692 # BLOCK2="1,2" - IMAGE,orderno
693 # IMAGETAG2=""
694 # IMAGEHREF2=""
695 # IMAGEUPLOAD2=""
696 # BLOCK1="2,1" - PARAGRAPH,orderno
697 # TEXT1="" - paragraphs are textblocks
698 # BLOCK1="3,3" - LINK,orderno
699 # LINK3="" - links are textblocks
700  
701 0 ▶sub LoadContent {
Subroutine LoadContent: not called CC=36 SCAR=71.9
Pod documented
702 0 my (@body,@ordernos);
703 0 ▶ my @blocks = $cgiparams{'list'} ? split(",", $cgiparams{'list'}) : ();
Branch: 1 branch
BranchTrueFalseTotal
$Labyrinth::Plugin::Articles::cgiparams{'list'} ? : 0 0 0
704  
705 0 ▶ my $maximagewidth = $settings{maximagewidth} || MaxArticleWidth;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
$Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Aresult
11
00
706 0 ▶ my $maximageheight = $settings{maximageheight} || MaxArticleHeight;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
$Labyrinth::Plugin::Articles::settings{'maximageheight'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximageheight'}
Aresult
11
00
707  
708 0 for my $block (@blocks) {
709 0 my ($type,$paraid) = split(",", $cgiparams{"BLOCK$block"});
710 0 push @ordernos, $block;
711  
712 0 $body[$block]->{type} = $type;
713 0 $body[$block]->{orderno} = $block;
714  
715 # images
716 0 ▶ if($type == IMAGE) {
Branch: 6 branches
BranchTrueFalseTotal
if ($type == 1) { } 0 0 0
elsif ($type == 2) { } 0 0 0
elsif ($type == 3) { } 0 0 0
elsif ($type == 6) { } 0 0 0
elsif ($type == 4) { } 0 0 0
elsif ($type == 5) { } 0 0 0
717 0 $body[$block]->{paraid} = $paraid;
718 0 $body[$block]->{imagelink} = $cgiparams{"IMAGELINK$block"};
719 0 $body[$block]->{href} = $cgiparams{"IMAGEHREF$block"};
720 0 $body[$block]->{align} = $cgiparams{"ALIGN$block"};
721 0 my $tag = CleanTags($cgiparams{"IMAGETAG$block"});
722 0 ▶ my $width = $cgiparams{"width$block"} || $maximagewidth;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{"width$block"} || $maximagewidth
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{"width$block"} || $maximagewidth
$Labyrinth::Plugin::Articles::cgiparams{"width$block"} $maximagewidth
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{"width$block"}B= $maximagewidth
ABresult
1X1
011
000
723 0 ▶ my $height = $cgiparams{"height$block"} || $maximageheight;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{"height$block"} || $maximageheight
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{"height$block"} || $maximageheight
$Labyrinth::Plugin::Articles::cgiparams{"height$block"} $maximageheight
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{"height$block"}B= $maximageheight
ABresult
1X1
011
000
724  
725 # uploaded own image
726 0 ▶ if(defined $cgiparams{"IMAGEUPLOAD$block"} && $cgiparams{"IMAGEUPLOAD$block"}) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"} and $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"}) { } 0 0 0
elsif (defined $Labyrinth::Plugin::Articles::cgiparams{"display$block"}) { } 0 0 0
elsif (defined $Labyrinth::Plugin::Articles::cgiparams{"gallery$block"}) { } 0 0 0
Condition0%0/3
defined $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"} and $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"} and $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"}
defined $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"} $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"}
Truth table0%0/3
A and B
A= defined $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"}B= $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD$block"}
ABresult
0X0
100
111
727 0 my ($imageid,$imagelink) = SaveImageFile(
728 param => "IMAGEUPLOAD$block",
729 stock => 'Special',
730 width => $width,
731 height => $height);
732 0 $body[$block]->{imageid} = $imageid;
733 0 $body[$block]->{imagelink} = $imagelink;
734  
735 # using an existing image
736 } elsif(defined $cgiparams{"display$block"}) {
737 0 $body[$block]->{imageid} = $cgiparams{"display$block"};
738 0 (undef,$body[$block]->{imagelink}) = GetImage($body[$block]->{imageid});
739  
740 # already uploaded photo
741 } elsif(defined $cgiparams{"gallery$block"}) {
742 0 $body[$block]->{imageid} = $cgiparams{"gallery$block"};
743 0 (undef,$body[$block]->{imagelink}) = GetImage($body[$block]->{imageid});
744 }
745  
746 0 ▶ $body[$block]->{href} ||= $body[$block]->{imagelink};
Condition0%0/3
$body[$block]{"href"} ||= $body[$block]{"imagelink"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$body[$block]{"href"} ||= $body[$block]{"imagelink"}
$body[$block]{"href"} $body[$block]{"imagelink"}
Truth table0%0/3
A ||= B
A= $body[$block]{"href"}B= $body[$block]{"imagelink"}
ABresult
1X1
011
000
747  
748 0 ▶ $tag ||= '';
Condition0%0/2
$tag ||= ""
l!l
00
MC/DC0%0/1
$tag ||= ""
$tag
Truth table0%0/2
A
A= $tag
Aresult
11
00
749 0 ▶ $width = $cgiparams{"width$block"} ? ($cgiparams{"width$block"} > $maximagewidth ? $maximagewidth : $cgiparams{"width$block"}) : '';
Branch: 2 branches
BranchTrueFalseTotal
$Labyrinth::Plugin::Articles::cgiparams{"width$block"} ? : 0 0 0
$Labyrinth::Plugin::Articles::cgiparams{"width$block"} > $maximagewidth ? : 0 0 0
750 0 ▶ $height = $cgiparams{"height$block"} ? ($cgiparams{"height$block"} > $maximageheight ? $maximageheight : $cgiparams{"height$block"}) : '';
Branch: 2 branches
BranchTrueFalseTotal
$Labyrinth::Plugin::Articles::cgiparams{"height$block"} ? : 0 0 0
$Labyrinth::Plugin::Articles::cgiparams{"height$block"} > $maximageheight ? : 0 0 0
751 0 $body[$block]->{body} = "$tag|$width|$height";
752 0 $body[$block]->{tag} = $tag;
753 0 $body[$block]->{width} = $width;
754 0 $body[$block]->{height} = $height;
755  
756 # paragraphs
757 } elsif($type == PARA) {
758 0 $body[$block]->{paraid} = $paraid;
759 0 $body[$block]->{body} = CleanTags($cgiparams{"TEXT$block"});
760 0 $body[$block]->{link} = '';
761 0 $body[$block]->{imageid} = 0;
762  
763 # links
764 } elsif($type == LINK) {
765 0 $body[$block]->{paraid} = $paraid;
766 0 $body[$block]->{body} = $cgiparams{"LINK$block"};
767 0 $body[$block]->{href} = CleanTags($cgiparams{"LINK$block"});
768 0 $body[$block]->{imageid} = 0;
769  
770 # video
771 } elsif($type == VIDEO) {
772 0 $body[$block]->{paraid} = $paraid;
773  
774 0 my $body = $cgiparams{"VIDEO$block"};
775 0 ▶ $body =~ s!.*?<iframe.*?src="([^"]+)".*!$1! if($body =~ /<iframe/);
Branch: 1 branch
BranchTrueFalseTotal
if $body =~ /<iframe/ 0 0 0
776
777 0 my $videoid = 0;
778 0 my ($type,$code) = $body =~ m!(.*)/(\w+)$!;
779 0 ▶ if($type =~ /youtu\.?be/) { $videoid = 1 }
Branch: 2 branches
BranchTrueFalseTotal
if ($type =~ /youtu\.?be/) { } 0 0 0
elsif ($type =~ /vimeo/) { } 0 0 0
780 0 elsif($type =~ /vimeo/) { $videoid = 2 }
781  
782 0 $body[$block]->{body} = $body;
783 0 $body[$block]->{href} = $code;
784 0 $body[$block]->{imageid} = $videoid;
785  
786 # media files
787 } elsif($type == MFILE) {
788 0 $body[$block]->{paraid} = $paraid;
789  
790 # uploaded own image
791 0 ▶ if(defined $cgiparams{"MEDIA$block"} && $cgiparams{"MEDIA$block"}) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"} and $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}) { } 0 0 0
elsif (defined $Labyrinth::Plugin::Articles::cgiparams{"media$block"}) { } 0 0 0
Condition0%0/3
defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"} and $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"} and $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}
defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"} $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}
Truth table0%0/3
A and B
A= defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}B= $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}
ABresult
0X0
100
111
792 0 my ($fileid) = SaveMediaFile(
793 param => "MEDIA$block",
794 stock => 'Media');
795 0 $body[$block]->{imageid} = $fileid;
796  
797 # already uploaded
798 } elsif(defined $cgiparams{"media$block"}) {
799 0 $body[$block]->{imageid} = $cgiparams{"media$block"};
800 }
801  
802 # download files
803 } elsif($type == DFILE) {
804 0 $body[$block]->{paraid} = $paraid;
805  
806 0 LogDebug("LoadContent:DFILE");
807 0 LogDebug(qq!LoadContent:param=[MEDIA$block][$cgiparams{"MEDIA$block"}]!);
808  
809 # uploaded own image
810 0 ▶ if(defined $cgiparams{"MEDIA$block"} && $cgiparams{"MEDIA$block"}) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"} and $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}) { } 0 0 0
elsif (defined $Labyrinth::Plugin::Articles::cgiparams{"media$block"}) { } 0 0 0
Condition0%0/3
defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"} and $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"} and $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}
defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"} $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}
Truth table0%0/3
A and B
A= defined $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}B= $Labyrinth::Plugin::Articles::cgiparams{"MEDIA$block"}
ABresult
0X0
100
111
811 0 my ($fileid) = SaveMediaFile(
812 param => "MEDIA$block",
813 stock => 'Talks');
814 0 $body[$block]->{imageid} = $fileid;
815  
816 # already uploaded
817 } elsif(defined $cgiparams{"media$block"}) {
818 0 $body[$block]->{imageid} = $cgiparams{"media$block"};
819 }
820 }
821 }
822  
823 0 ▶ $cgiparams{quickname} ||= $cgiparams{title};
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{"quickname"} ||= $Labyrinth::Plugin::Articles::cgiparams{"title"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{"quickname"} ||= $Labyrinth::Plugin::Articles::cgiparams{"title"}
$Labyrinth::Plugin::Articles::cgiparams{"quickname"} $Labyrinth::Plugin::Articles::cgiparams{"title"}
Truth table0%0/3
A ||= B
A= $Labyrinth::Plugin::Articles::cgiparams{"quickname"}B= $Labyrinth::Plugin::Articles::cgiparams{"title"}
ABresult
1X1
011
000
824 0 $cgiparams{quickname} =~ tr/ /_/;
825 0 $cgiparams{quickname} = lc $cgiparams{quickname};
826  
827 0 ▶ my %data = map {$_ => ($cgiparams{$_} || $tvars{data}->{$_})}
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{$_} || $Labyrinth::Plugin::Articles::tvars{'data'}{$_}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{$_} || $Labyrinth::Plugin::Articles::tvars{'data'}{$_}
$Labyrinth::Plugin::Articles::cgiparams{$_} $Labyrinth::Plugin::Articles::tvars{'data'}{$_}
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{$_}B= $Labyrinth::Plugin::Articles::tvars{'data'}{$_}
ABresult
1X1
011
000
828 qw(articleid createdate folderid userid title quickname publish snippet front latest sectionid);
829 0 ▶ $data{front} = ($data{'front'} ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$data{'front'} ? : 0 0 0
830 0 ▶ $data{latest} = ($data{'latest'} ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$data{'latest'} ? : 0 0 0
831 0 $data{imageid} = $cgiparams{'display0'};
832 0 $data{postdate} = formatDate(6,$data{createdate});
833  
834 0 return(\@blocks,\%data,\@body);
835 }
836  
837 0 ▶sub EditAmendments {
Subroutine EditAmendments: not called CC=18 SCAR=58.3
Pod documented
838 0 $tvars{articles}->{$tvars{primary}}{data}{metadata} = MetaGet( $tvars{articles}->{$tvars{primary}}{data}{'articleid'},'Art');
839 0 $tvars{articles}->{$tvars{primary}}{data}{name} = UserName( $tvars{articles}->{$tvars{primary}}{data}{userid});
840 0 $tvars{articles}->{$tvars{primary}}{data}{postdate} = formatDate(3,$tvars{articles}->{$tvars{primary}}{data}{createdate});
841 0 ▶ $tvars{articles}->{$tvars{primary}}{data}{publish} ||= 1;
Condition0%0/2
$Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} ||= 1
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} ||= 1
$Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"}
Aresult
11
00
842  
843 0 my $resize = 0;
844 0 ▶ if($tvars{articles}->{$tvars{primary}}{data}{imageid}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"imageid"}) 0 0 0
845 0 my ($tag,$link,undef,$x) = GetImage($tvars{articles}->{$tvars{primary}}{data}{imageid});
846 0 $tvars{articles}->{$tvars{primary}}{data}{tag} = $tag;
847 0 $tvars{articles}->{$tvars{primary}}{data}{link} = $link;
848 0 ▶ $resize = 1 if($x && $x > 100)
Branch: 1 branch
BranchTrueFalseTotal
if $x and $x > 100 0 0 0
Condition0%0/3
$x and $x > 100
!ll&&!rl&&r
000
MC/DC0%0/2
$x and $x > 100
$x $x > 100
Truth table0%0/3
A and B
A= $xB= $x > 100
ABresult
0X0
100
111
849 }
850  
851 0 ▶ if(Authorised(ADMIN)) {
Branch: 1 branch
BranchTrueFalseTotal
if (Authorised(4)) { } 0 0 0
852 0 LogDebug("EditAmendments: publish=[$tvars{articles}->{$tvars{primary}}{data}{publish}]");
853 0 $tvars{articles}->{$tvars{primary}}{data}{ddpublish} = PublishSelect($tvars{articles}->{$tvars{primary}}{data}{publish});
854 } else {
855 0 my $promote = 0;
856 0 ▶ $promote = 1 if($tvars{articles}->{$tvars{primary}}{data}{publish} == 1);
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 1 0 0 0
857 0 ▶ $promote = 1 if($tvars{articles}->{$tvars{primary}}{data}{publish} == 2 && AccessUser(PUBLISHER));
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 2 and AccessUser(3) 0 0 0
Condition0%0/3
$Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 2 and AccessUser(3)
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 2 and AccessUser(3)
$Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 2 AccessUser(3)
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 2B= AccessUser(3)
ABresult
0X0
100
111
858 0 ▶ $promote = 1 if($tvars{articles}->{$tvars{primary}}{data}{publish} == 3 && AccessUser(PUBLISHER));
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 3 and AccessUser(3) 0 0 0
Condition0%0/3
$Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 3 and AccessUser(3)
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 3 and AccessUser(3)
$Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 3 AccessUser(3)
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::Articles::tvars{"articles"}{$Labyrinth::Plugin::Articles::tvars{"primary"}}{"data"}{"publish"} == 3B= AccessUser(3)
ABresult
0X0
100
111
859 0 LogDebug("EditAmendments: publish=[$tvars{$tvars{primary}}{data}{publish}], promote=[$promote]");
860 0 $tvars{articles}->{$tvars{primary}}{data}{ddpublish} = PublishAction($tvars{articles}->{$tvars{primary}}{data}{publish},$promote);
861 }
862  
863 0 $tvars{htmltags} = LegalTags();
864 0 $tvars{preview}->{body} = clone($tvars{articles}->{$tvars{primary}}->{body});
865 0 $tvars{preview}->{data} = clone($tvars{articles}->{$tvars{primary}}->{data});
866 0 $tvars{preview}{data}{resize} = $resize;
867 0 $tvars{preview}{data}{postdate} = formatDate(6,$tvars{articles}->{$tvars{primary}}{data}{createdate});
868  
869 0 my @meta = MetaGet($tvars{articles}->{$tvars{primary}}{data}{'articleid'},'Art');
870 0 ▶ $tvars{preview}->{meta} = \@meta if(@meta);
Branch: 1 branch
BranchTrueFalseTotal
if @meta 0 0 0
871  
872 0 for(keys %fields) {
873 0 ▶ if($fields{$_}->{html} == 1) { $tvars{preview}{data}{$_} = CleanHTML($tvars{preview}{data}{$_});
Branch: 3 branches
BranchTrueFalseTotal
if ($fields{$_}{'html'} == 1) { } 0 0 0
elsif ($fields{$_}{'html'} == 2) { } 0 0 0
elsif ($fields{$_}{'html'} == 3) { } 0 0 0
874 0 $tvars{articles}->{$tvars{primary}}{data}{$_} = CleanHTML($tvars{articles}->{$tvars{primary}}{data}{$_}); }
875 0 elsif($fields{$_}->{html} == 2) { $tvars{articles}->{$tvars{primary}}{data}{$_} = SafeHTML($tvars{articles}->{$tvars{primary}}{data}{$_}); }
876 0 elsif($fields{$_}->{html} == 3) { $tvars{articles}->{$tvars{primary}}{data}{$_} = SafeHTML($tvars{articles}->{$tvars{primary}}{data}{$_}); }
877 }
878  
879 0 for my $item (@{$tvars{articles}->{$tvars{primary}}->{body}}) {
880 0 ▶ $item->{body} = SafeHTML($item->{body}) if($item->{type} == PARA);
Branch: 1 branch
BranchTrueFalseTotal
if $item->{"type"} == 2 0 0 0
881 }
882  
883 0 $tvars{article} = $tvars{articles}->{$tvars{primary}};
884 0 $tvars{authors} = UserSelect($tvars{article}{data}{userid},1);
885 }
886  
887 0 ▶sub Save {
Subroutine Save: not called CC=45 SCAR=76.4
Pod documented
888 0 ▶ return unless AccessUser($LEVEL);
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($Labyrinth::Plugin::Articles::LEVEL) 0 0 0
889 0 ▶ return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL);
Branch: 1 branch
BranchTrueFalseTotal
unless AuthorCheck($Labyrinth::Plugin::Articles::GETSQL, $Labyrinth::Plugin::Articles::INDEXKEY, $Labyrinth::Plugin::Articles::LEVEL) 0 0 0
890 0 ▶ $tvars{primary} = $tvars{data}->{quickname} || 'draft' . ($tvars{data}->{articleid}||0);
Condition0%0/4
$Labyrinth::Plugin::Articles::tvars{'data'}{'quickname'} || 'draft' . ($Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'} || 0)
l!l
00
$Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'} || 0
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::tvars{'data'}{'quickname'} || 'draft' . ($Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'} || 0)
$Labyrinth::Plugin::Articles::tvars{'data'}{'quickname'}
MC/DC0%0/1
$Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'} || 0
$Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::tvars{'data'}{'quickname'}
Aresult
11
00
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::tvars{'data'}{'articleid'}
Aresult
11
00
891 0 ▶ my $publish = $tvars{data}->{publish} || 0;
Condition0%0/2
$Labyrinth::Plugin::Articles::tvars{'data'}{'publish'} || 0
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::tvars{'data'}{'publish'} || 0
$Labyrinth::Plugin::Articles::tvars{'data'}{'publish'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::tvars{'data'}{'publish'}
Aresult
11
00
892 0 ▶ my $sectionid = $cgiparams{sectionid} || $SECTIONID;
Condition0%0/3
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} || $SECTIONID
$Labyrinth::Plugin::Articles::cgiparams{'sectionid'} $SECTIONID
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Articles::cgiparams{'sectionid'}B= $SECTIONID
ABresult
1X1
011
000
893  
894 0 for(keys %fields) {
895 0 ▶ if($fields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}) }
Branch: 3 branches
BranchTrueFalseTotal
if ($fields{$_}{'html'} == 1) { } 0 0 0
elsif ($fields{$_}{'html'} == 2) { } 0 0 0
elsif ($fields{$_}{'html'} == 3) { } 0 0 0
896 0 elsif($fields{$_}->{html} == 2) { $cgiparams{$_} = CleanTags($cgiparams{$_}) }
897 0 elsif($fields{$_}->{html} == 3) { $cgiparams{$_} = CleanLink($cgiparams{$_}) }
898 }
899  
900 # read the encoded form
901 0 my ($blocks,$data,$body) = LoadContent();
902 0 $tvars{$tvars{primary}}->{blocks} = join(",",@$blocks);
903 0 $tvars{$tvars{primary}}->{data} = $data;
904 0 $tvars{$tvars{primary}}->{body} = $body;
905  
906 0 my @manfields = @mandatory;
907 0 ▶ push @manfields, qw(snippet) if($cgiparams{front});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Articles::cgiparams{"front"} 0 0 0
908 0 FieldCheck(\@allfields,\@manfields);
909  
910 0 for my $key (keys %{$tvars{data}}) {
911 0 ▶ next unless($key =~ /^(?:TEXT|LINK|IMAGELINK|IMAGEHREF|IMAGETAG)(\d+)_err/);
Branch: 1 branch
BranchTrueFalseTotal
unless $key =~ /^(?:TEXT|LINK|IMAGELINK|IMAGEHREF|IMAGETAG)(\d+)_err/ 0 0 0
912 0 $tvars{body}->[$1]->{error} = ErrorSymbol;
913 0 $tvars{errcode} = 'ERROR';
914 }
915  
916 # check title is unique
917 0 my @data = $dbi->GetQuery('hash','FindTitle',$cgiparams{title});
918 0 for(@data) {
919 0 ▶ next if($_->{articleid} == $tvars{data}->{articleid});
Branch: 1 branch
BranchTrueFalseTotal
if $_->{"articleid"} == $Labyrinth::Plugin::Articles::tvars{"data"}{"articleid"} 0 0 0
920 0 $tvars{article}{data}{title_err} = ErrorSymbol;
921 0 $tvars{errmess} = 2;
922 0 last;
923 }
924  
925 0 ▶ return if($tvars{errcode});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Articles::tvars{"errcode"} 0 0 0
926  
927 0 ▶ $data->{front} = $data->{front} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$data->{'front'} ? : 0 0 0
928 0 ▶ $data->{latest} = $data->{latest} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$data->{'latest'} ? : 0 0 0
929 0 ▶ $data->{createdate} = formatDate(0) if($data->{publish} == 3 && $publish < 3);
Branch: 1 branch
BranchTrueFalseTotal
if $data->{"publish"} == 3 and $publish < 3 0 0 0
Condition0%0/3
$data->{"publish"} == 3 and $publish < 3
!ll&&!rl&&r
000
MC/DC0%0/2
$data->{"publish"} == 3 and $publish < 3
$data->{"publish"} == 3 $publish < 3
Truth table0%0/3
A and B
A= $data->{"publish"} == 3B= $publish < 3
ABresult
0X0
100
111
930 0 ▶ $data->{createdate} = unformatDate(3,$cgiparams{postdate}) if($cgiparams{postdate});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Articles::cgiparams{"postdate"} 0 0 0
931 0 ▶ $data->{userid} ||= $tvars{loginid};
Condition0%0/3
$data->{"userid"} ||= $Labyrinth::Plugin::Articles::tvars{"loginid"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$data->{"userid"} ||= $Labyrinth::Plugin::Articles::tvars{"loginid"}
$data->{"userid"} $Labyrinth::Plugin::Articles::tvars{"loginid"}
Truth table0%0/3
A ||= B
A= $data->{"userid"}B= $Labyrinth::Plugin::Articles::tvars{"loginid"}
ABresult
1X1
011
000
932 0 ▶ $data->{sectionid} ||= 1; # default 1 = article
Condition0%0/2
$data->{"sectionid"} ||= 1
l!l
00
MC/DC0%0/1
$data->{"sectionid"} ||= 1
$data->{"sectionid"}
Truth table0%0/2
A
A= $data->{"sectionid"}
Aresult
11
00
933  
934 0 ▶ if($sectionid == 6) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sectionid == 6) 0 0 0
935 0 ▶ if($data->{publish} == 3 && $publish < 3) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{"publish"} == 3 and $publish < 3) 0 0 0
Condition0%0/3
$data->{"publish"} == 3 and $publish < 3
!ll&&!rl&&r
000
MC/DC0%0/2
$data->{"publish"} == 3 and $publish < 3
$data->{"publish"} == 3 $publish < 3
Truth table0%0/3
A and B
A= $data->{"publish"} == 3B= $publish < 3
ABresult
0X0
100
111
936 0 my $archdate = formatDate(2, $data->{createdate});
937 0 my $volumeid = substr(formatDate(13,$data->{createdate}),0,6);
938 0 my @vols = $dbi->GetQuery('hash','GetVolume',$volumeid,$sectionid);
939 0 ▶ if(@vols) {
Branch: 1 branch
BranchTrueFalseTotal
if (@vols) { } 0 0 0
940 0 $dbi->DoQuery('UpdateVolume',$vols[0]->{counter}+1,$volumeid,$sectionid);
941 } else {
942 0 $dbi->DoQuery('InsertVolume',$volumeid,$sectionid,$archdate,1);
943 }
944 }
945 }
946  
947 # save master image, if one supplied
948 0 ▶ $data->{imageid} ||= 0;
Condition0%0/2
$data->{"imageid"} ||= 0
l!l
00
MC/DC0%0/1
$data->{"imageid"} ||= 0
$data->{"imageid"}
Truth table0%0/2
A
A= $data->{"imageid"}
Aresult
11
00
949 0 ▶ if(defined $cgiparams{"IMAGEUPLOAD0"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Labyrinth::Plugin::Articles::cgiparams{"IMAGEUPLOAD0"}) 0 0 0
950 0 ▶ my $maximagewidth = $settings{maximagewidth} || MaxArticleWidth;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximagewidth'} || 400
$Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximagewidth'}
Aresult
11
00
951 0 ▶ my $maximageheight = $settings{maximageheight} || MaxArticleHeight;
Condition0%0/2
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Articles::settings{'maximageheight'} || 400
$Labyrinth::Plugin::Articles::settings{'maximageheight'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::settings{'maximageheight'}
Aresult
11
00
952 0 ($data->{imageid}) =
953 SaveImageFile(
954 param => "IMAGEUPLOAD0",
955 stock => 'Special',
956 width => $maximagewidth,
957 height => $maximageheight
958 );
959 }
960  
961 # save article metadata
962 $dbi->DoQuery($SAVESQL,
963 $data->{folderid},
964 $data->{title},
965 $data->{userid},
966 $data->{sectionid},
967 $data->{quickname},
968 $data->{snippet},
969 $data->{imageid},
970 $data->{front},
971 $data->{latest},
972 $data->{publish},
973 $data->{createdate},
974 $data->{articleid}
975 0 );
976  
977 # save each content item as appropriate
978 0 foreach my $block (@$blocks) {
979 # MUST have a paraid
980 0 ▶ next unless($body->[$block]->{paraid});
Branch: 1 branch
BranchTrueFalseTotal
unless $body->[$block]{"paraid"} 0 0 0
981  
982 # save article paragraph
983 $dbi->DoQuery('SaveContent',
984 $data->{articleid},
985 $block,
986 $body->[$block]->{type},
987 $body->[$block]->{imageid},
988 $body->[$block]->{href},
989 $body->[$block]->{body},
990 $body->[$block]->{align},
991 0 $body->[$block]->{paraid});
992 }
993  
994 0 ▶ if($cgiparams{doaction}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Articles::cgiparams{"doaction"}) 0 0 0
995 0 ▶ if($cgiparams{doaction} eq 'AddImage') { AddImage(); }
Branch: 9 branches
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'AddImage') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'AddPara') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'AddLink') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'AddMedia') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'AddFile') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'AddVideo') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'Delete') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'MoveUp') { } 0 0 0
elsif ($Labyrinth::Plugin::Articles::cgiparams{'doaction'} eq 'MoveDn') { } 0 0 0
996 0 elsif($cgiparams{doaction} eq 'AddPara') { AddParagraph(); }
997 0 elsif($cgiparams{doaction} eq 'AddLink') { AddLink(); }
998 0 elsif($cgiparams{doaction} eq 'AddMedia') { AddMedia(); }
999 0 elsif($cgiparams{doaction} eq 'AddFile') { AddFile(); }
1000 0 elsif($cgiparams{doaction} eq 'AddVideo') { AddVideo(); }
1001 0 elsif($cgiparams{doaction} eq 'Delete') { DeleteItem(); }
1002 0 elsif($cgiparams{doaction} eq 'MoveUp') { Relocate(1); }
1003 0 elsif($cgiparams{doaction} eq 'MoveDn') { Relocate(0); }
1004 }
1005  
1006 # save metadata
1007 0 ▶ my @metadata = $cgiparams{metadata} ? split(qr/[, ]+/,$cgiparams{metadata}) : ();
Branch: 1 branch
BranchTrueFalseTotal
$Labyrinth::Plugin::Articles::cgiparams{'metadata'} ? : 0 0 0
1008 0 MetaSave($cgiparams{articleid},['Art'],@metadata);
1009  
1010 0 $tvars{thanks} = 1;
1011 }
1012  
1013 0 ▶sub Promote {
Subroutine Promote: not called CC=6 SCAR=37.4
Pod documented
1014 0 ▶ return unless AccessUser(PUBLISHER);
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser(3) 0 0 0
1015 0 my @ids = CGIArray('LISTED');
1016 0 ▶ return unless @ids;
Branch: 1 branch
BranchTrueFalseTotal
unless @ids 0 0 0
1017 0 for my $id (@ids) {
1018 0 $cgiparams{'articleid'} = $id;
1019 0 ▶ next unless AuthorCheck('GetArticleByID','articleid');
Branch: 1 branch
BranchTrueFalseTotal
unless AuthorCheck("GetArticleByID", "articleid") 0 0 0
1020 0 my $publish = $tvars{data}->{publish} + 1;
1021 0 ▶ next unless($publish < 5);
Branch: 1 branch
BranchTrueFalseTotal
unless $publish < 5 0 0 0
1022 0 $dbi->DoQuery('PromoteArticle',$publish,$cgiparams{'articleid'});
1023 }
1024 }
1025  
1026 0 ▶sub Copy {
Subroutine Copy: not called CC=4 SCAR=30.0
Pod documented
1027 0 ▶ return unless AccessUser($LEVEL);
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($Labyrinth::Plugin::Articles::LEVEL) 0 0 0
1028 0 $cgiparams{$INDEXKEY} = $cgiparams{'LISTED'};
1029 0 ▶ return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL);
Branch: 1 branch
BranchTrueFalseTotal
unless AuthorCheck($Labyrinth::Plugin::Articles::GETSQL, $Labyrinth::Plugin::Articles::INDEXKEY, $Labyrinth::Plugin::Articles::LEVEL) 0 0 0
1030  
1031 my @fields = ( $tvars{data}->{folderid},
1032 $tvars{data}->{title} . ' - COPY',
1033 $tvars{loginid},
1034 formatDate(0),
1035 $tvars{data}->{sectionid},
1036 0 $tvars{data}->{name} . '-copy',
1037 1);
1038 0 my $articleid = $dbi->IDQuery($ADDSQL,@fields);
1039  
1040 0 my $order = 1;
1041 0 my @body = $dbi->GetQuery('hash','GetContent',$cgiparams{$INDEXKEY});
1042 0 for my $item (@body) {
1043 0 $dbi->DoQuery('AddContent',$articleid,$order,$item->{type},$item->{imageid},$item->{link},$item->{body});
1044 0 $order++;
1045 }
1046  
1047 0 $cgiparams{$INDEXKEY} = $articleid;
1048 0 SetCommand('arts-edit');
1049 }
1050  
1051 0 ▶sub Delete {
Subroutine Delete: not called CC=3 SCAR=24.8
Pod documented
1052 0 ▶ return unless AccessUser($LEVEL2);
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($Labyrinth::Plugin::Articles::LEVEL2) 0 0 0
1053 # return unless AuthorCheck('GetArticleByID','articleid',$LEVEL);
1054  
1055 0 my @delete = CGIArray('LISTED');
1056 0 ▶ if(@delete) {
Branch: 1 branch
BranchTrueFalseTotal
if (@delete) 0 0 0
1057 0 $dbi->DoQuery('DeleteArticleContent',{ids=>join(",",@delete)});
1058 0 $dbi->DoQuery('DeleteArticle', {ids=>join(",",@delete)});
1059 }
1060 }
1061  
1062 0 ▶sub _snippet {
Subroutine _snippet: not called CC=2 SCAR=17.9
1063 0 my ($row,$chars) = @_;
1064 0 ▶ my $text = $row->{snippet} || $row->{body};
Condition0%0/3
$row->{'snippet'} || $row->{'body'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$row->{'snippet'} || $row->{'body'}
$row->{'snippet'} $row->{'body'}
Truth table0%0/3
A || B
A= $row->{'snippet'}B= $row->{'body'}
ABresult
1X1
011
000
1065 0 return substr(CleanHTML($text),0,($chars-length($row->{title})));
1066 }
1067  
1068 4 1;
1069  
1070 __END__
↑ Summary Menus.pm »