From 76a39ab4f52c7f25d18bb7dc714262ac8d400720 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 17 Mar 2017 11:53:45 +0100 Subject: [PATCH] =?utf8?q?ReportGenerator:=20Action-Bar-Actions=20=C3=BCbe?= =?utf8?q?r=20Hook-Funktion=20ausgeben=20lassen=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Damit ist es möglich, dass die Actions vom Report-Generator zwischen den Actions der Hauptmaske eingefügt werden. --- SL/ReportGenerator.pm | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index a62f0e46a..3b03f5aa1 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -415,8 +415,8 @@ sub prepare_html_content { return $variables; } -sub setup_action_bar { - my ($self, $action_bar, $variables) = @_; +sub create_action_bar_actions { + my ($self, $variables) = @_; my @actions; foreach my $type (qw(pdf csv)) { @@ -441,8 +441,21 @@ sub setup_action_bar { ); } - $action_bar = ($::request->layout->get('actionbar'))[0] unless blessed($action_bar); - $action_bar->add(@actions) if @actions; + return @actions; +} + +sub setup_action_bar { + my ($self, $variables, %params) = @_; + + my @actions = $self->create_action_bar_actions($variables); + + if ($params{action_bar_setup_hook}) { + $params{action_bar_setup_hook}->(@actions); + + } elsif (@actions) { + my $action_bar = blessed($params{action_bar}) ? $params{action_bar} : ($::request->layout->get('actionbar'))[0]; + $action_bar->add(@actions); + } } sub generate_html_content { @@ -452,7 +465,7 @@ sub generate_html_content { my $variables = $self->prepare_html_content(%params); - $self->setup_action_bar($params{action_bar}, $variables) if $params{action_bar}; + $self->setup_action_bar($variables, %params) if $params{action_bar}; my $stuff = $self->{form}->parse_html_template($self->{options}->{html_template}, $variables); return $stuff; -- 2.20.1