File Coverage

blib/lib/Labyrinth/Plugin/Content.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::Content;
2              
3 2     2   4678 use strict;
  2         2  
  2         65  
4 2     2   7 use warnings;
  2         2  
  2         66  
5              
6             my $VERSION = '5.17';
7              
8             =head1 NAME
9              
10             Labyrinth::Plugin::Content - General page content functionality.
11              
12             =head1 DESCRIPTION
13              
14             The functions contain herein are for general page content functionality.
15              
16             =cut
17              
18             #----------------------------------------------------------------------------
19             # Libraries
20              
21 2     2   7 use base qw(Labyrinth::Plugin::Base);
  2         1  
  2         799  
22              
23             use Labyrinth::Support;
24             use Labyrinth::Variables;
25              
26             #----------------------------------------------------------------------------
27             # Public Interface Functions
28              
29             =head1 PUBLIC INTERFACE METHODS
30              
31             =over 4
32              
33             =item Admin
34              
35             Checks whether user has admin priviledges.
36              
37             =item Home
38              
39             Sets article name to 'index' for quick loading.
40              
41             =item Section
42              
43             Sets article name to current section name for quick loading.
44              
45             =back
46              
47             =cut
48              
49             sub Admin { AccessUser(ADMIN); }
50             sub Home { $cgiparams{name} = 'index'; }
51             sub Section { $cgiparams{name} = $tvars{section}; }
52              
53             #----------------------------------------------------------
54             # Content Management Subroutines
55              
56             =head1 CONTENT MANAGEMENT FUNCTIONS
57              
58             =over 4
59              
60             =item GetVersion
61              
62             Sets the current application versions in template variables.
63              
64             =item ServerTime
65              
66             Sets the current server time in a template variable.
67              
68             =back
69              
70             =cut
71              
72             sub GetVersion { $tvars{'version'} = $main::VERSION; $tvars{'labversion'} = $Labyrinth::Variables::VERSION; }
73             sub ServerTime { $tvars{'server'}{'date'} = formatDate(3); $tvars{'server'}{'time'} = formatDate(17); }
74              
75             =head1 REALM CHANGING FUNCTIONS
76              
77             All the following reset the current realm.
78              
79             =over
80              
81             =item RealmAJAX
82              
83             Use when the AJAX layout template is required.
84              
85             =item RealmICal
86              
87             Use when the ICal layout template is required.
88              
89             =item RealmJS
90              
91             Use when the JavaScript layout template is required.
92              
93             =item RealmJSON
94              
95             Use when the JSON layout template is required.
96              
97             =item RealmPlain
98              
99             Use when the plain text layout template is required.
100              
101             =item RealmPopup
102              
103             Use when the popup layout template is required.
104              
105             =item RealmXML
106              
107             Use when the XML layout template is required.
108              
109             =item RealmYAML
110              
111             Use when the YAML layout template is required.
112              
113             =back
114              
115             =cut
116              
117             sub RealmAJAX { $tvars{realm} = 'ajax'; }
118             sub RealmICal { $tvars{realm} = 'ical'; }
119             sub RealmJS { $tvars{realm} = 'js'; }
120             sub RealmJSON { $tvars{realm} = 'json'; }
121             sub RealmPlain { $tvars{realm} = 'plain'; }
122             sub RealmPopup { $tvars{realm} = 'popup'; }
123             sub RealmXML { $tvars{realm} = 'xml'; }
124             sub RealmYAML { $tvars{realm} = 'yaml'; }
125              
126             1;
127              
128             __END__