X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/ba659b53059e637777865e646f0f2a6fb7f2988e..f91793544f0d5c7f978e5cf6214d9882d7c4db7c:/selfforum-cgi/shared/Template/Forum.pm diff --git a/selfforum-cgi/shared/Template/Forum.pm b/selfforum-cgi/shared/Template/Forum.pm index ab853ae..f4223f9 100644 --- a/selfforum-cgi/shared/Template/Forum.pm +++ b/selfforum-cgi/shared/Template/Forum.pm @@ -1,41 +1,57 @@ -# Template/Forum.pm +package Template::Forum; -# ==================================================== -# Autor: n.d.p. / 2001-01-12 -# lm : n.d.p. / 2001-01-12 -# ==================================================== -# Funktion: -# Erzeugung der HTML-Ausgabe der -# Forumshauptdatei -# ==================================================== +################################################################################ +# # +# File: shared/Template/Forum.pm # +# # +# Authors: André Malo # +# # +# Description: print Forum main file to STDOUT # +# # +################################################################################ use strict; +use vars qw( + @EXPORT +); -package Template::Forum; - -use vars qw(@ISA @EXPORT); - -use Lock qw(:READ); +use Lock; use Encode::Plain; $Encode::Plain::utf8 = 1; -use Posting::_lib qw(get_all_threads long_hr_time); +use Posting::_lib qw( + get_all_threads + long_hr_time +); use Template; use Template::_conf; use Template::_thread; -# ==================================================== -# Funktionsexport -# ==================================================== +################################################################################ +# +# Version check +# +# last modified: +# $Date$ (GMT) +# by $Author$ +# +sub VERSION {(q$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'} -require Exporter; -@ISA = qw(Exporter); +################################################################################ +# +# Export +# +use base qw(Exporter); @EXPORT = qw(print_forum_as_HTML); -################################ -# sub print_forum_as_HTML +### print_forum_as_HTML () ##################################################### +# +# print Forum main file to STDOUT +# +# Params: $mainfile - main xml file name +# $tempfile - template file name +# $param - hash reference (see doc for details) +# +# Return: ~none~ # -# HTML erstellen -################################ - sub print_forum_as_HTML ($$$) { my ($mainfile, $tempfile, $param) = @_; my $assign = $param -> {assign}; @@ -43,30 +59,45 @@ sub print_forum_as_HTML ($$$) { my $template = new Template $tempfile; my ($threads, $stat); - - unless ($stat = lock_file ($mainfile)) { - if ($stat == 0) { - violent_unlock_file ($mainfile); - # ueberlastet + my $main = new Lock ($mainfile); + + unless ($main -> lock (LH_SHARED)) { + unless ($main -> masterlocked) { + print ${$template -> scrap ( + $assign -> {errorDoc}, + { $assign -> {errorText} => $template -> insert ($assign -> {'occupied'}) } + )}; } - else { - # Mastersperre... + print ${$template -> scrap ( + $assign -> {errorDoc}, + { $assign -> {errorText} => $template -> insert ($assign -> {'notAvailable'}) } + )}; }} else { - my $view = get_view_params ({adminDefault => $param -> {adminDefault} - }); + my $view = get_view_params ( + { adminDefault => $param -> {adminDefault} } + ); - $threads = get_all_threads ($mainfile, $param -> {showDeleted}, $view -> {sortedMsg}); - violent_unlock_file ($mainfile) unless (unlock_file ($mainfile)); + # set process priority, remove if you don't need... + # + eval {setpriority 0,0,1}; - print ${$template -> scrap ($assign -> {mainDocStart}, - {$assign -> {loadingTime} => plain (long_hr_time (time)) } )},"\n
"; + $threads = get_all_threads ($main -> filename, $param -> {showDeleted}, $view -> {sortedMsg}); + $main -> unlock; - my $tpar = {template => $param -> {tree}, - cgi => $param -> {cgi}, - start => -1}; + print ${$template -> scrap ( + $assign -> {mainDocStart}, + { $assign -> {loadingTime} => plain (long_hr_time (time)) } + ) + },"\n
"; + + my $tpar = { + template => $param -> {tree}, + cgi => $param -> {cgi}, + start => -1 + }; my @threads; @@ -84,13 +115,9 @@ sub print_forum_as_HTML ($$$) { return; } -# ==================================================== -# Modulinitialisierung -# ==================================================== - -# making require happy +# keep 'require' happy 1; -# ==================================================== -# end of Template::Forum -# ==================================================== \ No newline at end of file +# +# +### end of Template::Forum ##################################################### \ No newline at end of file