]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/Forum.pm
fixed several bugs in all committed files, but anyway there's a lot to do further...
[selfforum.git] / selfforum-cgi / shared / Template / Forum.pm
1 # Template/Forum.pm
2
3 # ====================================================
4 # Autor: n.d.p. / 2001-01-12
5 # lm : n.d.p. / 2001-01-12
6 # ====================================================
7 # Funktion:
8 # Erzeugung der HTML-Ausgabe der
9 # Forumshauptdatei
10 # ====================================================
11
12 use strict;
13
14 package Template::Forum;
15
16 use vars qw(@ISA @EXPORT);
17
18 use Lock qw(:READ);
19 use Encode::Plain; $Encode::Plain::utf8 = 1;
20 use Posting::_lib qw(get_all_threads long_hr_time);
21 use Template;
22 use Template::_conf;
23 use Template::_thread;
24
25 # ====================================================
26 # Funktionsexport
27 # ====================================================
28
29 require Exporter;
30 @ISA = qw(Exporter);
31 @EXPORT = qw(print_forum_as_HTML);
32
33 ################################
34 # sub print_forum_as_HTML
35 #
36 # HTML erstellen
37 ################################
38
39 sub print_forum_as_HTML ($$$) {
40 my ($mainfile, $tempfile, $param) = @_;
41 my $assign = $param -> {assign};
42
43 my $template = new Template $tempfile;
44
45 my ($threads, $stat);
46
47 unless ($stat = lock_file ($mainfile)) {
48 if ($stat == 0) {
49 violent_unlock_file ($mainfile);
50 print "aha!"
51 # ueberlastet
52 }
53
54 else {
55 # Mastersperre...
56 }}
57
58 else {
59 my $view = get_view_params ({adminDefault => $param -> {adminDefault}
60 });
61
62 $threads = get_all_threads ($mainfile, $param -> {showDeleted}, $view -> {sortedMsg});
63 violent_unlock_file ($mainfile) unless (unlock_file ($mainfile));
64
65 print ${$template -> scrap ($assign -> {mainDocStart},
66 {$assign -> {loadingTime} => plain (long_hr_time (time)) } )},"\n<dl>";
67
68 my $tpar = {template => $param -> {tree},
69 cgi => $param -> {cgi},
70 start => -1};
71
72 my @threads;
73
74 unless ($view -> {sortedThreads}) {
75 @threads = sort {$b <=> $a} keys %$threads;}
76 else {
77 @threads = sort {$a <=> $b} keys %$threads;}
78
79 for (@threads) {
80 $tpar -> {thread} = "$_";
81 print ${html_thread ($threads -> {$_}, $template, $tpar)},"\n",'<dd>&nbsp;</dd>',"\n";}
82
83 print "</dl>\n",${$template -> scrap ($assign -> {mainDocEnd})};}
84
85 return;
86 }
87
88 # ====================================================
89 # Modulinitialisierung
90 # ====================================================
91
92 # making require happy
93 1;
94
95 # ====================================================
96 # end of Template::Forum
97 # ====================================================

patrick-canterino.de