From 2219d15895a48a6ec3aecef5ed3ae2313bf1c900 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 14 Sep 2012 16:57:16 +0200 Subject: [PATCH] form->footer --- SL/Controller/Layout/Base.pm | 14 +++++++++++++- SL/Dispatcher.pm | 2 ++ SL/Form.pm | 6 +++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/SL/Controller/Layout/Base.pm b/SL/Controller/Layout/Base.pm index 1a27174b5..ed8701947 100644 --- a/SL/Controller/Layout/Base.pm +++ b/SL/Controller/Layout/Base.pm @@ -97,7 +97,6 @@ sub use_javascript { sub javascripts { my ($self) = @_; - $::lxdebug->dump(0, "called", [ map { $self->find_javascript($_) } $self->use_javascript ]); return map { $self->_find_javascript($_) } $self->use_javascript; } @@ -108,4 +107,17 @@ sub _find_javascript { return $javascript if -f $javascript; } + +############################################ +# track state of form header +############################################ + +sub header_done { + $_[0]{_header_done} = 1; +} + +sub need_footer { + $_[0]{_header_done}; +} + 1; diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index 37ee29da0..d65e5d5e0 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -269,6 +269,8 @@ sub handle_request { } }; + $::form->footer; + # cleanup $::auth->save_session; $::auth->expire_sessions; diff --git a/SL/Form.pm b/SL/Form.pm index 59815ebde..450dd792d 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -485,7 +485,7 @@ sub header { push @header, map { qq|| } $layout->stylesheets; push @header, " " if $self->{landscape}; push @header, "" if -f $self->{favicon}; - push @header, map { qq|| } $layout->javascripts; + push @header, map { qq|| } $layout->javascripts; push @header, $self->{javascript} if $self->{javascript}; push @header, map { $_->show_javascript } @{ $self->{AJAX} || [] }; push @header, "" if $self->{fokus}; @@ -525,12 +525,16 @@ EOT print $::request->{layout}->pre_content; print $::request->{layout}->start_content; + $layout->header_done; + $::lxdebug->leave_sub; } sub footer { # TODO: fix abort conditions + return unless $::request->{layout}->need_footer; + print $::request->{layout}->end_content; print $::request->{layout}->post_content; # print "\n" for $::request->{layout}->javascripts; -- 2.20.1