--- ./include/views/configuration.action.list.php.orig	2014-04-17 14:07:30.000000000 +0200
+++ ./include/views/configuration.action.list.php	2014-08-24 16:12:53.000000000 +0200
@@ -19,7 +19,7 @@
 **/
 
 
-$actionWidget = new CWidget();
+$actionWidget = new CWidget(null, 'item-list');
 
 // create new action button
 $createForm = new CForm('get');
@@ -40,6 +40,168 @@
 $actionWidget->addHeader(_('Actions'), $filterForm);
 $actionWidget->addHeaderRowNumber();
 
+// filter
+$filterTable = new CTable('', 'filter');
+$filterTable->setAttribute('name', 'zbx_filter');
+$filterTable->setAttribute('id', 'zbx_filter');
+
+//row 1
+$groupFilter = null;
+if (!empty($data['filter_groupid'])) {
+	$getHostInfo = API::HostGroup()->get(array(
+		'groupids' => $data['filter_groupid'],
+		'output' => array('name')
+	));
+	$getHostInfo = reset($getHostInfo);
+	if (!empty($getHostInfo)) {
+		$groupFilter[] = array(
+			'id' => $getHostInfo['groupid'],
+			'name' => $getHostInfo['name']
+		);
+	}
+}
+
+$filterTable->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 CMultiSelect(array(
+			'name' => 'filter_groupid',
+			'selectedLimit' => 1,
+			'objectName' => 'hostGroup',
+			'objectOptions' => array(
+				'editable' => true
+			),
+			'data' => $groupFilter,
+				'popup' => array(
+					'parameters' => 'srctbl=host_groups&dstfrm='.$filterTable->getName().'&dstfld1=filter_groupid'.
+						'&srcfld1=groupid&writeonly=1',
+						'width' => 450,
+						'height' => 450,
+						'buttonClass' => 'input filter-multiselect-select-button'
+					)
+		))
+	), 'col12'),
+	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
+$hostFilterData = null;
+if (!empty($data['filter_hostid'])) {
+	$getHostInfo = API::Host()->get(array(
+		'hostids' => $data['filter_hostid'],
+		'output' => array('name')
+	));
+	$getHostInfo = reset($getHostInfo);
+	if (!empty($getHostInfo)) {
+		$hostFilterData[] = array(
+			'id' => $getHostInfo['hostid'],
+			'name' => $getHostInfo['name']
+		);
+	}
+}
+
+$filterTable->addRow(array(
+	new CCol(bold(_('Step duration').': '), 'label col1 nowrap'),
+	new CCol(new CNumericBox('filter_esc_period', $data['filter_esc_period'], 6, 'no', true)),
+	new CCol(bold(_('Host').': '), 'label col2'),
+	new CCol(array(
+		new CMultiSelect(array(
+			'name' => 'filter_hostid',
+			'selectedLimit' => 1,
+			'objectName' => 'hosts',
+			'objectOptions' => array(
+				'editable' => true
+			),
+			'data' => $hostFilterData,
+			'popup' => array(
+				'parameters' => 'srctbl=hosts&dstfrm='.$filterTable->getName().'&dstfld1=filter_hostid'.
+					'&srcfld1=hostid&writeonly=1',
+						'width' => 450,
+						'height' => 450,
+						'buttonClass' => 'input filter-multiselect-select-button'
+				)
+		))
+	), '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='.$filterTable->getName().'&dstfld1=filter_usrgrp&dstfld2=filter_usrgrp", 450, 450);',
+			'filter-select-button'
+		)
+	), '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
+$filterTable->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)
+		), 'col1'),
+	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='.$filterTable->getName().'&dstfld1=filter_user", 450, 450);',
+			'filter-select-button'
+		)
+	), 'col3')
+));
+
+//row 4
+$filterTable->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='.$filterTable->getName().'&dstfld1=filter_script&dstfld2=filter_script", 450, 450);',
+			'filter-select-button'
+		)
+	), '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();
+
+$divButtons = new CDiv(array($filter, SPACE, $reset));
+$divButtons->setAttribute('style', 'padding: 4px 0;');
+
+$filterTable->addRow(new CCol($divButtons, 'center', 8));
+
+$filterForm = new CForm('get');
+$filterForm->setAttribute('name', 'zbx_filter');
+$filterForm->setAttribute('id', 'zbx_filter');
+$filterForm->addItem($filterTable);
+
+$actionWidget->addFlicker($filterForm, CProfile::get('web.actionconf.filter.state', 0));
+
 // create form
 $actionForm = new CForm();
 $actionForm->setName('actionForm');
--- ./actionconf.php.orig	2014-04-17 14:07:32.000000000 +0200
+++ ./actionconf.php	2014-08-24 16:12:36.000000000 +0200
@@ -70,6 +70,21 @@
 	'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_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_INT, O_OPT, null,   null, null),
+	'filter_hostid' =>		array(T_ZBX_INT, O_OPT, null,   null, null),
+	'filter_usrgrp' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+	'filter_user' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+	'filter_trigger' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+	'filter_script' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+	'filter_subject' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+	'filter_message' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+	'filter_esc_period' =>		array(T_ZBX_STR, O_OPT, null,   null, null),
+	'filter_recovery_msg' =>	array(T_ZBX_STR, O_OPT, null,   null, null),
+	'filter_mediatype' =>	array(T_ZBX_INT, O_OPT, null,   null, 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})'),
@@ -91,7 +106,7 @@
  */
 if (isset($_REQUEST['favobj'])) {
 	if ($_REQUEST['favobj'] == 'filter') {
-		CProfile::update('web.audit.filter.state', $_REQUEST['favstate'], PROFILE_TYPE_INT);
+		CProfile::update('web.actionconf.filter.state', $_REQUEST['favstate'], PROFILE_TYPE_INT);
 	}
 }
 if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) {
@@ -109,6 +124,54 @@
 }
 
 /*
+ * 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');
+	$_REQUEST['filter_hostid'] = get_request('filter_hostid');
+	$_REQUEST['filter_usrgrp'] = get_request('filter_usrgrp');
+	$_REQUEST['filter_user'] = get_request('filter_user');
+	$_REQUEST['filter_trigger'] = get_request('filter_trigger');
+	$_REQUEST['filter_script'] = get_request('filter_script');
+	$_REQUEST['filter_subject'] = get_request('filter_subject');
+	$_REQUEST['filter_message'] = get_request('filter_message');
+	$_REQUEST['filter_esc_period'] = get_request('filter_esc_period');
+	$_REQUEST['filter_recovery_msg'] = get_request('filter_recovery_msg', -1);
+	$_REQUEST['filter_mediatype'] = get_request('filter_mediatype', -1);
+
+	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_INT);
+	CProfile::update('web.actionconf.filter_hostid', $_REQUEST['filter_hostid'], PROFILE_TYPE_STR);
+	CProfile::update('web.actionconf.filter_usrgrp', $_REQUEST['filter_usrgrp'], PROFILE_TYPE_STR);
+	CProfile::update('web.actionconf.filter_user', $_REQUEST['filter_user'], PROFILE_TYPE_STR);
+	CProfile::update('web.actionconf.filter_trigger', $_REQUEST['filter_trigger'], PROFILE_TYPE_STR);
+	CProfile::update('web.actionconf.filter_script', $_REQUEST['filter_script'], PROFILE_TYPE_STR);
+	CProfile::update('web.actionconf.filter_subject', $_REQUEST['filter_subject'], PROFILE_TYPE_STR);
+	CProfile::update('web.actionconf.filter_message', $_REQUEST['filter_message'], PROFILE_TYPE_STR);
+	CProfile::update('web.actionconf.filter_esc_period', $_REQUEST['filter_esc_period'], PROFILE_TYPE_STR);
+	CProfile::update('web.actionconf.filter_recovery_msg', $_REQUEST['filter_recovery_msg'], PROFILE_TYPE_STR);
+	CProfile::update('web.actionconf.filter_mediatype', $_REQUEST['filter_mediatype'], PROFILE_TYPE_INT);
+}
+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');
+	$_REQUEST['filter_hostid'] = CProfile::get('web.actionconf.filter_hostid');
+	$_REQUEST['filter_usrgrp'] = CProfile::get('web.actionconf.filter_usrgrp');
+	$_REQUEST['filter_user'] = CProfile::get('web.actionconf.filter_user');
+	$_REQUEST['filter_trigger'] = CProfile::get('web.actionconf.filter_trigger');
+	$_REQUEST['filter_script'] = CProfile::get('web.actionconf.filter_script');
+	$_REQUEST['filter_subject'] = CProfile::get('web.actionconf.filter_subject');
+	$_REQUEST['filter_message'] = CProfile::get('web.actionconf.filter_message');
+	$_REQUEST['filter_esc_period'] = CProfile::get('web.actionconf.filter_esc_period');
+	$_REQUEST['filter_recovery_msg'] = CProfile::get('web.actionconf.filter_recovery_msg', -1);
+	$_REQUEST['filter_mediatype'] = CProfile::get('web.actionconf.filter_mediatype', -1);
+}
+
+/*
  * Actions
  */
 if (isset($_REQUEST['clone']) && isset($_REQUEST['actionid'])) {
@@ -489,13 +552,168 @@
 	$actionView->show();
 }
 else {
+	$filters = null;
+
 	$data = array(
+		'displayNodes' => is_array(get_current_nodeid()),
+		'actions' => null,
 		'eventsource' => getRequest('eventsource', CProfile::get('web.actionconf.eventsource', EVENT_SOURCE_TRIGGERS)),
-		'displayNodes' => is_array(get_current_nodeid())
+		'filter_status' => get_request('filter_status'),
+		'filter_name' => get_request('filter_name'),
+		'filter_groupid' => get_request('filter_groupid'),
+		'filter_hostid' => get_request('filter_hostid'),
+		'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_REFER,
+		'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_groupid']) {
+		$opt = array_merge($options, array('groupids' => $data['filter_groupid']));
+		$filters[] = zbx_objectValues(API::Action()->get($opt), 'actionid');
+	}
+	if ($data['filter_hostid']) {
+		$opt = array_merge($options, array('hostids' => $data['filter_hostid']));
+		$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['actions'] = call_user_func_array('array_intersect', $filters);
+	} else {
+		$data['actions'] = $filters[0];
+	}
+
 	$data['actions'] = API::Action()->get(array(
 		'output' => API_OUTPUT_EXTEND,
 		'filter' => array('eventsource' => array($data['eventsource'])),
@@ -503,7 +721,8 @@
 		'selectOperations' => API_OUTPUT_EXTEND,
 		'editable' => true,
 		'sortfield' => $sortfield,
-		'limit' => $config['search_limit'] + 1
+		'limit' => $config['search_limit'] + 1,
+		'actionids' => $data['actions']
 	));
 
 	// sorting && paging
