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-inventory-row"> 28 <?= (new CRow([ 29 (new CSelect('filter_inventory[#{rowNum}][field]')) 30 ->addOptions(CSelect::createOptionsFromArray($data['filter']['inventories'])), 31 (new CTextBox('filter_inventory[#{rowNum}][value]'))->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH), 32 (new CCol( 33 (new CButton('filter_inventory[#{rowNum}][remove]', _('Remove'))) 34 ->addClass(ZBX_STYLE_BTN_LINK) 35 ->addClass('element-table-remove') 36 ))->addClass(ZBX_STYLE_NOWRAP) 37 ])) 38 ->addClass('form_row') 39 ->toString() 40 ?> 41</script> 42 43<script type="text/x-jquery-tmpl" id="filter-tag-row-tmpl"> 44 <?= (new CRow([ 45 (new CTextBox('filter_tags[#{rowNum}][tag]')) 46 ->setAttribute('placeholder', _('tag')) 47 ->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH), 48 (new CRadioButtonList('filter_tags[#{rowNum}][operator]', TAG_OPERATOR_LIKE)) 49 ->addValue(_('Contains'), TAG_OPERATOR_LIKE) 50 ->addValue(_('Equals'), TAG_OPERATOR_EQUAL) 51 ->setModern(true), 52 (new CTextBox('filter_tags[#{rowNum}][value]')) 53 ->setAttribute('placeholder', _('value')) 54 ->setWidth(ZBX_TEXTAREA_FILTER_SMALL_WIDTH), 55 (new CCol( 56 (new CButton('filter_tags[#{rowNum}][remove]', _('Remove'))) 57 ->addClass(ZBX_STYLE_BTN_LINK) 58 ->addClass('element-table-remove') 59 ))->addClass(ZBX_STYLE_NOWRAP) 60 ])) 61 ->addClass('form_row') 62 ->toString() 63 ?> 64</script> 65 66<script type="text/javascript"> 67 jQuery(function($) { 68 $(function() { 69 $('#filter-inventory').dynamicRows({template: '#filter-inventory-row'}); 70 $('#filter-tags').dynamicRows({template: '#filter-tag-row-tmpl'}); 71 }); 72 73 $('#filter_show').change(function() { 74 var filter_show = jQuery('input[name=filter_show]:checked').val(); 75 76 $('#filter_age').closest('li').toggle(filter_show == <?= TRIGGERS_OPTION_RECENT_PROBLEM ?> 77 || filter_show == <?= TRIGGERS_OPTION_IN_PROBLEM ?>); 78 }); 79 80 $('#filter_show').trigger('change'); 81 82 $('#filter_compact_view').change(function() { 83 if ($(this).is(':checked')) { 84 $('#filter_show_timeline, #filter_details').prop('disabled', true); 85 $('input[name=filter_show_opdata]').prop('disabled', true); 86 $('#filter_highlight_row').prop('disabled', false); 87 } 88 else { 89 $('#filter_show_timeline, #filter_details').prop('disabled', false); 90 $('input[name=filter_show_opdata]').prop('disabled', false); 91 $('#filter_highlight_row').prop('disabled', true); 92 } 93 }); 94 95 $('#filter_show_tags').change(function() { 96 var disabled = $(this).find('[value = "<?= PROBLEMS_SHOW_TAGS_NONE ?>"]').is(':checked'); 97 $('#filter_tag_priority').prop('disabled', disabled); 98 $('#filter_tag_name_format input').prop('disabled', disabled); 99 }); 100 101 $(document).on({ 102 mouseenter: function() { 103 if ($(this)[0].scrollWidth > $(this)[0].offsetWidth) { 104 $(this).attr({title: $(this).text()}); 105 } 106 }, 107 mouseleave: function() { 108 if ($(this).is('[title]')) { 109 $(this).removeAttr('title'); 110 } 111 } 112 }, 'table.<?= ZBX_STYLE_COMPACT_VIEW ?> a.<?= ZBX_STYLE_LINK_ACTION ?>'); 113 114 $.subscribe('acknowledge.create', function(event, response) { 115 // Clear all selected checkboxes in Monitoring->Problems. 116 if (chkbxRange.prefix === 'problem') { 117 chkbxRange.checkObjectAll(chkbxRange.pageGoName, false); 118 chkbxRange.clearSelectedOnFilterChange(); 119 } 120 121 window.flickerfreeScreen.refresh('problem'); 122 123 clearMessages(); 124 addMessage(makeMessageBox('good', [], response.message, true, false)); 125 }); 126 127 $(document).on('submit', '#problem_form', function(e) { 128 e.preventDefault(); 129 130 acknowledgePopUp({eventids: chkbxRange.selectedIds}, this); 131 }); 132 }); 133</script> 134