line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Labyrinth::Plugin::Event::Sponsors; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
22005
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
122
|
|
4
|
4
|
|
|
4
|
|
14
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
104
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
12
|
use vars qw($VERSION); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
187
|
|
7
|
|
|
|
|
|
|
$VERSION = '1.10'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Labyrinth::Plugin::Event::Sponsors - Event Sponsor handler for the Labyrinth framework. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Contains all the event sponsor functionality for Labyrinth. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# ------------------------------------- |
20
|
|
|
|
|
|
|
# Library Modules |
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
4
|
|
14
|
use base qw(Labyrinth::Plugin::Base); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
2898
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use Clone qw(clone); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use Labyrinth::DBUtils; |
27
|
|
|
|
|
|
|
use Labyrinth::MLUtils; |
28
|
|
|
|
|
|
|
use Labyrinth::Support; |
29
|
|
|
|
|
|
|
use Labyrinth::Variables; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# ------------------------------------- |
32
|
|
|
|
|
|
|
# Variables |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# type: 0 = optional, 1 = mandatory |
35
|
|
|
|
|
|
|
# html: 0 = none, 1 = text, 2 = textarea |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my %fields = ( |
39
|
|
|
|
|
|
|
sponsorid => { type => 0, html => 0 }, |
40
|
|
|
|
|
|
|
sponsor => { type => 1, html => 1 }, |
41
|
|
|
|
|
|
|
sponsorlink => { type => 0, html => 1 }, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my (@mandatory,@allfields); |
45
|
|
|
|
|
|
|
for(keys %fields) { |
46
|
|
|
|
|
|
|
push @mandatory, $_ if($fields{$_}->{type}); |
47
|
|
|
|
|
|
|
push @allfields, $_; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
our $INDEXKEY = 'sponsorid'; |
51
|
|
|
|
|
|
|
our $LEVEL = ADMIN; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# ------------------------------------- |
54
|
|
|
|
|
|
|
# The Subs |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 PUBLIC INTERFACE METHODS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=over 4 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item SponsorSelect |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Provides a dropdown list of sponsors available. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub SponsorSelect { |
69
|
|
|
|
|
|
|
my ($self,$opt,$blank) = @_; |
70
|
|
|
|
|
|
|
$blank ||= 0; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my @rows = $dbi->GetQuery('hash','AllSponsors'); |
73
|
|
|
|
|
|
|
my @list; |
74
|
|
|
|
|
|
|
for(@rows) { push @list, { id => $_->{sponsorid}, value => $_->{sponsor} }; } |
75
|
|
|
|
|
|
|
unshift @list, { id => 0, value => 'Select Sponsor' } if($blank == 1); |
76
|
|
|
|
|
|
|
DropDownRows($opt,$INDEXKEY,'id','value',@list); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 ADMIN INTERFACE METHODS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=over 4 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item Admin |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Provides list of the sponsors currently available. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item Add |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Add a new sponsor. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item Edit |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Edit an existing sponsor. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item Save |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Save the current sponsor. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item Delete |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Delete a sponsor. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub Admin { |
108
|
|
|
|
|
|
|
return unless AccessUser(EDITOR); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
if($cgiparams{doaction}) { |
111
|
|
|
|
|
|
|
if($cgiparams{doaction} eq 'Delete') { Delete(); } |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my @rows = $dbi->GetQuery('hash','AllSponsors'); |
115
|
|
|
|
|
|
|
$tvars{data} = \@rows if(@rows); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub Add { |
119
|
|
|
|
|
|
|
return unless AccessUser(EDITOR); |
120
|
|
|
|
|
|
|
$tvars{data} = { |
121
|
|
|
|
|
|
|
sponsor => 'Sponsor', |
122
|
|
|
|
|
|
|
sponsorlink => '' |
123
|
|
|
|
|
|
|
}; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub Edit { |
127
|
|
|
|
|
|
|
return unless AccessUser(EDITOR); |
128
|
|
|
|
|
|
|
return unless AuthorCheck('GetSponsorByID',$INDEXKEY,EDITOR); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub Save { |
132
|
|
|
|
|
|
|
return unless AccessUser(EDITOR); |
133
|
|
|
|
|
|
|
return unless AuthorCheck('GetSponsorByID',$INDEXKEY,EDITOR); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
return if FieldCheck(\@allfields,\@mandatory); |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
for(keys %fields) { |
138
|
|
|
|
|
|
|
next unless($fields{$_}); |
139
|
|
|
|
|
|
|
if($fields{$_}->{html} == 1) { $tvars{data}->{$_} = CleanHTML($tvars{data}->{$_}) } |
140
|
|
|
|
|
|
|
elsif($fields{$_}->{html} == 2) { $tvars{data}->{$_} = CleanTags($tvars{data}->{$_}) } |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
my @fields = ( |
144
|
|
|
|
|
|
|
$tvars{data}->{sponsor}, |
145
|
|
|
|
|
|
|
$tvars{data}->{sponsorlink} |
146
|
|
|
|
|
|
|
); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
if($cgiparams{$INDEXKEY}) |
149
|
|
|
|
|
|
|
{ $dbi->DoQuery('SaveSponsor',@fields,$cgiparams{$INDEXKEY}); } |
150
|
|
|
|
|
|
|
else { $cgiparams{$INDEXKEY} = $dbi->IDQuery('AddSponsor',@fields); } |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub Delete { |
154
|
|
|
|
|
|
|
return unless AccessUser(ADMIN); |
155
|
|
|
|
|
|
|
my @ids = CGIArray('LISTED'); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
return unless @ids; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
$dbi->DoQuery('DeleteSponsors',{ids => join(',',@ids)}); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
__END__ |