]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Form.pm
HTML-Templates vor und nicht nach der Verarbeitung durch die Template-Klasse mit...
[mfinanz.git] / SL / Form.pm
index d8077528f03bb12bc7bf3f324e6838e8f1edb944..0aa7fb69cb92785acd061699cdbe9b06500af282 100644 (file)
@@ -41,6 +41,7 @@ use Data::Dumper;
 use CGI;
 use CGI::Ajax;
 use Cwd;
+use IO::File;
 use SL::Auth;
 use SL::Auth::DB;
 use SL::Auth::LDAP;
@@ -729,13 +730,26 @@ sub parse_html_template {
 
   map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self };
 
+  my $in = IO::File->new($file, 'r');
+
+  if (!$in) {
+    print STDERR "Error opening template file: $!";
+    $main::lxdebug->leave_sub();
+    return '';
+  }
+
+  my $input = join('', <$in>);
+  $in->close();
+
+  if ($main::locale) {
+    $input = $main::locale->{iconv}->convert($input);
+  }
+
   my $output;
-  if (!$template->process($file, $additional_params, \$output)) {
+  if (!$template->process(\$input, $additional_params, \$output)) {
     print STDERR $template->error();
   }
 
-  $output = $main::locale->{iconv}->convert($output) if ($main::locale);
-
   $main::lxdebug->leave_sub();
 
   return $output;