From 08ca74a8fe8fc1f9e528b0cc1172062c80283a36 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 11 Jul 2008 11:27:04 +0000 Subject: [PATCH] =?utf8?q?AJAX-Antworten=20nicht=20direkt=20$cgi->header()?= =?utf8?q?=20ausgeben,=20sondern=20=C3=BCber=20eine=20Funktion,=20die=20au?= =?utf8?q?ch=20das=20Charset=20ausgibt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 14 ++++++++++++++ bin/mozilla/ct.pl | 6 +++--- bin/mozilla/io.pl | 2 +- bin/mozilla/ir.pl | 6 +++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 58614c415..5fcd09ef8 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -639,6 +639,20 @@ sub header { $main::lxdebug->leave_sub(); } +sub ajax_response_header { + $main::lxdebug->enter_sub(); + + my ($self) = @_; + + my $db_charset = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET; + my $cgi = $main::cgi || CGI->new(''); + my $output = $cgi->header('-charset' => $db_charset); + + $main::lxdebug->leave_sub(); + + return $output; +} + sub _prepare_html_template { $main::lxdebug->enter_sub(); diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 086565d7d..29a0283cd 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -566,7 +566,7 @@ sub get_contact { $auth->assert('customer_vendor_edit'); CT->get_contact(\%myconfig, \%$form); - print $cgi->header(), join '__pjx__', map $form->{"cp_$_"}, + print $form->ajax_response_header(), join '__pjx__', map $form->{"cp_$_"}, qw(name greeting title givenname phone1 phone2 email abteilung fax mobile1 mobile2 satphone satfax project privatphone privatemail birthday used); $lxdebug->leave_sub(); @@ -578,7 +578,7 @@ sub get_shipto { $auth->assert('customer_vendor_edit'); CT->get_shipto(\%myconfig, \%$form); - print $cgi->header(), join '__pjx__', map $form->{"shipto$_"}, + print $form->ajax_response_header(), join '__pjx__', map $form->{"shipto$_"}, qw(name department_1 department_2 street zipcode city country contact phone fax email used); $lxdebug->leave_sub(); @@ -591,7 +591,7 @@ sub get_delivery { CT->get_delivery(\%myconfig, \%$form ); - print $cgi->header(), $form->parse_html_template('ct/get_delivery'); + print $form->ajax_response_header(), $form->parse_html_template('ct/get_delivery'); $lxdebug->leave_sub(); } diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 87cb3ea78..a15f2acb8 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -1849,7 +1849,7 @@ sub set_duedate { $form->get_duedate(\%myconfig); - print $cgi->header() . $form->{duedate}; + print $form->ajax_response_header() . $form->{duedate}; $lxdebug->leave_sub(); } diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 07efa666a..022c85840 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -1219,9 +1219,9 @@ sub yes { sub set_duedate_vendor { $lxdebug->enter_sub(); - print $cgi->header(), IR->get_duedate('vendor_id' => $form->{vendor_id}, - 'invdate' => $form->{invdate}, - 'default' => $form->{old_duedate}); + print $form->ajax_response_header(), IR->get_duedate('vendor_id' => $form->{vendor_id}, + 'invdate' => $form->{invdate}, + 'default' => $form->{old_duedate}); $lxdebug->leave_sub(); } -- 2.20.1