Source
xxxxxxxxxx
for (const footer_button of document.querySelectorAll('#action_buttons button:not(.js-no-chkbxrange)')) {
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/*
* Automatic checkbox range selection
*/
var chkbxRange = {
startbox: null, // start checkbox obj
chkboxes: {}, // ckbx list
prefix: null, // prefix for session storage variable name
pageGoName: null, // which checkboxes should be counted by Go button and saved to session storage
sessionStorageName: null,
event_handlers: null,
init: function() {
var path = new Curl();
var filename = basename(path.getPath(), '.php');
this.sessionStorageName = 'cb_' + filename + (this.prefix ? '_' + this.prefix : '');
// Erase old checkboxes.
this.chkboxes = {};
this.startbox = null;
this.resetOtherPage();
// initialize checkboxes
var chkboxes = jQuery('.list-table tbody input[type=checkbox]:not(:disabled)');
if (chkboxes.length > 0) {
for (var i = 0; i < chkboxes.length; i++) {
this.implement(chkboxes[i]);
}
}
// load selected checkboxes from session storage or cache
if (this.pageGoName != null) {
const selected_ids = this.getSelectedIds();
// check if checkboxes should be selected from session storage
if (!jQuery.isEmptyObject(selected_ids)) {
var objectIds = Object.keys(selected_ids);
}
// no checkboxes selected, check browser cache if checkboxes are still checked and update state
else {
var checkedFromCache = jQuery('main .list-table tbody input[type=checkbox]:checked:not(:disabled)');
var objectIds = jQuery.map(checkedFromCache, jQuery.proxy(function(checkbox) {
return this.getObjectIdFromName(checkbox.name);
}, this));
}
this.checkObjects(this.pageGoName, objectIds, true);
this.update(this.pageGoName);
}