Inbox.pm

filter: Statementstmt 52.6% 20 / 38 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 54.5% 6 / 11 Podpod 100% 5 / 5 totaltotal 43.6% 31 / 71 CC 9 SCAR 19.8
CC
9
Cov
37%
InboxCheck
12.0
InboxView
12.0
MessageView
12.0
CRAP 7.3
« Articles/Sections.pm ↑ Summary Core.pm »
1 package Labyrinth::Plugin::Inbox;
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::Inbox - Inbox plugin handler for Labyrinth
11  
12 =head1 DESCRIPTION
13  
14 Contains all the inbox/message handling functionality for the Labyrinth
15 framework.
16  
17 Note that although this module was originally used to alert changes within
18 the content management framework, the methods within have been little used.
19 As such, they are being looked at with a view to redesigning in the future.
20  
21 The intention with approval and decline, is to hook into the appropriate
22 plugin to promote the specified item, such as an article, news item or event.
23 This functionality would only be used by publishers to review items submittd
24 by writers/editors.
25  
26 =cut
27  
28 # -------------------------------------
29 # Library Modules
30  
31 4 ▶use base qw(Labyrinth::Plugin::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 4 ▶use Labyrinth::DBUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 4 ▶use Labyrinth::Inbox;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 4 ▶use Labyrinth::Variables;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 # -------------------------------------
38 # The Subs
39  
40 =head1 PUBLIC INTERFACE METHODS
41  
42 =over 4
43  
44 =item InboxCheck
45  
46 Provide a count of messages in the inbox.
47  
48 =item InboxView
49  
50 Provide a list of message headers in the inbox.
51  
52 =item MessageView
53  
54 Read a specific message.
55  
56 =item MessageApprove
57  
58 Approve the action of a specific message.
59  
60 =item MessageDecline
61  
62 Decline the action of a specific message.
63  
64 =back
65  
66 =cut
67  
68 0 ▶sub InboxCheck {
Subroutine InboxCheck: not called CC=3 SCAR=24.8
Pod documented
69 0 ▶ return if($tvars{user}->{name} eq 'guest');
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Inbox::tvars{"user"}{"name"} eq "guest" 0 0 0
70 0 my $folders = AccessAllFolders($tvars{loginid},PUBLISHER);
71 0 my $areas = AccessAllAreas();
72 0 my @rows = $dbi->GetQuery('array','CountInbox',
73 {areas=>$areas,folders=>$folders});
74 0 ▶ $tvars{inbox} = $rows[0]->[0] || 0;
Condition0%0/2
$rows[0][0] || 0
l!l
00
MC/DC0%0/1
$rows[0][0] || 0
$rows[0][0]
Truth table0%0/2
A
A= $rows[0][0]
Aresult
11
00
75 }
76  
77 0 ▶sub InboxView {
Subroutine InboxView: not called CC=3 SCAR=24.8
Pod documented
78 0 ▶ return if($tvars{user}->{name} eq 'guest');
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Inbox::tvars{"user"}{"name"} eq "guest" 0 0 0
79 0 my $folders = AccessAllFolders($tvars{loginid},PUBLISHER);
80 0 my $areas = AccessAllAreas();
81 0 my @rows = $dbi->GetQuery('array','ReadInbox',
82 {areas=>$areas,folders=>$folders});
83 0 $tvars{inbox} = scalar(@rows);
84 0 ▶ $tvars{data} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
85 }
86  
87 0 ▶sub MessageView {
Subroutine MessageView: not called CC=3 SCAR=24.8
Pod documented
88 0 ▶ return if($tvars{user}->{name} eq 'guest');
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Inbox::tvars{"user"}{"name"} eq "guest" 0 0 0
89 0 my @rows = $dbi->GetQuery('hash','ReadMessage', $cgiparams{message});
90 0 ▶ $tvars{data} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
91 }
92  
93 0 ▶sub MessageApprove {
Subroutine MessageApprove: not called CC=2 SCAR=17.9
Pod documented
94 0 ▶ return if($tvars{user}->{name} eq 'guest');
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Inbox::tvars{"user"}{"name"} eq "guest" 0 0 0
95 0 MessageApproval(1,$tvars{loginid},$cgiparams{message});
96 }
97  
98 0 ▶sub MessageDecline {
Subroutine MessageDecline: not called CC=2 SCAR=17.9
Pod documented
99 0 ▶ return if($tvars{user}->{name} eq 'guest');
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::Inbox::tvars{"user"}{"name"} eq "guest" 0 0 0
100 0 MessageApproval(0,$tvars{loginid},$cgiparams{message});
101 }
102  
103 4 1;
104  
105 __END__
« Articles/Sections.pm ↑ Summary Core.pm »