*** /usr/share/zabbix/include/views/configuration.action.list.php.orig	2013-08-21 15:59:24.000000000 +0200
--- /usr/share/zabbix/include/views/configuration.action.list.php	2013-10-04 23:03:03.000000000 +0200
***************
*** 20,24 ****
  
  
! $actionWidget = new CWidget();
  
  // create new action button
--- 20,24 ----
  
  
! $actionWidget = new CWidget(null, 'item-list');
  
  // create new action button
***************
*** 40,43 ****
--- 40,190 ----
  $actionWidget->addHeaderRowNumber();
  
+ // filter
+ $hostGroupIdField= new CTextBox('filter_groupid', $data['filter_groupid']);
+ $hostGroupIdField->addClass('hidden');
+ 
+ $hostGroupNameField = new CTextBox('filter_group_name', $data['filter_group_name'], ZBX_TEXTBOX_FILTER_SIZE);
+ $hostGroupNameField->setReadonly('yes');
+ 
+ $hostIdField= new CTextBox('filter_hostid', $data['filter_hostid']);
+ $hostIdField->addClass('hidden');
+ 
+ $hostNameField = new CTextBox('filter_host_name', $data['filter_host_name'], ZBX_TEXTBOX_FILTER_SIZE);
+ $hostNameField->setReadonly('yes');
+ 
+ $userGroupIdField= new CTextBox('filter_usrgrpid', $data['filter_usrgrpid']);
+ $userGroupIdField->addClass('hidden');
+ 
+ $userGroupNameField = new CTextBox('filter_usrgrp_name', $data['filter_usrgrp_name'], ZBX_TEXTBOX_FILTER_SIZE);
+ $userGroupNameField->setReadonly('yes');
+ 
+ $userIdField= new CTextBox('filter_userid', $data['filter_userid']);
+ $userIdField->addClass('hidden');
+ 
+ $userNameField = new CTextBox('filter_user_name', $data['filter_user_name'], ZBX_TEXTBOX_FILTER_SIZE);
+ $userNameField->setReadonly('yes');
+ 
+ $triggerIdField= new CTextBox('filter_triggerid', $data['filter_triggerid']);
+ $triggerIdField->addClass('hidden');
+ 
+ $triggerNameField = new CTextBox('filter_trigger_name', $data['filter_trigger_name'], ZBX_TEXTBOX_FILTER_SIZE);
+ $triggerNameField->setReadonly('yes');
+ 
+ $scriptIdField= new CTextBox('filter_scriptid', $data['filter_scriptid']);
+ $scriptIdField->addClass('hidden');
+ 
+ $scriptNameField = new CTextBox('filter_script_name', $data['filter_script_name'], ZBX_TEXTBOX_FILTER_SIZE);
+ $scriptNameField->setReadonly('yes');
+ 
+ $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(bold(_('Host group').': '), 'label col1'),
+ 	new CCol(array(
+ 		$hostGroupIdField,
+ 		$hostGroupNameField,
+ 		new CButton('btn_group', _('Select'),
+ 			'return PopUp("popup.php?srctbl=host_group&srcfld1=groupid&srcfld2=name'.
+ 			'&dstfrm='.$filter_table->getName().'&dstfld1=filter_groupid&dstfld2=filter_group_name", 450, 450);',
+ 			'G'
+ 		)
+ 	), 'col1'),
+ 	new CCol(bold(_('User group').': '), 'label col2'),
+ 	new CCol(array(
+ 		$userGroupIdField,
+ 		$userGroupNameField,
+ 		new CButton('btn_usrgrp', _('Select'),
+ 			'return PopUp("popup.php?srctbl=usrgrp&srcfld1=usrgrpid&srcfld2=name'.
+ 			'&dstfrm='.$filter_table->getName().'&dstfld1=filter_usrgrpid&dstfld2=filter_usrgrp_name", 450, 450);',
+ 			'G'
+ 		)
+ 	), 'col2'),
+ 	new CCol(bold(_('Trigger').': '), 'label col3'),
+ 	new CCol(array(
+ 		$triggerIdField,
+ 		$triggerNameField,
+ 		new CButton('btn_trigger', _('Select'),
+ 			'return PopUp("popup.php?srctbl=triggers&srcfld1=triggerid&srcfld2=description'.
+ 			'&dstfrm='.$filter_table->getName().'&dstfld1=filter_triggerid&dstfld2=filter_trigger_name", 450, 450);',
+ 			'T'
+ 		)
+ 	), 'col3'),
+ 	new CCol(bold(_('Status').': '), 'label col4'),
+ 	new CComboBox('filter_status', $_REQUEST['filter_status'], null, array(
+ 		-1 => _('all'),
+ 		0 => _('Enabled'),
+ 		1 => _('Disabled')
+ 	), 'col4')
+ ));
+ 
+ //row 2
+ $filter_table->addRow(array(
+ 	new CCol(bold(_('Host').': '), 'label col1'),
+ 	new CCol(array(
+ 		$hostIdField,
+ 		$hostNameField,
+ 		new CButton('btn_host', _('Select'),
+ 			'return PopUp("popup.php?srctbl=hosts_and_templates&srcfld1=hostid&srcfld2=name'.
+ 			'&dstfrm='.$filter_table->getName().'&dstfld1=filter_hostid&dstfld2=filter_host_name", 450, 450);',
+ 			'G'
+ 		)
+ 	), 'col1'),
+ 	new CCol(bold(_('User').': '), 'label col2'),
+ 	new CCol(array(
+ 		$userIdField,
+ 		$userNameField,
+ 		new CButton('btn_user', _('Select'),
+ 			'return PopUp("popup.php?srctbl=users&srcfld1=userid&srcfld2=alias'.
+ 			'&dstfrm='.$filter_table->getName().'&dstfld1=filter_userid&dstfld2=filter_user_name", 450, 450);',
+ 			'G'
+ 		)
+ 	), 'col2'),
+ 	new CCol(bold(_('Scripts').': '), 'label col3'),
+ 	new CCol(array(
+ 		$scriptIdField,
+ 		$scriptNameField,
+ 		new CButton('btn_scripts', _('Select'),
+ 			'return PopUp("popup.php?srctbl=scripts&srcfld1=scriptid&srcfld2=name'.
+ 			'&dstfrm='.$filter_table->getName().'&dstfld1=filter_scriptid&dstfld2=filter_script_name", 450, 450);',
+ 			'S'
+ 		)
+ 	), 'col3'),
+ 	new CCol('', 'label col4'),
+ 	new CCol('', 'label col4')
+ ));
+ 
+ //row 3
+ $filter_table->addRow(array(
+ 	new CCol(array(bold(_('Name')), SPACE._('like').': '), 'label col1'),
+ 	new CCol(new CTextBox('filter_name', $_REQUEST['filter_name'], ZBX_TEXTBOX_FILTER_SIZE)),
+ 	new CCol('', 'label col2'),
+ 	new CCol('', 'label col2'),
+ 	new CCol('', 'label col3'),
+ 	new CCol('', 'label col3'),
+ 	new CCol('', 'label col4'),
+ 	new CCol('', 'label col4')
+ ));
+ 
+ $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));
+ 
  // create form
  $actionForm = new CForm('get');
*** /usr/share/zabbix/actionconf.php.orig	2013-08-21 15:59:26.000000000 +0200
--- /usr/share/zabbix/actionconf.php	2013-10-04 23:04:07.000000000 +0200
***************
*** 64,67 ****
--- 64,83 ----
  	'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_name' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_status' =>		array(T_ZBX_INT, O_OPT, null,   IN(array(-1, 0, 1)), null),
+ 	'filter_groupid' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_group_name' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_hostid' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_host_name' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_usrgrpid' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_usrgrp_name' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_userid' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_user_name' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_triggerid' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_trigger_name' =>	array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_scriptid' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+ 	'filter_script_name' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
  	// ajax
  	'favobj' =>				array(T_ZBX_STR, O_OPT, P_ACT,	null,		null),
***************
*** 81,85 ****
  if (isset($_REQUEST['favobj'])) {
  	if ($_REQUEST['favobj'] == 'filter') {
! 		CProfile::update('web.audit.filter.state', $_REQUEST['favstate'], PROFILE_TYPE_INT);
  	}
  }
--- 97,101 ----
  if (isset($_REQUEST['favobj'])) {
  	if ($_REQUEST['favobj'] == 'filter') {
! 		CProfile::update('web.actionconf.filter.state', $_REQUEST['favstate'], PROFILE_TYPE_INT);
  	}
  }
***************
*** 101,104 ****
--- 117,171 ----
  
  /*
+  * Filter
+  */
+ if (isset($_REQUEST['filter_set'])) {
+ 	$_REQUEST['filter_name'] = get_request('filter_name');
+ 	$_REQUEST['filter_status'] = get_request('filter_status', -1);
+ 	$_REQUEST['filter_groupid'] = get_request('filter_groupid', 0);
+ 	$_REQUEST['filter_group_name'] = get_request('filter_group_name');
+ 	$_REQUEST['filter_hostid'] = get_request('filter_hostid', 0);
+ 	$_REQUEST['filter_host_name'] = get_request('filter_host_name');
+ 	$_REQUEST['filter_usrgrpid'] = get_request('filter_usrgrpid', 0);
+ 	$_REQUEST['filter_usrgrp_name'] = get_request('filter_usrgrp_name');
+ 	$_REQUEST['filter_userid'] = get_request('filter_userid', 0);
+ 	$_REQUEST['filter_user_name'] = get_request('filter_user_name');
+ 	$_REQUEST['filter_triggerid'] = get_request('filter_triggerid', 0);
+ 	$_REQUEST['filter_trigger_name'] = get_request('filter_trigger_name');
+ 	$_REQUEST['filter_scriptid'] = get_request('filter_scriptid', 0);
+ 	$_REQUEST['filter_script_name'] = get_request('filter_script_name');
+ 
+ 	CProfile::update('web.actionconf.filter_name', $_REQUEST['filter_name'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_status', $_REQUEST['filter_status'], PROFILE_TYPE_INT);
+ 	CProfile::update('web.actionconf.filter_groupid', $_REQUEST['filter_groupid'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_group_name', $_REQUEST['filter_group_name'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_hostid', $_REQUEST['filter_hostid'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_host_name', $_REQUEST['filter_host_name'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_usrgrpid', $_REQUEST['filter_usrgrpid'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_usrgrp_name', $_REQUEST['filter_usrgrp_name'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_userid', $_REQUEST['filter_userid'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_user_name', $_REQUEST['filter_user_name'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_triggerid', $_REQUEST['filter_triggerid'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_trigger_name', $_REQUEST['filter_trigger_name'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_scriptid', $_REQUEST['filter_scriptid'], PROFILE_TYPE_STR);
+ 	CProfile::update('web.actionconf.filter_script_name', $_REQUEST['filter_script_name'], PROFILE_TYPE_STR);
+ }
+ else {
+ 	$_REQUEST['filter_name'] = CProfile::get('web.actionconf.filter_name');
+ 	$_REQUEST['filter_status'] = CProfile::get('web.actionconf.filter_status', -1);
+ 	$_REQUEST['filter_groupid'] = CProfile::get('web.actionconf.filter_groupid', 0);
+ 	$_REQUEST['filter_group_name'] = CProfile::get('web.actionconf.filter_group_name');
+ 	$_REQUEST['filter_hostid'] = CProfile::get('web.actionconf.filter_hostid', 0);
+ 	$_REQUEST['filter_host_name'] = CProfile::get('web.actionconf.filter_host_name');
+ 	$_REQUEST['filter_usrgrpid'] = CProfile::get('web.actionconf.filter_usrgrpid', 0);
+ 	$_REQUEST['filter_usrgrp_name'] = CProfile::get('web.actionconf.filter_usrgrp_name');
+ 	$_REQUEST['filter_userid'] = CProfile::get('web.actionconf.filter_userid', 0);
+ 	$_REQUEST['filter_user_name'] = CProfile::get('web.actionconf.filter_user_name');
+ 	$_REQUEST['filter_triggerid'] = CProfile::get('web.actionconf.filter_triggerid', 0);
+ 	$_REQUEST['filter_trigger_name'] = CProfile::get('web.actionconf.filter_trigger_name');
+ 	$_REQUEST['filter_scriptid'] = CProfile::get('web.actionconf.filter_scriptid', 0);
+ 	$_REQUEST['filter_script_name'] = CProfile::get('web.actionconf.filter_script_name');
+ }
+ 
+ /*
   * Actions
   */
***************
*** 440,449 ****
  else {
  	$data = array(
! 		'eventsource' => get_request('eventsource')
  	);
  
  	$sortfield = getPageSortField('name');
  
! 	$data['actions'] = API::Action()->get(array(
  		'output' => API_OUTPUT_EXTEND,
  		'filter' => array('eventsource' => array($data['eventsource'])),
--- 507,528 ----
  else {
  	$data = array(
! 		'eventsource' => get_request('eventsource'),
! 		'filter_groupid' => get_request('filter_groupid'),
! 		'filter_group_name' => get_request('filter_group_name'),
! 		'filter_hostid' => get_request('filter_hostid'),
! 		'filter_host_name' => get_request('filter_host_name'),
! 		'filter_usrgrpid' => get_request('filter_usrgrpid'),
! 		'filter_usrgrp_name' => get_request('filter_usrgrp_name'),
! 		'filter_userid' => get_request('filter_userid'),
! 		'filter_user_name' => get_request('filter_user_name'),
! 		'filter_triggerid' => get_request('filter_triggerid'),
! 		'filter_trigger_name' => get_request('filter_trigger_name'),
! 		'filter_scriptid' => get_request('filter_scriptid'),
! 		'filter_script_name' => get_request('filter_script_name'),
  	);
  
  	$sortfield = getPageSortField('name');
  
! 	$options = array(
  		'output' => API_OUTPUT_EXTEND,
  		'filter' => array('eventsource' => array($data['eventsource'])),
***************
*** 453,457 ****
  		'sortfield' => $sortfield,
  		'limit' => $config['search_limit'] + 1
! 	));
  
  	// sorting && paging
--- 532,562 ----
  		'sortfield' => $sortfield,
  		'limit' => $config['search_limit'] + 1
! 	);
! 
! 	if (isset($_REQUEST['filter_name']) && !zbx_empty($_REQUEST['filter_name'])) {
! 		$options['search']['name'] = $_REQUEST['filter_name'];
! 	}
! 	if ($_REQUEST['filter_status'] > -1) {
! 		$options['filter']['status'] = ($_REQUEST['filter_status'] == -1) ? null : $_REQUEST['filter_status'];
! 	}
! 	if ($data['filter_groupid'] > 0) {
! 		$options['groupids'] = $data['filter_groupid'];
! 	}
! 	if ($data['filter_hostid'] > 0) {
! 		$options['hostids'] = $data['filter_hostid'];
! 	}
! 	if ($data['filter_usrgrpid'] > 0) {
! 		$options['usrgrpids'] = $data['filter_usrgrpid'];
! 	}
! 	if ($data['filter_userid'] > 0) {
! 		$options['userids'] = $data['filter_userid'];
! 	}
! 	if ($data['filter_triggerid'] > 0) {
! 		$options['triggerids'] = $data['filter_triggerid'];
! 	}
! 	if ($data['filter_scriptid'] > 0) {
! 		$options['scriptids'] = $data['filter_scriptid'];
! 	}
! 	$data['actions'] = API::Action()->get($options);
  
  	// sorting && paging
