File: UserPost.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 (91 lines) | stat: -rw-r--r-- 2,152 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
package Templates::UserPost;

use SmallPigVars qw($config);
use SPDB;
use Templates::User;

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

@ISA = qw(Templates::User);

my $lang;

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

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

  $template->{'STATE'} = $spcgi->{'STATE'};
  $template->{'spdb'} = $spdb || SPDB->new;
  
  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";

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

  my $pagesubs = {};
  $pagesubs->{'default'} = \&whole;
  $pagesubs->{'threads'} = \&threads;
 
  $template->{'pagesubs'} = $pagesubs;

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

#########################################################################
# --- pagesubs
# ---
sub whole{
    $template->print_user_index();

    $template->print_msg("header1", 1, "", $lang->{'posthist2'},
			 $config->{'inbgcolor'}, $config->{'inbgcolor'});

    my $msg;
    $msg .= qq|<a href="$config->{'cgidir'}/user.cgi?op=umovethreads">
	$lang->{'movemsg'}</a>|;
    $template->print_msg("header2", 1, "", "$lang->{'posthist3'}\:<BR>$msg",
			 $config->{'inbgcolor'}, $config->{'inbgcolor'});

    
    $template->print_user_posts();
    my ($uid, $postsper) = map{ $template->STATE->{$_} } qw(uid postsper);
    $template->print_page_index($template->{'totalnums'}, 
				"&uid=$uid&postsper=$postsper");

#    print qq|<font size ="1"><input type="submit" name="op" value=$lang->{'Subscribe'}></font></form>|;
}

sub threads{
    my $STATE = $template->STATE; 
    use Templates::Admin::StandardIndex;
    
    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);
    }
}

return 1;