1<?php
2/*
3** Zabbix
4** Copyright (C) 2001-2021 Zabbix SIA
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19**/
20
21
22/**
23 * @var CView $this
24 */
25?>
26
27<script type="text/javascript">
28	function removeMedia(index) {
29		// table row
30		jQuery('#user_medias_' + index).remove();
31		// hidden variables
32		jQuery('#user_medias_' + index + '_mediaid').remove();
33		jQuery('#user_medias_' + index + '_mediatype').remove();
34		jQuery('#user_medias_' + index + '_mediatypeid').remove();
35		jQuery('#user_medias_' + index + '_period').remove();
36		jQuery('#user_medias_' + index + '_sendto').remove();
37		removeVarsBySelector(null, 'input[id^="user_medias_' + index + '_sendto_"]');
38		jQuery('#user_medias_' + index + '_severity').remove();
39		jQuery('#user_medias_' + index + '_active').remove();
40		jQuery('#user_medias_' + index + '_name').remove();
41	}
42
43	function autologoutHandler() {
44		var	$autologout_visible = jQuery('#autologout_visible'),
45			disabled = !$autologout_visible.prop('checked'),
46			$autologout = jQuery('#autologout'),
47			$hidden = $autologout.prev('input[type=hidden][name="' + $autologout.prop('name') + '"]');
48
49		$autologout.prop('disabled', disabled);
50
51		if (!disabled) {
52			$hidden.remove();
53		}
54		else if (!$hidden.length) {
55			jQuery('<input>', {'type': 'hidden', 'name': $autologout.prop('name')})
56				.val('0')
57				.insertBefore($autologout);
58		}
59	}
60
61	jQuery(function($) {
62		var $autologin_cbx = $('#autologin'),
63			$autologout_cbx = $('#autologout_visible');
64
65		$autologin_cbx.on('click', function() {
66			if (this.checked) {
67				$autologout_cbx.prop('checked', false);
68			}
69			autologoutHandler();
70		});
71
72		$autologout_cbx.on('click', function() {
73			if (this.checked) {
74				$autologin_cbx.prop('checked', false).change();
75			}
76			autologoutHandler();
77		});
78	});
79
80	jQuery(document).ready(function($) {
81		autologoutHandler();
82	});
83</script>
84