const current_userid = <?= CWebUser::$data['userid'] ?>;
const current_user_name = <?= json_encode(getUserFullname(CWebUser::$data)) ?>;
const old_dashboardid = <?= $data['old_dashboardid'] ?>;
let dashboard_inaccessible = <?= json_encode($data['dashboard_inaccessible']) ?>;
let subscriptions_sanitized = true;
function sanitizeSubscriptions() {
document.querySelectorAll('#subscriptions-table tbody tr').forEach((row) => {
if (row.querySelector('[name*=recipient_inaccessible]').value == 1) {
const recipientid = row.querySelector('[name*=recipientid]').value;
if (row.querySelector('[name*=recipient_type]').value == <?= ZBX_REPORT_RECIPIENT_TYPE_USER ?>) {
userids.delete(recipientid);
usrgrpids.delete(recipientid);
else if (row.querySelector('[name*=creator_type]').value == <?= ZBX_REPORT_RECIPIENT_TYPE_USER ?>) {
const creator = row.querySelector('[name*=creatorid]').parentNode.querySelector('span');
creator.textContent = current_user_name;
creator.setAttribute('title', current_user_name);
creator.classList.remove('<?= ZBX_STYLE_GREY ?>');
row.querySelector('[name*=creatorid]').value = <?= CWebUser::$data['userid'] ?>;
row.querySelector('[name*=creator_type]').value = <?= ZBX_REPORT_CREATOR_TYPE_USER ?>;
row.querySelector('[name*=creator_name]').value = current_user_name;
row.querySelector('[name*=creator_inaccessible]').value = 0;
subscriptions_sanitized = true;
function showConfirmationDialog(e) {
const update_btn = document.querySelector('#update');
if (update_btn === null || subscriptions_sanitized) {