*** /usr/share/zabbix/include/views/configuration.triggers.list.php.orig	2013-08-21 15:59:24.000000000 +0200
--- /usr/share/zabbix/include/views/configuration.triggers.list.php	2013-10-06 13:22:50.000000000 +0200
***************
*** 20,24 ****
  
  
! $triggersWidget = new CWidget();
  
  // append host summary to widget header
--- 20,24 ----
  
  
! $triggersWidget = new CWidget(null, 'item-list');
  
  // append host summary to widget header
***************
*** 64,75 ****
  
  	$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)
! 		),
! 		' ]'
  	));
  }
  
--- 64,133 ----
  
  	$triggersWidget->addHeader(_('Triggers'), $filterForm);
! 	$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));
+ 
  }
  
*** /usr/share/zabbix/triggers.php.orig	2013-08-21 15:59:26.000000000 +0200
--- /usr/share/zabbix/triggers.php	2013-10-06 13:08:36.000000000 +0200
***************
*** 53,57 ****
  	'copy_targetid' =>		array(T_ZBX_INT, O_OPT, null,	DB_ID,		null),
  	'filter_groupid' =>		array(T_ZBX_INT, O_OPT, P_SYS,	DB_ID,		'isset({copy})&&(isset({copy_type})&&({copy_type}==0))'),
- 	'showdisabled' =>		array(T_ZBX_INT, O_OPT, P_SYS,	IN('0,1'),	null),
  	'massupdate' =>			array(T_ZBX_STR, O_OPT, P_SYS,	null,		null),
  	'visible' =>			array(T_ZBX_STR, O_OPT, null,	null,		null),
--- 53,56 ----
***************
*** 76,83 ****
  	'cancel' =>				array(T_ZBX_STR, O_OPT, P_SYS,	null,		null),
  	'form' =>				array(T_ZBX_STR, O_OPT, P_SYS,	null,		null),
! 	'form_refresh' =>		array(T_ZBX_INT, O_OPT, null,	null,		null)
  );
- $_REQUEST['showdisabled'] = get_request('showdisabled', CProfile::get('web.triggers.showdisabled', 1));
- 
  check_fields($fields);
  validate_sort_and_sortorder('description', ZBX_SORT_UP);
--- 75,95 ----
  	'cancel' =>				array(T_ZBX_STR, O_OPT, P_SYS,	null,		null),
  	'form' =>				array(T_ZBX_STR, O_OPT, P_SYS,	null,		null),
! 	'form_refresh' =>		array(T_ZBX_INT, O_OPT, null,	null,		null),
! 	// filter
! 	'filter_set' =>		array(T_ZBX_STR, O_OPT, P_ACT,	null, null),
! 	'filter_description' =>	array(T_ZBX_STR, O_OPT, null,	null, null),
! 	'filter_priority' =>	array(T_ZBX_INT, O_OPT, null,
! 		IN(array(-1, TRIGGER_SEVERITY_NOT_CLASSIFIED, TRIGGER_SEVERITY_INFORMATION, TRIGGER_SEVERITY_WARNING,
! 			TRIGGER_SEVERITY_AVERAGE, TRIGGER_SEVERITY_HIGH, TRIGGER_SEVERITY_DISASTER, TRIGGER_SEVERITY_COUNT)), null),
! 	'filter_type' =>	array(T_ZBX_INT, O_OPT, null, IN(array(-1, TRIGGER_MULT_EVENT_ENABLED, TRIGGER_MULT_EVENT_DISABLED)), null),
! 	'filter_flags' =>	array(T_ZBX_INT, O_OPT, null, IN(array(-1, ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED)), null),
! 	'filter_inherited' =>	array(T_ZBX_INT, O_OPT, null, IN(array(-1, 0, 1)), null),
! 	'filter_monitored' =>	array(T_ZBX_INT, O_OPT, null, IN(array(-1, 0, 1)), null),
! 	'filter_status' =>	array(T_ZBX_INT, O_OPT, null, IN(array(-1, TRIGGER_STATUS_ENABLED, TRIGGER_STATUS_DISABLED)), null),
! 	// ajax
! 	'favobj' =>	array(T_ZBX_STR, O_OPT, P_ACT, null,      null),
! 	'favref' =>	array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'),
! 	'favstate' =>	array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})&&("filter"=={favobj})')
  );
  check_fields($fields);
  validate_sort_and_sortorder('description', ZBX_SORT_UP);
***************
*** 112,115 ****
--- 124,166 ----
  
  /*
+  * Ajax
+  */
+ if (isset($_REQUEST['favobj'])) {
+ 	if ('filter' == $_REQUEST['favobj']) {
+ 		CProfile::update('web.triggers.filter.state', $_REQUEST['favstate'], PROFILE_TYPE_INT);
+ 	}
+ }
+ 
+ /*
+  * Filter
+  */
+ if (isset($_REQUEST['filter_set'])) {
+ 	$_REQUEST['filter_description'] = get_request('filter_description');
+ 	$_REQUEST['filter_priority'] = get_request('filter_priority', -1);
+ 	$_REQUEST['filter_type'] = get_request('filter_type', -1);
+ 	$_REQUEST['filter_flags'] = get_request('filter_flags', -1);
+ 	$_REQUEST['filter_inherited'] = get_request('filter_inherited', -1);
+ 	$_REQUEST['filter_monitored'] = get_request('filter_monitored', -1);
+ 	$_REQUEST['filter_status'] = get_request('filter_status', -1);
+ 
+ 	CProfile::update('web.triggers.filter_description', $_REQUEST['filter_description'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.triggers.filter_priority', $_REQUEST['filter_priority'], PROFILE_TYPE_INT);
+ 	CProfile::update('web.triggers.filter_type', $_REQUEST['filter_type'], PROFILE_TYPE_INT);
+ 	CProfile::update('web.triggers.filter_flags', $_REQUEST['filter_flags'], PROFILE_TYPE_INT);
+ 	CProfile::update('web.triggers.filter_inherited', $_REQUEST['filter_inherited'], PROFILE_TYPE_INT);
+ 	CProfile::update('web.triggers.filter_status', $_REQUEST['filter_status'], PROFILE_TYPE_INT);
+ 	CProfile::update('web.triggers.filter_monitored', $_REQUEST['filter_monitored'], PROFILE_TYPE_INT);
+ }
+ else {
+ 	$_REQUEST['filter_description'] = CProfile::get('web.triggers.filter_description');
+ 	$_REQUEST['filter_priority'] = CProfile::get('web.triggers.filter_priority', -1);
+ 	$_REQUEST['filter_type'] = CProfile::get('web.triggers.filter_type', -1);
+ 	$_REQUEST['filter_flags'] = CProfile::get('web.triggers.filter_flags', -1);
+ 	$_REQUEST['filter_inherited'] = CProfile::get('web.triggers.filter_inherited', -1);
+ 	$_REQUEST['filter_monitored'] = CProfile::get('web.triggers.filter_monitored', -1);
+ 	$_REQUEST['filter_status'] = CProfile::get('web.triggers.filter_status', -1);
+ }
+ 
+ /*
   * Actions
   */
***************
*** 380,389 ****
  else {
  	$data = array(
- 		'showdisabled' => get_request('showdisabled', 1),
  		'parent_discoveryid' => null,
  		'triggers' => array()
  	);
- 	CProfile::update('web.triggers.showdisabled', $data['showdisabled'], PROFILE_TYPE_INT);
- 
  	$data['pageFilter'] = new CPageFilter(array(
  		'groups' => array('not_proxy_hosts' => true, 'editable' => true),
--- 431,437 ----
***************
*** 409,414 ****
  			'limit' => $config['search_limit'] + 1
  		);
! 		if (empty($data['showdisabled'])) {
! 			$options['filter']['status'] = TRIGGER_STATUS_ENABLED;
  		}
  		if ($data['pageFilter']->hostid > 0) {
--- 457,462 ----
  			'limit' => $config['search_limit'] + 1
  		);
! 		if ($_REQUEST['filter_status'] > -1) {
! 			$options['filter']['status'] = $_REQUEST['filter_status'];
  		}
  		if ($data['pageFilter']->hostid > 0) {
***************
*** 418,424 ****
  			$options['groupids'] = $data['pageFilter']->groupid;
  		}
  		$data['triggers'] = API::Trigger()->get($options);
  	}
- 	$data['paging'] = getPagingLine($data['triggers']);
  
  	$data['triggers'] = API::Trigger()->get(array(
--- 466,490 ----
  			$options['groupids'] = $data['pageFilter']->groupid;
  		}
+ 		if (!zbx_empty($_REQUEST['filter_description'])) {
+ 			$options['search']['description'] = $_REQUEST['filter_description'];
+ 		}
+ 		if ($_REQUEST['filter_type'] > -1) {
+ 			$options['filter']['type'] = $_REQUEST['filter_type'];
+ 		}
+ 		if ($_REQUEST['filter_priority'] > -1) {
+ 			$options['filter']['priority'] = $_REQUEST['filter_priority'];
+ 		}
+ 		if ($_REQUEST['filter_flags'] > -1) {
+ 			$options['filter']['flags'] = $_REQUEST['filter_flags'];
+ 		}
+ 		if ($_REQUEST['filter_inherited'] > -1) {
+ 			$options['inherited'] = $_REQUEST['filter_inherited'];
+ 		}
+ 		if ($_REQUEST['filter_monitored'] > -1) {
+ 			$options['monitored'] = $_REQUEST['filter_monitored'];
+ 		}
+ 
  		$data['triggers'] = API::Trigger()->get($options);
  	}
  
  	$data['triggers'] = API::Trigger()->get(array(
***************
*** 432,435 ****
--- 498,502 ----
  	));
  	order_result($data['triggers'], $sortfield, getPageSortOrder());
+ 	$data['paging'] = getPagingLine($data['triggers']);
  
  	// get real hosts
