X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/42ecd63a35d8800977547f073de9336cbddfd5fd..99ccfeab2e445e4ae4aaf4b11afdc38a5c776d6f:/SL/Form.pm
diff --git a/SL/Form.pm b/SL/Form.pm
index acc6c6b58..124e972ab 100644
--- a/SL/Form.pm
+++ b/SL/Form.pm
@@ -37,6 +37,8 @@
package Form;
+use HTML::Template;
+
sub _input_to_hash {
$main::lxdebug->enter_sub();
@@ -419,6 +421,46 @@ function fokus(){document.$self->{fokus}.focus();}
$main::lxdebug->leave_sub();
}
+sub parse_html_template {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $file) = @_;
+
+ my $template = HTML::Template->new("filename" => "templates/webpages/$file",
+ "die_on_bad_params" => 0,
+ "strict" => 0,
+ "case_sensitive" => 1,
+ "loop_context_vars" => 1,
+ "global_vars" => 1);
+ my @params = $template->param();
+
+ if (grep("DEBUG", @params) && $self->{"DEBUG"}) {
+ $template->param("DEBUG" => "
DEBUG INFORMATION:
" . + $self->{"DEBUG"} . ""); + } + + foreach my $key (keys(%{$self})) { + if (("DEBUG" ne $key) && grep(${key}, @params)) { + $template->param($key => $self->{$key}); + } + } + + my $output = $template->output(); + + $main::lxdebug->leave_sub(); + + return $output; +} + +sub show_generic_error { + my ($self, $error, $title) = @_; + + $self->{"title"} = $title if ($title); + $self->{"label_error"} = $error; + + print($self->parse_html_template("generic/error.html")); +} + # write Trigger JavaScript-Code ($qty = quantity of Triggers) # changed it to accept an arbitrary number of triggers - sschoeling sub write_trigger {