Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ff058663

Von Moritz Bunkus vor fast 11 Jahren hinzugefügt

  • ID ff0586637d90ef8f0b4b725e476ad7ccbeb32570
  • Vorgänger 8d72d404
  • Nachfolger e9e0b170

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.

Unterschiede anzeigen:

bin/mozilla/common.pl
343 343

  
344 344
# -------------------------------------------------------------------------
345 345

  
346
sub set_longdescription {
347
  $main::lxdebug->enter_sub();
348

  
349
  my $form     = $main::form;
350
  my $locale   = $main::locale;
351

  
352
  $form->{title} = $locale->text("Enter longdescription");
353
  $form->header(no_layout => 1);
354
  print $form->parse_html_template("generic/set_longdescription");
355

  
356
  $main::lxdebug->leave_sub();
357
}
358

  
359
# -------------------------------------------------------------------------
360

  
361 346
sub H {
362 347
  return $main::locale->quote_special_chars('HTML', $_[0]);
363 348
}
bin/mozilla/do.pl
310 310

  
311 311
  $form->{follow_up_trans_info} = $form->{donumber} .'('. $follow_up_vc .')';
312 312

  
313
  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase));
314

  
313 315
  $form->header();
314 316
  # Fix für Bug 1082 Erwartet wird: 'abteilungsNAME--abteilungsID'
315 317
  # und Erweiterung für Bug 1760:
bin/mozilla/ir.pl
331 331
  ), @custom_hiddens,
332 332
  map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}];
333 333

  
334
  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase));
335

  
334 336
  $form->header();
335 337

  
336 338
  print $form->parse_html_template("ir/form_header", \%TMPL_VAR);
bin/mozilla/is.pl
383 383
  ), @custom_hiddens,
384 384
  map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}];
385 385

  
386
  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase));
387

  
386 388
  $form->header();
387 389

  
388 390
  print $form->parse_html_template("is/form_header", \%TMPL_VAR);
bin/mozilla/oe.pl
432 432
  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
433 433
  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
434 434
  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
435
  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase));
435 436

  
436 437
  $form->header;
437 438
  if ($form->{CFDD_shipto} && $form->{CFDD_shipto_id} ) {
js/common.js
33 33
  return string;
34 34
}
35 35

  
36
function set_longdescription_window(input_name) {
37
  var parm = centerParms(600,500) + ",width=600,height=500,status=yes,scrollbars=yes";
38
  var name = document.getElementsByName(input_name)[0].value;
39
  url = "common.pl?" +
40
    "INPUT_ENCODING=UTF-8&" +
41
    "action=set_longdescription&" +
42
    "longdescription=" + encodeURIComponent(document.getElementsByName(input_name)[0].value) + "&" +
43
    "input_name=" + encodeURIComponent(input_name) + "&"
44
  window.open(url, "_new_generic", parm);
45
  }
46

  
47 36
function check_right_number_format(input_name) {
48 37
  if(decpoint && thpoint && thpoint == decpoint) {
49 38
    return show_alert_and_focus(input_name, wrongNumberFormat);
js/kivi.SalesPurchase.js
1
namespace('kivi.SalesPurchase', function(ns) {
2
  this.edit_longdescription = function(row) {
3
    var $edit    = $('#popup_edit_longdescription_input');
4
    var $element = $('#longdescription_' + row);
5

  
6
    if (!$element.length) {
7
      console.error("kivi.SalesPurchase.edit_longdescription: Element #longdescription_" + row + " not found");
8
      return;
9
    }
10

  
11
    $edit.data('element', $element);
12
    $edit.val($element.val());
13

  
14
    $('#popup_edit_longdescription_runningnumber').html(row);
15
    $('#popup_edit_longdescription_partnumber').html($('#partnumber_' + row).val() || '');
16

  
17
    var description = ($('#description_' + row).val() || '').replace(/[\n\r]+/, '');
18
    if (description.length >= 50)
19
      description = description.substring(0, 50) + "…";
20
    $('#popup_edit_longdescription_description').html(description);
21

  
22
    kivi.popup_dialog({
23
      id:    'edit_longdescription_dialog',
24
      dialog: {
25
        title: kivi.t8('Enter longdescription')
26
      }
27
    });
28
  };
29

  
30
  this.set_longdescription = function() {
31
    var $edit    = $('#popup_edit_longdescription_input');
32
    var $element = $edit.data('element');
33

  
34
    $element.val($edit.val());
35
    $('#edit_longdescription_dialog').dialog('close');
36
  };
37
});
js/locale/de.js
3 3
"Are you sure?":"Sind Sie sicher?",
4 4
"Database Connection Test":"Test der Datenbankverbindung",
5 5
"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?",
6
"Enter longdescription":"Langtext eingeben",
6 7
"Map":"Karte",
7 8
"Part picker":"Artikelauswahl",
8 9
"The description is missing.":"Die Beschreibung fehlt.",
locale/de/all
1588 1588
  'Please enter the taxnumber in the client configuration.' => 'Bitte geben Sie in der Mandantenkonfiguration die Steuernummer an.',
1589 1589
  'Please enter values'         => 'Bitte Werte eingeben',
1590 1590
  'Please insert object dimensions below.' => 'Bitte geben Sie die Abmessungen unten ein',
1591
  'Please insert your longdescription below' => 'Bitte den Langtext eingeben',
1592 1591
  'Please install the below listed modules or ask your system administrator to.' => 'Bitte installieren Sie die unten aufgef&uuml;hrten Module, oder bitten Sie Ihren Administrator darum.',
1593 1592
  'Please log in to the administration panel.' => 'Bitte melden Sie sich im Administrationsbereich an.',
1594 1593
  '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 1775
  'Revenues EU without UStId'   => 'Erl&ouml;se EU o. UStId',
1777 1776
  'Review of Aging list'        => 'Altersstrukturliste',
1778 1777
  'Right'                       => 'Rechts',
1778
  'Row'                         => 'Zeile',
1779 1779
  'Row #1: amount has to be different from zero.' => 'Zeile #1: Der Wert darf nicht 0 sein.',
1780 1780
  'Row number'                  => 'Zeilennummer',
1781 1781
  'Row was created from current record' => 'Zeile wurde aus aktuellem Beleg erstellt',
templates/webpages/do/form_header.html
38 38
 <div class="listtop">[% title %]</div>
39 39

  
40 40
[%- INCLUDE 'common/flash.html' %]
41
[%- INCLUDE 'generic/set_longdescription.html' %]
41 42

  
42 43
 [%- IF ERRORS && ERRORS.size %]
43 44
 <p><font color="#ff0000">[% ERRORS.join('<br>') %]</font></p>
templates/webpages/generic/set_longdescription.html
1
[%- USE T8 %]
2
[%- USE HTML %]
3
 <form name="Form">
4

  
5
  <input type="hidden" name="input_name" value="[% HTML.escape(input_name) %]">
6

  
7
  <div class="listtop">[% title %]</div>
8

  
9
  <p>[% 'Please insert your longdescription below' | $T8 %]</p>
10

  
11
  <p><textarea id="longdescription" name="longdescription" rows="15" cols="45" wrap="soft">[% HTML.escape(longdescription) %]</textarea></p>
12

  
13
  <p><input type="submit" onclick="longdescription_updated()" value="[% 'Close' | $T8 %]"></p>
14
 </form>
15

  
16
 <script type="text/javascript">
17
  <!--
18
      function longdescription_updated() {
19
        window.opener.document.getElementsByName(document.Form.input_name.value)[0].value = document.getElementsByName("longdescription")[0].value;
20

  
21
        self.close();
22
      }
23
    -->
24
 </script>
25

  
1
[%- USE L -%][%- USE LxERP -%]
2

  
3
<div id="edit_longdescription_dialog" style="display: none">
4
 <p>
5
  <table>
6
   <tr>
7
    <th align="right">[% LxERP.t8("Row") %]:</th>
8
    <td id="popup_edit_longdescription_runningnumber"></td>
9
   </tr>
10

  
11
   <tr>
12
    <th align="right">[% LxERP.t8("Part Number") %]:</th>
13
    <td id="popup_edit_longdescription_partnumber"></td>
14
   </tr>
15

  
16
   <tr>
17
    <th align="right">[% LxERP.t8("Description") %]:</th>
18
    <td id="popup_edit_longdescription_description"></td>
19
   </tr>
20
  </table>
21
 </p>
22

  
23
 <p>[% L.textarea_tag("popup_edit_longdescription_input", "", wrap="soft", style="width: 750px; height: 240px;") %]</p>
24

  
25
 <p>
26
  [% L.button_tag("kivi.SalesPurchase.set_longdescription()", LxERP.t8("Close")) %]
27
  <a onclick="$('#edit_longdescription_dialog').dialog('close');" href="#">[% LxERP.t8("Abort") %]</a>
28
 </p>
29
</div>
templates/webpages/ir/form_header.html
24 24
<p><div class="listtop" width="100%">[% title %]</div></p>
25 25

  
26 26
[%- INCLUDE 'common/flash.html' %]
27
[%- INCLUDE 'generic/set_longdescription.html' %]
27 28

  
28 29
<div class="tabwidget">
29 30
 <ul>
templates/webpages/is/form_header.html
25 25
<p>[% saved_message %]</p>
26 26

  
27 27
[%- PROCESS 'common/flash.html' %]
28
[%- INCLUDE 'generic/set_longdescription.html' %]
28 29

  
29 30
<div class="tabwidget">
30 31
 <ul>
templates/webpages/oe/form_header.html
28 28
    <h1>[% title %]</h1>
29 29

  
30 30
[%- INCLUDE 'common/flash.html' %]
31
[%- INCLUDE 'generic/set_longdescription.html' %]
31 32

  
32 33
    <div class="tabwidget">
33 34
     <ul>

Auch abrufbar als: Unified diff