From 3c255f2892121da44822fd2c391a4ed5b333ff7e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 20 Sep 2012 18:40:29 +0200 Subject: [PATCH] onload aus do.pl und oe.pl entfernt --- bin/mozilla/do.pl | 9 +++++---- bin/mozilla/oe.pl | 14 +++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 1dc880ef9..071a7a4c2 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -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' }; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index f73c43776..41b9da9b7 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -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}; -- 2.20.1