File Coverage

blib/lib/Labyrinth/Plugin/Inbox.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Labyrinth::Plugin::Inbox;
2              
3 2     2   3957 use warnings;
  2         2  
  2         71  
4 2     2   8 use strict;
  2         4  
  2         108  
5              
6             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 2     2   10 use base qw(Labyrinth::Plugin::Base);
  2         3  
  2         890  
32              
33             use Labyrinth::DBUtils;
34             use Labyrinth::Inbox;
35             use Labyrinth::Variables;
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             sub InboxCheck {
69             return if($tvars{user}->{name} eq 'guest');
70             my $folders = AccessAllFolders($tvars{loginid},PUBLISHER);
71             my $areas = AccessAllAreas();
72             my @rows = $dbi->GetQuery('array','CountInbox',
73             {areas=>$areas,folders=>$folders});
74             $tvars{inbox} = $rows[0]->[0] || 0;
75             }
76              
77             sub InboxView {
78             return if($tvars{user}->{name} eq 'guest');
79             my $folders = AccessAllFolders($tvars{loginid},PUBLISHER);
80             my $areas = AccessAllAreas();
81             my @rows = $dbi->GetQuery('array','ReadInbox',
82             {areas=>$areas,folders=>$folders});
83             $tvars{inbox} = scalar(@rows);
84             $tvars{data} = \@rows if(@rows);
85             }
86              
87             sub MessageView {
88             return if($tvars{user}->{name} eq 'guest');
89             my @rows = $dbi->GetQuery('hash','ReadMessage', $cgiparams{message});
90             $tvars{data} = \@rows if(@rows);
91             }
92              
93             sub MessageApprove {
94             return if($tvars{user}->{name} eq 'guest');
95             MessageApproval(1,$tvars{loginid},$cgiparams{message});
96             }
97              
98             sub MessageDecline {
99             return if($tvars{user}->{name} eq 'guest');
100             MessageApproval(0,$tvars{loginid},$cgiparams{message});
101             }
102              
103             1;
104              
105             __END__