]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/Forum.pm
style changes
[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 # ueberlastet
51 }
52
53 else {
54 # Mastersperre...
55 }}
56
57 else {
58 my $view = get_view_params ({adminDefault => $param -> {adminDefault}
59 });
60
61 $threads = get_all_threads ($mainfile, $param -> {showDeleted}, $view -> {sortedMsg});
62 violent_unlock_file ($mainfile) unless (unlock_file ($mainfile));
63
64 print ${$template -> scrap ($assign -> {mainDocStart},
65 {$assign -> {loadingTime} => plain (long_hr_time (time)) } )},"\n<dl>";
66
67 my $tpar = {template => $param -> {tree},
68 cgi => $param -> {cgi},
69 start => -1};
70
71 my @threads;
72
73 unless ($view -> {sortedThreads}) {
74 @threads = sort {$b <=> $a} keys %$threads;}
75 else {
76 @threads = sort {$a <=> $b} keys %$threads;}
77
78 for (@threads) {
79 $tpar -> {thread} = "$_";
80 print ${html_thread ($threads -> {$_}, $template, $tpar)},"\n",'<dd>&nbsp;</dd>',"\n";}
81
82 print "</dl>\n",${$template -> scrap ($assign -> {mainDocEnd})};}
83
84 return;
85 }
86
87 # ====================================================
88 # Modulinitialisierung
89 # ====================================================
90
91 # making require happy
92 1;
93
94 # ====================================================
95 # end of Template::Forum
96 # ====================================================

patrick-canterino.de