From 7d82f0e8db96e595122ebe723c129e6f3e26bb0d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 22 Nov 2006 14:46:49 +0000 Subject: [PATCH] Form::parse_html_template: Wenn in der Vorlage Variablen benutzt werden, die es in $form nicht gibt, so werden leere Werte und vor allem leere Arrays fuer Schleifenvariablen erzeugt. Form::show_generic_error: Wenn ein weiterer Parameter "action" angegeben wird, so wird auf der Fehlerseite ein Button mit dieser beschriftung ausgegeben. Alle $form-Variablen werden ebenfalls ausgegeben (z.B. fuer eine "Zurueck"-Funktion). --- SL/Form.pm | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index b67ae21ea..326ff9f00 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -490,22 +490,14 @@ sub parse_html_template { $additional_params->{"conf_latex_templates"} = $main::latex; $additional_params->{"conf_opendocument_templates"} = $main::opendocument_templates; - my $menu; - if (-f $self->{"login"} . "_menu.ini") { - $menu = Menu->new($self->{"login"} . "_menu.ini"); - } else { - $menu = Menu->new("menu.ini"); - } - $menu->generate_acl("", $additional_params); - my @additional_param_names = keys(%{$additional_params}); foreach my $key ($template->param()) { - if (grep(/^${key}$/, @additional_param_names)) { - $template->param($key => $additional_params->{$key}); - } else { - $template->param($key => $self->{$key}); - } + my $param = $self->{$key}; + $param = $additional_params->{$key} if (grep(/^${key}$/, @additional_param_names)); + $param = [] if (($template->query("name" => $key) eq "LOOP") && (ref($param) ne "ARRAY")); + $template->param($key => $param); } + my $output = $template->output(); $main::lxdebug->leave_sub(); @@ -514,12 +506,23 @@ sub parse_html_template { } sub show_generic_error { - my ($self, $error, $title) = @_; + my ($self, $error, $title, $action) = @_; my $add_params = {}; $add_params->{"title"} = $title if ($title); $self->{"label_error"} = $error; + my @vars; + if ($action) { + map({ delete($self->{$_}); } qw(action)); + map({ push(@vars, { "name" => $_, "value" => $self->{$_} }) + if (!ref($self->{$_})); } + keys(%{$self})); + $add_params->{"SHOW_BUTTON"} = 1; + $add_params->{"BUTTON_LABEL"} = $action; + } + $add_params->{"VARIABLES"} = \@vars; + $self->header(); print($self->parse_html_template("generic/error", $add_params)); -- 2.20.1