]>
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-04-19 #
9 # Description: print Forum main file to STDOUT #
11 ################################################################################
16 use Encode
::Plain
; $Encode::Plain
::utf8
= 1;
23 use Template
::_thread
;
25 ################################################################################
29 use base
qw(Exporter);
30 @Template::Forum
::EXPORT
= qw(print_forum_as_HTML);
32 ### sub print_forum_as_HTML ($$$) ##############################################
34 # print Forum main file to STDOUT
36 # Params: $mainfile - main xml file name
37 # $tempfile - template file name
38 # $param - hash reference (see doc for details)
42 sub print_forum_as_HTML
($$$) {
43 my ($mainfile, $tempfile, $param) = @_;
44 my $assign = $param -> {assign
};
46 my $template = new Template
$tempfile;
50 unless ($stat = lock_file
($mainfile)) {
52 violent_unlock_file
($mainfile);
53 print ${$template -> scrap
(
54 $assign -> {errorDoc
},
55 { $assign -> {errorText
} => $template -> insert
($assign -> {'occupied'}) }
59 print ${$template -> scrap
(
60 $assign -> {errorDoc
},
61 { $assign -> {errorText
} => $template -> insert
($assign -> {'notAvailable'}) }
66 my $view = get_view_params
(
67 { adminDefault
=> $param -> {adminDefault
} }
70 $threads = get_all_threads
($mainfile, $param -> {showDeleted
}, $view -> {sortedMsg
});
71 violent_unlock_file
($mainfile) unless (unlock_file
($mainfile));
73 print ${$template -> scrap
(
74 $assign -> {mainDocStart
},
75 { $assign -> {loadingTime
} => plain
(long_hr_time
(time)) }
80 template
=> $param -> {tree
},
81 cgi
=> $param -> {cgi
},
87 unless ($view -> {sortedThreads
}) {
88 @threads = sort {$b <=> $a} keys %$threads;}
90 @threads = sort {$a <=> $b} keys %$threads;}
93 $tpar -> {thread
} = "$_";
94 print ${html_thread
($threads -> {$_}, $template, $tpar)},"\n",'<dd> </dd>',"\n";}
96 print "</dl>\n",${$template -> scrap
($assign -> {mainDocEnd
})};}
106 ### end of Template::Forum #####################################################
patrick-canterino.de