blib/lib/Labyrinth/Plugin/Release.pm

filter: Statementstmt 22.4% 52 / 232 Branchbran 1.9% 2 / 102 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 48.1% 13 / 27 Podpod 100% 14 / 14 totaltotal 20.6% 81 / 393 CC 65 SCAR 48.9
CC
65
Cov
16%
Save
462.0
List
90.0
Edit
72.0
CRAP 133.2
↑ Summary
1 package Labyrinth::Plugin::Release;
2  
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 $VERSION = '0.02';
9  
10 =head1 NAME
11  
12 Labyrinth::Plugin::Release - Release plugin handler for Labyrinth
13  
14 =head1 DESCRIPTION
15  
16 Contains all the release handling functionality for the Labyrinth Web
17 Framework.
18  
19 =cut
20  
21 # -------------------------------------
22 # Library Modules
23  
24 5 ▶use base qw(Labyrinth::Plugin::Articles);
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 5 ▶use Clone qw(clone);
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 5 ▶use Labyrinth::Audit;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 5 ▶use Labyrinth::DBUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 5 ▶use Labyrinth::DTUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 5 ▶use Labyrinth::Media;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 5 ▶use Labyrinth::MLUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 5 ▶use Labyrinth::Support;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 5 ▶use Labyrinth::Users;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 5 ▶use Labyrinth::Variables;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 # -------------------------------------
38 # Variables
39  
40 # type: 0 = optional, 1 = mandatory
41 # html: 0 = none, 1 = text, 2 = textarea
42  
43 5 my %fields = (
44 articleid => { type => 0, html => 0 },
45 releaseid => { type => 0, html => 0 },
46 title => { type => 1, html => 1 },
47 quickname => { type => 1, html => 0 },
48 reldate => { type => 1, html => 0 },
49 publish => { type => 1, html => 0 },
50 reltypeid => { type => 1, html => 0 },
51 );
52  
53 5 my (@mandatory,@allfields);
54 5 for(keys %fields) {
55 35 ▶ push @mandatory, $_ if($fields{$_}->{type});
Branch: 1 branch
BranchTrueFalseTotal
if $fields{$_}{"type"} 25 10 35
56 35 push @allfields, $_;
57 }
58  
59 5 my $ALLSQL = 'AllReleases';
60 5 my $SECTIONID = 8;
61 5 my $SECTION_ALBUM = 8;
62 5 my $SECTION_LYRIC = 7;
63 5 my $SECTION_PROFILE = 5;
64 5 my $LEVEL = ADMIN;
65  
66 # -------------------------------------
67 # The Subs
68  
69 =head1 PUBLIC INTERFACE METHODS
70  
71 =over 4
72  
73 =item * List
74  
75 Provides basic information for each published release.
76  
77 =item * Item
78  
79 Retrieves the basic release data, liner notes and a list of the lyrics,
80 profiles and mp3s associated with the release.
81  
82 =item * Lyrics
83  
84 Calls Item(), and provides the full content of each lyric of a release.
85  
86 =item * Profiles
87  
88 Calls Item(), and provides the full content of each profile of a release.
89  
90 =back
91  
92 =cut
93  
94 sub List {
95 0 ▶ my $self = shift;
Subroutine List: not called CC=9 SCAR=45.0
Pod documented
96 0 my @releases;
97  
98 0 my @rows = $dbi->GetQuery('hash','ListReleases');
99 0 for my $row (@rows) {
100 0 my @release = $dbi->GetQuery('hash','GetReleaseByID',$row->{releaseid});
101 0 my @article = $dbi->GetQuery('hash','GetArticleByName',$row->{quickname});
102 0 $release[0]->{$_} = $article[0]->{$_} for(qw(link tag));
103 0 my @formats = $dbi->GetQuery('hash','ListFormats',$row->{releaseid});
104 0 ▶ $release[0]->{formats} = \@formats if(@formats);
Branch: 1 branch
BranchTrueFalseTotal
if @formats 0 0 0
105  
106 0 my @lyrics = $dbi->GetQuery('hash','ListLyrics',$row->{releaseid});
107 0 ▶ $release[0]->{lyrics} = \@lyrics if(@lyrics);
Branch: 1 branch
BranchTrueFalseTotal
if @lyrics 0 0 0
108 0 my @profiles = $dbi->GetQuery('hash','ListProfiles',$row->{releaseid});
109 0 ▶ $release[0]->{profiles} = \@profiles if(@profiles);
Branch: 1 branch
BranchTrueFalseTotal
if @profiles 0 0 0
110 0 my @mp3s = $dbi->GetQuery('hash','ListMp3s',$row->{releaseid});
111 0 ▶ $release[0]->{mp3s} = \@mp3s if(@mp3s);
Branch: 1 branch
BranchTrueFalseTotal
if @mp3s 0 0 0
112
113 0 $release[0]->{postyear} = formatDate(1,$release[0]->{releasedate});
114  
115 0 $cgiparams{articleid} = $release[0]->{articleid};
116 0 $cgiparams{sectionid} = $SECTION_ALBUM;
117 0 $self->SUPER::Item;
118 0 $release[0]->{data} = clone($tvars{articles}{$tvars{primary}});
119  
120 0 push @releases, $release[0];
121 }
122  
123 0 my @types = $dbi->GetQuery('hash','ListAllTypes');
124  
125 0 ▶ $tvars{types} = \@types if(@types);
Branch: 1 branch
BranchTrueFalseTotal
if @types 0 0 0
126 0 ▶ $tvars{releases} = \@releases if(@releases);
Branch: 1 branch
BranchTrueFalseTotal
if @releases 0 0 0
127 }
128  
129 sub Item {
130 0 ▶ my @release = $dbi->GetQuery('hash','GetReleaseByID',$cgiparams{releaseid});
Subroutine Item: not called CC=5 SCAR=34.0
Pod documented
131 0 ▶ if(@release) {
Branch: 1 branch
BranchTrueFalseTotal
if (@release) 0 0 0
132 0 my @lyrics = $dbi->GetQuery('hash','ListLyrics',$cgiparams{releaseid});
133 0 ▶ $release[0]->{lyrics} = \@lyrics if(@lyrics);
Branch: 1 branch
BranchTrueFalseTotal
if @lyrics 0 0 0
134 0 my @profiles = $dbi->GetQuery('hash','ListProfiles',$cgiparams{releaseid});
135 0 ▶ $release[0]->{profiles} = \@profiles if(@profiles);
Branch: 1 branch
BranchTrueFalseTotal
if @profiles 0 0 0
136 0 my @mp3s = $dbi->GetQuery('hash','ListMp3s',$cgiparams{releaseid});
137 0 ▶ $release[0]->{mp3s} = \@mp3s if(@mp3s);
Branch: 1 branch
BranchTrueFalseTotal
if @mp3s 0 0 0
138  
139 0 $release[0]->{postyear} = formatDate(1,$release[0]->{releasedate});
140 0 $tvars{release} = $release[0];
141 }
142  
143 0 $cgiparams{articleid} = $tvars{release}->{articleid};
144 0 $cgiparams{sectionid} = $SECTION_ALBUM;
145 0 shift->SUPER::Item;
146 0 $tvars{release}{notes} = clone($tvars{articles}{$tvars{primary}});
147 }
148  
149 sub Lyrics {
150 0 ▶ my $self = shift;
Subroutine Lyrics: not called CC=3 SCAR=24.8
Pod documented
151 0 ▶ return unless($cgiparams{articleid});
Branch: 1 branch
BranchTrueFalseTotal
unless $Labyrinth::Plugin::Release::cgiparams{"articleid"} 0 0 0
152  
153 0 $self->Item;
154  
155 0 for my $lyric (sort {$a->{orderno} <=> $b->{orderno}} @{$tvars{release}{lyrics}}) {
156 0 $cgiparams{articleid} = $lyric->{articleid};
157 0 $cgiparams{sectionid} = $SECTION_LYRIC;
158 0 shift->SUPER::Item;
159 0 $lyric->{data} = clone($tvars{articles}{$tvars{primary}});
160 }
161 }
162  
163 sub Profiles {
164 0 ▶ my $self = shift;
Subroutine Profiles: not called CC=3 SCAR=24.8
Pod documented
165 0 ▶ return unless($cgiparams{articleid});
Branch: 1 branch
BranchTrueFalseTotal
unless $Labyrinth::Plugin::Release::cgiparams{"articleid"} 0 0 0
166  
167 0 $self->Item;
168  
169 0 for my $profile (sort {$a->{orderno} <=> $b->{orderno}} @{$tvars{release}{profiles}}) {
170 0 $cgiparams{articleid} = $profile->{articleid};
171 0 $cgiparams{sectionid} = $SECTION_PROFILE;
172 0 shift->SUPER::Item;
173 0 $profile->{data} = clone($tvars{articles}{$tvars{primary}});
174 }
175 }
176  
177 =head1 ADMIN INTERFACE METHODS
178  
179 =over 4
180  
181 =item * Admin
182  
183 =item * Add
184  
185 =item * Edit
186  
187 =item * Save
188  
189 =item * SaveFormat
190  
191 =item * SaveLyric
192  
193 =item * SaveProfile
194  
195 =item * Promote
196  
197 =item * Delete
198  
199 =item * TypeSelect
200  
201 =back
202  
203 =cut
204  
205 sub Admin {
206 0 ▶ return unless(AccessUser($LEVEL));
Subroutine Admin: not called CC=6 SCAR=37.4
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($LEVEL) 0 0 0
207 0 ▶ if($cgiparams{doaction}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Release::cgiparams{"doaction"}) 0 0 0
208 0 ▶ if($cgiparams{doaction} eq 'Promote' ) { Promote(); }
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Release::cgiparams{"doaction"} eq "Promote") 0 0 0
209 0 ▶ if($cgiparams{doaction} eq 'Delete' ) { Delete(); }
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Release::cgiparams{"doaction"} eq "Delete") 0 0 0
210 }
211  
212 0 my @rows = $dbi->GetQuery('hash','ListAllReleases');
213 0 for my $row (@rows) {
214 0 $row->{publishstate} = PublishState($row->{publish});
215 }
216 0 $tvars{data} = \@rows;
217 0 $tvars{sectionid} = $SECTION_ALBUM;
218 }
219  
220 sub Add {
221 0 ▶ return unless(AccessUser($LEVEL));
Subroutine Add: not called CC=4 SCAR=30.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($LEVEL) 0 0 0
222 0 $cgiparams{sectionid} = $SECTION_ALBUM;
223 0 shift->SUPER::Add;
224  
225 my %data = (
226 releaseid => 0,
227 title => 'DRAFT',
228 reldate => formatDate(3),
229 ddpublish => PublishSelect(1),
230 ddtypes => TypeSelect(),
231 quickname => $tvars{article}{data}{quickname}
232 0 );
233  
234 0 my @allformats = $dbi->GetQuery('hash','ListAllFormats');
235 0 ▶ $tvars{allformats} = \@allformats if(@allformats);
Branch: 1 branch
BranchTrueFalseTotal
if @allformats 0 0 0
236 0 my @alltracks = $dbi->GetQuery('hash','ListAllLyrics');
237 0 ▶ $tvars{alltracks} = \@alltracks if(@alltracks);
Branch: 1 branch
BranchTrueFalseTotal
if @alltracks 0 0 0
238  
239 0 $tvars{release} = \%data;
240 }
241  
242 sub Edit {
243 0 ▶ return unless(AccessUser($LEVEL));
Subroutine Edit: not called CC=8 SCAR=42.8
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($LEVEL) 0 0 0
244 0 my @release = $dbi->GetQuery('hash','GetReleaseByID',$cgiparams{releaseid});
245 0 ▶ return unless(@release);
Branch: 1 branch
BranchTrueFalseTotal
unless @release 0 0 0
246 0 $tvars{release} = $release[0];
247 0 $tvars{release}{reldate} = formatDate(3,$tvars{release}{releasedate});
248 0 $tvars{release}{ddtypes} = TypeSelect($cgiparams{releaseid});
249  
250 0 my @formats = $dbi->GetQuery('hash','ListFormats',$cgiparams{releaseid});
251 0 ▶ $tvars{formats} = \@formats if(@formats);
Branch: 1 branch
BranchTrueFalseTotal
if @formats 0 0 0
252 0 my @lyrics = $dbi->GetQuery('hash','ListLyrics',$cgiparams{releaseid});
253 0 ▶ $tvars{lyrics} = \@lyrics if(@lyrics);
Branch: 1 branch
BranchTrueFalseTotal
if @lyrics 0 0 0
254  
255 0 my @allformats = $dbi->GetQuery('hash','ListAllFormats');
256 0 ▶ $tvars{allformats} = \@allformats if(@allformats);
Branch: 1 branch
BranchTrueFalseTotal
if @allformats 0 0 0
257 0 my @alltracks = $dbi->GetQuery('hash','ListAllLyrics');
258 0 ▶ $tvars{alltracks} = \@alltracks if(@alltracks);
Branch: 1 branch
BranchTrueFalseTotal
if @alltracks 0 0 0
259  
260 0 ▶ $cgiparams{articleid} ||= $tvars{release}{articleid};
Condition0%0/3
$Labyrinth::Plugin::Release::cgiparams{"articleid"} ||= $Labyrinth::Plugin::Release::tvars{"release"}{"articleid"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::Release::cgiparams{"articleid"} ||= $Labyrinth::Plugin::Release::tvars{"release"}{"articleid"}
$Labyrinth::Plugin::Release::cgiparams{"articleid"} $Labyrinth::Plugin::Release::tvars{"release"}{"articleid"}
Truth table0%0/3
A ||= B
A= $Labyrinth::Plugin::Release::cgiparams{"articleid"}B= $Labyrinth::Plugin::Release::tvars{"release"}{"articleid"}
ABresult
1X1
011
000
261 0 $cgiparams{sectionid} = $SECTION_ALBUM;
262 0 shift->SUPER::Edit;
263 }
264  
265 sub Save {
266 0 ▶ return unless(AccessUser($LEVEL));
Subroutine Save: not called CC=21 SCAR=61.4
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($LEVEL) 0 0 0
267 # save content
268 0 $cgiparams{sectionid} = $SECTION_ALBUM;
269 0 shift->SUPER::Save;
270  
271 # check details
272 0 ▶ return unless AuthorCheck('GetReleaseByID','releaseid',EDITOR);
Branch: 1 branch
BranchTrueFalseTotal
unless AuthorCheck("GetReleaseByID", "releaseid", 2) 0 0 0
273 0 ▶ my $publish = $tvars{data}->{publish} || 0;
Condition0%0/2
$Labyrinth::Plugin::Release::tvars{'data'}{'publish'} || 0
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::Release::tvars{'data'}{'publish'} || 0
$Labyrinth::Plugin::Release::tvars{'data'}{'publish'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Release::tvars{'data'}{'publish'}
Aresult
11
00
274 0 $tvars{release} = $tvars{data};
275  
276 0 for(keys %fields) {
277 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
278 0 elsif($fields{$_}->{html} == 2) { $cgiparams{$_} = CleanTags($cgiparams{$_}) }
279 0 elsif($fields{$_}->{html} == 3) { $cgiparams{$_} = CleanTags($cgiparams{$_}) }
280 }
281 0 ▶ return if FieldCheck(\@allfields,\@mandatory);
Branch: 1 branch
BranchTrueFalseTotal
if FieldCheck(\@allfields, \@mandatory) 0 0 0
282  
283 # save release data
284 0 $tvars{data}->{releasedate} = unformatDate(3,$tvars{data}->{reldate});
285  
286 my @fields = ( $tvars{data}->{title},
287 $tvars{data}->{quickname},
288 $tvars{data}->{publish},
289 $tvars{data}->{releasedate},
290 $tvars{data}->{reltypeid},
291 0 );
292  
293 0 ▶ if($tvars{data}->{releaseid})
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Release::tvars{'data'}{'releaseid'}) { } 0 0 0
294 0 { $dbi->DoQuery('UpdateRelease',@fields,$tvars{data}->{releaseid}); }
295 0 else { $cgiparams{releaseid} = $dbi->IDQuery('InsertRelease',@fields); }
296  
297 # save formats
298 0 for my $key ( keys %cgiparams ) {
299 0 ▶ if($key =~ /^frm_(\d+)/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($key =~ /^frm_(\d+)/) { } 0 0 0
elsif ($key =~ /^frm_(x\d+)/) { } 0 0 0
300 0 $cgiparams{ixformatid} = $1;
301 0 $cgiparams{'relformid'} = $cgiparams{'frm_'.$1};
302 0 $cgiparams{'catalogue'} = $cgiparams{'cat_'.$1};
303 0 $cgiparams{'label'} = $cgiparams{'lab_'.$1};
304 0 SaveFormat();
305 } elsif($key =~ /^frm_(x\d+)/) {
306 0 $cgiparams{ixformatid} = 0;
307 0 $cgiparams{'relformid'} = $cgiparams{'frm_'.$1};
308 0 $cgiparams{'catalogue'} = $cgiparams{'cat_'.$1};
309 0 $cgiparams{'label'} = $cgiparams{'lab_'.$1};
310 0 SaveFormat();
311 }
312 }
313  
314 0 ▶ if($cgiparams{FORMATS}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Release::cgiparams{"FORMATS"}) 0 0 0
315 0 my @ids = CGIArray('FORMATS');
316 0 $dbi->DoQuery('DeleteFormats',{ids=>join(',',@ids)},$cgiparams{releaseid});
317 }
318  
319 # save track list
320 0 my %ids;
321 0 ▶ if($cgiparams{LISTED}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Release::cgiparams{"LISTED"}) 0 0 0
322 0 my @ids = CGIArray('LISTED');
323 0 %ids = map {$_ => 1} @ids;
324 }
325 0 $dbi->DoQuery('DeleteLyricLinks',{ids => $cgiparams{releaseid}});
326 0 for my $ord ( keys %cgiparams ) {
327 0 ▶ if($ord =~ /^ord_(\d+)/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ord =~ /^ord_(\d+)/) { } 0 0 0
elsif ($ord =~ /^ord_(x\d+)/) { } 0 0 0
328 0 $cgiparams{lyricid} = $1;
329 0 $cgiparams{orderno} = $cgiparams{$ord};
330 0 ▶ $dbi->DoQuery('InsertLyricLink',$cgiparams{orderno},$cgiparams{releaseid},$cgiparams{lyricid}) unless($ids{$cgiparams{lyricid}});
Branch: 1 branch
BranchTrueFalseTotal
unless $ids{$Labyrinth::Plugin::Release::cgiparams{"lyricid"}} 0 0 0
331 } elsif($ord =~ /^ord_(x\d+)/) {
332 0 $cgiparams{lyricid} = $cgiparams{'trk_'.$1};
333 0 $cgiparams{orderno} = $cgiparams{$ord};
334 0 $dbi->DoQuery('InsertLyricLink',$cgiparams{orderno},$cgiparams{releaseid},$cgiparams{lyricid});
335 }
336 }
337  
338 0 ▶ if($cgiparams{lyric_title} && $cgiparams{lyric_name}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Release::cgiparams{"lyric_title"} and $Labyrinth::Plugin::Release::cgiparams{"lyric_name"}) 0 0 0
Condition0%0/3
$Labyrinth::Plugin::Release::cgiparams{"lyric_title"} and $Labyrinth::Plugin::Release::cgiparams{"lyric_name"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::Release::cgiparams{"lyric_title"} and $Labyrinth::Plugin::Release::cgiparams{"lyric_name"}
$Labyrinth::Plugin::Release::cgiparams{"lyric_title"} $Labyrinth::Plugin::Release::cgiparams{"lyric_name"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::Release::cgiparams{"lyric_title"}B= $Labyrinth::Plugin::Release::cgiparams{"lyric_name"}
ABresult
0X0
100
111
339 0 SaveLyric();
340 }
341 }
342  
343 sub SaveFormat {
344 0 ▶ return unless(AccessUser($LEVEL));
Subroutine SaveFormat: not called CC=3 SCAR=24.8
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($LEVEL) 0 0 0
345 0 ▶ if($cgiparams{ixformatid}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::Release::cgiparams{'ixformatid'}) { } 0 0 0
346 0 $dbi->DoQuery('UpdateFormat',$cgiparams{releaseid},$cgiparams{relformid},$cgiparams{catalogue},$cgiparams{label},$cgiparams{ixformatid});
347 } else {
348 0 $dbi->DoQuery('InsertFormat',$cgiparams{releaseid},$cgiparams{relformid},$cgiparams{catalogue},$cgiparams{label});
349 }
350 }
351  
352 sub SaveLyric {
353 0 ▶ return unless(AccessUser($LEVEL));
Subroutine SaveLyric: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($LEVEL) 0 0 0
354 0 my $id = $dbi->IDQuery('InsertLyric',$cgiparams{lyric_title},$cgiparams{lyric_name},$SECTION_LYRIC);
355 0 $dbi->DoQuery('InsertLyricLink',$cgiparams{lyric_order},$cgiparams{releaseid},$id);
356 }
357  
358 sub SaveProfile {
359 0 ▶ return unless(AccessUser($LEVEL));
Subroutine SaveProfile: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($LEVEL) 0 0 0
360 0 my $id = $dbi->IDQuery('InsertProfile',$cgiparams{profile_title},$cgiparams{profile_name},$SECTION_PROFILE);
361 0 $dbi->DoQuery('InsertProfileLink',$cgiparams{profile_order},$cgiparams{releaseid},$id);
362 }
363  
364 sub Promote {
365 0 ▶ return unless(AccessUser($LEVEL));
Subroutine Promote: not called CC=6 SCAR=37.4
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($LEVEL) 0 0 0
366 0 my @ids = CGIArray('LISTED');
367 0 ▶ next unless(@ids);
Branch: 1 branch
BranchTrueFalseTotal
unless @ids 0 0 0
368  
369 0 my @rows = $dbi->GetQuery('hash',$ALLSQL);
370 0 my %ids = map {$_->{mp3id} => $_->{publish}} @rows;
371  
372 0 for my $id (@ids) {
373 0 ▶ next unless(defined $ids{$id} && $ids{$id} < 4);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ids{$id} and $ids{$id} < 4 0 0 0
Condition0%0/3
defined $ids{$id} and $ids{$id} < 4
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ids{$id} and $ids{$id} < 4
defined $ids{$id} $ids{$id} < 4
Truth table0%0/3
A and B
A= defined $ids{$id}B= $ids{$id} < 4
ABresult
0X0
100
111
374 0 $dbi->DoQuery('PromoteReleases',($ids{$id} + 1),$id);
375 }
376 }
377  
378 sub Delete {
379 0 ▶ return unless(AccessUser($LEVEL));
Subroutine Delete: not called CC=5 SCAR=34.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
unless AccessUser($LEVEL) 0 0 0
380 0 my @arts;
381 0 my @ids = CGIArray('LISTED');
382 0 ▶ return unless @ids;
Branch: 1 branch
BranchTrueFalseTotal
unless @ids 0 0 0
383 0 my $ids = join(",",@ids);
384 0 my @rows = $dbi->GetQuery('hash','GetReleases',{ids => $ids});
385 0 for my $row (@rows) {
386 0 push @arts, $row->{articleid};
387 }
388 0 ▶ if(@arts) {
Branch: 1 branch
BranchTrueFalseTotal
if (@arts) 0 0 0
389 0 my $arts = join(",",@arts);
390 0 $dbi->DoQuery('DeleteArticleContent',{ids => $arts});
391 0 $dbi->DoQuery('DeleteArticle', {ids => $arts});
392 }
393 0 $dbi->DoQuery('DeleteReleases', {ids => $ids});
394 0 $dbi->DoQuery('DeleteReleaseLinks', {ids => $ids});
395 0 $dbi->DoQuery('DeleteReleaseFormats',{ids => $ids});
396 }
397  
398 sub TypeSelect {
399 0 ▶ my $opt = shift;
Subroutine TypeSelect: not called CC=1 SCAR=6.9
Pod documented
400 0 my @rows = $dbi->GetQuery('hash','ListAllTypes');
401 0 DropDownRows($opt,'reltypeid','reltypeid','type',@rows);
402 }
403  
404 5 1;
405  
406 __END__
407  
408 =head1 BACKGROUND
409  
410 The suite of Music plugins for Labyrinth were originally developed for the Ark
411 and Slim Pickins band websites. With enhancements along the way as they were
412 used in part or wholly for other sites.
413  
414 There are four key modules within the suite, which enables a "release" to be
415 linked to each element within it.
416  
417 * Labyrinth::Plugin::Articles::Lyrics
418 * Labyrinth::Plugin::Articles::Profiles
419 * Labyrinth::Plugin::MP3s
420 * Labyrinth::Plugin::Release
421  
422 The first three can be use completely independently, and do not require the
423 last. However, the last, this module, does require the other three, even if
424 they aren't used.
425  
426 In the music world, the term 'discography' is used to represent a collection
427 of records (albums, singles, demos, etc), while in the literary world, the
428 term 'bibliography' is used to represent a collection of works by an author
429 (novels, novellas, articles, short stories, etc). This suite of modules can
430 hopefully be used for both, and any other collection type that may be used in
431 other fields of work.
432  
433 =head1 CREATING A RELEASE
434  
435 When creating a release, there are many components that can make up the whole
436 picture.
437  
438 Thinking of albums, there is the basic release information, the liner
439 notes, the lyrics, the people involved (mostly the performers, but may be also
440 a producer, engineer and road crew), and possible MP3s, either samples or
441 complete tracks.
442  
443 For a book, you may only require the release information, cover notes, the
444 people involved (author(s), editor(s), publisher, etc), and maybe extracts
445 or complete short stories. You may wish to even include audio snippets or
446 interviews via MP3s (or even video files).
447  
448 All these elements are collected together under this module, so that they can
449 be neatly associated with multiple releases, songs can appear on more than one
450 album, and a short story may feature in more than one collected stories.
451  
452 To help identify where elements are stored in the system, the following
453 provides a helpful guide.
454  
455 =over
456  
457 =item * Release Information
458  
459 mangement module = Labyrinth::Plugin::Release
460 database tables = releases, release_ixformats
461 templates = ./releases
462  
463 =item * Liner Notes
464  
465 mangement module = Labyrinth::Plugin::Release
466 database tables = releases, articles, paragraphs, images
467 templates = ./releases
468  
469 Where sectionid=8 in articles table.
470  
471 =item * Lyrics
472  
473 mangement module = Labyrinth::Plugin::Articles::Lyrics
474 database tables = ixreleases, articles, paragraphs
475 templates = ./lyrics
476  
477 Where sectionid=7 in articles table, and type=1 in ixreleases.
478  
479 =item * Profiles
480  
481 mangement module = Labyrinth::Plugin::Articles::Profiles
482 database tables = ixreleases, articles, paragraphs, ixprofile, profiles
483 templates = ./who
484  
485 Where sectionid=5 in articles table, and type=2 in ixreleases.
486  
487 =item * MP3s
488  
489 mangement module = Labyrinth::Plugin::MP3s
490 database tables = ixmp3s, ixreleases, mp3s
491 templates = ./mp3s
492  
493 Where type=3 in ixreleases.
494  
495 Note that ixmp3s is used to link an mp3 to a specific lyric. This can then be
496 used to add appropriate links associated with the displayed lyrics.
497  
498 =item * Support Information
499  
500 These are the data types, that are provided to describe the release
501 information. The default set up is for music, but these should be updated to
502 reference other forms, to be more appropriate for the collection type.
503  
504 mangement module = Labyrinth::Plugin::Release
505 database tables = release_forms, release_types
506 templates = ./releases
507  
508 =back
509  
510 =head1 SEE ALSO
511  
512 Labyrinth
513  
514 =head1 AUTHOR
515  
516 Barbie, <barbie@missbarbell.co.uk> for
517 Miss Barbell Productions, L<http://www.missbarbell.co.uk/>
518  
519 =head1 COPYRIGHT & LICENSE
520  
521 Copyright (C) 2002-2014 Barbie for Miss Barbell Productions
522 All Rights Reserved.
523  
524 This distribution is free software; you can redistribute it and/or
525 modify it under the Artistic Licence v2.
526  
527 =cut
↑ Summary