]>
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;
17 use Posting
::_lib
qw(get_all_threads long_hr_time);
20 use Template
::_thread
;
22 ################################################################################
26 use base
qw(Exporter);
27 @Template::Forum
::EXPORT
= qw(print_forum_as_HTML);
29 ### sub print_forum_as_HTML ($$$) ##############################################
31 # print Forum main file to STDOUT
33 # Params: $mainfile - main xml file name
34 # $tempfile - template file name
35 # $param - hash reference (see doc for details)
39 sub print_forum_as_HTML
($$$) {
40 my ($mainfile, $tempfile, $param) = @_;
41 my $assign = $param -> {assign
};
43 my $template = new Template
$tempfile;
47 unless ($stat = lock_file
($mainfile)) {
49 violent_unlock_file
($mainfile);
50 print ${$template -> scrap
(
51 $assign -> {errorDoc
},
52 { $assign -> {errorText
} => $template -> insert
($assign -> {'occupied'}) }
56 print ${$template -> scrap
(
57 $assign -> {errorDoc
},
58 { $assign -> {errorText
} => $template -> insert
($assign -> {'notAvailable'}) }
63 my $view = get_view_params
(
64 { adminDefault
=> $param -> {adminDefault
} }
67 $threads = get_all_threads
($mainfile, $param -> {showDeleted
}, $view -> {sortedMsg
});
68 violent_unlock_file
($mainfile) unless (unlock_file
($mainfile));
70 print ${$template -> scrap
(
71 $assign -> {mainDocStart
},
72 { $assign -> {loadingTime
} => plain
(long_hr_time
(time)) }
77 template
=> $param -> {tree
},
78 cgi
=> $param -> {cgi
},
84 unless ($view -> {sortedThreads
}) {
85 @threads = sort {$b <=> $a} keys %$threads;}
87 @threads = sort {$a <=> $b} keys %$threads;}
90 $tpar -> {thread
} = "$_";
91 print ${html_thread
($threads -> {$_}, $template, $tpar)},"\n",'<dd> </dd>',"\n";}
93 print "</dl>\n",${$template -> scrap
($assign -> {mainDocEnd
})};}
103 ### end of Template::Forum #####################################################
patrick-canterino.de