]> git.p6c8.net - selfforum.git/blobdiff - selfforum-cgi/shared/Template/Posting.pm
version checks added, fixed comments
[selfforum.git] / selfforum-cgi / shared / Template / Posting.pm
index 348a7dbb07797d7c2f16e1d153dc1b1fbc4f453b..64b05373f4263c20560deedbeeae2908207daa80 100644 (file)
@@ -4,13 +4,17 @@ package Template::Posting;
 #                                                                              #
 # File:        shared/Template/Posting.pm                                      #
 #                                                                              #
-# Authors:     Andre Malo       <nd@o3media.de>, 2001-04-01                    #
+# Authors:     Andre Malo       <nd@o3media.de>, 2001-06-16                    #
 #                                                                              #
 # Description: show HTML formatted posting                                     #
 #                                                                              #
 ################################################################################
 
 use strict;
+use vars qw(
+  @EXPORT
+  $VERSION
+);
 
 use Encode::Posting;
 use Encode::Plain; $Encode::Plain::utf8 = 1;
@@ -24,6 +28,7 @@ use Posting::_lib qw(
   parse_xml_file
   hr_time
 );
+use Posting::Cache;
 use Template;
 use Template::_conf;
 use Template::_query;
@@ -31,17 +36,23 @@ use Template::_thread;
 
 use XML::DOM;
 
+################################################################################
+#
+# Version check
+#
+$VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+
 ################################################################################
 #
 # Export
 #
 use base qw(Exporter);
-@Template::Posting::EXPORT = qw(
+@EXPORT = qw(
   print_posting_as_HTML
   message_as_HTML
 );
 
-### sub print_posting_as_HTML ($$$) ############################################
+### print_posting_as_HTML () ###################################################
 #
 # print HTML formatted Posting to STDOUT
 #
@@ -169,18 +180,33 @@ sub print_posting_as_HTML ($$$) {
           $formdata->{uniqueID}  ->{assign}->{value} => plain(unique_id),
           $formdata->{followUp}  ->{assign}->{value} => plain($param -> {thread}.';'.$param -> {posting}),
           $formdata->{quoteChar} ->{assign}->{value} => "&#255;".plain(defined $view -> {quoteChars} ? $view -> {quoteChars} : ''),
-          $formdata->{userID}    ->{assign}->{value} => ''
+          $formdata->{userID}    ->{assign}->{value} => '',
+          $assign->{firsttime}                       => $param->{firsttime} ? $param->{firsttime} : '',
+          $assign->{voted}                           => $param->{voted} ? $param->{voted} : ''
         },
         $pars,
         $parent_pars
       )};
+
+      # all output done
+      #
+      close STDOUT;
+
+      if ($param->{firsttime}) {
+        my $cache = new Posting::Cache ($param->{cachepath});
+        $cache -> add_view (
+          { thread  => $param -> {thread},
+            posting => $param -> {posting}
+          }
+        );
+      }
     }
   }
 
   return;
 }
 
-### sub message_as_HTML ($$$) ##################################################
+### message_as_HTML () #########################################################
 #
 # create HTML String for the Messagetext
 #
@@ -210,7 +236,7 @@ sub message_as_HTML ($$$) {
   $text;
 }
 
-# keep require happy
+# keep 'require' happy
 1;
 
 #

patrick-canterino.de