Revision f644f694
Von Moritz Bunkus vor fast 13 Jahren hinzugefügt
js/checkbox_utils.js | ||
---|---|---|
1 |
function checkbox_check_all(cb_name, prefix, start, end) { |
|
2 |
var i; |
|
3 |
|
|
4 |
var control = document.getElementsByName(cb_name)[0]; |
|
5 |
if (!control) |
|
6 |
return; |
|
7 |
|
|
8 |
var checked = control.checked; |
|
9 |
|
|
10 |
for (i = start; i <= end; i++) { |
|
11 |
control = document.getElementsByName(prefix + i)[0]; |
|
12 |
if (control) |
|
13 |
control.checked = checked; |
|
14 |
} |
|
15 |
} |
templates/webpages/dunning/show_invoices.html | ||
---|---|---|
1 | 1 |
[%- USE T8 %] |
2 |
[% USE HTML %]<body> |
|
3 |
<script type="text/javascript" src="js/checkbox_utils.js"></script> |
|
2 |
[% USE HTML %] |
|
3 |
[% USE L %] |
|
4 |
[% L.javascript_tag('jquery.checkall') %] |
|
5 |
[% SET all_active = 1 %][% FOREACH row = DUNNINGS %][% IF !row.active %][% SET all_active = 0 %][% LAST %][% END %][% END %] |
|
6 |
[% SET all_email = 1 %][% FOREACH row = DUNNINGS %][% IF !row.email %][% SET all_email = 0 %][% LAST %][% END %][% END %] |
|
7 |
<body> |
|
4 | 8 |
<script type="text/javascript" src="js/common.js"></script> |
5 | 9 |
<script type="text/javascript" src="js/dunning.js"></script> |
6 | 10 |
|
... | ... | |
14 | 18 |
<th class="listheading" colspan="2">[% 'Current / Next Level' | $T8 %]</th> |
15 | 19 |
|
16 | 20 |
<th class="listheading"> |
17 |
<input type="checkbox" name="selectall_active" id="selectall_active" onclick="checkbox_check_all('selectall_active', 'active_', 1, [% rowcount %]);">
|
|
21 |
[% L.checkbox_tag('selectall_active', checkall='INPUT[name*=active_]', checked=all_active) %]
|
|
18 | 22 |
<label for="selectall_active">[% 'Active?' | $T8 %]</label> |
19 | 23 |
</th> |
20 | 24 |
|
21 | 25 |
<th class="listheading"> |
22 |
<input type="checkbox" name="selectall_email" id="selectall_email" onclick="checkbox_check_all('selectall_email', 'email_', 1, [% rowcount %]);">
|
|
26 |
[% L.checkbox_tag('selectall_email', checkall='INPUT[name*=email_]', checked=all_email) %]
|
|
23 | 27 |
<label for="selectall_email">[% 'eMail?' | $T8 %]</label> |
24 | 28 |
</th> |
25 | 29 |
|
Auch abrufbar als: Unified diff
Unser eigenes "check all checkboxes" durch unsere eigene jQuery-Variante ersetzen