d41bb5d47133f065d2cdfe0e611a7a857befb196
[koha.git] / koha-tmpl / intranet-tmpl / prog / js / viewlog.js
1 function tickAll(section){
2     $("input[name='" + section + "']").prop("checked", true);
3     $("#" + section.slice(0,-1) + "ALL").prop("checked", true);
4     $("input[name='" + section + "']").prop("disabled", true);
5     $("#" + section.slice(0,-1) + "ALL").prop("disabled", false);
6 }
7
8 function untickAll(section){
9     $("input[name='" + section + "']").prop("checked", false);
10     $("input[name='" + section + "']").prop("disabled", false);
11 }
12
13 $(document).ready(function(){
14     tickAll('modules');
15     $("#moduleALL").change(function(){
16         if ( this.checked == true ){
17             tickAll('modules');
18         } else {
19             untickAll('modules');
20         }
21
22     });
23     $("input[name='modules']").change(function(){
24         if ( $("input[name='modules']:checked").length == $("input[name='modules']").length - 1 ){
25             tickAll('modules');
26         }
27     });
28
29     tickAll('actions');
30     $("#actionALL").change(function(){
31         if ( this.checked == true ){
32             tickAll('actions');
33         } else {
34             untickAll('actions');
35         }
36
37     });
38     $("input[name='actions']").change(function(){
39         if ( $("input[name='actions']:checked").length == $("input[name='actions']").length - 1 ){
40             tickAll('actions');
41         }
42     });
43
44     tickAll('interfaces');
45     $("#interfaceALL").change(function(){
46         if ( this.checked == true ){
47             tickAll('interfaces');
48         } else {
49             untickAll('interfaces');
50         }
51
52     });
53     $("input[name='interfaces']").change(function(){
54         if ( $("input[name='interfaces']:checked").length == $("input[name='interfaces']").length - 1 ){
55             tickAll('interfaces');
56         }
57     });
58 });