3 function tickAll(section){
4 $("input[type='checkbox'][name='" + section + "']").prop("checked", true);
5 $("#" + section.slice(0,-1) + "ALL").prop("checked", true);
6 $("input[type='checkbox'][name='" + section + "']").prop("disabled", true);
7 $("#" + section.slice(0,-1) + "ALL").prop("disabled", false);
10 function untickAll(section){
11 $("input[type='checkbox'][name='" + section + "']").prop("checked", false);
12 $("input[type='checkbox'][name='" + section + "']").prop("disabled", false);
15 function limitCheckboxes() {
16 var checkboxes = $(".compare");
18 var compare_link = '<a href="#" class="btn btn-link compare_link"><i class="fa fa-columns"></i> ' + __("View comparison") + '</a>';
19 checkboxes.each(function(){
20 $(this).on("change", function(){
22 checkboxes.each(function () {
23 if( $(this).prop("checked") ){
24 checked.push( $(this).data("actionid") );
27 if (checked.length > 0) {
28 $("#select_none").removeClass("disabled");
30 $("#select_none").addClass("disabled");
31 $("#logst").DataTable().search("").draw();
33 if( checked.length == 1 ){
34 $("#logst").DataTable().search($(this).data("filter")).draw();
35 humanMsg.displayAlert( __("Showing results for %s").format( $(this).data("filter") ) );
37 if( checked.length == 2 ){
38 $("#compare_info" + checked[0]).prepend( compare_link );
39 $("#compare_info" + checked[1]).prepend( compare_link );
40 $("button.compare_link").removeClass("disabled");
41 } else if (checked.length > limit) {
42 humanMsg.displayAlert( __("You can select maximum of two checkboxes") );
43 $(this).prop("checked", false );
44 } else if (checked.length < limit) {
45 $("a.compare_link").remove();
46 $("button.compare_link").addClass("disabled");
52 $(document).ready(function(){
55 if( $(".compare_info").length == 0 ){
56 /* Remove toolbar if there are no system preference
58 $("#toolbar").remove();
61 if ($('#toolbar').length) {
62 Sticky = $("#toolbar");
65 stickyClass: "floating"
69 if ( $('input[type="checkbox"][name="modules"]:checked').length == 0 ) {
72 $("#moduleALL").change(function(){
73 if ( this.checked == true ){
79 $("input[type='checkbox'][name='modules']").change(function(){
80 if ( $("input[name='modules']:checked").length == $("input[name='modules']").length - 1 ){
85 if ( $('input[name="actions"]:checked').length == 0 ) {
88 $("#actionALL").change(function(){
89 if ( this.checked == true ){
96 $("input[name='actions']").change(function(){
97 if ( $("input[name='actions']:checked").length == $("input[name='actions']").length - 1 ){
102 if ( $('input[name="interfaces"]:checked').length == 0 ) {
103 tickAll('interfaces');
105 $("#interfaceALL").change(function(){
106 if ( this.checked == true ){
107 tickAll('interfaces');
109 untickAll('interfaces');
113 $("input[name='interfaces']").change(function(){
114 if ( $("input[name='interfaces']:checked").length == $("input[name='interfaces']").length - 1 ){
115 tickAll('interfaces');
119 var logst = KohaTable("logst", {
121 "order": [[0, "desc"]],
122 "pagingType" : "full"
125 $("body").on("click", ".compare_link", function(e){
127 if( $(this).hasClass('disabled') ){
128 humanMsg.displayAlert( __("You must select two entries to compare") );
130 var firstid = $(".compare:checked").eq(0).data("actionid");
131 var secondid = $(".compare:checked").eq(1).data("actionid");
132 var firstvalue = $("#loginfo" + firstid).text();
133 var secondvalue = $("#loginfo" + secondid).text();
134 var diffs = diffString(secondvalue, firstvalue);
135 $("#col1 pre,#col2 pre").html(diffs);
136 $("#compareInfo").modal("show");
139 $("#compareInfo").on("hidden.bs.modal", function(){
140 $("#col1 pre,#col2 pre").html("");
143 $("#select_none").on("click", function(e){
145 $(".compare:checked").prop("checked", false).change();
147 patron_autocomplete($("#user"), { 'on-select-callback': function ( event, ui ) {
148 $("#user").val( ui.item.patron_id );