]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Template/Forum.pm
1 package Template
::Forum
;
3 ################################################################################
5 # File: shared/Template/Forum.pm #
7 # Authors: André Malo <nd@o3media.de> #
9 # Description: print Forum main file to STDOUT #
11 ################################################################################
19 use Encode
::Plain
; $Encode::Plain
::utf8
= 1;
26 use Template
::_thread
;
28 ################################################################################
36 sub VERSION
{(q
$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}
38 ################################################################################
42 use base
qw(Exporter);
43 @EXPORT = qw(print_forum_as_HTML);
45 ### print_forum_as_HTML () #####################################################
47 # print Forum main file to STDOUT
49 # Params: $mainfile - main xml file name
50 # $tempfile - template file name
51 # $param - hash reference (see doc for details)
55 sub print_forum_as_HTML
($$$) {
56 my ($mainfile, $tempfile, $param) = @_;
57 my $assign = $param -> {assign
};
59 my $template = new Template
$tempfile;
62 my $main = new Lock
($mainfile);
64 unless ($main -> lock (LH_SHARED
)) {
65 unless ($main -> masterlocked
) {
66 print ${$template -> scrap
(
67 $assign -> {errorDoc
},
68 { $assign -> {errorText
} => $template -> insert
($assign -> {'occupied'}) }
72 print ${$template -> scrap
(
73 $assign -> {errorDoc
},
74 { $assign -> {errorText
} => $template -> insert
($assign -> {'notAvailable'}) }
79 my $view = get_view_params
(
80 { adminDefault
=> $param -> {adminDefault
} }
83 # set process priority, remove if you don't need...
85 eval {setpriority 0,0,1};
87 $threads = get_all_threads
($main -> filename
, $param -> {showDeleted
}, $view -> {sortedMsg
});
90 print ${$template -> scrap
(
91 $assign -> {mainDocStart
},
92 { $assign -> {loadingTime
} => plain
(long_hr_time
(time)) }
97 template
=> $param -> {tree
},
98 cgi
=> $param -> {cgi
},
104 unless ($view -> {sortedThreads
}) {
105 @threads = sort {$b <=> $a} keys %$threads;}
107 @threads = sort {$a <=> $b} keys %$threads;}
110 $tpar -> {thread
} = "$_";
111 print ${html_thread
($threads -> {$_}, $template, $tpar)},"\n",'<dd> </dd>',"\n";}
113 print "</dl>\n",${$template -> scrap
($assign -> {mainDocEnd
})};}
118 # keep 'require' happy
123 ### end of Template::Forum #####################################################
patrick-canterino.de