]>
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>, 2001-06-16 #
9 # Description: print Forum main file to STDOUT #
11 ################################################################################
20 use Encode
::Plain
; $Encode::Plain
::utf8
= 1;
27 use Template
::_thread
;
29 ################################################################################
33 $VERSION = do { my @r =(q
$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x
$#r, @r };
35 ################################################################################
39 use base
qw(Exporter);
40 @EXPORT = qw(print_forum_as_HTML);
42 ### print_forum_as_HTML () #####################################################
44 # print Forum main file to STDOUT
46 # Params: $mainfile - main xml file name
47 # $tempfile - template file name
48 # $param - hash reference (see doc for details)
52 sub print_forum_as_HTML
($$$) {
53 my ($mainfile, $tempfile, $param) = @_;
54 my $assign = $param -> {assign
};
56 my $template = new Template
$tempfile;
60 unless ($stat = lock_file
($mainfile)) {
62 violent_unlock_file
($mainfile);
63 print ${$template -> scrap
(
64 $assign -> {errorDoc
},
65 { $assign -> {errorText
} => $template -> insert
($assign -> {'occupied'}) }
69 print ${$template -> scrap
(
70 $assign -> {errorDoc
},
71 { $assign -> {errorText
} => $template -> insert
($assign -> {'notAvailable'}) }
76 my $view = get_view_params
(
77 { adminDefault
=> $param -> {adminDefault
} }
80 # set process priority, remove if you don't need...
82 eval {setpriority 0,0,1};
84 $threads = get_all_threads
($mainfile, $param -> {showDeleted
}, $view -> {sortedMsg
});
85 violent_unlock_file
($mainfile) unless (unlock_file
($mainfile));
87 print ${$template -> scrap
(
88 $assign -> {mainDocStart
},
89 { $assign -> {loadingTime
} => plain
(long_hr_time
(time)) }
94 template
=> $param -> {tree
},
95 cgi
=> $param -> {cgi
},
101 unless ($view -> {sortedThreads
}) {
102 @threads = sort {$b <=> $a} keys %$threads;}
104 @threads = sort {$a <=> $b} keys %$threads;}
107 $tpar -> {thread
} = "$_";
109 print ${html_thread
($threads -> {$_}, $template, $tpar)},"\n",'<dd> </dd>',"\n";}
111 print "</dl>\n",${$template -> scrap
($assign -> {mainDocEnd
})};}
116 # keep 'require' happy
121 ### end of Template::Forum #####################################################
patrick-canterino.de