From f7f03503cfc22a15f5497d09dd9215c10c1d39b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 18 Sep 2012 15:32:32 +0200 Subject: [PATCH] setupPoints und setupDateFormat in ein partial Layout verschoben --- SL/Controller/Layout/Classic.pm | 1 + SL/Controller/Layout/Javascript.pm | 12 ++++++++++++ SL/Controller/Layout/None.pm | 4 ++++ SL/Controller/Layout/V3.pm | 12 ++++++++++++ SL/Controller/Layout/V4.pm | 5 ++++- SL/Form.pm | 2 +- bin/mozilla/ap.pl | 2 -- bin/mozilla/ar.pl | 1 - bin/mozilla/ca.pl | 2 -- bin/mozilla/cp.pl | 10 ++++------ bin/mozilla/dn.pl | 2 -- bin/mozilla/gl.pl | 2 -- templates/webpages/ap/search.html | 2 -- templates/webpages/ar/search.html | 2 -- templates/webpages/do/form_header.html | 2 -- templates/webpages/dunning/add.html | 2 -- templates/webpages/generic/javascript_setup.html | 5 +++++ templates/webpages/ir/form_header.html | 2 -- templates/webpages/is/form_header.html | 2 -- templates/webpages/oe/form_footer.html | 10 ---------- templates/webpages/vk/search_invoice.html | 8 +++----- 21 files changed, 46 insertions(+), 44 deletions(-) create mode 100644 templates/webpages/generic/javascript_setup.html diff --git a/SL/Controller/Layout/Classic.pm b/SL/Controller/Layout/Classic.pm index a4d99b451..b7438740c 100644 --- a/SL/Controller/Layout/Classic.pm +++ b/SL/Controller/Layout/Classic.pm @@ -14,6 +14,7 @@ sub new { $self->add_sub_layouts([ SL::Controller::Layout::Top->new, SL::Controller::Layout::MenuLeft->new, + SL::Controller::Layout::None->new, ]); $self; diff --git a/SL/Controller/Layout/Javascript.pm b/SL/Controller/Layout/Javascript.pm index 590c53e22..f9ee831bf 100644 --- a/SL/Controller/Layout/Javascript.pm +++ b/SL/Controller/Layout/Javascript.pm @@ -6,6 +6,18 @@ use parent qw(SL::Controller::Layout::Base); use List::Util qw(max); use URI; +sub new { + my ($class, @slurp) = @_; + + my $self = $class->SUPER::new(@slurp); + + $self->add_sub_layouts([ + SL::Controller::Layout::None->new, + ]); + + $self; +} + sub pre_content { &display } diff --git a/SL/Controller/Layout/None.pm b/SL/Controller/Layout/None.pm index f3fc79ffa..2d9e2e85e 100644 --- a/SL/Controller/Layout/None.pm +++ b/SL/Controller/Layout/None.pm @@ -3,4 +3,8 @@ package SL::Controller::Layout::None; use strict; use parent qw(SL::Controller::Layout::Base); +sub javascripts_inline { + $::form->parse_html_template('generic/javascript_setup') +} + 1; diff --git a/SL/Controller/Layout/V3.pm b/SL/Controller/Layout/V3.pm index e545b72c6..3a2c9848b 100644 --- a/SL/Controller/Layout/V3.pm +++ b/SL/Controller/Layout/V3.pm @@ -6,6 +6,18 @@ use SL::Controller::Layout::Css; use URI; +sub new { + my ($class, @slurp) = @_; + + my $self = $class->SUPER::new(@slurp); + + $self->add_sub_layouts([ + SL::Controller::Layout::None->new, + ]); + + $self; +} + sub pre_content { &render; } diff --git a/SL/Controller/Layout/V4.pm b/SL/Controller/Layout/V4.pm index df61836fa..a89b4148a 100644 --- a/SL/Controller/Layout/V4.pm +++ b/SL/Controller/Layout/V4.pm @@ -11,7 +11,10 @@ sub new { my ($class, @slurp) = @_; my $self = $class->SUPER::new(@slurp); - $self->add_sub_layouts(SL::Controller::Layout::Top->new); + $self->add_sub_layouts( + SL::Controller::Layout::Top->new + SL::Controller::Layout::None->new, + ); $self; } diff --git a/SL/Form.pm b/SL/Form.pm index 46b190580..186e66151 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -537,7 +537,7 @@ sub footer { print $::request->{layout}->post_content; if (my @inline_scripts = $::request->{layout}->javascripts_inline) { - print "\n" for @inline_scripts; + print "\n"; } print < $form->{"globalproject_id"} )); $form->header; - my $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; - $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print qq| diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index ced49fda2..1e6c6780f 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -327,7 +327,6 @@ sub form_header { qq||; $onload = qq|focus()|; - $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; # $amount = $locale->text('Amount'); # $project = $locale->text('Project'); diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl index af6c6c824..b22ed29cd 100644 --- a/bin/mozilla/ca.pl +++ b/bin/mozilla/ca.pl @@ -155,8 +155,6 @@ sub list { $::form->{title} = $::locale->text('List Transactions') . " - " . $::locale->text('Account') . " $::form->{accno}"; my $onload = qq|focus()|; - $onload .= qq|;setupDateFormat('$::myconfig{dateformat}', '|. $::locale->text("Falsches Datumsformat!") .qq|')|; - $onload .= qq|;setupPoints('$::myconfig{numberformat}', '|. $::locale->text("wrongformat") .qq|')|; $::form->header; print $::form->parse_html_template('ca/list', { diff --git a/bin/mozilla/cp.pl b/bin/mozilla/cp.pl index a8caa526b..7825ed639 100644 --- a/bin/mozilla/cp.pl +++ b/bin/mozilla/cp.pl @@ -84,7 +84,7 @@ sub payment { # Standard Konto für Umlaufvermögen my $accno_arap = IS->get_standard_accno_current_assets(\%myconfig, \%$form); - # Entsprechend präventiv die Auswahlliste für Kontonummer + # Entsprechend präventiv die Auswahlliste für Kontonummer # auch mit value= zusammenbauen (s.a. oben bugfix 1771) # Wichtig: Auch das Template anpassen, damit hidden input korrekt die " # escaped. @@ -114,7 +114,7 @@ sub payment { $form->{defaultcurrency} = $form->{currency} = $form->{oldcurrency} = $curr[0]; - # Entsprechend präventiv die Auswahlliste für Währungen + # Entsprechend präventiv die Auswahlliste für Währungen # auch mit value= zusammenbauen (s.a. oben bugfix 1771) $form->{selectcurrency} = ""; map { $form->{selectcurrency} .= "\n" } @curr; @@ -168,8 +168,6 @@ sub form_header { $arap = lc $form->{ARAP}; $onload = qq|focus()|; - $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; - $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print $::form->parse_html_template('cp/form_header', { is_customer => $form->{vc} eq 'customer', @@ -278,8 +276,8 @@ sub update { $form->{customer_id} = $form->{AR}[0]{customer_id}; } - # search by invoicenumber, - if ($form->{invnumber}) { + # search by invoicenumber, + if ($form->{invnumber}) { $form->{open} ='Y'; # only open invoices if ($form->{ARAP} eq 'AR'){ # ar_transactions automatically searches by $form->{customer_id} or else diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 627f69633..92db5d875 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -317,8 +317,6 @@ sub search { $form->header(); $form->{onload} = qq|focus()| - . qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')| - . qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print $form->parse_html_template("dunning/search"); diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index e217aee3f..8cf990099 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -221,8 +221,6 @@ sub search { $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); my $onload = "focus()" - . qq|;setupDateFormat('|. $::myconfig{dateformat} . qq|', '| . $::locale->text("Falsches Datumsformat!") . qq|')| - . qq|;setupPoints('|. $::myconfig{numberformat} . qq|', '| . $::locale->text("wrongformat") . qq|')|; $::form->header; print $::form->parse_html_template('gl/search', { diff --git a/templates/webpages/ap/search.html b/templates/webpages/ap/search.html index a89b9b245..91ebc325d 100644 --- a/templates/webpages/ap/search.html +++ b/templates/webpages/ap/search.html @@ -175,8 +175,6 @@ diff --git a/templates/webpages/ar/search.html b/templates/webpages/ar/search.html index ddd688177..07f2fc1f1 100644 --- a/templates/webpages/ar/search.html +++ b/templates/webpages/ar/search.html @@ -221,8 +221,6 @@ diff --git a/templates/webpages/do/form_header.html b/templates/webpages/do/form_header.html index 848fa898e..5c5132977 100644 --- a/templates/webpages/do/form_header.html +++ b/templates/webpages/do/form_header.html @@ -18,8 +18,6 @@ diff --git a/templates/webpages/dunning/add.html b/templates/webpages/dunning/add.html index 889432a95..62a11a4f9 100644 --- a/templates/webpages/dunning/add.html +++ b/templates/webpages/dunning/add.html @@ -4,8 +4,6 @@ diff --git a/templates/webpages/generic/javascript_setup.html b/templates/webpages/generic/javascript_setup.html new file mode 100644 index 000000000..49ecb0a3c --- /dev/null +++ b/templates/webpages/generic/javascript_setup.html @@ -0,0 +1,5 @@ +[%- USE T8 %] +$(function() { + setupPoints('[% myconfig.numberformat %]', '[% 'wrongformat' | $T8 %]'); + setupDateFormat('[% myconfig.dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]'); +}) diff --git a/templates/webpages/ir/form_header.html b/templates/webpages/ir/form_header.html index 53acb60ee..f444c6d47 100644 --- a/templates/webpages/ir/form_header.html +++ b/templates/webpages/ir/form_header.html @@ -196,8 +196,6 @@ [% ELSE %] focus(); [% END %] - setupDateFormat('[% dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]'); - setupPoints('[% numberformat %]', '[% 'wrongformat' | $T8 %]'); }); function set_duedate() { $.ajax({ diff --git a/templates/webpages/is/form_header.html b/templates/webpages/is/form_header.html index c2cfa0664..416fea852 100644 --- a/templates/webpages/is/form_header.html +++ b/templates/webpages/is/form_header.html @@ -255,8 +255,6 @@ [% ELSE %] focus(); [% END %] - setupDateFormat('[% dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]'); - setupPoints('[% numberformat %]', '[% 'wrongformat' | $T8 %]'); }); function set_duedate() { $.ajax({ diff --git a/templates/webpages/oe/form_footer.html b/templates/webpages/oe/form_footer.html index 61a6060e8..ddf4a53d2 100644 --- a/templates/webpages/oe/form_footer.html +++ b/templates/webpages/oe/form_footer.html @@ -186,13 +186,3 @@ [% END %] - - - diff --git a/templates/webpages/vk/search_invoice.html b/templates/webpages/vk/search_invoice.html index 0b34502ca..95a4b6141 100644 --- a/templates/webpages/vk/search_invoice.html +++ b/templates/webpages/vk/search_invoice.html @@ -52,7 +52,7 @@ [% 'Item mode' | $T8 %] ([%'Show items from invoices individually' | $T8 %]) - + [% 'Total sum' | $T8 %] @@ -226,7 +226,7 @@ [% 'Purchase price total' | $T8 %] [% 'Margetotal' | $T8 %] ([% 'Single values in item mode, cumulated values in invoice mode' | $T8 %]) - + [% 'Sales price' | $T8 %] @@ -274,7 +274,7 @@ [% CUSTOM_VARIABLES_INCLUSION_CODE_CT %] - +   @@ -299,8 +299,6 @@ -- 2.20.1