Koha/koha-tmpl/intranet-tmpl/prog/js/viewlog.js
Owen Leonard e68fe2a928 Bug 25968: Make logs sort by date descending as a default
This patch adds DataTables with columns configuration to the log viewer.
The table of log entries is now sorted by default by date descending.

To test, apply the patch and go to Administration -> Table settings.

 - Expand the "Tools" section and confirm that there is a section for
   "logviewer."
 - Go to Tools -> Log viewer.
 - Perform a search which will return multiple results.
 - Confirm that the results are sorted by date descending.
 - Test that the table controls work correctly: Paging, columns, export.
 - Return to the Table settings administration page and test that
   changes to those settings are correctly reflected in the log viewer
   table.

Signed-off-by: barbara <barbara.johnson@bedfordtx.gov>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch: Fix indentation in .yml to match other entries

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-07-30 17:44:27 +02:00

70 lines
2.1 KiB
JavaScript

function tickAll(section){
$("input[type='checkbox'][name='" + section + "']").prop("checked", true);
$("#" + section.slice(0,-1) + "ALL").prop("checked", true);
$("input[type='checkbox'][name='" + section + "']").prop("disabled", true);
$("#" + section.slice(0,-1) + "ALL").prop("disabled", false);
}
function untickAll(section){
$("input[type='checkbox'][name='" + section + "']").prop("checked", false);
$("input[type='checkbox'][name='" + section + "']").prop("disabled", false);
}
$(document).ready(function(){
if ( $('input[type="checkbox"][name="modules"]:checked').length == 0 ) {
tickAll('modules');
}
$("#moduleALL").change(function(){
if ( this.checked == true ){
tickAll('modules');
} else {
untickAll('modules');
}
});
$("input[type='checkbox'][name='modules']").change(function(){
if ( $("input[name='modules']:checked").length == $("input[name='modules']").length - 1 ){
tickAll('modules');
}
});
if ( $('input[name="actions"]:checked').length == 0 ) {
tickAll('actions');
}
$("#actionALL").change(function(){
if ( this.checked == true ){
tickAll('actions');
} else {
untickAll('actions');
}
});
$("input[name='actions']").change(function(){
if ( $("input[name='actions']:checked").length == $("input[name='actions']").length - 1 ){
tickAll('actions');
}
});
if ( $('input[name="interfaces"]:checked').length == 0 ) {
tickAll('interfaces');
}
$("#interfaceALL").change(function(){
if ( this.checked == true ){
tickAll('interfaces');
} else {
untickAll('interfaces');
}
});
$("input[name='interfaces']").change(function(){
if ( $("input[name='interfaces']:checked").length == $("input[name='interfaces']").length - 1 ){
tickAll('interfaces');
}
});
var logst = KohaTable("logst", {
"autoWidth": false,
"order": [[0, "desc"]],
"pagingType" : "full"
}, columns_settings);
});