|
Lines 23-55
$(document).ready(function() {
Link Here
|
| 23 |
|
23 |
|
| 24 |
$('#tabs').tabs(); |
24 |
$('#tabs').tabs(); |
| 25 |
|
25 |
|
|
|
26 |
// DataTables removes hidden rows from the DOM, so we can't expect a |
| 27 |
// "regular" submit to work and we need to build another form containing |
| 28 |
// all form elements, and then submit this form. |
| 29 |
$('form').submit(function(e) { |
| 30 |
e.preventDefault(); |
| 31 |
|
| 32 |
var form = $(this); |
| 33 |
var table = form.find('table').dataTable(); |
| 34 |
|
| 35 |
var new_form = $('<form>') |
| 36 |
.attr('action', form.attr('action')) |
| 37 |
.attr('method', form.attr('method')); |
| 38 |
form.find('input[type="hidden"]') |
| 39 |
.add(table.$('input:checkbox:checked')) |
| 40 |
.each(function() { |
| 41 |
var input = $('<input type="hidden">') |
| 42 |
.attr('name', $(this).attr('name')) |
| 43 |
.attr('value', $(this).attr('value')); |
| 44 |
new_form.append(input); |
| 45 |
}); |
| 46 |
$(document.body).append(new_form); |
| 47 |
new_form.submit(); |
| 48 |
}); |
| 49 |
|
| 26 |
$(".CheckNone").click(function(e){ |
50 |
$(".CheckNone").click(function(e){ |
| 27 |
e.preventDefault(); |
51 |
e.preventDefault(); |
| 28 |
var form = $(this).parents("form").get(0); |
52 |
var form = $(this).parents("form").first(); |
| 29 |
$(form).unCheckCheckboxes(); |
53 |
var table = form.find('table').dataTable(); |
|
|
54 |
table.$('input[type="checkbox"]').attr('checked', false); |
| 30 |
enableCheckboxActions(form); |
55 |
enableCheckboxActions(form); |
| 31 |
}); |
56 |
}); |
| 32 |
$(".CheckAll").click(function(e){ |
57 |
$(".CheckAll").click(function(e){ |
| 33 |
e.preventDefault(); |
58 |
e.preventDefault(); |
| 34 |
var form = $(this).parents("form").get(0); |
59 |
var form = $(this).parents("form").first(); |
| 35 |
$(form).checkCheckboxes(); |
60 |
var table = form.find('table').dataTable(); |
|
|
61 |
table.$('input[type="checkbox"]').attr('checked', true); |
| 36 |
enableCheckboxActions(form); |
62 |
enableCheckboxActions(form); |
| 37 |
}); |
63 |
}); |
| 38 |
|
64 |
|
| 39 |
$("input:checkbox").click(function(){ |
65 |
$("input:checkbox").click(function(){ |
| 40 |
var form = $(this).parents("form").get(0); |
66 |
var form = $(this).parents("form").first(); |
| 41 |
enableCheckboxActions(form); |
67 |
enableCheckboxActions(form); |
| 42 |
}); |
68 |
}); |
| 43 |
|
69 |
|
| 44 |
$(".action_delete").click(function(e){ |
70 |
$(".action_delete").click(function(e){ |
| 45 |
e.preventDefault(); |
71 |
e.preventDefault(); |
| 46 |
var form = $(this).parents("form").get(0); |
72 |
var form = $(this).parents("form").first(); |
| 47 |
var ids = $(form).find("input:checkbox:checked"); |
73 |
var table = form.find('table').dataTable(); |
|
|
74 |
var ids = table.$("input:checkbox:checked"); |
| 48 |
if ( $(ids).length < 1 ) { |
75 |
if ( $(ids).length < 1 ) { |
| 49 |
return false; |
76 |
return false; |
| 50 |
} |
77 |
} |
| 51 |
if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) { |
78 |
if ( confirm(MSG_CONFIRM_DELETE_HISTORY) ) { |
| 52 |
$(form).submit(); |
79 |
form.submit(); |
| 53 |
} |
80 |
} |
| 54 |
return false; |
81 |
return false; |
| 55 |
}); |
82 |
}); |
|
Lines 58-70
$(document).ready(function() {
Link Here
|
| 58 |
|
85 |
|
| 59 |
function enableCheckboxActions(form){ |
86 |
function enableCheckboxActions(form){ |
| 60 |
// Enable/disable controls if checkboxes are checked |
87 |
// Enable/disable controls if checkboxes are checked |
| 61 |
var checkedBoxes = $(form).find("input:checkbox:checked"); |
88 |
var table = form.find('table').dataTable(); |
| 62 |
if ($(checkedBoxes).size()) { |
89 |
var checkedBoxes = table.$("input:checkbox:checked"); |
| 63 |
$(form).find(".selections").html(_("With selected searches: ")); |
90 |
if (checkedBoxes.size()) { |
| 64 |
$(form).find(".selections-toolbar .links a").removeClass("disabled"); |
91 |
form.find(".selections").html(_("With selected searches: ")); |
|
|
92 |
form.find(".selections-toolbar .links a").removeClass("disabled"); |
| 65 |
} else { |
93 |
} else { |
| 66 |
$(form).find(".selections").html(_("Select searches to: ")); |
94 |
form.find(".selections").html(_("Select searches to: ")); |
| 67 |
$(form).find(".selections-toolbar .links a").addClass("disabled"); |
95 |
form.find(".selections-toolbar .links a").addClass("disabled"); |
| 68 |
} |
96 |
} |
| 69 |
} |
97 |
} |
| 70 |
|
98 |
|
| 71 |
- |
|
|