form->footer
authorSven Schöling <s.schoeling@linet-services.de>
Fri, 14 Sep 2012 14:57:16 +0000 (16:57 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Wed, 17 Oct 2012 13:58:56 +0000 (15:58 +0200)
SL/Controller/Layout/Base.pm
SL/Dispatcher.pm
SL/Form.pm

index 1a27174..ed87019 100644 (file)
@@ -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;
index 37ee29d..d65e5d5 100644 (file)
@@ -269,6 +269,8 @@ sub handle_request {
     }
   };
 
+  $::form->footer;
+
   # cleanup
   $::auth->save_session;
   $::auth->expire_sessions;
index 59815eb..450dd79 100644 (file)
@@ -485,7 +485,7 @@ sub header {
   push @header, map { qq|<link rel="stylesheet" href="$_" type="text/css" title="Stylesheet">| } $layout->stylesheets;
   push @header, "<style type='text/css'>\@page { size:landscape; }</style> "                     if $self->{landscape};
   push @header, "<link rel='shortcut icon' href='$self->{favicon}' type='image/x-icon'>"         if -f $self->{favicon};
-  push @header, map { qq|<script type="text/javascript" src="$_"></script>| }                 $layout->javascripts;
+  push @header, map { qq|<script type="text/javascript" src="$_"></script>| }                    $layout->javascripts;
   push @header, $self->{javascript} if $self->{javascript};
   push @header, map { $_->show_javascript } @{ $self->{AJAX} || [] };
   push @header, "<script type='text/javascript'>function fokus(){ document.$self->{fokus}.focus(); }</script>" 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 "<script type='text/javascript' src='$_'></script>\n" for $::request->{layout}->javascripts;