]> git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/Forum.pm
c03f05a236fde7657fb61e42b7122c6dec10ce93
[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 Lock qw(:READ);
17 use Encode::Plain; $Encode::Plain::utf8 = 1;
18 use Posting::_lib qw(get_all_threads long_hr_time);
19 use Template;
20 use Template::_conf;
21 use Template::_thread;
22
23 # ====================================================
24 # Funktionsexport
25 # ====================================================
26
27 use base qw(Exporter);
28 @Template::Forum::EXPORT = qw(print_forum_as_HTML);
29
30 ################################
31 # sub print_forum_as_HTML
32 #
33 # HTML erstellen
34 ################################
35
36 sub print_forum_as_HTML ($$$) {
37 my ($mainfile, $tempfile, $param) = @_;
38 my $assign = $param -> {assign};
39
40 my $template = new Template $tempfile;
41
42 my ($threads, $stat);
43
44 unless ($stat = lock_file ($mainfile)) {
45 if ($stat == 0) {
46 violent_unlock_file ($mainfile);
47 print "aha!"
48 # ueberlastet
49 }
50
51 else {
52 # Mastersperre...
53 }}
54
55 else {
56 my $view = get_view_params ({adminDefault => $param -> {adminDefault}
57 });
58
59 $threads = get_all_threads ($mainfile, $param -> {showDeleted}, $view -> {sortedMsg});
60 violent_unlock_file ($mainfile) unless (unlock_file ($mainfile));
61
62 print ${$template -> scrap ($assign -> {mainDocStart},
63 {$assign -> {loadingTime} => plain (long_hr_time (time)) } )},"\n<dl>";
64
65 my $tpar = {template => $param -> {tree},
66 cgi => $param -> {cgi},
67 start => -1};
68
69 my @threads;
70
71 unless ($view -> {sortedThreads}) {
72 @threads = sort {$b <=> $a} keys %$threads;}
73 else {
74 @threads = sort {$a <=> $b} keys %$threads;}
75
76 for (@threads) {
77 $tpar -> {thread} = "$_";
78 print ${html_thread ($threads -> {$_}, $template, $tpar)},"\n",'<dd>&nbsp;</dd>',"\n";}
79
80 print "</dl>\n",${$template -> scrap ($assign -> {mainDocEnd})};}
81
82 return;
83 }
84
85 # ====================================================
86 # Modulinitialisierung
87 # ====================================================
88
89 # making require happy
90 1;
91
92 # ====================================================
93 # end of Template::Forum
94 # ====================================================

patrick-canterino.de