From cd3dc84b8687e1571c7012d91a5138b9444c246c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 2 May 2007 10:44:00 +0000 Subject: [PATCH] =?utf8?q?Checkboxen=20bei=20Mahnungen=20eingebaut,=20um?= =?utf8?q?=20die=20ganze=20Liste=20an-=20oder=20abzuw=C3=A4hlen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/dn.pl | 15 ++++++++++++--- js/checkbox_utils.js | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 js/checkbox_utils.js diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 293f07640..844abf5b5 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -382,7 +382,10 @@ sub show_invoices { $form->{nextsub} = "save_dunning"; - + + $form->{jsscript} = 1; + $form->{javascript} .= qq||; + $form->{callback} = "$form->{script}?action=show_invoices&login=$form->{login}&password=$form->{password}&customer=$form->{customer}&invnumber=$form->{invnumber}&ordnumber=$form->{ordnumber}&paymentuntil=$form->{paymentuntil}&groupinvoices=$form->{groupinvoices}&minamount=$form->{minamount}&dunning_level=$form->{dunning_level}¬es=$form->{notes}" unless $form->{callback}; @@ -395,11 +398,17 @@ sub show_invoices { . qq||; $column_header{active} = qq|| - . $locale->text('Active?') + . NTI($cgi->checkbox('-name' => 'selectall_active', + '-label' => $locale->text('Active?'), + '-checked' => 1, + '-onclick' => "checkbox_check_all('selectall_active', 'active_', 1, " . scalar(@{ $form->{DUNNINGS} }) . ")")) . qq||; $column_header{email} = qq|| - . $locale->text('eMail?') + . NTI($cgi->checkbox('-name' => 'selectall_email', + '-label' => $locale->text('eMail?'), + '-checked' => 0, + '-onclick' => "checkbox_check_all('selectall_email', 'email_', 1, " . scalar(@{ $form->{DUNNINGS} }) . ")")) . qq||; $column_header{customername} = qq|| diff --git a/js/checkbox_utils.js b/js/checkbox_utils.js new file mode 100644 index 000000000..b5d4e61d7 --- /dev/null +++ b/js/checkbox_utils.js @@ -0,0 +1,15 @@ +function checkbox_check_all(cb_name, prefix, start, end) { + var i; + + var control = document.getElementsByName(cb_name)[0]; + if (!control) + return; + + var checked = control.checked; + + for (i = start; i <= end; i++) { + control = document.getElementsByName(prefix + i)[0]; + if (control) + control.checked = checked; + } +} -- 2.20.1