onload aus do.pl und oe.pl entfernt
authorSven Schöling <s.schoeling@linet-services.de>
Thu, 20 Sep 2012 16:40:29 +0000 (18:40 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Wed, 17 Oct 2012 14:01:05 +0000 (16:01 +0200)
bin/mozilla/do.pl
bin/mozilla/oe.pl

index 1dc880e..071a7a4 100644 (file)
@@ -297,14 +297,15 @@ sub form_header {
   $form->{oldvcname}         =  $form->{"old$form->{vc}"};
   $form->{oldvcname}         =~ s/--.*//;
 
-  $form->{onload} = "";
   if ($form->{resubmit}) {
+    my $dispatch_to_popup = '';
     if ($form->{format} eq "html") {
-      $form->{onload} = "window.open('about:blank','Beleg'); document.do.target = 'Beleg';";
+      $dispatch_to_popup .= "window.open('about:blank','Beleg'); document.do.target = 'Beleg';";
     }
     # emulate click for resubmitting actions
-    $form->{onload} .= "document.do.${_}.click(); " for grep { /^action_/ } keys %$form;
-    $form->{onload} .= "document.do.submit();"
+    $dispatch_to_popup .= "document.do.${_}.click(); " for grep { /^action_/ } keys %$form;
+    $dispatch_to_popup .= "document.do.submit();";
+    $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup)");
   }
 
   my $follow_up_vc                =  $form->{ $form->{vc} eq 'customer' ? 'customer' : 'vendor' };
index f73c437..41b9da9 100644 (file)
@@ -402,19 +402,19 @@ sub form_header {
     }
   }
 
-  my $onload = "";
+  my $dispatch_to_popup = '';
   if ($form->{resubmit} && ($form->{format} eq "html")) {
-      $onload  = "window.open('about:blank','Beleg'); document.oe.target = 'Beleg';";
-      $onload .= "document.do.submit();";
+      $dispatch_to_popup  = "window.open('about:blank','Beleg'); document.oe.target = 'Beleg';";
+      $dispatch_to_popup .= "document.do.submit();";
   } elsif ($form->{resubmit}) {
     # emulate click for resubmitting actions
-    $onload  = "document.oe.${_}.click(); " for grep { /^action_/ } keys %$form;
-    $onload .= "document.oe.submit();";
+    $dispatch_to_popup  = "document.oe.${_}.click(); " for grep { /^action_/ } keys %$form;
+    $dispatch_to_popup .= "document.oe.submit();";
   } elsif ($creditwarning) {
-    $onload = "alert('$credittext')";
+    $::request->{layout}->add_javascripts_inline("alert('$credittext')");
   }
 
-  $TMPL_VAR{onload} = $onload;
+  $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup})");
   $TMPL_VAR{dateformat}          = $myconfig{dateformat};
   $TMPL_VAR{numberformat}        = $myconfig{numberformat};