From: Moritz Bunkus Date: Fri, 11 Jul 2008 11:12:08 +0000 (+0000) Subject: JavaScript und Umlaute in UTF-8-Codierung funktioniert nicht mit der JavaScript-Funkt... X-Git-Tag: release-2.6.0beta1~56 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=6b063f3c88f7ca16e83a19759441a05e0ff84a47;p=kivitendo-erp.git JavaScript und Umlaute in UTF-8-Codierung funktioniert nicht mit der JavaScript-Funktion "encode()", deshalb "encodeURIComponent()" benutzen. --- diff --git a/SL/Form.pm b/SL/Form.pm index d155a0d7f..58614c415 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -599,11 +599,11 @@ sub header { 'charset' => $db_charset,); print qq|${doctype} + $self->{titlebar} $stylesheet $pagelayout $favicon - $jsscript $ajax @@ -691,6 +691,7 @@ sub _prepare_html_template { $additional_params->{"myconfig_jsc_dateformat"} = $jsc_dateformat; } + $additional_params->{"conf_dbcharset"} = $main::dbcharset; $additional_params->{"conf_webdav"} = $main::webdav; $additional_params->{"conf_lizenzen"} = $main::lizenzen; $additional_params->{"conf_latex_templates"} = $main::latex; diff --git a/js/calculate_qty.js b/js/calculate_qty.js index fb04cd7cd..4a7f91bcc 100644 --- a/js/calculate_qty.js +++ b/js/calculate_qty.js @@ -8,12 +8,12 @@ function calculate_qty_selection_window(input_name, alu, formel, row) { } else var action = "calculate_qty"; url = "common.pl?" + "action=" + action + "&" + - "name=" + escape(name) + "&" + - "input_name=" + escape(input_name) + "&" + - "description=" + escape(description) + "&" + - "qty=" + escape(qty) + "&" + - "row=" + escape(row) + "&" + - "formel=" + escape(document.getElementsByName(formel)[0].value) + "name=" + encodeURIComponent(name) + "&" + + "input_name=" + encodeURIComponent(input_name) + "&" + + "description=" + encodeURIComponent(description) + "&" + + "qty=" + encodeURIComponent(qty) + "&" + + "row=" + encodeURIComponent(row) + "&" + + "formel=" + encodeURIComponent(document.getElementsByName(formel)[0].value) //alert(url); window.open(url, "_new_generic", parm); } diff --git a/js/common.js b/js/common.js index e1037d70f..6d818f312 100644 --- a/js/common.js +++ b/js/common.js @@ -38,18 +38,13 @@ function centerParms(width,height,extra) { return string; } -function escape_more(s) { - s = escape(s); - return s.replace(/\+/g, '%2b'); -} - function set_longdescription_window(input_name) { var parm = centerParms(600,500) + ",width=600,height=500,status=yes,scrollbars=yes"; var name = document.getElementsByName(input_name)[0].value; url = "common.pl?" + "action=set_longdescription&" + - "longdescription=" + escape_more(document.getElementsByName(input_name)[0].value) + "&" + - "input_name=" + escape_more(input_name) + "&" + "longdescription=" + encodeURIComponent(document.getElementsByName(input_name)[0].value) + "&" + + "input_name=" + encodeURIComponent(input_name) + "&" window.open(url, "_new_generic", parm); } diff --git a/js/customer_or_vendor_selection.js b/js/customer_or_vendor_selection.js index 1be1c716c..2e1698055 100644 --- a/js/customer_or_vendor_selection.js +++ b/js/customer_or_vendor_selection.js @@ -3,12 +3,12 @@ function customer_or_vendor_selection_window(input_name, input_id, is_vendor, al var name = document.getElementsByName(input_name)[0].value; url = "common.pl?" + "action=cov_selection_internal&" + - "name=" + escape_more(name) + "&" + - "input_name=" + escape(input_name) + "&" + - "input_id=" + escape(input_id) + "&" + + "name=" + encodeURIComponent(name) + "&" + + "input_name=" + encodeURIComponent(input_name) + "&" + + "input_id=" + encodeURIComponent(input_id) + "&" + "is_vendor=" + (is_vendor ? "1" : "0") + "&" + "allow_both=" + (allow_both ? "1" : "0") + "&" + - "action_on_cov_selected=" + (action_on_cov_selected ? escape(action_on_cov_selected) : "") + "action_on_cov_selected=" + (action_on_cov_selected ? encodeURIComponent(action_on_cov_selected) : "") //alert(url); window.open(url, "_new_cov_selection", parm); } diff --git a/js/delivery_customer_selection.js b/js/delivery_customer_selection.js index 89a9a8972..c44b3385e 100644 --- a/js/delivery_customer_selection.js +++ b/js/delivery_customer_selection.js @@ -3,9 +3,9 @@ function delivery_customer_selection_window(input_name, input_id) { var name = document.getElementsByName(input_name)[0].value; url = "common.pl?" + "action=delivery_customer_selection&" + - "name=" + escape(name) + "&" + - "input_name=" + escape(input_name) + "&" + - "input_id=" + escape(input_id) + "name=" + encodeURIComponent(name) + "&" + + "input_name=" + encodeURIComponent(input_name) + "&" + + "input_id=" + encodeURIComponent(input_id) //alert(url); window.open(url, "_new_generic", parm); } diff --git a/js/dunning.js b/js/dunning.js index a98722ed2..ccf80c691 100644 --- a/js/dunning.js +++ b/js/dunning.js @@ -2,11 +2,11 @@ function set_email_window(input_subject, input_body, input_attachment) { var parm = centerParms(800,600) + ",width=800,height=600,status=yes,scrollbars=yes"; var url = "dn.pl?" + "action=set_email&" + - "email_subject=" + escape_more(document.getElementsByName(input_subject)[0].value) + "&" + - "email_body=" + escape_more(document.getElementsByName(input_body)[0].value) + "&" + - "email_attachment=" + escape_more(document.getElementsByName(input_attachment)[0].value) + "&" + - "input_subject=" + escape_more(input_subject) + "&" + - "input_body=" + escape_more(input_body) + "&" + - "input_attachment=" + escape_more(input_attachment); + "email_subject=" + encodeURIComponent(document.getElementsByName(input_subject)[0].value) + "&" + + "email_body=" + encodeURIComponent(document.getElementsByName(input_body)[0].value) + "&" + + "email_attachment=" + encodeURIComponent(document.getElementsByName(input_attachment)[0].value) + "&" + + "input_subject=" + encodeURIComponent(input_subject) + "&" + + "input_body=" + encodeURIComponent(input_body) + "&" + + "input_attachment=" + encodeURIComponent(input_attachment); window.open(url, "_new_generic", parm); } diff --git a/js/follow_up.js b/js/follow_up.js index 407341e97..379c71684 100644 --- a/js/follow_up.js +++ b/js/follow_up.js @@ -16,12 +16,12 @@ function follow_up_window() { var trans_info = document.getElementsByName("follow_up_trans_info_" + i); url += "&" + - "trans_id_" + i + "=" + escape_more(typeof trans_id != "undefined" ? trans_id[0].value : "") + "&" + - "trans_type_" + i + "=" + escape_more(typeof trans_type != "undefined" ? trans_type[0].value : "") + "&" + - "trans_info_" + i + "=" + escape_more(typeof trans_info != "undefined" ? trans_info[0].value : ""); + "trans_id_" + i + "=" + encodeURIComponent(typeof trans_id != "undefined" ? trans_id[0].value : "") + "&" + + "trans_type_" + i + "=" + encodeURIComponent(typeof trans_type != "undefined" ? trans_type[0].value : "") + "&" + + "trans_info_" + i + "=" + encodeURIComponent(typeof trans_info != "undefined" ? trans_info[0].value : ""); } - url += "&trans_rowcount=" + escape_more(trans_rowcount[0].value); + url += "&trans_rowcount=" + encodeURIComponent(trans_rowcount[0].value); } //alert(url); diff --git a/js/part_selection.js b/js/part_selection.js index 5e5ff80a6..3e0c50037 100644 --- a/js/part_selection.js +++ b/js/part_selection.js @@ -25,15 +25,15 @@ function part_selection_window(input_partnumber, input_description, input_partsi url = "common.pl?" + "action=part_selection_internal&" + - "partnumber=" + escape_more(partnumber) + "&" + - "description=" + escape_more(description) + "&" + - "input_partnumber=" + escape_more(input_partnumber) + "&" + - "input_description=" + escape_more(input_description) + "&" + - "input_partsid=" + escape_more(input_partsid) + "&" + - "input_partnotes=" + escape_more(input_partnotes) + "&" + - "filter=" + escape_more(filter) + "&" + - "options=" + escape_more(options) + "&" + - "formname=" + escape_more(formname) + "&" + + "partnumber=" + encodeURIComponent(partnumber) + "&" + + "description=" + encodeURIComponent(description) + "&" + + "input_partnumber=" + encodeURIComponent(input_partnumber) + "&" + + "input_description=" + encodeURIComponent(input_description) + "&" + + "input_partsid=" + encodeURIComponent(input_partsid) + "&" + + "input_partnotes=" + encodeURIComponent(input_partnotes) + "&" + + "filter=" + encodeURIComponent(filter) + "&" + + "options=" + encodeURIComponent(options) + "&" + + "formname=" + encodeURIComponent(formname) + "&" + "allow_creation=" + (allow_creation ? "1" : "0") + "&" + "action_on_part_selected=" + (null == action_on_part_selected ? "" : action_on_part_selected.value); //alert(url); diff --git a/js/parts_language_selection.js b/js/parts_language_selection.js index 87f8f10f4..de5dafdbe 100644 --- a/js/parts_language_selection.js +++ b/js/parts_language_selection.js @@ -3,9 +3,9 @@ function parts_language_selection_window(input_name) { var name = document.getElementsByName(input_name)[0].value; url = "ic.pl?" + "action=parts_language_selection&" + - "id=" + escape_more(document.ic.id.value) + "&" + - "language_values=" + escape_more(document.ic.language_values.value) + "&" + - "name=" + escape_more(name) + "&" + - "input_name=" + escape_more(input_name) + "&" + "id=" + encodeURIComponent(document.ic.id.value) + "&" + + "language_values=" + encodeURIComponent(document.ic.language_values.value) + "&" + + "name=" + encodeURIComponent(name) + "&" + + "input_name=" + encodeURIComponent(input_name) + "&" window.open(url, "_new_generic", parm); } diff --git a/js/show_history.js b/js/show_history.js index 2aeb7d4fc..55912590e 100644 --- a/js/show_history.js +++ b/js/show_history.js @@ -16,6 +16,6 @@ function set_history_window(id) { url = "common.pl?" + "action=show_history&" + "longdescription=" + "&" + - "input_name=" + escape(id) + "&" + "input_name=" + encodeURIComponent(id) + "&" window.open(url, "_new_generic", parm); } diff --git a/js/show_vc_details.js b/js/show_vc_details.js index 5595e72fb..3e5bffc01 100644 --- a/js/show_vc_details.js +++ b/js/show_vc_details.js @@ -7,8 +7,8 @@ function show_vc_details(vc) { vc_id = vc_id[0].value; url = "common.pl?" + "action=show_vc_details&" + - "vc=" + escape(vc) + "&" + - "vc_id=" + escape(vc_id) + "vc=" + encodeURIComponent(vc) + "&" + + "vc_id=" + encodeURIComponent(vc_id) //alert(url); window.open(url, "_new_generic", parm); } diff --git a/js/stock_in_out.js b/js/stock_in_out.js index 542311032..93d120a05 100644 --- a/js/stock_in_out.js +++ b/js/stock_in_out.js @@ -12,14 +12,14 @@ function open_stock_in_out_window(in_out, row) { url = "do.pl?" + "action=stock_in_out_form&" + - "in_out=" + escape_more(in_out) + "&" + - "row=" + escape_more(row) + "&" + - "parts_id=" + escape_more(parts_id) + "&" + - "do_qty=" + escape_more(do_qty) + "&" + - "do_unit=" + escape_more(do_unit) + "&" + - "stock=" + escape_more(stock) + "&" + - "closed=" + escape_more(closed) + "&" + - "delivered=" + escape_more(delivered) + "&" + + "in_out=" + encodeURIComponent(in_out) + "&" + + "row=" + encodeURIComponent(row) + "&" + + "parts_id=" + encodeURIComponent(parts_id) + "&" + + "do_qty=" + encodeURIComponent(do_qty) + "&" + + "do_unit=" + encodeURIComponent(do_unit) + "&" + + "stock=" + encodeURIComponent(stock) + "&" + + "closed=" + encodeURIComponent(closed) + "&" + + "delivered=" + encodeURIComponent(delivered) + "&" + ""; //alert(url); window.open(url, "_new_generic", parm); diff --git a/js/vendor_selection.js b/js/vendor_selection.js index 41f6e1766..298635770 100644 --- a/js/vendor_selection.js +++ b/js/vendor_selection.js @@ -3,9 +3,9 @@ function vendor_selection_window(input_name, input_id) { var name = document.getElementsByName(input_name)[0].value; url = "common.pl?" + "action=vendor_selection&" + - "name=" + escape(name) + "&" + - "input_name=" + escape(input_name) + "&" + - "input_id=" + escape(input_id) + "name=" + encodeURIComponent(name) + "&" + + "input_name=" + encodeURIComponent(input_name) + "&" + + "input_id=" + encodeURIComponent(input_id) //alert(url); window.open(url, "_new_generic", parm); } diff --git a/templates/webpages/admin/edit_user_de.html b/templates/webpages/admin/edit_user_de.html index 6dd456d74..70664c3ca 100644 --- a/templates/webpages/admin/edit_user_de.html +++ b/templates/webpages/admin/edit_user_de.html @@ -6,10 +6,10 @@ function open_connection_test_window() { // host name port user passwd var url = "admin.pl?action=test_db_connection&" + - "dbhost=" + escape_more(get_input_value("dbhost")) + "&" + - "dbname=" + escape_more(get_input_value("dbname")) + "&" + - "dbuser=" + escape_more(get_input_value("dbuser")) + "&" + - "dbpasswd=" + escape_more(get_input_value("dbpasswd")) + "&"; + "dbhost=" + encodeURIComponent(get_input_value("dbhost")) + "&" + + "dbname=" + encodeURIComponent(get_input_value("dbname")) + "&" + + "dbuser=" + encodeURIComponent(get_input_value("dbuser")) + "&" + + "dbpasswd=" + encodeURIComponent(get_input_value("dbpasswd")) + "&"; var parm = centerParms(400,300) + ",width=400,height=300,status=yes,scrollbars=yes"; diff --git a/templates/webpages/admin/edit_user_master.html b/templates/webpages/admin/edit_user_master.html index 71fd28285..d02952ccf 100644 --- a/templates/webpages/admin/edit_user_master.html +++ b/templates/webpages/admin/edit_user_master.html @@ -6,10 +6,10 @@ function open_connection_test_window() { // host name port user passwd var url = "admin.pl?action=test_db_connection&" + - "dbhost=" + escape_more(get_input_value("dbhost")) + "&" + - "dbname=" + escape_more(get_input_value("dbname")) + "&" + - "dbuser=" + escape_more(get_input_value("dbuser")) + "&" + - "dbpasswd=" + escape_more(get_input_value("dbpasswd")) + "&"; + "dbhost=" + encodeURIComponent(get_input_value("dbhost")) + "&" + + "dbname=" + encodeURIComponent(get_input_value("dbname")) + "&" + + "dbuser=" + encodeURIComponent(get_input_value("dbuser")) + "&" + + "dbpasswd=" + encodeURIComponent(get_input_value("dbpasswd")) + "&"; var parm = centerParms(400,300) + ",width=400,height=300,status=yes,scrollbars=yes";