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/x-jquery-tmpl" id="filter-tag-row-tmpl">
28	<?= (new CRow([
29			(new CTextBox('filter_tags[#{rowNum}][tag]'))
30				->setAttribute('placeholder', _('tag'))
31				->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH),
32			(new CRadioButtonList('filter_tags[#{rowNum}][operator]', TAG_OPERATOR_LIKE))
33				->addValue(_('Contains'), TAG_OPERATOR_LIKE)
34				->addValue(_('Equals'), TAG_OPERATOR_EQUAL)
35				->setModern(true),
36			(new CTextBox('filter_tags[#{rowNum}][value]'))
37				->setAttribute('placeholder', _('value'))
38				->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH),
39			(new CCol(
40				(new CButton('filter_tags[#{rowNum}][remove]', _('Remove')))
41					->addClass(ZBX_STYLE_BTN_LINK)
42					->addClass('element-table-remove')
43			))->addClass(ZBX_STYLE_NOWRAP)
44		]))
45			->addClass('form_row')
46			->toString()
47	?>
48</script>
49
50<script type="text/javascript">
51	jQuery(function($) {
52		$('#filter-tags').dynamicRows({template: '#filter-tag-row-tmpl'});
53
54		$('#filter_monitored_by').on('change', function() {
55			var filter_monitored_by = $('input[name=filter_monitored_by]:checked').val();
56
57			if (filter_monitored_by == <?= ZBX_MONITORED_BY_PROXY ?>) {
58				$('#filter_proxyids_').multiSelect('enable');
59			}
60			else {
61				$('#filter_proxyids_').multiSelect('disable');
62			}
63		});
64	});
65</script>
66