| 1 | package Labyrinth::Plugin::Event; | ||||||||||||||||||||||||||||
| 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 | 5 | $VERSION = '1.09'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 NAME | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | Labyrinth::Plugin::Event - Events handler for the Labyrinth framework. | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | Contains all the event functionality for Labyrinth. | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =cut | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # ------------------------------------- | ||||||||||||||||||||||||||||
| 20 | # Library Modules | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 5 | ▶ | use base qw(Labyrinth::Plugin::Base); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 5 | ▶ | use Clone qw(clone); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 5 | ▶ | use Time::Local; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 5 | ▶ | use Labyrinth::Audit; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | 5 | ▶ | use Labyrinth::DBUtils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | 5 | ▶ | use Labyrinth::DTUtils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | 5 | ▶ | use Labyrinth::MLUtils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 31 | 5 | ▶ | use Labyrinth::Session; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 32 | 5 | ▶ | use Labyrinth::Support; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 33 | 5 | ▶ | use Labyrinth::Users; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | 5 | ▶ | use Labyrinth::Variables; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 5 | ▶ | use Labyrinth::Plugin::Articles::Sections; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 37 | 5 | ▶ | use Labyrinth::Plugin::Event::Sponsors; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 38 | 5 | ▶ | use Labyrinth::Plugin::Event::Types; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | # ------------------------------------- | ||||||||||||||||||||||||||||
| 41 | # Variables | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 5 | my $ADAY = 86400; | |||||||||||||||||||||||||||
| 44 | 5 | my %abbreviations; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | # type: 0 = optional, 1 = mandatory | ||||||||||||||||||||||||||||
| 47 | # html: 0 = none, 1 = text, 2 = textarea | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 5 | my %fields = ( | |||||||||||||||||||||||||||
| 50 | eventid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||
| 51 | folderid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||
| 52 | userid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||
| 53 | imageid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||
| 54 | title => { type => 1, html => 1 }, | ||||||||||||||||||||||||||||
| 55 | listeddate => { type => 1, html => 1 }, | ||||||||||||||||||||||||||||
| 56 | eventdate => { type => 1, html => 1 }, | ||||||||||||||||||||||||||||
| 57 | eventtime => { type => 1, html => 1 }, | ||||||||||||||||||||||||||||
| 58 | eventtypeid => { type => 1, html => 0 }, | ||||||||||||||||||||||||||||
| 59 | sponsorid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||
| 60 | venueid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||
| 61 | publish => { type => 1, html => 0 }, | ||||||||||||||||||||||||||||
| 62 | body => { type => 1, html => 2 }, | ||||||||||||||||||||||||||||
| 63 | links => { type => 0, html => 2 }, | ||||||||||||||||||||||||||||
| 64 | image => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||
| 65 | align => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 5 | my (@mandatory,@allfields); | |||||||||||||||||||||||||||
| 69 | 5 | for(keys %fields) { | |||||||||||||||||||||||||||
| 70 | 80 | ▶ | push @mandatory, $_ if($fields{$_}->{type}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 80 | push @allfields, $_; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 5 | my $LEVEL = EDITOR; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | # ------------------------------------- | ||||||||||||||||||||||||||||
| 77 | # The Subs | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =head1 PUBLIC INTERFACE METHODS | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =head2 Full Event Details | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =over 4 | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =item NextEvent() | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | Retrieves the next event for event type. | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =item NextEvents() | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | Retrieves all the future events for event type. | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | =item PrevEvents() | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | Retrieves all the future events for event type. | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =back | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =cut | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | sub NextEvent { | ||||||||||||||||||||||||||||
| 102 | 0 | ▶ | my $timer = _get_timer(); | ||||||||||||||||||||||||||
|
Subroutine
NextEvent: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 103 | 0 | my @rows; | |||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $cgiparams{eventtypeid} ||= 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Event::cgiparams{"eventtypeid"} ||= 0
MC/DC0%0/1
$Labyrinth::Plugin::Event::cgiparams{"eventtypeid"} ||= 0
$Labyrinth::Plugin::Event::cgiparams{"eventtypeid"}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Event::cgiparams{"eventtypeid"}
| |||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if($cgiparams{eventtypeid}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | 0 | @rows = $dbi->GetQuery('hash','GetNextEventByType',$timer,$cgiparams{eventtypeid}); | |||||||||||||||||||||||||||
| 109 | } else { | ||||||||||||||||||||||||||||
| 110 | 0 | @rows = $dbi->GetQuery('hash','GetNextEvent',$timer); | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | 0 | ▶ | return unless(@rows); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 0 | $tvars{event}{$cgiparams{eventtypeid}}{next} = $rows[0]; | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 0 | my @talks = $dbi->GetQuery('hash','GetEventTalks',$rows[0]->{eventid}); | |||||||||||||||||||||||||||
| 117 | 0 | ▶ | if(@talks) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 0 | for my $talk (@talks) { | |||||||||||||||||||||||||||
| 119 | 0 | my %talk = map {$_ => $talk->{$_}} qw(userid realname guest talktitle abstract); | |||||||||||||||||||||||||||
| 120 | 0 | push @{ $tvars{event}{$cgiparams{eventtypeid}}{talks} }, \%talk; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | my @dates; | |||||||||||||||||||||||||||
| 125 | 0 | push @dates, formatDate(10,$_->{listdate}) for(@rows); | |||||||||||||||||||||||||||
| 126 | 0 | ▶ | $tvars{events}{$cgiparams{eventtypeid}}{dates} = \@dates if(@dates); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | sub NextEvents { | ||||||||||||||||||||||||||||
| 130 | 0 | ▶ | my $timer = _get_timer(); | ||||||||||||||||||||||||||
|
Subroutine
NextEvents: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 131 | 0 | my @rows; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | ▶ | $cgiparams{eventtypeid} ||= 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Event::cgiparams{"eventtypeid"} ||= 0
MC/DC0%0/1
$Labyrinth::Plugin::Event::cgiparams{"eventtypeid"} ||= 0
$Labyrinth::Plugin::Event::cgiparams{"eventtypeid"}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Event::cgiparams{"eventtypeid"}
| |||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if($cgiparams{eventtypeid}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | 0 | @rows = $dbi->GetQuery('hash','GetNextEventsByType',$timer,$cgiparams{eventtypeid}); | |||||||||||||||||||||||||||
| 137 | } else { | ||||||||||||||||||||||||||||
| 138 | 0 | @rows = $dbi->GetQuery('hash','GetNextEvents',$timer); | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | 0 | LogDebug("NextEvents rows=".scalar(@rows)); | |||||||||||||||||||||||||||
| 141 | 0 | ▶ | return unless(@rows); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | my @dates; | |||||||||||||||||||||||||||
| 144 | 0 | for my $row (@rows) { | |||||||||||||||||||||||||||
| 145 | 0 | push @dates, formatDate(10,$row->{listdate}); | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | $tvars{events}{$cgiparams{eventtypeid}}{future} = $rows[0]; | |||||||||||||||||||||||||||
| 149 | 0 | ▶ | $tvars{events}{$cgiparams{eventtypeid}}{dates} = \@dates if(@dates); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if($cgiparams{eventtypeid}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | 0 | my $sections = Labyrinth::Plugin::Articles::Sections->new(); | |||||||||||||||||||||||||||
| 153 | 0 | $sections->GetSection('eventtype' . $cgiparams{eventtypeid}); | |||||||||||||||||||||||||||
| 154 | 0 | $tvars{events}{$cgiparams{eventtypeid}}{intro} = $tvars{page}{section}; | |||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | sub PrevEvents { | ||||||||||||||||||||||||||||
| 159 | 0 | ▶ | my $timer = _get_timer(); | ||||||||||||||||||||||||||
|
Subroutine
PrevEvents: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 160 | 0 | my @rows; | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 0 | ▶ | $cgiparams{eventtypeid} ||= 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Event::cgiparams{"eventtypeid"} ||= 0
MC/DC0%0/1
$Labyrinth::Plugin::Event::cgiparams{"eventtypeid"} ||= 0
$Labyrinth::Plugin::Event::cgiparams{"eventtypeid"}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Event::cgiparams{"eventtypeid"}
| |||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if($cgiparams{eventtypeid}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 0 | @rows = $dbi->GetQuery('hash','GetPrevEventsByType',$timer,$cgiparams{eventtypeid}); | |||||||||||||||||||||||||||
| 166 | } else { | ||||||||||||||||||||||||||||
| 167 | 0 | @rows = $dbi->GetQuery('hash','GetPrevEvents',$timer); | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | 0 | LogDebug("PrevEvents rows=".scalar(@rows)); | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 0 | my %data; | |||||||||||||||||||||||||||
| 172 | 0 | for my $row (@rows) { | |||||||||||||||||||||||||||
| 173 | 0 | $data{$row->{listdate}}->{$_} = $row->{$_} for(keys %$row); | |||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | next unless($row->{talktitle}); # ignore talks without a title | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | 0 | my %talk = map {$_ => $row->{$_}} qw(realname guest talktitle); | |||||||||||||||||||||||||||
| 177 | 0 | push @{$data{$row->{listdate}}->{talks}}, \%talk; | |||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | 0 | my @data = map {$data{$_}} reverse sort keys %data; | |||||||||||||||||||||||||||
| 181 | 0 | ▶ | $tvars{events}{$cgiparams{eventtypeid}}{past} = \@data if(@data); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | ▶ | if($cgiparams{eventtypeid}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | 0 | my $sections = Labyrinth::Plugin::Articles::Sections->new(); | |||||||||||||||||||||||||||
| 185 | 0 | $sections->GetSection('eventtype' . $cgiparams{eventtypeid}); | |||||||||||||||||||||||||||
| 186 | 0 | $tvars{events}{$cgiparams{eventtypeid}}{intro} = $tvars{page}{section}; | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | sub _get_timer { | ||||||||||||||||||||||||||||
| 191 | 0 | ▶ | my $date = formatDate(3); | ||||||||||||||||||||||||||
|
Subroutine
_get_timer: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 192 | 0 | my ($day,$month,$year) = split("/",$date); | |||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 0 | return timelocal(0,0,0,$day,$month-1,$year); | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | =head2 Event Lists | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | =over 4 | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | =item ShortList() | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | Provides a list of forthcoming events, with abbreviations as appropriate. | ||||||||||||||||||||||||||||
| 204 | Defaults to 365 days or 20 events, but these limits can be set in the | ||||||||||||||||||||||||||||
| 205 | configuration as 'eventsshortlistdays' and 'eventsshortlistcount' respectively. | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | =item LongList() | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | Provides a list of forthcoming events. No defaults, will return the list based | ||||||||||||||||||||||||||||
| 210 | on the configured limits or all future events if no configuration. Values can | ||||||||||||||||||||||||||||
| 211 | be set for 'eventslonglistdays' and 'eventslonglistcount'. | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | =item Item() | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | Provides the specified event. | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | =back | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | =cut | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | sub ShortList { | ||||||||||||||||||||||||||||
| 222 | 0 | ▶ | my $date = formatDate(3); | ||||||||||||||||||||||||||
|
Subroutine
ShortList: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 223 | 0 | my ($day,$month,$year) = split("/",$date); | |||||||||||||||||||||||||||
| 224 | 0 | ▶ | my $daylimit = $settings{eventsshortlistdays} || 365; | ||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Event::settings{'eventsshortlistdays'} || 365
MC/DC0%0/1
$Labyrinth::Plugin::Event::settings{'eventsshortlistdays'} || 365
$Labyrinth::Plugin::Event::settings{'eventsshortlistdays'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Event::settings{'eventsshortlistdays'}
| |||||||||||||||||||||||||||||
| 225 | 0 | ▶ | my $numlimit = $settings{eventsshortlistcount} || 20; | ||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Event::settings{'eventsshortlistcount'} || 20
MC/DC0%0/1
$Labyrinth::Plugin::Event::settings{'eventsshortlistcount'} || 20
$Labyrinth::Plugin::Event::settings{'eventsshortlistcount'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Event::settings{'eventsshortlistcount'}
| |||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | unless(%abbreviations) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | 0 | for(@{ $settings{abbreviations} }) { | |||||||||||||||||||||||||||
| 229 | 0 | my ($name,$value) = split(/=/,$_,2); | |||||||||||||||||||||||||||
| 230 | 0 | $abbreviations{$name} = $value; | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 0 | my @events; | |||||||||||||||||||||||||||
| 235 | 0 | my $events = _events_list($year,$month,$day,$daylimit,$numlimit); | |||||||||||||||||||||||||||
| 236 | 0 | for my $event (@$events) { | |||||||||||||||||||||||||||
| 237 | 0 | for my $abbr (keys %abbreviations) { | |||||||||||||||||||||||||||
| 238 | 0 | $event->{title} =~ s/$abbr/$abbreviations{$abbr}/; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | 0 | $event->{eventdate} =~ s/\s+/ /g; | |||||||||||||||||||||||||||
| 241 | 0 | push @events, $event; | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 0 | $tvars{events}{shortlist} = \@events; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | sub LongList { | ||||||||||||||||||||||||||||
| 248 | 0 | ▶ | my ($day,$month,$year) = _startdate(); | ||||||||||||||||||||||||||
|
Subroutine
LongList: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 249 | 0 | my $daylimit = $settings{eventslonglistdays}; | |||||||||||||||||||||||||||
| 250 | 0 | my $numlimit = $settings{eventslonglistcount}; | |||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 0 | my $eventtypes = Labyrinth::Plugin::Event::Types->new(); | |||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 0 | my $list = _events_list($year,$month,$day,$daylimit,$numlimit); | |||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 0 | ▶ | $tvars{events}{longlist} = $list if(defined $list); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 0 | $tvars{events}{ddpublish} = PublishSelect($cgiparams{'publish'},1); | |||||||||||||||||||||||||||
| 258 | 0 | $tvars{events}{ddtypes} = $eventtypes->EventTypeSelect($cgiparams{'eventtypeid'},1); | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | sub _events_list { | ||||||||||||||||||||||||||||
| 262 | 0 | ▶ | my ($year,$month,$day,$daylimit,$numlimit) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_events_list: not called CC=15 SCAR=54.8
| |||||||||||||||||||||||||||||
| 263 | 0 | my @rows; | |||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | 0 | ▶ | $daylimit ||= 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$daylimit ||= 0
MC/DC0%0/1
$daylimit ||= 0
$daylimit
Truth table0%0/2
A
A= $daylimit
| |||||||||||||||||||||||||||||
| 266 | 0 | ▶ | $numlimit ||= 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$numlimit ||= 0
MC/DC0%0/1
$numlimit ||= 0
$numlimit
Truth table0%0/2
A
A= $numlimit
| |||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | my $timer = timelocal(0,0,0,$day,$month-1,$year); | |||||||||||||||||||||||||||
| 269 | 0 | my $limit = $timer + ($daylimit * $ADAY); | |||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 0 | my @where = ("listdate>=$timer"); | |||||||||||||||||||||||||||
| 272 | 0 | ▶ | push @where, "eventtypeid=$cgiparams{'eventtypeid'}" if($cgiparams{'eventtypeid'}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 273 | 0 | ▶ | push @where, "publish=$cgiparams{'publish'}" if($cgiparams{'publish'}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 274 | 0 | ▶ | my $where = @where ? join(' AND ',@where) : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 0 | my $num = 0; | |||||||||||||||||||||||||||
| 277 | 0 | my $next = $dbi->Iterator('hash','GetEventsByDate',{where=>$where}); | |||||||||||||||||||||||||||
| 278 | 0 | ▶ | while(my $row = $next->()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 279 | 0 | ▶ | last if($daylimit && $row->{listdate} > $limit); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$daylimit and $row->{"listdate"} > $limit
MC/DC0%0/2
$daylimit and $row->{"listdate"} > $limit
$daylimit
$row->{"listdate"} > $limit
Truth table0%0/3
A and B
A= $daylimitB= $row->{"listdate"} > $limit
| |||||||||||||||||||||||||||||
| 280 | 0 | ▶ | last if($numlimit && $num > $numlimit); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$numlimit and $num > $numlimit
MC/DC0%0/2
$numlimit and $num > $numlimit
$numlimit
$num > $numlimit
Truth table0%0/3
A and B
A= $numlimitB= $num > $numlimit
| |||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | 0 | $row->{snippet} = $row->{body}; | |||||||||||||||||||||||||||
| 283 | 0 | ▶ | $row->{snippet} =~ s!^(?:.*?)?<p>(.*?)</p>.*$!<p>$1...</p>!si if($row->{snippet}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 284 | 0 | $row->{shortdate} = $row->{eventdate}; | |||||||||||||||||||||||||||
| 285 | 0 | ▶ | $row->{shortdate} =~ s/([A-Za-z]{3}).*/$1/ if($row->{shortdate}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 286 | 0 | ▶ | $row->{links} =~ s!\*!<br />!g if($row->{links}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 287 | 0 | push @rows, $row; | |||||||||||||||||||||||||||
| 288 | 0 | $num++; | |||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 0 | ▶ | return unless(@rows); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 292 | 0 | return \@rows; | |||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | sub _startdate { | ||||||||||||||||||||||||||||
| 296 | 0 | ▶ | my %base = ( | ||||||||||||||||||||||||||
|
Subroutine
_startdate: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 297 | day => 1, | ||||||||||||||||||||||||||||
| 298 | month => isMonth(), | ||||||||||||||||||||||||||||
| 299 | year => formatDate(1) | ||||||||||||||||||||||||||||
| 300 | ); | ||||||||||||||||||||||||||||
| 301 | 0 | my $base = sprintf "%04d%02d%02d", $base{year},$base{month},$base{day}; | |||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | 0 | my @time = localtime(time); | |||||||||||||||||||||||||||
| 304 | 0 | my $time = sprintf "%04d%02d%02d", $time[5]+1900,$time[4]+1,$time[3]; | |||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 0 | ▶ | my @date = map {$cgiparams{$_} || $base{$_}} qw(year month day); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 307 | 0 | my $date = sprintf "%04d%02d%02d", @date; | |||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | #use Labyrinth::Audit; | ||||||||||||||||||||||||||||
| 310 | #LogDebug("base=$base"); | ||||||||||||||||||||||||||||
| 311 | #LogDebug("time=$time"); | ||||||||||||||||||||||||||||
| 312 | #LogDebug("date=$date"); | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if($date < $time) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | 0 | return ($time[3],$time[4]+1,$time[5]+1900); | |||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | 0 | return reverse @date; | |||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | sub Item { | ||||||||||||||||||||||||||||
| 322 | 0 | ▶ | return unless($cgiparams{'eventid'}); | ||||||||||||||||||||||||||
|
Subroutine
Item: not called CC=4 SCAR=30.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | 0 | my @rows = $dbi->GetQuery('hash','GetEventByID',$cgiparams{'eventid'}); | |||||||||||||||||||||||||||
| 325 | 0 | ▶ | $tvars{event} = $rows[0] if(@rows); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | 0 | my @talks = $dbi->GetQuery('hash','GetEventTechTalks',$cgiparams{eventid}); | |||||||||||||||||||||||||||
| 328 | 0 | ▶ | $tvars{event}{talks} = @talks ? \@talks : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | =head1 ADMIN INTERFACE METHODS | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | =head2 Events | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | =over 4 | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | =item Admin | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | Provides list of the events currently available. | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | =item Add | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | Add a new event. | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | =item Edit | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | Edit an existing event. | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | =item Copy | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | Copy an existing event, creating a new event. | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | =item Save | ||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | Save the current event. | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | =item Promote | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | Promote the published status of the specified event by one level. | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | =item Delete | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | Delete the specified events. | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | =back | ||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | =cut | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | sub Admin { | ||||||||||||||||||||||||||||
| 370 | 0 | ▶ | return unless AccessUser(EDITOR); | ||||||||||||||||||||||||||
|
Subroutine
Admin: not called CC=12 SCAR=50.5
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | 0 | ▶ | if($cgiparams{doaction}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 373 | 0 | ▶ | if($cgiparams{doaction} eq 'Delete' ) { Delete(); } | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 374 | 0 | elsif($cgiparams{doaction} eq 'Copy' ) { Copy(); } | |||||||||||||||||||||||||||
| 375 | 0 | elsif($cgiparams{doaction} eq 'Promote') { Promote(); } | |||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | 0 | my $month = $cgiparams{'month'}; | |||||||||||||||||||||||||||
| 379 | 0 | my $year = $cgiparams{'year'}; | |||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | 0 | my @where; | |||||||||||||||||||||||||||
| 382 | 0 | ▶ | push @where, "userid=$tvars{'loginid'}" unless(Authorised(PUBLISHER)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 383 | 0 | ▶ | if($cgiparams{'publish'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 384 | 0 | push @where, "publish=$cgiparams{'publish'}"; | |||||||||||||||||||||||||||
| 385 | } else { | ||||||||||||||||||||||||||||
| 386 | 0 | push @where, "publish<4"; | |||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||
| 388 | 0 | ▶ | push @where, "eventtype=$cgiparams{'eventtype'}" if($cgiparams{'eventtype'}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 389 | 0 | ▶ | my $where = @where ? 'WHERE '.join(' AND ',@where) : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 0 | my $eventtypes = Labyrinth::Plugin::Event::Types->new(); | |||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | 0 | my @rows = $dbi->GetQuery('hash','AllEvents',{where=>$where}); | |||||||||||||||||||||||||||
| 394 | 0 | foreach my $row (@rows) { | |||||||||||||||||||||||||||
| 395 | 0 | $row->{publishstate} = PublishState($row->{publish}); | |||||||||||||||||||||||||||
| 396 | 0 | $row->{createdate} = formatDate(3,$row->{listdate}); | |||||||||||||||||||||||||||
| 397 | 0 | $row->{eventtype} = $eventtypes->EventType($row->{eventtypeid}); | |||||||||||||||||||||||||||
| 398 | 0 | $row->{name} = UserName($row->{userid}); | |||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||
| 400 | 0 | ▶ | $tvars{data} = \@rows if(@rows); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | 0 | $tvars{ddpublish} = PublishSelect($cgiparams{'publish'},1); | |||||||||||||||||||||||||||
| 403 | 0 | $tvars{ddtypes} = $eventtypes->EventTypeSelect($cgiparams{'eventtype'},1); | |||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | sub Add { | ||||||||||||||||||||||||||||
| 407 | 0 | ▶ | return unless AccessUser(EDITOR); | ||||||||||||||||||||||||||
|
Subroutine
Add: not called CC=4 SCAR=30.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | 0 | my $eventtypes = Labyrinth::Plugin::Event::Types->new(); | |||||||||||||||||||||||||||
| 410 | 0 | my $sponsors = Labyrinth::Plugin::Event::Sponsors->new(); | |||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | my %data = ( | ||||||||||||||||||||||||||||
| 413 | folderid => 1, | ||||||||||||||||||||||||||||
| 414 | title => '', | ||||||||||||||||||||||||||||
| 415 | userid => $tvars{loginid}, | ||||||||||||||||||||||||||||
| 416 | name => $tvars{user}->{name}, | ||||||||||||||||||||||||||||
| 417 | 0 | createdate => formatDate(4), | |||||||||||||||||||||||||||
| 418 | body => '', | ||||||||||||||||||||||||||||
| 419 | imageid => 1, | ||||||||||||||||||||||||||||
| 420 | ddalign => AlignSelect(1), | ||||||||||||||||||||||||||||
| 421 | ddtype => $eventtypes->EventTypeSelect(0,1), | ||||||||||||||||||||||||||||
| 422 | link => 'images/blank.png', | ||||||||||||||||||||||||||||
| 423 | ddpublish => PublishAction(1,1), | ||||||||||||||||||||||||||||
| 424 | ); | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 0 | $tvars{data} = \%data; | |||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | 0 | my $promote = 0; | |||||||||||||||||||||||||||
| 429 | 0 | ▶ | $promote = 1 if(Authorised(EDITOR)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 430 | 0 | $tvars{data}{ddpublish} = PublishAction(1,$promote); | |||||||||||||||||||||||||||
| 431 | 0 | ▶ | $tvars{data}{ddpublish} = PublishSelect(1) if(Authorised(ADMIN)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 432 | 0 | $tvars{data}{ddvenue} = VenueSelect($tvars{data}{venueid},1); | |||||||||||||||||||||||||||
| 433 | 0 | $tvars{data}{ddsponsor} = $sponsors->SponsorSelect($tvars{data}{sponsorid},1); | |||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | sub Edit { | ||||||||||||||||||||||||||||
| 437 | 0 | ▶ | return unless AccessUser(EDITOR); | ||||||||||||||||||||||||||
|
Subroutine
Edit: not called CC=18 SCAR=58.3
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 438 | 0 | ▶ | return unless AuthorCheck('GetEventByID','eventid',EDITOR); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 439 | 0 | ▶ | return unless($tvars{data}); # no data, no event | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | 0 | ▶ | if($tvars{data}{publish} == 4 && $tvars{command} ne 'view') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 4 and $Labyrinth::Plugin::Event::tvars{"command"} ne "view"
MC/DC0%0/2
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 4 and $Labyrinth::Plugin::Event::tvars{"command"} ne "view"
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 4
$Labyrinth::Plugin::Event::tvars{"command"} ne "view"
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 4B= $Labyrinth::Plugin::Event::tvars{"command"} ne "view"
| |||||||||||||||||||||||||||||
| 442 | 0 | $tvars{errcode} = 'FAILURE'; | |||||||||||||||||||||||||||
| 443 | 0 | return; | |||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | 0 | my $eventtypes = Labyrinth::Plugin::Event::Types->new(); | |||||||||||||||||||||||||||
| 447 | 0 | my $sponsors = Labyrinth::Plugin::Event::Sponsors->new(); | |||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | 0 | $tvars{data}{align} = $cgiparams{ALIGN0}; | |||||||||||||||||||||||||||
| 450 | 0 | $tvars{data}{alignment} = AlignClass($tvars{data}{align}); | |||||||||||||||||||||||||||
| 451 | 0 | $tvars{data}{ddalign} = AlignSelect($tvars{data}{align}); | |||||||||||||||||||||||||||
| 452 | 0 | $tvars{data}{name} = UserName($tvars{data}{userid}); | |||||||||||||||||||||||||||
| 453 | 0 | $tvars{data}{ddtype} = $eventtypes->EventTypeSelect($tvars{data}{eventtypeid},1); | |||||||||||||||||||||||||||
| 454 | 0 | $tvars{data}{createdate} = formatDate(4,$tvars{data}{createdate}); | |||||||||||||||||||||||||||
| 455 | 0 | $tvars{data}{ddvenue} = VenueSelect($tvars{data}{venueid},1); | |||||||||||||||||||||||||||
| 456 | 0 | $tvars{data}{ddsponsor} = $sponsors->SponsorSelect($tvars{data}{sponsorid},1); | |||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | 0 | my $promote = 0; | |||||||||||||||||||||||||||
| 459 | 0 | ▶ | $promote = 1 if($tvars{data}{publish} == 1 && Authorised(EDITOR)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 1 and Authorised(2)
MC/DC0%0/2
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 1 and Authorised(2)
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 1
Authorised(2)
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 1B= Authorised(2)
| |||||||||||||||||||||||||||||
| 460 | 0 | ▶ | $promote = 1 if($tvars{data}{publish} == 2 && Authorised(PUBLISHER)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 2 and Authorised(3)
MC/DC0%0/2
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 2 and Authorised(3)
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 2
Authorised(3)
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 2B= Authorised(3)
| |||||||||||||||||||||||||||||
| 461 | 0 | ▶ | $promote = 1 if($tvars{data}{publish} == 3 && Authorised(PUBLISHER)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 3 and Authorised(3)
MC/DC0%0/2
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 3 and Authorised(3)
$Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 3
Authorised(3)
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::Event::tvars{"data"}{"publish"} == 3B= Authorised(3)
| |||||||||||||||||||||||||||||
| 462 | 0 | $tvars{data}{ddpublish} = PublishAction($tvars{data}{publish},$promote); | |||||||||||||||||||||||||||
| 463 | 0 | ▶ | $tvars{data}{ddpublish} = PublishSelect($tvars{data}{publish}) if(Authorised(ADMIN)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | 0 | my @rows = $dbi->GetQuery('hash','GetEventTechTalks',$tvars{data}{eventid}); | |||||||||||||||||||||||||||
| 466 | 0 | ▶ | $tvars{data}{talks} = @rows ? \@rows : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 467 | 0 | $tvars{preview} = clone($tvars{data}); # data fields need to be editable | |||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | 0 | for(keys %fields) { | |||||||||||||||||||||||||||
| 470 | 0 | ▶ | if($fields{$_}->{html} == 1) { $tvars{data}{$_} = CleanHTML($tvars{data}{$_}) } | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 471 | 0 | elsif($fields{$_}->{html} == 2) { $tvars{data}{$_} = SafeHTML($tvars{data}{$_}); | |||||||||||||||||||||||||||
| 472 | 0 | $tvars{preview}{$_} = CleanTags($tvars{preview}{$_}) } | |||||||||||||||||||||||||||
| 473 | 0 | elsif($fields{$_}->{html} == 3) { $tvars{data}{$_} = SafeHTML($tvars{data}{$_}); | |||||||||||||||||||||||||||
| 474 | 0 | $tvars{preview}{$_} = CleanTags($tvars{preview}{$_}) } | |||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | 0 | $tvars{data}{listeddate} = formatDate(3,$tvars{data}{listdate}); | |||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | sub Copy { | ||||||||||||||||||||||||||||
| 481 | 0 | ▶ | return unless AccessUser(EDITOR); | ||||||||||||||||||||||||||
|
Subroutine
Copy: not called CC=4 SCAR=30.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 482 | 0 | $cgiparams{'eventid'} = $cgiparams{'LISTED'}; | |||||||||||||||||||||||||||
| 483 | 0 | ▶ | return unless AuthorCheck('GetEventByID','eventid',EDITOR); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | my @fields = ( $tvars{data}{folderid}, | ||||||||||||||||||||||||||||
| 486 | $tvars{data}{title}, | ||||||||||||||||||||||||||||
| 487 | $tvars{data}{eventdate}, | ||||||||||||||||||||||||||||
| 488 | $tvars{data}{eventtime}, | ||||||||||||||||||||||||||||
| 489 | $tvars{data}{eventtypeid}, | ||||||||||||||||||||||||||||
| 490 | $tvars{data}{venueid}, | ||||||||||||||||||||||||||||
| 491 | $tvars{data}{imageid}, | ||||||||||||||||||||||||||||
| 492 | $tvars{data}{align}, | ||||||||||||||||||||||||||||
| 493 | 1, | ||||||||||||||||||||||||||||
| 494 | $tvars{data}{sponsorid} || 0, | ||||||||||||||||||||||||||||
| 495 | $tvars{data}{listdate}, | ||||||||||||||||||||||||||||
| 496 | $tvars{data}{body}, | ||||||||||||||||||||||||||||
| 497 | $tvars{data}{links}, | ||||||||||||||||||||||||||||
| 498 | 0 | ▶ | $tvars{loginid}); | ||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Event::tvars{'data'}{'sponsorid'} || 0
MC/DC0%0/1
$Labyrinth::Plugin::Event::tvars{'data'}{'sponsorid'} || 0
$Labyrinth::Plugin::Event::tvars{'data'}{'sponsorid'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Event::tvars{'data'}{'sponsorid'}
| |||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | 0 | $cgiparams{eventid} = $dbi->IDQuery('AddEvent',@fields); | |||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | 0 | $tvars{errcode} = 'NEXT'; | |||||||||||||||||||||||||||
| 503 | 0 | $tvars{command} = 'event-edit'; | |||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | sub Save { | ||||||||||||||||||||||||||||
| 507 | 0 | ▶ | return unless AccessUser(EDITOR); | ||||||||||||||||||||||||||
|
Subroutine
Save: not called CC=16 SCAR=56.1
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 508 | 0 | ▶ | return unless AuthorCheck('GetEventByID','eventid',EDITOR); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||
| 510 | 0 | $tvars{data}{align} = $cgiparams{ALIGN0}; | |||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | 0 | for(keys %fields) { | |||||||||||||||||||||||||||
| 513 | 0 | ▶ | next unless($fields{$_}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 514 | 0 | ▶ | if($fields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}) } | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 515 | 0 | elsif($fields{$_}->{html} == 2) { $cgiparams{$_} = CleanTags($cgiparams{$_}) } | |||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | 0 | ▶ | return if FieldCheck(\@allfields,\@mandatory); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||
| 520 | # check whether listing date has changed | ||||||||||||||||||||||||||||
| 521 | 0 | my $listeddate = formatDate(3,$tvars{data}{listdate}); | |||||||||||||||||||||||||||
| 522 | $tvars{data}{listdate} = unformatDate(3,$tvars{data}{listeddate}) | ||||||||||||||||||||||||||||
| 523 | 0 | ▶ | unless($listeddate eq $tvars{data}{listeddate}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||
| 525 | 0 | my $imageid = 1; | |||||||||||||||||||||||||||
| 526 | # withdrawn, may be reintroduced later. | ||||||||||||||||||||||||||||
| 527 | #my $imageid = $tvars{data}{'imageid'} || 1; | ||||||||||||||||||||||||||||
| 528 | #($imageid) = Images::SaveImageFile( | ||||||||||||||||||||||||||||
| 529 | # param => 'image', | ||||||||||||||||||||||||||||
| 530 | # stock => 4) if($cgiparams{image}); | ||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | 0 | my %fields = map {$_ => 1} @allfields; | |||||||||||||||||||||||||||
| 533 | 0 | delete $fields{$_} for @mandatory; | |||||||||||||||||||||||||||
| 534 | 0 | for(keys %fields) { | |||||||||||||||||||||||||||
| 535 | 0 | ▶ | if(/align|id/) { $tvars{data}{$_} ||= 0; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$Labyrinth::Plugin::Event::tvars{"data"}{$_} ||= 0
MC/DC0%0/1
$Labyrinth::Plugin::Event::tvars{"data"}{$_} ||= 0
$Labyrinth::Plugin::Event::tvars{"data"}{$_}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Event::tvars{"data"}{$_}
| |||||||||||||||||||||||||||||
| 536 | 0 | ▶ | else { $tvars{data}{$_} ||= undef; } | ||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Event::tvars{"data"}{$_} ||= undef
MC/DC0%0/1
$Labyrinth::Plugin::Event::tvars{"data"}{$_} ||= undef
$Labyrinth::Plugin::Event::tvars{"data"}{$_}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Event::tvars{"data"}{$_}
| |||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||
| 539 | my @fields = ( $tvars{data}{folderid}, | ||||||||||||||||||||||||||||
| 540 | $tvars{data}{title}, | ||||||||||||||||||||||||||||
| 541 | $tvars{data}{eventdate}, | ||||||||||||||||||||||||||||
| 542 | $tvars{data}{eventtime}, | ||||||||||||||||||||||||||||
| 543 | $tvars{data}{eventtypeid}, | ||||||||||||||||||||||||||||
| 544 | $tvars{data}{venueid}, | ||||||||||||||||||||||||||||
| 545 | $imageid, | ||||||||||||||||||||||||||||
| 546 | $tvars{data}{align}, | ||||||||||||||||||||||||||||
| 547 | $tvars{data}{publish}, | ||||||||||||||||||||||||||||
| 548 | $tvars{data}{sponsorid} || 0, | ||||||||||||||||||||||||||||
| 549 | $tvars{data}{listdate}, | ||||||||||||||||||||||||||||
| 550 | $tvars{data}{body}, | ||||||||||||||||||||||||||||
| 551 | $tvars{data}{links} | ||||||||||||||||||||||||||||
| 552 | 0 | ▶ | ); | ||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Event::tvars{'data'}{'sponsorid'} || 0
MC/DC0%0/1
$Labyrinth::Plugin::Event::tvars{'data'}{'sponsorid'} || 0
$Labyrinth::Plugin::Event::tvars{'data'}{'sponsorid'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Event::tvars{'data'}{'sponsorid'}
| |||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | 0 | ▶ | if($cgiparams{eventid}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 555 | 0 | { $dbi->DoQuery('SaveEvent',@fields,$cgiparams{eventid}); } | |||||||||||||||||||||||||||
| 556 | 0 | else { $cgiparams{eventid} = $dbi->IDQuery('AddEvent',@fields,$tvars{loginid}); } | |||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||
| 558 | 0 | $tvars{thanks} = 1; | |||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||
| 561 | sub Promote { | ||||||||||||||||||||||||||||
| 562 | 0 | ▶ | return unless AccessUser(PUBLISHER); | ||||||||||||||||||||||||||
|
Subroutine
Promote: not called CC=6 SCAR=37.4
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 563 | 0 | my @ids = CGIArray('LISTED'); | |||||||||||||||||||||||||||
| 564 | 0 | ▶ | return unless @ids; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||
| 566 | 0 | for my $id (@ids) { | |||||||||||||||||||||||||||
| 567 | 0 | $cgiparams{'eventid'} = $id; | |||||||||||||||||||||||||||
| 568 | 0 | ▶ | next unless AuthorCheck('GetEventByID','eventid'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||
| 570 | 0 | my $publish = $tvars{data}{publish} + 1; | |||||||||||||||||||||||||||
| 571 | 0 | ▶ | next unless($publish < 5); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 572 | 0 | $dbi->DoQuery('PromoteEvent',$publish,$cgiparams{'eventid'}); | |||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||
| 576 | sub Delete { | ||||||||||||||||||||||||||||
| 577 | 0 | ▶ | return unless AccessUser(ADMIN); | ||||||||||||||||||||||||||
|
Subroutine
Delete: not called CC=5 SCAR=34.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 578 | 0 | my @ids = CGIArray('LISTED'); | |||||||||||||||||||||||||||
| 579 | 0 | ▶ | return unless @ids; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||
| 581 | 0 | for my $id (@ids) { | |||||||||||||||||||||||||||
| 582 | 0 | $cgiparams{'eventid'} = $id; | |||||||||||||||||||||||||||
| 583 | 0 | ▶ | next unless AuthorCheck('GetEventByID','eventid',EDITOR); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 584 | 0 | $dbi->DoQuery('DeleteEvent',$cgiparams{'eventid'}); | |||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | =head2 Event Attributes | ||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||
| 590 | =over 4 | ||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||
| 592 | =item VenueSelect | ||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||
| 594 | Provides a dropdown list of venues available. | ||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||
| 596 | =back | ||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||
| 598 | =cut | ||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||
| 600 | sub VenueSelect { | ||||||||||||||||||||||||||||
| 601 | 0 | ▶ | my ($opt,$blank) = @_; | ||||||||||||||||||||||||||
|
Subroutine
VenueSelect: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 602 | 0 | ▶ | $blank ||= 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$blank ||= 0
MC/DC0%0/1
$blank ||= 0
$blank
Truth table0%0/2
A
A= $blank
| |||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||
| 604 | 0 | my @list = $dbi->GetQuery('hash','AllVenues'); | |||||||||||||||||||||||||||
| 605 | 0 | ▶ | unshift @list, { venueid => 0, venue => 'Select A Venue' } if($blank == 1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 606 | 0 | DropDownRows($opt,'venueid','venueid','venue',@list); | |||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||
| 609 | # withdrawn, may be reintroduced later. | ||||||||||||||||||||||||||||
| 610 | #sub ImageCheck { | ||||||||||||||||||||||||||||
| 611 | # my @rows = $dbi->GetQuery('array','EventsImageCheck',$_[0]); | ||||||||||||||||||||||||||||
| 612 | # @rows ? 1 : 0; | ||||||||||||||||||||||||||||
| 613 | #} | ||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||
| 616 | 5 | 1; | |||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | __END__ | ||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||
| 620 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||
| 622 | L<Labyrinth> | ||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||
| 624 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||
| 626 | Barbie, <barbie@missbarbell.co.uk> for | ||||||||||||||||||||||||||||
| 627 | Miss Barbell Productions, L<http://www.missbarbell.co.uk/> | ||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||
| 629 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||
| 631 | Copyright (C) 2002-2015 Barbie for Miss Barbell Productions | ||||||||||||||||||||||||||||
| 632 | All Rights Reserved. | ||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||
| 634 | This module is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||
| 635 | modify it under the Artistic License 2.0. | ||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||
| 637 | =cut | ||||||||||||||||||||||||||||