--- /usr/share/zabbix/include/views/configuration.action.list.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/include/views/configuration.action.list.php 2013-12-21 21:58:53.000000000 +0100 @@ -39,27 +39,156 @@ $actionWidget->addHeader(_('Actions'), $filterForm); $actionWidget->addHeaderRowNumber(); +// filter +$filter_table = new CTable('', 'filter'); +$filter_table->setAttribute('name', 'zbx_filter'); +$filter_table->setAttribute('id', 'zbx_filter'); + +//row 1 +$filter_table->addRow(array( + new CCol(array(bold(_('Name')), SPACE._('like').': '), 'label col1'), + new CCol(new CTextBox('filter_name', $data['filter_name'], ZBX_TEXTBOX_FILTER_SIZE)), + new CCol(bold(_('Host group').': '), 'label col2'), + new CCol(array( + new CTextBox('filter_group', $data['filter_group'], ZBX_TEXTBOX_FILTER_SIZE), + new CButton('btn_group', _('Select'), + 'return PopUp("popup.php?srctbl=host_group&srcfld1=name'. + '&dstfrm='.$filter_table->getName().'&dstfld1=filter_group", 450, 450);', '' + ) + ), 'col2'), + new CCol(bold(_('Media type').': '), 'label col3'), + new CComboBox('filter_mediatype', $data['filter_mediatype'], null, $data['mediatypes'], 'col3'), + new CCol(bold(_('Status').': '), 'label col4'), + new CComboBox('filter_status', $data['filter_status'], null, array( + -1 => _('all'), + 0 => _('Enabled'), + 1 => _('Disabled') + ), 'col4') +)); + +//row 2 +$filter_table->addRow(array( + new CCol(bold(_('Step duration').': '), 'label col1'), + new CCol(new CNumericBox('filter_esc_period', $data['filter_esc_period'], 6, 'no', true)), + new CCol(bold(_('Host').': '), 'label col2'), + new CCol(array( + new CTextBox('filter_host', $data['filter_host'], ZBX_TEXTBOX_FILTER_SIZE), + new CButton('btn_host', _('Select'), + 'return PopUp("popup.php?srctbl=hosts_and_templates&srcfld1=name'. + '&dstfrm='.$filter_table->getName().'&dstfld1=filter_host", 450, 450);', '' + ) + ), 'col2'), + new CCol(bold(_('User group').': '), 'label col3'), + new CCol(array( + new CTextBox('filter_usrgrp', $data['filter_usrgrp'], ZBX_TEXTBOX_FILTER_SIZE), + new CButton('btn_usrgrp', _('Select'), + 'return PopUp("popup.php?srctbl=usrgrp&srcfld1=name&srcfld2=name'. + '&dstfrm='.$filter_table->getName().'&dstfld1=filter_usrgrp&dstfld2=filter_usrgrp", 450, 450);', '' + ) + ), 'col3'), + new CCol(bold(_('Recovery').': '), 'label col4'), + new CComboBox('filter_recovery_msg', $data['filter_recovery_msg'], null, array( + -1 => _('all'), + 0 => _('No'), + 1 => _('Yes') + ), 'col4') +)); + +//row 3 +$filter_table->addRow(array( + new CCol(array(bold(_('Subject')), SPACE._('like').': '), 'label col1'), + new CCol(new CTextBox('filter_subject', $data['filter_subject'], ZBX_TEXTBOX_FILTER_SIZE)), + new CCol(array(bold(_('Trigger')), SPACE._('like').': '), 'label col2'), + new CCol(array( + new CTextBox('filter_trigger', $data['filter_trigger'], ZBX_TEXTBOX_FILTER_SIZE) + ), 'col2'), + new CCol(array(bold(_('User').': ')), 'label col3'), + new CCol(array( + new CTextBox('filter_user', $data['filter_user'], ZBX_TEXTBOX_FILTER_SIZE), + new CButton('btn_user', _('Select'), + 'return PopUp("popup.php?srctbl=users&srcfld1=alias'. + '&dstfrm='.$filter_table->getName().'&dstfld1=filter_user", 450, 450);', '' + ) + ), 'col3') +)); + +//row 4 +$filter_table->addRow(array( + new CCol(array(bold(_('Message')), SPACE._('like').': '), 'label col1'), + new CCol(new CTextBox('filter_message', $data['filter_message'], ZBX_TEXTBOX_FILTER_SIZE)), + new CCol('', 'label col2'), + new CCol('', 'label col2'), + new CCol(array(_('global').SPACE,bold(_('Script').': ')), 'label col3'), + new CCol(array( + new CTextBox('filter_script', $data['filter_script'], ZBX_TEXTBOX_FILTER_SIZE), + new CButton('btn_script', _('Select'), + 'return PopUp("popup.php?srctbl=scripts&srcfld1=name&srcfld2=name'. + '&dstfrm='.$filter_table->getName().'&dstfld1=filter_script&dstfld2=filter_script", 450, 450);', '' + ) + ), 'col3') +)); + +$filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);"); +$filter->useJQueryStyle('main'); + +$reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');"); +$reset->useJQueryStyle(); + +$div_buttons = new CDiv(array($filter, SPACE, $reset)); +$div_buttons->setAttribute('style', 'padding: 4px 0;'); + +$filter_table->addRow(new CCol($div_buttons, 'center', 8)); + +$filter_form = new CForm('get'); +$filter_form->setAttribute('name', 'zbx_filter'); +$filter_form->setAttribute('id', 'zbx_filter'); +$filter_form->addItem($filter_table); + +$actionWidget->addFlicker($filter_form, CProfile::get('web.actionconf.filter.state', 0), $data['filter_ind']); + // create form $actionForm = new CForm('get'); $actionForm->setName('actionForm'); // create table +$expred_ico_item = new CImg('images/general/plus.png'); +$expred_ico_item->setAttribute('id', 'expRedConIco'); +$expred_ico_url = 'javascript:expandReduce(".expRedCon", "'._('[expand]').'", "'._('[reduce]').'", "#expRedConIco");'; +$expred_ico = new CLink($expred_ico_item, $expred_ico_url, null, null, false); + $actionTable = new CTableInfo(_('No actions defined.')); $actionTable->setHeader(array( new CCheckBox('all_items', null, "checkAll('".$actionForm->getName()."', 'all_items', 'g_actionid');"), make_sorting_header(_('Name'), 'name'), - _('Conditions'), + array(_('Conditions'), SPACE, $expred_ico), _('Operations'), make_sorting_header(_('Status'), 'status') )); foreach ($this->data['actions'] as $action) { - $conditions = array(); + $conditions = $conditions_short = array(); order_result($action['conditions'], 'conditiontype', ZBX_SORT_DOWN); foreach ($action['conditions'] as $condition) { $conditions[] = array(get_condition_desc($condition['conditiontype'], $condition['operator'], $condition['value']), BR()); } + $conditions_short = array_slice($conditions, 0, 3); + foreach(array_keys($conditions_short) as $key) { + $max_text_length = ZBX_TEXTBOX_FILTER_SIZE * 3; + if (zbx_strlen($conditions_short[$key][0]) > $max_text_length) + $conditions_short[$key][0] = zbx_substr($conditions_short[$key][0], 0, $max_text_length).' ...'; + }; + + if ($conditions_short != $conditions) { + $expred_lnk_url = 'javascript:expandReduce(".expRedCon' . $action['actionid'].'", "'._('[expand]').'", "'._('[reduce]').'");'; + $expred_lnk = new CLink(_('[expand]'), $expred_lnk_url, 'expRedCon'.$action['actionid'].' expRedCon', null, false); + $conditions_short_class = "expRedCon${action['actionid']}_short expRedCon_short visible"; + $conditions_long_class = "expRedCon${action['actionid']}_long expRedCon_long hidden"; + $conditions = array(new CDiv($conditions_short, $conditions_short_class), new CDiv($conditions, $conditions_long_class), $expred_lnk); + } else { + $conditions = array(new CDiv($conditions_short)); + } + sortOperations($action['eventsource'], $action['operations']); $operations = array(); foreach ($action['operations'] as $operation) { --- /usr/share/zabbix/actionconf.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/actionconf.php 2013-12-13 14:10:44.000000000 +0100 @@ -438,12 +501,176 @@ $actionView->show(); } else { + $filters = null; + $data = array( - 'eventsource' => get_request('eventsource') + 'actions' => null, + 'eventsource' => get_request('eventsource'), + 'filter_ind' => 1, + 'filter_status' => get_request('filter_status'), + 'filter_name' => get_request('filter_name'), + 'filter_group' => get_request('filter_group'), + 'filter_host' => get_request('filter_host'), + 'filter_usrgrp' => get_request('filter_usrgrp'), + 'filter_user' => get_request('filter_user'), + 'filter_trigger' => get_request('filter_trigger'), + 'filter_script' => get_request('filter_script'), + 'filter_subject' => get_request('filter_subject'), + 'filter_message' => get_request('filter_message'), + 'filter_esc_period' => get_request('filter_esc_period'), + 'filter_recovery_msg' => get_request('filter_recovery_msg'), + 'filter_mediatype' => get_request('filter_mediatype') ); $sortfield = getPageSortField('name'); + $options = array('output' => array('description')); + $data['mediatypes'] = API::MediaType()->get($options); + $data['mediatypes'] = array_combine(zbx_objectValues($data['mediatypes'], 'mediatypeid'), zbx_objectValues($data['mediatypes'], 'description')); + asort($data['mediatypes']); + $data['mediatypes'] = array(-1 => _('all')) + $data['mediatypes']; + + $options = array( + 'editable' => true, + 'output' => API_OUTPUT_SHORTEN, + 'limit' => $config['search_limit'] + 1 + ); + + if (isset($_REQUEST['filter_name']) && !zbx_empty($_REQUEST['filter_name'])) { + $opt = array_merge($options, array('search' => array('name' => $data['filter_name']))); + $filters[]= zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_status'] > -1) { + $opt = array_merge($options, array('filter' => array('status' => $data['filter_status']))); + $filters[]= zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_group']) { + $opt = array_merge($options, array('filter' => array('name' => $data['filter_group']))); + $groupids = zbx_objectValues(API::HostGroup()->get($opt), 'groupid'); + + $opt = array_merge($options, array('groupids' => $groupids)); + $filters[] = zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_host']) { + $opt = array_merge($options, array('filter' => array('name' => $data['filter_host']))); + $hostids = zbx_objectValues(API::Host()->get($opt), 'hostid'); + + $opt = array_merge($options, array('hostids' => $hostids)); + $filters[] = zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_usrgrp']) { + $opt = array_merge($options, array('filter' => array('name' => $data['filter_usrgrp']))); + $usrgrpids = zbx_objectValues(API::UserGroup()->get($opt), 'usrgrpid'); + + $opt = array_merge($options, array('usrgrpids' => $usrgrpids)); + $filters[] = zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_user']) { + $opt = array_merge($options, array('filter' => array('alias' => $data['filter_user']))); + $userids = zbx_objectValues(API::User()->get($opt), 'userid'); + + $opt = array_merge($options, array('userids' => $userids)); + $filters[] = zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_trigger']) { + $opt = array_merge($options, array('search' => array('description' => $data['filter_trigger']))); + $triggerids = zbx_objectValues(API::Trigger()->get($opt), 'triggerid'); + + $opt = array_merge($options, array('triggerids' => $triggerids)); + $filters[]= zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_script']) { + $opt = array_merge($options, array('filter' => array('name' => $data['filter_script']))); + $scriptids = zbx_objectValues(API::Script()->get($opt), 'scriptid'); + + $opt = array_merge($options, array('scriptids' => $scriptids)); + $filters[]= zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_esc_period']) { + $opt = array_merge($options, array('filter' => array('esc_period' => $data['filter_esc_period']))); + $actionids = zbx_objectValues(API::Action()->get($opt), 'actionid'); + + if (empty($actionids[0])) { + $opt = array_merge($options, array('actionids' => $data['actions'], 'selectOperations' => 'refer')); + $actions = API::Action()->get($opt); + + foreach ($actions as $action) { + foreach ($action['operations'] as $operationid) { + if (isset($operationid['esc_period'])) { + if ($operationid['esc_period'] == $data['filter_esc_period']) { + $actionids[] = $action['actionid']; + } + } + } + } + } + + $filters[] = $actionids; + } + + if ($data['filter_recovery_msg'] > -1) { + $opt = array_merge($options, array('filter' => array('recovery_msg' => $data['filter_recovery_msg']))); + $filters[]= zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_mediatype'] > -1) { + $opt = array_merge($options, array('mediatypeids' => $data['filter_mediatype'])); + $filters[]= zbx_objectValues(API::Action()->get($opt), 'actionid'); + } + if ($data['filter_subject']) { + $opt['search']['def_shortdata'] = $data['filter_subject']; + $opt['search']['r_shortdata'] = $data['filter_subject']; + $opt['searchByAny'] = true; + $actionids = zbx_objectValues(API::Action()->get($opt), 'actionid'); + + if (empty($actionids[0])) { + $opt = array_merge($options, array('actionids' => $data['actions'], 'selectOperations' => 'refer')); + $actions = API::Action()->get($opt); + + foreach ($actions as $action) { + foreach ($action['operations'] as $operationid) { + if (isset($operationid['opmessage']['subject'])) { + if (stristr($operationid['opmessage']['subject'], $data['filter_subject']) != false) { + $actionids[] = $action['actionid']; + } + } + } + } + } + + $filters[] = $actionids; + } + if ($data['filter_message']) { + $opt['search']['def_longdata'] = $data['filter_message']; + $opt['search']['r_longdata'] = $data['filter_message']; + $opt['searchByAny'] = true; + $actionids = zbx_objectValues(API::Action()->get($opt), 'actionid'); + + if (empty($actionids[0])) { + $opt = array_merge($options, array('actionids' => $data['actions'], 'selectOperations' => 'refer')); + $actions = API::Action()->get($opt); + + foreach ($actions as $action) { + foreach ($action['operations'] as $operationid) { + if (isset($operationid['opmessage']['message'])) { + if (stristr($operationid['opmessage']['message'], $data['filter_message']) != false) { + $actionids[] = $action['actionid']; + } + } + } + } + } + + $filters[] = $actionids; + } + + if (1 < count($filters)) { + $data['filter_ind'] = 2; + $data['actions'] = call_user_func_array('array_intersect', $filters); + } else if (1 == count($filters)){ + $data['filter_ind'] = 2; + $data['actions'] = $filters[0]; + } + $data['actions'] = API::Action()->get(array( 'output' => API_OUTPUT_EXTEND, 'filter' => array('eventsource' => array($data['eventsource'])), --- /usr/share/zabbix/include/views/administration.auditlogs.list.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/include/views/administration.auditlogs.list.php 2013-12-13 14:10:50.000000000 +0100 @@ -73,7 +73,7 @@ $filterForm->addItem($filterTable); $auditWidget->addFlicker($filterForm, CProfile::get('web.auditlogs.filter.state', 1)); -$auditWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.auditlogs.filter.state', 1)); +$auditWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.auditlogs.filter.state', 1), $this->data['filter_ind']); // create form $auditForm = new CForm('get'); --- /usr/share/zabbix/auditlogs.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/auditlogs.php 2013-12-13 14:10:44.000000000 +0100 @@ -101,7 +101,8 @@ 'actions' => array(), 'action' => get_request('action'), 'resourcetype' => get_request('resourcetype'), - 'alias' => get_request('alias') + 'alias' => get_request('alias'), + 'filter_ind' => 1 ); $from = zbxDateToTime($data['stime']); @@ -110,12 +111,15 @@ // get audit $sqlWhere = array(); if (!empty($data['alias'])) { + $data['filter_ind'] = 2; $sqlWhere['alias'] = ' AND u.alias='.zbx_dbstr($data['alias']); } if ($data['action'] > -1) { + $data['filter_ind'] = 2; $sqlWhere['action'] = ' AND a.action='.$data['action'].' '; } if ($data['resourcetype'] > -1) { + $data['filter_ind'] = 2; $sqlWhere['resourcetype'] = ' AND a.resourcetype='.$data['resourcetype'].' '; } $sqlWhere['from'] = ' AND a.clock>'.$from; --- /usr/share/zabbix/events.php.orig 2013-10-21 10:48:13.000000000 +0200 +++ /usr/share/zabbix/events.php 2013-12-15 10:20:10.000000000 +0100 @@ -368,10 +404,47 @@ $filterForm->addRow(_('Show unknown events'), $unkcbx); + $tr_select = new CComboBox('show_triggers', $_REQUEST['show_triggers']); + $tr_select->addItem(EVENTS_SHOW_TRIGGERS_ALL, _('Any')); + $tr_select->addItem(EVENTS_SHOW_TRIGGERS_OK, _('Ok')); + $tr_select->additem(EVENTS_SHOW_TRIGGERS_PROBLEM, _('Problem')); + $filterForm->addRow(_('Triggers status'), $tr_select); + + $config = select_config(); + if($config['event_ack_enable']){ + $cb_ack_status = new CComboBox('ack_status', $_REQUEST['ack_status']); + $cb_ack_status->addItem(EVENTS_SHOW_ALL, _('Any')); + $cb_ack_status->additem(EVENTS_SHOW_ZBX_ACK, _('Yes')); + $cb_ack_status->additem(EVENTS_SHOW_ZBX_UNACK, _('No')); + $filterForm->addRow(_('Acknowledge status'), $cb_ack_status); + } + $severity_select = new CComboBox('show_severity', $_REQUEST['show_severity']); + $cb_items = array( + -1 => _('All'), + TRIGGER_SEVERITY_NOT_CLASSIFIED => _('Not classified'), + TRIGGER_SEVERITY_INFORMATION => _('Information'), + TRIGGER_SEVERITY_WARNING => _('Warning'), + TRIGGER_SEVERITY_AVERAGE => _('Average'), + TRIGGER_SEVERITY_HIGH => _('High'), + TRIGGER_SEVERITY_DISASTER => _('Disaster'), + ); + + $severity_select->addItems($cb_items); + $filterForm->addRow(_('Min severity'), $severity_select); + $filterForm->addRow(_('Filter by description'), new CTextBox('txt_select', $_REQUEST['txt_select'], 40)); + $reset = new CButton('filter_rst', _('Reset'), 'javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();'); $filterForm->addItemToBottomRow(new CSubmit('filter_set', _('Filter'))); $filterForm->addItemToBottomRow($reset); + + $filter_ind = ( + $trigger || + $_REQUEST['showUnknown'] || + $_REQUEST['txt_select'] || + $_REQUEST['show_triggers'] != EVENTS_SHOW_TRIGGERS_ALL || + $_REQUEST['ack_status'] != EVENTS_SHOW_ALL || + $_REQUEST['show_severity'] != -1) ? 2 : 1; } $events_wdgt->addFlicker($filterForm, CProfile::get('web.events.filter.state', 0)); @@ -379,7 +452,8 @@ $scroll_div = new CDiv(); $scroll_div->setAttribute('id', 'scrollbar_cntr'); -$events_wdgt->addFlicker($scroll_div, CProfile::get('web.events.filter.state', 0)); + +$events_wdgt->addFlicker($scroll_div, CProfile::get('web.events.filter.state', 0), isset($filter_ind)?$filter_ind:0); // }}} FILTER --- /usr/share/zabbix/include/views/configuration.hostgroups.list.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/include/views/configuration.hostgroups.list.php 2014-01-06 16:24:17.000000000 +0100 @@ -39,34 +38,69 @@ $hostgroupWidget->addHeader(_('Host groups')); $hostgroupWidget->addHeaderRowNumber(); +// filter +$filter_table = new CTable('', 'filter'); +$filter_table->setAttribute('name', 'zbx_filter'); +$filter_table->setAttribute('id', 'zbx_filter'); + +$filter_table->addRow(array( + new CCol(array(bold(_('Name')), SPACE._('like').': '), 'label col1'), + new CCol(new CTextBox('filter_name', $data['filter_name'], ZBX_TEXTBOX_FILTER_SIZE)), + new CCol(array(bold(_('Member')), SPACE._('like').': '), 'label col2'), + new CCol(new CTextBox('filter_member', $data['filter_member'], ZBX_TEXTBOX_FILTER_SIZE)) +)); + +$filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);"); +$filter->useJQueryStyle('main'); + +$reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');"); +$reset->useJQueryStyle(); + +$div_buttons = new CDiv(array($filter, SPACE, $reset)); +$div_buttons->setAttribute('style', 'padding: 4px 0;'); + +$filter_table->addRow(new CCol($div_buttons, 'center', 4)); + +$filter_form = new CForm('get'); +$filter_form->setAttribute('name', 'zbx_filter'); +$filter_form->setAttribute('id', 'zbx_filter'); +$filter_form->addItem($filter_table); + +$hostgroupWidget->addFlicker($filter_form, CProfile::get('web.hostgroups.filter.state', 0), $data['filter_ind']); + // create form $hostgroupForm = new CForm(); $hostgroupForm->setName('hostgroupForm'); // create table +$expred_ico_item = new CImg('images/general/plus.png'); +$expred_ico_item->setAttribute('id', 'expRedMemIco'); +$expred_ico_url = 'javascript:expandReduce(".expRedMem", "...", "'._('[reduce]').'", "#expRedMemIco");'; +$expred_ico = new CLink($expred_ico_item, $expred_ico_url, null, null, false); + $hostgroupTable = new CTableInfo(_('No host groups defined.')); $hostgroupTable->setHeader(array( new CCheckBox('all_groups', null, "checkAll('".$hostgroupForm->getName()."', 'all_groups', 'groups');"), make_sorting_header(_('Name'), 'name'), ' # ', - _('Members') + array(_('Members'), SPACE, $expred_ico) )); foreach ($this->data['groups'] as $group) { $tpl_count = 0; $host_count = 0; - $hosts_output = array(); + $hosts_output = $hosts_output_short = array(); $i = 0; foreach ($group['templates'] as $template) { $i++; - if ($i > $this->data['config']['max_in_table']) { - $hosts_output[] = '...'; - $hosts_output[] = '//empty for array_pop'; - break; + $url = 'templates.php?form=update&templateid='.$template['hostid'].'&groupid='.$group['groupid']; + + if ($i <= $this->data['config']['max_in_table']) { + $hosts_output_short[] = new CLink($template['name'], $url, 'unknown'); + $hosts_output_short[] = ', '; } - $url = 'templates.php?form=update&templateid='.$template['hostid'].'&groupid='.$group['groupid']; $hosts_output[] = new CLink($template['name'], $url, 'unknown'); $hosts_output[] = ', '; } --- /usr/share/zabbix/hostgroups.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/hostgroups.php 2014-01-06 17:10:06.000000000 +0100 @@ -294,15 +343,42 @@ } else { $data['config'] = $config; + $data['filter_name'] = get_request('filter_name'); + $data['filter_member'] = get_request('filter_member'); + $data['filter_ind'] = 1; $sortfield = getPageSortField('name'); $sortorder = getPageSortOrder(); + + if (!zbx_empty($data['filter_member'])) { + $data['filter_ind'] = 2; + $options = array( + 'editable' => 1, + 'templated_hosts' => 1, + 'search' => array( + 'host' => $data['filter_member'], + 'name' => $data['filter_member']), + 'searchByAny' => 1, + 'output' => API_OUTPUT_SHORTEN, + 'limit' => $config['search_limit'] + 1 + ); + $hosts = API::Host()->get($options); + } else { + $hosts = null; + } + $options = array( + 'hostids' => zbx_objectValues($hosts, 'hostid'), 'editable' => 1, 'output' => API_OUTPUT_SHORTEN, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1 ); + if (!zbx_empty($data['filter_name'])) { + $data['filter_ind'] = 2; + $options['search']['name'] = $data['filter_name']; + } + $groups = API::HostGroup()->get($options); $data['paging'] = getPagingLine($groups); --- /usr/share/zabbix/hosts.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/hosts.php 2013-12-22 22:38:23.000000000 +0100 @@ -663,30 +687,47 @@ $div_buttons = new CDiv(array($filter, SPACE, $reset)); $div_buttons->setAttribute('style', 'padding: 4px 0;'); - $filter_table->addRow(new CCol($div_buttons, 'center', 4)); + $filter_table->addRow(new CCol($div_buttons, 'center', 5)); $filter_form = new CForm('get'); $filter_form->setAttribute('name', 'zbx_filter'); $filter_form->setAttribute('id', 'zbx_filter'); $filter_form->addItem($filter_table); - $hosts_wdgt->addFlicker($filter_form, CProfile::get('web.hosts.filter.state', 0)); + $filter_ind = ($_REQUEST['filter_host'] + || $_REQUEST['filter_dns'] + || $_REQUEST['filter_ip'] + || $_REQUEST['filter_port'] + || $_REQUEST['filter_proxy'] != 0) ? 2 : 1; + + $hosts_wdgt->addFlicker($filter_form, CProfile::get('web.hosts.filter.state', 0), $filter_ind); // table hosts + $expred_if_ico_item = new CImg('images/general/plus.png'); + $expred_if_ico_item->setAttribute('id', 'expRedIfIco'); + $expred_if_ico_url = 'javascript:expandReduce(".expRedIf", "'._('[expand]').'", "'._('[reduce]').'", "#expRedIfIco");'; + $expred_if_ico = new CLink($expred_if_ico_item, $expred_if_ico_url, null, null, false); + + $expred_tpl_ico_item = new CImg('images/general/plus.png'); + $expred_tpl_ico_item->setAttribute('id', 'expRedTplIco'); + $expred_tpl_ico_url = 'javascript:expandReduce(".expRedTpl", "'._('[show]').'", "'._('[hide]').'", "#expRedTplIco");'; + $expred_tpl_ico = new CLink($expred_tpl_ico_item, $expred_tpl_ico_url, null, null, false); + $form = new CForm(); $form->setName('hosts'); $table = new CTableInfo(_('No hosts defined.')); $table->setHeader(array( new CCheckBox('all_hosts', null, "checkAll('".$form->getName()."', 'all_hosts', 'hosts');"), + _('Proxy'), make_sorting_header(_('Name'), 'name'), _('Applications'), _('Items'), _('Triggers'), _('Graphs'), _('Discovery'), - _('Interface'), - _('Templates'), + array(_('Interface'), SPACE, $expred_if_ico), + array(_('Templates'), SPACE, $expred_tpl_ico), make_sorting_header(_('Status'), 'status'), _('Availability') )); --- /usr/share/zabbix/include/views/monitoring.history.php.orig 2013-10-23 19:31:26.000000000 +0200 +++ /usr/share/zabbix/include/views/monitoring.history.php 2013-12-13 14:10:50.000000000 +0100 @@ -38,20 +38,25 @@ 'elid' => $this->data['item']['itemid'], 'elname' => 'itemid' )); + $header['right'][] = get_icon('pinned', array('pinned' => $this->data['pinned'])); } } // append action form to header $actionForm = new CForm('get'); $actionForm->addVar('itemid', $_REQUEST['itemid']); +$filter_ind = 1; if (isset($_REQUEST['filter_task'])) { + $filter_ind = 2; $actionForm->addVar('filter_task', $_REQUEST['filter_task']); } if (isset($_REQUEST['filter'])) { + $filter_ind = 2; $actionForm->addVar('filter', $_REQUEST['filter']); } if (isset($_REQUEST['mark_color'])) { + $filter_ind = 2; $actionForm->addVar('mark_color', $_REQUEST['mark_color']); } @@ -178,7 +183,7 @@ $historyWidget->addItem($historyTable); if ($this->data['action'] == 'showvalues' || $this->data['action'] == 'showgraph') { - $historyWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.history.filter.state', 1)); + $historyWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.history.filter.state', 1), $filter_ind); CScreenBuilder::insertScreenStandardJs(array( 'timeline' => $screen->timeline, --- /usr/share/zabbix/include/views/configuration.item.list.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/include/views/configuration.item.list.php 2013-12-13 14:10:50.000000000 +0100 @@ -37,7 +37,7 @@ if (!empty($this->data['hostid'])) { $itemsWidget->addItem(get_header_host_table('items', $this->data['hostid'])); } -$itemsWidget->addFlicker($this->data['flicker'], CProfile::get('web.items.filter.state', 0)); +$itemsWidget->addFlicker($this->data['flicker'], CProfile::get('web.items.filter.state', 0), $this->data['filter_ind']); // create form $itemForm = new CForm(); --- /usr/share/zabbix/items.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/items.php 2013-12-13 14:10:50.000000000 +0100 @@ -800,7 +800,8 @@ else { $data = array( 'form' => get_request('form', null), - 'sortfield' => getPageSortField('name') + 'sortfield' => getPageSortField('name'), + 'filter_ind' => 1 ); if (isset($hostid)) { @@ -892,6 +893,7 @@ $data['items'] = array(); } else { + $data['filter_ind'] = 2; $data['items'] = API::Item()->get($options); } --- /usr/share/zabbix/latest.php.orig 2013-10-21 10:48:58.000000000 +0200 +++ /usr/share/zabbix/latest.php 2013-12-13 14:10:50.000000000 +0100 @@ -134,14 +152,16 @@ $filterForm->setAttribute('id','zbx_filter'); $filterForm->addRow(_('Show items with name like'), new CTextBox('select',$_REQUEST['select'],20)); +$filterForm->addRow(_('Show items from applications with name like'), new CTextBox('select_app',$_REQUEST['select_app'],20)); $filterForm->addRow(_('Show items without data'), new CCheckBox('show_without_data', $_REQUEST['show_without_data'], null, 1)); +$filter_ind = (zbx_empty($_REQUEST['select']) && zbx_empty($_REQUEST['select_app']) && zbx_empty($_REQUEST['select']) && $_REQUEST['show_without_data'] == 0) ? 1 : 2; $reset = new CButton("filter_rst", _('Reset'), 'javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();'); $filterForm->addItemToBottomRow(new CSubmit("filter_set", _('Filter'))); $filterForm->addItemToBottomRow($reset); -$latest_wdgt->addFlicker($filterForm, CProfile::get('web.latest.filter.state', 1)); +$latest_wdgt->addFlicker($filterForm, CProfile::get('web.latest.filter.state', 1), $filter_ind); //------- validate_sort_and_sortorder('i.name',ZBX_SORT_UP); --- /usr/share/zabbix/include/views/configuration.triggers.list.php.orig 2013-10-15 11:25:56.000000000 +0200 +++ /usr/share/zabbix/include/views/configuration.triggers.list.php 2013-12-13 14:10:50.000000000 +0100 @@ -63,14 +63,72 @@ $filterForm->addItem(array(SPACE._('Host').SPACE, $this->data['pageFilter']->getHostsCB())); $triggersWidget->addHeader(_('Triggers'), $filterForm); - $triggersWidget->addHeaderRowNumber(array( - '[ ', - new CLink( - $this->data['showdisabled'] ? _('Hide disabled triggers') : _('Show disabled triggers'), - 'triggers.php?hostid='.$this->data['hostid'].'&showdisabled='.($this->data['showdisabled'] ? 0 : 1) - ), - ' ]' + $triggersWidget->addHeaderRowNumber(); + + // filter + $filter_table = new CTable('', 'filter'); + + $filter_table->addRow(array( + new CCol(array(bold(_('Description')), SPACE._('like').': '), 'label col1'), + new CCol(new CTextBox('filter_description', $_REQUEST['filter_description'], 20), 'label col1'), + new CCol(array(bold(_('Type')), ': '), 'label col2'), + new CCol(new CComboBox('filter_type', $_REQUEST['filter_type'], null, array( + -1 => _('all'), + TRIGGER_MULT_EVENT_DISABLED => _('Single PROBLEM events'), + TRIGGER_MULT_EVENT_ENABLED => _('Multiple PROBLEM events')))), + new CCol(array(bold(_('Templated')), ': '), 'label col3'), + new CCol(new CComboBox('filter_inherited', $_REQUEST['filter_inherited'], null, array( + -1 => _('all'), + 0 => _('Not Templated'), + 1 => _('Templated')))), + new CCol(array(bold(_('Monitored')), ': '), 'label col4'), + new CCol(new CComboBox('filter_monitored', $_REQUEST['filter_monitored'], null, array( + -1 => _('all'), + true => _('Monitored')))) + )); + + $filter_table->addRow(array( + new CCol('', 'label col1'), + new CCol('', 'label col1'), + new CCol(array(bold(_('Severity')), ': '), 'label col2'), + new CCol(new CComboBox('filter_priority', $_REQUEST['filter_priority'], null, array( + -1 => _('all'), + TRIGGER_SEVERITY_NOT_CLASSIFIED => _('Not classified'), + TRIGGER_SEVERITY_INFORMATION => _('Information'), + TRIGGER_SEVERITY_WARNING => _('Warning'), + TRIGGER_SEVERITY_AVERAGE => _('Average'), + TRIGGER_SEVERITY_HIGH => _('High'), + TRIGGER_SEVERITY_DISASTER => _('Disaster')))), + new CCol(array(bold(_('Discovered')), ': '), 'label col3'), + new CCol(new CComboBox('filter_flags', $_REQUEST['filter_flags'], null, array( + -1 => _('all'), + ZBX_FLAG_DISCOVERY_NORMAL => _('Not Discovered'), + ZBX_FLAG_DISCOVERY_CREATED => _('Discovered')))), + new CCol(array(bold(_('Status')), ': '), 'label col4'), + new CCol(new CComboBox('filter_status', $_REQUEST['filter_status'], null, array( + -1 => _('all'), + TRIGGER_STATUS_ENABLED => _('Enabled'), + TRIGGER_STATUS_DISABLED => _('Disabled')))) )); + + $filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);"); + $filter->useJQueryStyle('main'); + + $reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');"); + $reset->useJQueryStyle(); + + $div_buttons = new CDiv(array($filter, SPACE, $reset)); + $div_buttons->setAttribute('style', 'padding: 4px 0;'); + + $filter_table->addRow(new CCol($div_buttons, 'center', 8)); + + $filter_form = new CForm('get'); + $filter_form->setAttribute('name', 'zbx_filter'); + $filter_form->setAttribute('id', 'zbx_filter'); + $filter_form->addItem($filter_table); + + $triggersWidget->addFlicker($filter_form, CProfile::get('web.triggers.filter.state', 0), $data['filter_ind']); + } // create form --- /usr/share/zabbix/triggers.php.orig 2013-12-12 04:26:11.000000000 +0100 +++ /usr/share/zabbix/triggers.php 2014-01-05 13:37:50.000000000 +0100 @@ -381,19 +432,18 @@ } else { $data = array( - 'showdisabled' => get_request('showdisabled', 1), 'parent_discoveryid' => null, - 'triggers' => array() + 'triggers' => array(), + 'filter_ind' => 1 ); - CProfile::update('web.triggers.showdisabled', $data['showdisabled'], PROFILE_TYPE_INT); - $data['pageFilter'] = new CPageFilter(array( 'groups' => array('not_proxy_hosts' => true, 'editable' => true), 'hosts' => array('templated_hosts' => true, 'editable' => true), 'triggers' => array('editable' => true), 'groupid' => get_request('groupid', null), 'hostid' => get_request('hostid', null), - 'triggerid' => get_request('triggerid', null) + 'triggerid' => get_request('triggerid', null), + 'config' => array('allow_all' => 1) )); if ($data['pageFilter']->triggerid > 0) { $data['triggerid'] = $data['pageFilter']->triggerid; @@ -410,8 +460,9 @@ 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1 ); - if (empty($data['showdisabled'])) { - $options['filter']['status'] = TRIGGER_STATUS_ENABLED; + if ($_REQUEST['filter_status'] > -1) { + $data['filter_ind'] = 2; + $options['filter']['status'] = $_REQUEST['filter_status']; } if ($data['pageFilter']->hostid > 0) { $options['hostids'] = $data['pageFilter']->hostid; @@ -419,9 +470,33 @@ elseif ($data['pageFilter']->groupid > 0) { $options['groupids'] = $data['pageFilter']->groupid; } + if (!zbx_empty($_REQUEST['filter_description'])) { + $data['filter_ind'] = 2; + $options['search']['description'] = $_REQUEST['filter_description']; + } + if ($_REQUEST['filter_type'] > -1) { + $data['filter_ind'] = 2; + $options['filter']['type'] = $_REQUEST['filter_type']; + } + if ($_REQUEST['filter_priority'] > -1) { + $data['filter_ind'] = 2; + $options['filter']['priority'] = $_REQUEST['filter_priority']; + } + if ($_REQUEST['filter_flags'] > -1) { + $data['filter_ind'] = 2; + $options['filter']['flags'] = $_REQUEST['filter_flags']; + } + if ($_REQUEST['filter_inherited'] > -1) { + $data['filter_ind'] = 2; + $options['inherited'] = $_REQUEST['filter_inherited']; + } + if ($_REQUEST['filter_monitored'] > -1) { + $data['filter_ind'] = 2; + $options['monitored'] = $_REQUEST['filter_monitored']; + } + $data['triggers'] = API::Trigger()->get($options); } - $data['paging'] = getPagingLine($data['triggers']); $data['triggers'] = API::Trigger()->get(array( 'triggerids' => zbx_objectValues($data['triggers'], 'triggerid'), --- /usr/share/zabbix/tr_status.php.orig 2013-10-25 15:17:22.000000000 +0200 +++ /usr/share/zabbix/tr_status.php 2013-12-13 14:10:50.000000000 +0100 @@ -248,7 +261,16 @@ $filterForm->addItemToBottomRow(new CSubmit('filter_set', _('Filter'))); $filterForm->addItemToBottomRow(new CSubmit('filter_rst', _('Reset'))); - $trigg_wdgt->addFlicker($filterForm, CProfile::get('web.tr_status.filter.state', 0)); + $filter_ind = (zbx_empty($_REQUEST['txt_select']) + && $show_triggers == TRIGGERS_OPTION_ONLYTRUE + && $ack_status == ZBX_ACK_STS_ANY + && $show_severity == -1 + && !$_REQUEST['status_change'] + && get_request('show_maintenance') + && !$_REQUEST['show_details'] + ) ? 1 : 2; + + $trigg_wdgt->addFlicker($filterForm, CProfile::get('web.tr_status.filter.state', 0), $filter_ind); /*************** FILTER END ******************/ if($_REQUEST['fullscreen']){ --- /usr/share/zabbix/include/views/administration.users.list.php.orig 2013-10-12 15:51:49.000000000 +0200 +++ /usr/share/zabbix/include/views/administration.users.list.php 2013-12-13 14:10:50.000000000 +0100 @@ -43,6 +43,75 @@ $usersWidget->addHeader(_('Users'), $userGroupListForm); $usersWidget->addHeaderRowNumber(); +// filter +$filter_table = new CTable('', 'filter'); +$filter_table->setAttribute('name', 'zbx_filter'); +$filter_table->setAttribute('id', 'zbx_filter'); + +//row 1 +$filter_table->addRow(array( + new CCol(array(bold(_('Alias')), SPACE._('like'), bold(': ')), 'label col1'), + new CCol(new CTextBox('filter_alias', $data['filter_alias'], ZBX_TEXTBOX_FILTER_SIZE)), + new CCol(array(bold(_('Name')), SPACE._('like'), bold(': ')), 'label col2'), + new CCol(new CTextBox('filter_name', $data['filter_name'], ZBX_TEXTBOX_FILTER_SIZE)), + new CCol(array(bold(_('Surname')), SPACE._('like'), bold(': ')), 'label col3'), + new CCol(new CTextBox('filter_surname', $data['filter_surname'], ZBX_TEXTBOX_FILTER_SIZE)), + new CCol(bold(_('User type').':'), 'label col4'), + new CComboBox('filter_type', $data['filter_type'], null, array( + -1 => _('all'), + USER_TYPE_ZABBIX_USER => _('Zabbix user'), + USER_TYPE_ZABBIX_ADMIN => _('Zabbix admin'), + USER_TYPE_SUPER_ADMIN => _('Zabbix super admin') + )) +)); + +//row 2 +$filter_table->addRow(array( + new CCol(bold(array(_('Is online?'),':')), 'label col1'), + new CComboBox('filter_online', $data['filter_online'], null, array( + -1 => _('all'), + 0 => _('No'), + 1 => _('Yes') + )), + new CCol(bold(array(_('Frontend access'),':')), 'label col2'), + new CComboBox('filter_access', $data['filter_access'], null, array( + -1 => _('all'), + 0 => _('System default'), + 1 => _('Internal'), + 2 => _('Disabled') + )), + new CCol(bold(array(_('Debug mode'),':')), 'label col3'), + new CComboBox('filter_debug', $data['filter_debug'], null, array( + -1 => _('all'), + 0 => _('Disabled'), + 1 => _('Enabled') + )), + new CCol(bold(array(_('Status'),':')), 'label col4'), + new CComboBox('filter_status', $data['filter_status'], null, array( + -1 => _('all'), + 0 => _('Enabled'), + 1 => _('Disabled') + )) +)); + +$filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);"); +$filter->useJQueryStyle('main'); + +$reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');"); +$reset->useJQueryStyle(); + +$div_buttons = new CDiv(array($filter, SPACE, $reset)); +$div_buttons->setAttribute('style', 'padding: 4px 0;'); + +$filter_table->addRow(new CCol($div_buttons, 'center', 8)); + +$filter_form = new CForm('get'); +$filter_form->setAttribute('name', 'zbx_filter'); +$filter_form->setAttribute('id', 'zbx_filter'); +$filter_form->addItem($filter_table); + +$usersWidget->addFlicker($filter_form, CProfile::get('web.users.filter.state', 0), $data['filter_ind']); + // create form $usersForm = new CForm(); $usersForm->setName('userForm'); --- /usr/share/zabbix/users.php.orig 2013-10-12 15:51:53.000000000 +0200 +++ /usr/share/zabbix/users.php 2013-12-13 14:10:50.000000000 +0100 @@ -343,6 +399,18 @@ $usersView->show(); } else { + $data = array( + 'filter_ind' => 1, + 'filter_alias' => get_request('filter_alias'), + 'filter_name' => get_request('filter_name'), + 'filter_surname' => get_request('filter_surname'), + 'filter_type' => get_request('filter_type'), + 'filter_online' => get_request('filter_online'), + 'filter_access' => get_request('filter_access'), + 'filter_debug' => get_request('filter_debug'), + 'filter_status' => get_request('filter_status') + ); + // get user groups $options = array( 'output' => API_OUTPUT_EXTEND, @@ -360,11 +428,31 @@ if ($_REQUEST['filter_usrgrpid'] > 0) { $options['usrgrpids'] = $_REQUEST['filter_usrgrpid']; } + + if (!zbx_empty($data['filter_alias'])) { + $data['filter_ind'] = 2; + $options['search']['alias'] = $data['filter_alias']; + } + + if (!zbx_empty($data['filter_name'])) { + $data['filter_ind'] = 2; + $options['search']['name'] = $data['filter_name']; + } + + if (!zbx_empty($data['filter_surname'])) { + $data['filter_ind'] = 2; + $options['search']['surname'] = $data['filter_surname']; + } + + if ($data['filter_type'] > -1) { + $data['filter_ind'] = 2; + $options['filter']['type'] = $data['filter_type']; + } + $data['users'] = API::User()->get($options); // sort users order_result($data['users'], getPageSortField('alias'), getPageSortOrder()); - $data['paging'] = getPagingLine($data['users']); // set default lastaccess time to 0 foreach ($data['users'] as $user) { @@ -381,6 +469,39 @@ } } + if ($data['filter_online'] > -1 || $data['filter_access'] > -1 || $data['filter_debug'] > -1 || $data['filter_status'] > -1) { + $data['filter_ind'] = 2; + + foreach ($data['users'] as $key => $user) { + $userid = $user['userid']; + + if ($data['filter_online'] > -1) { + $session = $data['usersSessions'][$userid]; + $online_time = ($user['autologout'] == 0 || ZBX_USER_ONLINE_TIME < $user['autologout']) ? ZBX_USER_ONLINE_TIME : $user['autologout']; + + if ($session['lastaccess'] && ($session['lastaccess'] + $online_time) >= time()) { + if ($data['filter_online'] == 0) unset($data['users'][$key]); + } else { + if ($data['filter_online'] == 1) unset($data['users'][$key]); + } + } + + if ($data['filter_access'] > -1) { + if ($user['gui_access'] != $data['filter_access']) unset($data['users'][$key]); + } + + if ($data['filter_debug'] > -1) { + if ($user['debug_mode'] != $data['filter_debug']) unset($data['users'][$key]); + } + + if ($data['filter_status'] > -1) { + if ($user['users_status'] != $data['filter_status']) unset($data['users'][$key]); + } + } + } + + $data['paging'] = getPagingLine($data['users']); + // render view $usersView = new CView('administration.users.list', $data); $usersView->render();