Source
<?php declare(strict_types = 0);
/*
** 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/>.
**/
/**
* @var CView $this
*/
?>
window.copy_popup = new class {
init({action}) {
this.overlay = overlays_stack.getById('copy');
this.dialogue = this.overlay.$dialogue[0];
this.form = this.overlay.$dialogue.$body[0].querySelector('form');
this.curl = new Curl('zabbix.php');
this.curl.setArgument('action', action);
for (const element of document.querySelectorAll('input[name="copy_type"]')) {
element.addEventListener('change', () => {
this.changeTargetType(parseInt(element.value));
});
}
this.changeTargetType();
}
changeTargetType(copy_type = <?= COPY_TYPE_TO_TEMPLATE_GROUP ?>) {
const copy_targets = document.getElementById('copy_targets');
copy_targets.innerHTML = '';
const multiselect = document.createElement('div');
multiselect.id = 'copy_targetids';
multiselect.classList.add('multiselect');
multiselect.style.width = '<?= ZBX_TEXTAREA_MEDIUM_WIDTH ?>px';
multiselect.setAttribute('aria-required', 'true');
copy_targets.appendChild(multiselect);
const helper_options = {
id: 'copy_targetids',
name: 'copy_targetids[]',
objectOptions: {
editable: true
},
popup: {
parameters: {
dstfld1: 'copy_targetids',
writeonly: 1,
multiselect: 1
}