X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/b6dc5623d93c1be1c54248d4512e80f495af2899..cdfebb5085afaf1fe0f0278ca6172d5fe009bd9c:/SL/Form.pm diff --git a/SL/Form.pm b/SL/Form.pm index e4c4dd5b7..f43578bb6 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -39,7 +39,6 @@ package Form; use Data::Dumper; use Cwd; -use HTML::Template; use Template; use SL::Template; use CGI::Ajax; @@ -380,6 +379,12 @@ sub header { my ($stylesheet, $favicon); if ($ENV{HTTP_USER_AGENT}) { + my $doctype; + + if ($ENV{'HTTP_USER_AGENT'} =~ m/MSIE\s+\d/) { + # Only set the DOCTYPE for Internet Explorer. Other browsers have problems displaying the menu otherwise. + $doctype = qq|\n|; + } my $stylesheets = "$self->{stylesheet} $self->{stylesheets}"; @@ -433,8 +438,7 @@ sub header { } print qq|Content-Type: text/html; charset=${db_charset}; - - +${doctype} $self->{titlebar} $stylesheet @@ -551,42 +555,12 @@ sub parse_html_template { $file = $self->_prepare_html_template($file, $additional_params); - my $template = HTML::Template->new("filename" => $file, - "die_on_bad_params" => 0, - "strict" => 0, - "case_sensitive" => 1, - "loop_context_vars" => 1, - "global_vars" => 1); - - foreach my $key ($template->param()) { - my $param = $additional_params->{$key} || $self->{$key}; - $param = [] if (($template->query("name" => $key) eq "LOOP") && (ref($param) ne "ARRAY")); - $template->param($key => $param); - } - - my $output = $template->output(); - - $output = $main::locale->{iconv}->convert($output) if ($main::locale); - - $main::lxdebug->leave_sub(); - - return $output; -} - -sub parse_html_template2 { - $main::lxdebug->enter_sub(); - - my ($self, $file, $additional_params) = @_; - - $additional_params ||= { }; - - $file = $self->_prepare_html_template($file, $additional_params); - - my $template = Template->new({ 'INTERPOLATE' => 0, - 'EVAL_PERL' => 0, - 'ABSOLUTE' => 1, - 'CACHE_SIZE' => 0, - 'PLUGIN_BASE' => 'SL::Template::Plugin', + my $template = Template->new({ 'INTERPOLATE' => 0, + 'EVAL_PERL' => 0, + 'ABSOLUTE' => 1, + 'CACHE_SIZE' => 0, + 'PLUGIN_BASE' => 'SL::Template::Plugin', + 'INCLUDE_PATH' => '.:templates/webpages', }) || die; map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self }; @@ -606,9 +580,10 @@ sub parse_html_template2 { sub show_generic_error { my ($self, $error, $title, $action) = @_; - my $add_params = {}; - $add_params->{"title"} = $title if ($title); - $self->{"label_error"} = $error; + my $add_params = { + 'title_error' => $title, + 'label_error' => $error, + }; my @vars; if ($action) { @@ -621,21 +596,26 @@ sub show_generic_error { } $add_params->{"VARIABLES"} = \@vars; + $self->{title} = $title if ($title); + $self->header(); - print($self->parse_html_template("generic/error", $add_params)); + print $self->parse_html_template("generic/error", $add_params); die("Error: $error\n"); } sub show_generic_information { - my ($self, $error, $title) = @_; + my ($self, $text, $title) = @_; + + my $add_params = { + 'title_information' => $title, + 'label_information' => $text, + }; - my $add_params = {}; - $add_params->{"title"} = $title if ($title); - $self->{"label_information"} = $error; + $self->{title} = $title if ($title); $self->header(); - print($self->parse_html_template("generic/information", $add_params)); + print $self->parse_html_template("generic/information", $add_params); die("Information: $error\n"); }