File: Admin.pm

package info (click to toggle)
sporum 1.8b1-3.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,108 kB
  • ctags: 676
  • sloc: perl: 14,300; makefile: 52
file content (170 lines) | stat: -rw-r--r-- 4,296 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package Templates::Admin;

use SmallPigVars qw($config);
use Templates::Default;
use Templates::Admin::StandardIndex;

use strict;
use vars qw(@ISA $template);

@ISA = qw(Templates::Default);

my $lang;

sub new{
  my ($class, $spcgi, $spdb, $pagetype) = @_;

  $template = Templates::Default->new($spcgi, $spdb, $pagetype);

  $template->{'spcgi'} ||= $spcgi;
  $template->{'STATE'} = $spcgi->{'STATE'};
  $template->{'STATE'}->{'theme'} = $template->{'theme'};
  $template->{'STATE'}->{'langptr'} = $template->{'lang'};
  $template->{'spdb'} ||= $spdb;
  
  bless $template, $class;

  $template->initialize();
  
  return $template;
}

#########################################################################
# --- Sun Dec 19 23:06:10 PST 1999
# ---
sub initialize{
  my ($template) = @_;
  
  my $pagefiles = {};
  $pagefiles->{'default'} = "default.temp";
  $pagefiles->{'index'} = "adminindex.temp";
  
  $template->{'pagefiles'} = $pagefiles;

  my $pagesubs = {};
  $pagesubs->{'default'} = \&whole;
  $pagesubs->{'grantadmin'} = \&grantadmin;
  $pagesubs->{'revokeadmin'} = \&revokeadmin;
  $pagesubs->{'assignmod'} = \&assignmod;
  $pagesubs->{'revokemod'} = \&revokemod;
  $pagesubs->{'grantgroup'} = \&grantgroup;
  $pagesubs->{'revokegroup'} = \&revokegroup;
  $pagesubs->{'modifyuser'} = \&modifyuser;
  $pagesubs->{'createcat'} = \&createcat;
  $pagesubs->{'modifycat'} = \&modifycat;
  $pagesubs->{'createboard'} = \&createboard;
  $pagesubs->{'modifyboard'} = \&modifyboard;
  $pagesubs->{'threads'} = \&threads;
  $pagesubs->{'showstat'} = \&showstat;  

  $template->{'pagesubs'} = $pagesubs;

  $lang = $template->{'lang'};

}

sub grantadmin{
  my $STATE = $template->STATE;
  require Templates::Admin::GAOMU;
  my $gaomu = Templates::Admin::GAOMU->new();
  print $gaomu->display($STATE);
}

sub revokeadmin{
  my $STATE = $template->STATE;
  require Templates::Admin::RevokeAdmin;
  my $obj = Templates::Admin::RevokeAdmin->new();
  print $obj->display($STATE);
}

sub assignmod{
  my $STATE = $template->STATE;
  require Templates::Admin::AssignUsers;
  my $assignusers = Templates::Admin::AssignUsers->new();
  print $assignusers->display($STATE);
}

sub revokemod{
  my $STATE = $template->STATE;  
  require Templates::Admin::RevokeUsers;
  my $revokemodorgroup = Templates::Admin::RevokeUsers->new();
  print $revokemodorgroup->display($STATE);
}

sub grantgroup{
  my $STATE = $template->STATE;
  require Templates::Admin::AssignUsers;
  my $assignusers = Templates::Admin::AssignUsers->new();
  print $assignusers->display($STATE);
}

sub revokegroup{
  my $STATE = $template->STATE;  
  require Templates::Admin::RevokeUsers;
  my $revokemodorgroup = Templates::Admin::RevokeUsers->new();
  print $revokemodorgroup->display($STATE);
}

sub modifyuser{
  my $STATE = $template->STATE;
  require Templates::Admin::GAOMU;
  my $gaomu = Templates::Admin::GAOMU->new();
  print $gaomu->display($STATE);
}

sub createcat{
    my $STATE = $template->STATE;
    require Templates::Admin::Cats;
    my $obj = Templates::Admin::Cats->new();
    print $obj->display($STATE);
}

sub modifycat{
    my $STATE = $template->STATE;
    require Templates::Admin::ModifyCat;
    my $modifycategory = Templates::Admin::ModifyCat->new();
    print $modifycategory->get($STATE);
    #$title = $lang->{'modify_cat1'};
}

sub createboard{
    my $STATE = $template->STATE;
    require Templates::Admin::CreateBoard;
    my $createboard = Templates::Admin::CreateBoard->new();
    print $createboard->display($STATE);
}

sub modifyboard{
    my $STATE = $template->STATE;
    require Templates::Admin::ModifyBoard;
    my $modifyboard = Templates::Admin::ModifyBoard->new($STATE);
    print $modifyboard->display();	
}

sub threads{
    my $STATE = $template->STATE; 
    unless($STATE->{'sid'}){
	require Templates::Admin::BoardsBlock;
	my $boardblock = Templates::Admin::BoardsBlock->new($STATE->{'op'});
	print $boardblock->get($STATE);
    }
    else{
	require Templates::Admin::ThreadsBlock;
	my $threads = Templates::Admin::ThreadsBlock->new();
	print $threads->get($STATE);
    }
}

sub showstat{
    my $STATE = $template->STATE; 
    require Templates::Admin::ShowStat;
    my $showstat = Templates::Admin::ShowStat->new($STATE);
    print $showstat->display();
}

return 1;