X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/145128187279c4d4b52b8fc9b19f3f3a4d8f95b8..2a78476e5bf2aee7120b59f5ee5e30ad5609fe55:/selfforum-cgi/shared/Template/Forum.pm?ds=sidebyside

diff --git a/selfforum-cgi/shared/Template/Forum.pm b/selfforum-cgi/shared/Template/Forum.pm
index 6b29a22..9140478 100644
--- a/selfforum-cgi/shared/Template/Forum.pm
+++ b/selfforum-cgi/shared/Template/Forum.pm
@@ -1,20 +1,17 @@
-# 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 <nd@o3media.de>, 2001-04-19                          #
+#                                                                              #
+# Description: print Forum main file to STDOUT                                 #
+#                                                                              #
+################################################################################
 
 use strict;
 
-package Template::Forum;
-
-use vars qw(@ISA @EXPORT);
-
 use Lock qw(:READ);
 use Encode::Plain; $Encode::Plain::utf8 = 1;
 use Posting::_lib qw(get_all_threads long_hr_time);
@@ -22,20 +19,23 @@ use Template;
 use Template::_conf;
 use Template::_thread;
 
-# ====================================================
-# Funktionsexport
-# ====================================================
-
-require Exporter;
-@ISA    = qw(Exporter);
-@EXPORT = qw(print_forum_as_HTML);
-
-################################
-# sub print_forum_as_HTML
+################################################################################
 #
-# HTML erstellen
-################################
+# Export
+#
+use base qw(Exporter);
+@Template::Forum::EXPORT = qw(print_forum_as_HTML);
 
+### sub 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~
+#
 sub print_forum_as_HTML ($$$) {
   my ($mainfile, $tempfile, $param) = @_;
   my $assign = $param -> {assign};
@@ -45,29 +45,39 @@ sub print_forum_as_HTML ($$$) {
   my ($threads, $stat);
 
   unless ($stat = lock_file ($mainfile)) {
-    if ($stat == 0) {
+    if (defined $stat) {
       violent_unlock_file ($mainfile);
-      print "aha!"
-      # ueberlastet
+      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));
 
-    print ${$template -> scrap ($assign -> {mainDocStart},
-                               {$assign -> {loadingTime} => plain (long_hr_time (time)) } )},"\n<dl>";
+    print ${$template -> scrap (
+      $assign -> {mainDocStart},
+      {  $assign -> {loadingTime} => plain (long_hr_time (time)) }
+      )
+    },"\n<dl>";
 
-    my $tpar = {template => $param -> {tree},
-                cgi      => $param -> {cgi},
-                start    => -1};
+    my $tpar = {
+      template => $param -> {tree},
+      cgi      => $param -> {cgi},
+      start    => -1
+    };
 
     my @threads;
 
@@ -85,13 +95,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 #####################################################