From: Moritz Bunkus Date: Wed, 15 Jan 2014 11:28:37 +0000 (+0100) Subject: Verkaufs-/Einkaufsmasken: Langtext in jQuery-Popup bearbeiten X-Git-Tag: release-3.1.0beta1~22^2~2^2~2^2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ff0586637d90ef8f0b4b725e476ad7ccbeb32570;p=kivitendo-erp.git Verkaufs-/Einkaufsmasken: Langtext in jQuery-Popup bearbeiten Der alte Mechanismus öffnete ein normales Popup-Fenster, in dem eine URL geladen wurde, die dann die Maske angezeigt hat. Das Zurückschreiben geschah schon via JavaScript. Mit der Methode gibt's zwei Probleme: 1. Es ist langsam, weil ein überflüssiger Roundtrip zum Server gemacht wird. Die Informationen sind bereits alle beim initialen Anzeigen der Maske vorhanden. 2. Es handelt sich um einen GET-Request, an den sämtliche Übersetzungen als GET-Parameter angehängt werden. Damit kann man problemlos in die Größenbeschränkung bei GET-Requests laufen. --- diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index abe345150..c51b13f7a 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -343,21 +343,6 @@ sub calculate_qty { # ------------------------------------------------------------------------- -sub set_longdescription { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $form->{title} = $locale->text("Enter longdescription"); - $form->header(no_layout => 1); - print $form->parse_html_template("generic/set_longdescription"); - - $main::lxdebug->leave_sub(); -} - -# ------------------------------------------------------------------------- - sub H { return $main::locale->quote_special_chars('HTML', $_[0]); } diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 776a99274..26985e278 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -310,6 +310,8 @@ sub form_header { $form->{follow_up_trans_info} = $form->{donumber} .'('. $follow_up_vc .')'; + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase)); + $form->header(); # Fix für Bug 1082 Erwartet wird: 'abteilungsNAME--abteilungsID' # und Erweiterung für Bug 1760: diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index bad6e4fff..2be277685 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -331,6 +331,8 @@ sub form_header { ), @custom_hiddens, map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}]; + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase)); + $form->header(); print $form->parse_html_template("ir/form_header", \%TMPL_VAR); diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index ffa759544..a1af7b19b 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -383,6 +383,8 @@ sub form_header { ), @custom_hiddens, map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}]; + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase)); + $form->header(); print $form->parse_html_template("is/form_header", \%TMPL_VAR); diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index d4da314cc..92ce872f5 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -432,6 +432,7 @@ sub form_header { $form->{javascript} .= qq||; $form->{javascript} .= qq||; $form->{javascript} .= qq||; + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase)); $form->header; if ($form->{CFDD_shipto} && $form->{CFDD_shipto_id} ) { diff --git a/js/common.js b/js/common.js index 2bc91078c..d961814bc 100644 --- a/js/common.js +++ b/js/common.js @@ -33,17 +33,6 @@ function centerParms(width,height,extra) { return string; } -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?" + - "INPUT_ENCODING=UTF-8&" + - "action=set_longdescription&" + - "longdescription=" + encodeURIComponent(document.getElementsByName(input_name)[0].value) + "&" + - "input_name=" + encodeURIComponent(input_name) + "&" - window.open(url, "_new_generic", parm); - } - function check_right_number_format(input_name) { if(decpoint && thpoint && thpoint == decpoint) { return show_alert_and_focus(input_name, wrongNumberFormat); diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js new file mode 100644 index 000000000..0331d8408 --- /dev/null +++ b/js/kivi.SalesPurchase.js @@ -0,0 +1,37 @@ +namespace('kivi.SalesPurchase', function(ns) { + this.edit_longdescription = function(row) { + var $edit = $('#popup_edit_longdescription_input'); + var $element = $('#longdescription_' + row); + + if (!$element.length) { + console.error("kivi.SalesPurchase.edit_longdescription: Element #longdescription_" + row + " not found"); + return; + } + + $edit.data('element', $element); + $edit.val($element.val()); + + $('#popup_edit_longdescription_runningnumber').html(row); + $('#popup_edit_longdescription_partnumber').html($('#partnumber_' + row).val() || ''); + + var description = ($('#description_' + row).val() || '').replace(/[\n\r]+/, ''); + if (description.length >= 50) + description = description.substring(0, 50) + "…"; + $('#popup_edit_longdescription_description').html(description); + + kivi.popup_dialog({ + id: 'edit_longdescription_dialog', + dialog: { + title: kivi.t8('Enter longdescription') + } + }); + }; + + this.set_longdescription = function() { + var $edit = $('#popup_edit_longdescription_input'); + var $element = $edit.data('element'); + + $element.val($edit.val()); + $('#edit_longdescription_dialog').dialog('close'); + }; +}); diff --git a/js/locale/de.js b/js/locale/de.js index 969a16240..3fbe53804 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -3,6 +3,7 @@ namespace("kivi").setupLocale({ "Are you sure?":"Sind Sie sicher?", "Database Connection Test":"Test der Datenbankverbindung", "Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"Soll die Kontonummer \"#1\" zu \"#2\" und den Name \"#3\" zu \"#4\" geändert werden?", +"Enter longdescription":"Langtext eingeben", "Map":"Karte", "Part picker":"Artikelauswahl", "The description is missing.":"Die Beschreibung fehlt.", diff --git a/locale/de/all b/locale/de/all index 3d1d60090..c7c9a0699 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1588,7 +1588,6 @@ $self->{texts} = { 'Please enter the taxnumber in the client configuration.' => 'Bitte geben Sie in der Mandantenkonfiguration die Steuernummer an.', 'Please enter values' => 'Bitte Werte eingeben', 'Please insert object dimensions below.' => 'Bitte geben Sie die Abmessungen unten ein', - 'Please insert your longdescription below' => 'Bitte den Langtext eingeben', 'Please install the below listed modules or ask your system administrator to.' => 'Bitte installieren Sie die unten aufgeführten Module, oder bitten Sie Ihren Administrator darum.', 'Please log in to the administration panel.' => 'Bitte melden Sie sich im Administrationsbereich an.', 'Please re-run the analysis for broken general ledger entries by clicking this button:' => 'Bitte wiederholen Sie die Analyse der Hauptbucheinträge, indem Sie auf diesen Button klicken:', @@ -1776,6 +1775,7 @@ $self->{texts} = { 'Revenues EU without UStId' => 'Erlöse EU o. UStId', 'Review of Aging list' => 'Altersstrukturliste', 'Right' => 'Rechts', + 'Row' => 'Zeile', 'Row #1: amount has to be different from zero.' => 'Zeile #1: Der Wert darf nicht 0 sein.', 'Row number' => 'Zeilennummer', 'Row was created from current record' => 'Zeile wurde aus aktuellem Beleg erstellt', diff --git a/templates/webpages/do/form_header.html b/templates/webpages/do/form_header.html index 5454d4d83..2961b5c68 100644 --- a/templates/webpages/do/form_header.html +++ b/templates/webpages/do/form_header.html @@ -38,6 +38,7 @@
[% title %]
[%- INCLUDE 'common/flash.html' %] +[%- INCLUDE 'generic/set_longdescription.html' %] [%- IF ERRORS && ERRORS.size %]

[% ERRORS.join('
') %]

diff --git a/templates/webpages/generic/set_longdescription.html b/templates/webpages/generic/set_longdescription.html index 1b4b9d064..f7855f341 100644 --- a/templates/webpages/generic/set_longdescription.html +++ b/templates/webpages/generic/set_longdescription.html @@ -1,25 +1,29 @@ -[%- USE T8 %] -[%- USE HTML %] -
- - - -
[% title %]
- -

[% 'Please insert your longdescription below' | $T8 %]

- -

- -

-
- - - +[%- USE L -%][%- USE LxERP -%] + + diff --git a/templates/webpages/ir/form_header.html b/templates/webpages/ir/form_header.html index 66b7c0dbc..c42139ea0 100644 --- a/templates/webpages/ir/form_header.html +++ b/templates/webpages/ir/form_header.html @@ -24,6 +24,7 @@

[% title %]

[%- INCLUDE 'common/flash.html' %] +[%- INCLUDE 'generic/set_longdescription.html' %]