diff -Nur /usr/share/zabbix/include/defines.inc.php zabbix_action/include/defines.inc.php
--- /usr/share/zabbix/include/defines.inc.php	2012-12-08 12:09:20.000000000 +0100
+++ zabbix_action/include/defines.inc.php	2012-12-25 01:48:12.133779734 +0100
@@ -458,6 +458,11 @@
 		"Device service uptime: {DISCOVERY.SERVICE.UPTIME}"
 );
 
+define('SUCCEED',      1);
+define('FAIL',         0);
+define('MEDIA_STATUS_ACTIVE',         0);
+
+
 define('ACTION_STATUS_ENABLED',		0);
 define('ACTION_STATUS_DISABLED',	1);
 
diff -Nur /usr/share/zabbix/include/menu.inc.php zabbix_action/include/menu.inc.php
--- /usr/share/zabbix/include/menu.inc.php	2012-12-08 12:09:18.000000000 +0100
+++ zabbix_action/include/menu.inc.php	2012-12-22 23:07:00.516313309 +0100
@@ -174,6 +174,7 @@
 					'tr_logform.php',
 					'tr_testexpr.php',
 					'popup_trexpr.php',
+					'popup_action.php',
 					'host_discovery.php',
 					'disc_prototypes.php',
 					'trigger_prototypes.php'
diff -Nur /usr/share/zabbix/include/views/configuration.triggers.list.php zabbix_action/include/views/configuration.triggers.list.php
--- /usr/share/zabbix/include/views/configuration.triggers.list.php	2012-12-08 12:09:17.000000000 +0100
+++ zabbix_action/include/views/configuration.triggers.list.php	2012-12-22 23:14:20.550355369 +0100
@@ -95,7 +95,8 @@
 	make_sorting_header(_('Name'), 'description', $link),
 	_('Expression'),
 	make_sorting_header(_('Status'), 'status', $link),
-	empty($this->data['parent_discoveryid']) ? _('Error') : null
+	empty($this->data['parent_discoveryid']) ? _('Error') : null,
+	empty($this->data['action_test']) ? _('Action?') : null
 ));
 foreach ($this->data['triggers'] as $tnum => $trigger) {
 	$triggerid = $trigger['triggerid'];
@@ -192,6 +193,17 @@
 		$status = new CLink(_('Enabled'), $status_link, 'enabled');
 	}
 
+        # TODO: Don't show for templates
+        if ($trigger['status'] == TRIGGER_STATUS_ENABLED) {
+                $action_test = new CButton('actions', _('Actions?'), 'return PopUp("popup_action.php?dstfrm=action&triggerid='.$triggerid.'", 550, 400);', 'link_menu');
+        }
+        # Trigger disabled or on a template
+        elseif ($trigger['status'] == TRIGGER_STATUS_DISABLED)  {
+                $action_test = null;
+        }
+
+
+
 	$hosts = null;
 	if (empty($this->data['hostid'])) {
 		foreach ($trigger['hosts'] as $hostid => $host) {
@@ -215,7 +227,8 @@
 		$description,
 		$expressionColumn,
 		$status,
-		$error
+		$error,
+		$action_test
 	));
 	$triggers[$tnum] = $trigger;
 }
diff -Nur /usr/share/zabbix/popup_action.php zabbix_action/popup_action.php
--- /usr/share/zabbix/popup_action.php	1970-01-01 01:00:00.000000000 +0100
+++ zabbix_action/popup_action.php	2012-12-25 23:22:37.333562524 +0100
@@ -0,0 +1,576 @@
+<?php
+/*
+** Zabbix
+** Copyright (C) 2000-2011 Zabbix SIA
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+**/
+
+
+require_once dirname(__FILE__).'/include/config.inc.php';
+require_once dirname(__FILE__).'/include/triggers.inc.php';
+require_once dirname(__FILE__).'/include/forms.inc.php';
+require_once dirname(__FILE__).'/include/perm.inc.php';
+require_once dirname(__FILE__).'/include/js.inc.php';
+
+$page['title'] = _('Action');
+$page['file'] = 'popup_action.php';
+
+define('ZBX_PAGE_NO_MENU', 1);
+
+require_once dirname(__FILE__).'/include/page_header.php';
+
+if ($USER_DETAILS['alias'] == ZBX_GUEST_USER) {
+	access_deny();
+}
+
+//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
+$fields = array(
+	'dstfrm'=>		array(T_ZBX_STR, O_MAND,P_SYS,	NOT_EMPTY,		NULL),
+	'triggerid'=>		array(T_ZBX_INT, O_MAND,P_SYS,	NOT_EMPTY,		NULL),
+
+/* other */
+	'form'=>		array(T_ZBX_STR, O_OPT, P_SYS,	NULL,	NULL),
+);
+
+check_fields($fields);
+
+$triggerid = get_request('triggerid');
+$period = get_request('period', ZBX_DEFAULT_INTERVAL);
+
+
+
+function process_actions($data) {
+	$actions = API::Action()->get(array(
+	'output' => API_OUTPUT_EXTEND,
+            'selectConditions' => API_OUTPUT_EXTEND,
+            'selectOperations' => API_OUTPUT_EXTEND,
+            'output' => API_OUTPUT_EXTEND,
+	        'filter' => array('status' => '0', 'eventsource' => '0'),
+	));
+
+    $valid_actions = array();
+    foreach ($actions as $action) {
+        if (action_conditions($action, $data) == SUCCEED) {
+            $valid_actions[] = $action;
+        }
+    }
+
+    $notifications = execute_operations($data['hosts'][0]['hostid'], $data['priority'], $valid_actions);
+    
+    return $notifications;
+}
+
+
+function action_conditions($action, $data) {
+    $exit = 0;
+    $old_type = -1;
+    $ret = SUCCEED;
+    foreach ($action['conditions'] as $condition) {
+        if ($exit == 0) {
+
+            switch ($action['evaltype']) {
+                case ACTION_EVAL_TYPE_AND_OR:
+                    // OR conditions
+                    if ($old_type == $condition['conditiontype']) {
+                        if (check_trigger_condition($condition, $data) == SUCCEED) {
+                            $ret = SUCCEED;
+                        }
+                    }
+                    // OR conditions
+                    else {
+                        // Break if PREVIOUS AND condition is FALSE
+                        if ($ret == FAIL) {
+                            $exit = 1;
+                        }
+                        elseif (check_trigger_condition($condition, $data) == FAIL) {
+                            $ret = FAIL;
+                        }
+                    }
+
+                    $old_type = $condition['conditiontype'];
+
+                    break;
+                
+                case ACTION_EVAL_TYPE_AND:
+                    // break if any AND condition is FALSE
+                    if (check_trigger_condition($condition, $data) == FAIL) {
+                        $ret = FAIL;
+                        $exit = 1;
+                    }
+                    else {
+                        $ret = SUCCEED;
+                    }
+                    
+                    break;
+
+                case ACTION_EVAL_TYPE_OR:
+                    // break if any OR condition is TRUE
+                    if (check_trigger_condition($condition, $data) == SUCCEED) {
+                        $ret = SUCCEED;
+                        $exit = 1;
+                    }
+                    else {
+                        $ret = FAIL;
+                    }
+
+                    break;
+            }
+        }
+        elseif ($exit == 1) {
+            break;
+        }
+    }
+    return $ret;
+}
+
+
+function check_trigger_condition($condition, $data){
+    $ret = FAIL;
+
+    if ($condition['conditiontype'] == CONDITION_TYPE_HOST_GROUP) {
+
+        $condition_matches = API::Trigger()->get(array(
+                'groupids' => array($condition['value']),
+                'triggerids' => array($data['triggerid']),
+                'countOutput' => '1'
+        ));
+
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_EQUAL:
+                if ($condition_matches == 1)
+                    $ret = SUCCEED;
+                break;
+            case CONDITION_OPERATOR_NOT_EQUAL:
+                if ($condition_matches == 0)
+                    $ret = SUCCEED;
+                break;
+        }
+    }
+    elseif ($condition['conditiontype'] == CONDITION_TYPE_HOST_TEMPLATE) {
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_EQUAL:
+            case CONDITION_OPERATOR_NOT_EQUAL:
+                $triggerid = $data['triggerid'];
+
+                //Loop until you hit the template
+                while ($ret != SUCCEED and $triggerid != 0){
+                    $condition_matches = API::Trigger()->get(array(
+                            'triggerids' => $triggerid,
+                            'selectHosts' => API_OUTPUT_EXTEND,
+                            'output' => API_OUTPUT_EXTEND,
+                    ));
+                    if ($condition_matches) {
+
+                        $triggerid = $condition_matches[0]['templateid'];
+
+                        if ($condition_matches[0]['hosts'][0]['hostid'] == $condition['value']) {
+                            $ret = SUCCEED;
+                            break;
+                        }
+                    }
+                    else {
+                        $triggerid = 0;
+                    }
+                }
+                if ($condition['operator'] == CONDITION_OPERATOR_NOT_EQUAL) {
+                    $ret = ($ret == SUCCEED) ? FAIL : SUCCEED;
+                break;
+                }
+        }
+    }
+    elseif ($condition['conditiontype'] == CONDITION_TYPE_HOST) {
+
+        if ($data['hosts'][0]['hostid'] == $condition['value']) {
+            $condition_matches = 1;
+        }
+        else {
+            $condition_matches = 0;
+        }
+
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_EQUAL:
+                if ($condition_matches == 1){
+                    $ret = SUCCEED;}
+                break;
+            case CONDITION_OPERATOR_NOT_EQUAL:
+                if ($condition_matches == 0){
+                    $ret = SUCCEED;}
+                break;
+        }
+    }
+    elseif ($condition['conditiontype'] == CONDITION_TYPE_TRIGGER) {
+
+        if ($data['triggerid'] == $condition['value']) {
+            $condition_matches = 1;
+        }
+        else {
+            $condition_matches = 0;
+        }
+
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_EQUAL:
+                if ($condition_matches == 1)
+                    $ret = SUCCEED;
+                break;
+            case CONDITION_OPERATOR_NOT_EQUAL:
+                if ($condition_matches == 0)
+                    $ret = SUCCEED;
+                break;
+        }
+    }
+    elseif ($condition['conditiontype'] == CONDITION_TYPE_TRIGGER_NAME) {
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_LIKE:
+                if (strstr($data['description'], $condition['value'])) {
+                    $ret = SUCCEED;
+                }
+                break;
+            case CONDITION_OPERATOR_NOT_LIKE:
+                if (!strstr($data['description'], $condition['value'])) {
+                    $ret = SUCCEED;
+                }
+                break;
+        }
+    }
+    elseif ($condition['conditiontype'] == CONDITION_TYPE_TRIGGER_SEVERITY) {
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_EQUAL:
+                if ($data['priority'] == $condition['value']) {
+                    $ret = SUCCEED;
+                }
+                break;
+            case CONDITION_OPERATOR_NOT_EQUAL:
+                if ($data['priority'] != $condition['value']) {
+                    $ret = SUCCEED;
+                }
+                break;
+            case CONDITION_OPERATOR_MORE_EQUAL:
+                if ($data['priority'] >= $condition['value']) {
+                    $ret = SUCCEED;
+                }
+                break;
+            case CONDITION_OPERATOR_LESS_EQUAL:
+                if ($data['priority'] <= $condition['value']) {
+                    $ret = SUCCEED;
+                }
+                break;
+        }
+    }
+    elseif ($condition['conditiontype'] == CONDITION_TYPE_TRIGGER_VALUE) {
+        //TODO: Not implemented yet; should only be relevant for recovery messages
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_EQUAL:
+                break;
+        }
+        $ret = SUCCEED;
+    }
+    elseif ($condition['conditiontype'] == CONDITION_TYPE_TIME_PERIOD) {
+	//TODO: Not implemented yet
+        //TODO: Implement a check_time_period function
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_IN:
+                break;
+            case CONDITION_OPERATOR_NOT_IN:
+                break;
+        }
+        $ret = SUCCEED;
+    }
+    elseif ($condition['conditiontype'] == CONDITION_TYPE_MAINTENANCE) {
+	//TODO: Not implemented yet
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_IN:
+                break;
+            case CONDITION_OPERATOR_NOT_IN:
+                break;
+        }
+        $ret = SUCCEED;
+    }
+    elseif ($condition['conditiontype'] == CONDITION_TYPE_APPLICATION) {
+        $items = array_map(function($item) {return $item['itemid'];}, $data['items']);
+        //No output customization possible
+        $applications = API::Application()->get(array(
+            'itemids' => $items,
+	        'output' => API_OUTPUT_EXTEND,
+            ));
+
+        switch ($condition['operator']) {
+            case CONDITION_OPERATOR_EQUAL:
+                
+                foreach ($applications as $app) {
+                   if (strcmp($app['name'], $condition['value'])){
+                       $ret = SUCCEED;
+                       break;
+                   }
+                }
+                break;
+            case CONDITION_OPERATOR_LIKE:
+                foreach ($applications as $app) {
+                   if (strstr($app['name'], $condition['value'])){
+                       $ret = SUCCEED;
+                       break;
+                   }
+                }
+                break;
+            case CONDITION_OPERATOR_NOT_LIKE:
+                $ret = SUCCEED;
+                foreach ($applications as $app) {
+                   if (strstr($app['name'], $condition['value'])){
+                       $ret = FAIL;
+                       break;
+                   }
+                }
+                break;
+        }
+    }
+    return $ret;
+}
+
+
+// Operations
+function get_host_permissions($userid, $hostid) {
+    $user = API::User()->get(array(
+        'userids' => $userid,
+        'output' => API_OUTPUT_EXTEND
+    ));
+
+    if ($user[0]['type'] == USER_TYPE_SUPER_ADMIN) {
+        $ret = SUCCEED;
+        return $ret;
+    }
+    //Found nothing fitting in the API
+    //get_accessible_hosts_by_user
+    //get_accessible_groups_by_user
+    //get_accessible_hosts_by_rights
+    //get_accessible_groups_by_rights
+
+    $sql = 'SELECT MIN(r.permission)'.
+           ' FROM rights r, hosts_groups hg, users_groups ug'.
+           ' WHERE r.groupid=ug.usrgrpid'.
+            ' AND r.id=hg.groupid'.
+            ' AND hg.hostid='.$hostid.
+            ' AND ug.userid='.$userid;
+    $permission = DBfetchArray(DBselect($sql));
+    if ($permission[0]['min'] > PERM_DENY) {
+        $ret = SUCCEED;
+    }
+    else {
+        $ret = FAIL;
+    }
+
+    return $ret;
+}
+
+
+function add_user_msg($hostid, $earlier_results) {
+    $preliminary_results = array();
+
+    //User is enabled and allowed to receive notification for this host
+    foreach ($earlier_results as $earlier_result) {
+        if (check_perm2system($earlier_result['userid']) AND get_host_permissions($earlier_result['userid'], $hostid) == SUCCEED) {
+            $preliminary_results[] = $earlier_result;
+        }
+    }
+    return $preliminary_results;
+}
+
+
+function add_object_msg($hostid, $priority, $action_name, $operation) {
+    $preliminary_result = array();
+    $mediatypeid = $operation['opmessage']['mediatypeid'];
+
+    //Operations on per user group basis
+    if ($operation['opmessage_grp']) {
+        $usergroups = array_map(function($item) {return $item['usrgrpid'];}, $operation['opmessage_grp']);
+
+        //Multiple user groups can be specified per operation
+        foreach ($usergroups as $usergroup) {
+            $users = API::Usergroup()->get(array(
+                'usrgrpids' => $usergroup,
+                'selectUsers' => API_OUTPUT_EXTEND
+            ));
+            foreach ($users[0]['users'] as $user) {
+                $preliminary_result[] = array('action_name' => $action_name, 'alias' => $user['alias'], 'userid' => $user['userid'], 'reason' => 'Group', 'mediatypeid' => $mediatypeid);
+            }
+        }
+    }
+
+    //Operations on per user basis
+    if ($operation['opmessage_usr']) {
+        $users = array_map(function($item) {return $item['userid'];}, $operation['opmessage_usr']);
+
+        //Multiple users can be specified per operation
+        foreach ($users as $user) {
+            $users = API::User()->get(array(
+                'userids' => $user,
+                'output' => API_OUTPUT_EXTEND
+            ));
+
+            foreach ($users as $user) {
+                $preliminary_result[] = array('action_name' => $action_name, 'alias' => $user['alias'], 'userid' => $user['userid'], 'reason' => 'User', 'mediatypeid' => $mediatypeid);
+            }
+        }
+    }
+
+    $notifications = add_user_msg($hostid, $preliminary_result);
+    return $notifications;
+}
+
+
+function add_message_alert($priority, $preliminary_results) {
+    //TODO: Ignoring temporal restrictions for now
+    $results = array();
+
+    //Mediatype active system-wide?
+    $mediatypes = API::Mediatype()->get(array(
+        'output' => API_OUTPUT_EXTEND,
+        'filter' => array('status' => 0),
+        'preservekeys' => '1'
+    ));
+
+    foreach ($preliminary_results as $preliminary_result) {
+        if ($preliminary_result['mediatypeid'] == 0) {
+            $usermedias = API::Usermedia()->get(array(
+                'userids' => $preliminary_result['userid'],
+                'filter' => array('active' => MEDIA_STATUS_ACTIVE),
+                'output' => API_OUTPUT_EXTEND
+            ));
+            if ($usermedias) {
+                foreach ($usermedias as $usermedia) {
+                    // Severity not covered by media?
+                    if((1 << $priority & $usermedia['severity']) == 0) {
+                        continue;
+                    }
+
+                    if (array_key_exists($usermedia['mediatypeid'],$mediatypes)) {
+                        $preliminary_result['mediatypeid'] = $mediatypes[$usermedia['mediatypeid']]['description'];
+                        $preliminary_result['sendto'] = $usermedia['sendto'];
+                        $results[] = $preliminary_result;
+                    }
+                }
+            }
+        }
+        else {
+            $usermedia = API::Usermedia()->get(array(
+                'userids' => $preliminary_result['userid'],
+                'filter' => array('active' => MEDIA_STATUS_ACTIVE),
+                'mediatypeids' => $preliminary_result['mediatypeid'],
+                'output' => API_OUTPUT_EXTEND
+            ));
+            if ($usermedia AND array_key_exists($usermedia[0]['mediatypeid'], $mediatypes) AND (1 << $priority & $usermedia[0]['severity']) != 0) {
+                $preliminary_result['mediatypeid'] = $mediatypes[$usermedia[0]['mediatypeid']]['description'];
+                $preliminary_result['sendto'] = $usermedia[0]['sendto'];
+                $results[] = $preliminary_result;
+            }
+        }
+    }
+    return $results;
+}
+
+
+function execute_operations($hostid, $priority, $actions) {
+    // Escalation belongs here
+    $result = array();
+
+    foreach ($actions as $action) {
+        $operation = array_pop($action['operations']);
+        // Messaging
+        if ($operation['operationtype'] == OPERATION_TYPE_MESSAGE) {
+            $result = array_merge(add_object_msg($hostid, $priority, $action['name'],$operation), $result);
+            $final = add_message_alert($priority, $result);
+        }
+    }
+    return $final;
+}
+
+
+//////////////////////
+
+$data = API::Trigger()->get(array(
+	'triggerids' => $triggerid,
+    'expandDescription' => '1',
+	'output' => API_OUTPUT_EXTEND,
+	'selectGroups' => API_OUTPUT_EXTEND,
+	'selectHosts' => API_OUTPUT_EXTEND,
+	'selectItems' => API_OUTPUT_EXTEND,
+	'selectFunctions' => API_OUTPUT_EXTEND,
+	'selectDependencies' => API_OUTPUT_EXTEND,
+	'selectDiscoveryRule' => API_OUTPUT_EXTEND
+));
+
+$frmAction = new CFormTable(_('Actions caused'));
+$frmAction->setName('frmAction');
+$frmAction->addVar('dstfrm', $_REQUEST['dstfrm']);
+$frmAction->addVar('triggerid', $_REQUEST['triggerid']);
+
+$trigger = $data[0]['description'];
+$description = array();
+
+$dependencies = $data[0]['dependencies'];
+if (count($dependencies) > 0) {
+	foreach ($dependencies as $dep_trigger) {
+
+		$db_hosts = get_hosts_by_triggerid($dep_trigger['triggerid']);
+		while ($host = DBfetch($db_hosts)) {
+			$description[] = $host['name'];
+			$description[] = ', ';
+		}
+		array_pop($description);
+		$description[] = ' : ';
+		$description[] = $dep_trigger['description'];
+	}
+}
+
+$frmAction->addRow(_('Trigger'), new CSpan($trigger, 'unknown'));
+$frmAction->addRow(_('Depends on'), new CSpan($description, 'unknown'));
+
+$notifications = process_actions($data[0]);
+
+$table = new CTableInfo(_('No actions caused.'));
+
+$table->setHeader(array(
+	_('Action name'),
+	_('Alias'),
+	_('Send To'),
+	_('Media type'),
+	_('Reason')
+));
+
+foreach ($notifications as $notification) {
+    $table->addRow(array(
+        $notification['action_name'],
+        $notification['alias'],
+        $notification['sendto'],
+        $notification['mediatypeid'],
+        $notification['reason'],
+        ));
+}
+
+$frmAction->addRow(_('Actions'), $table);
+
+//IDEA: Escalation could be integrated by offering a time slider and re-evaluate on that basis.
+
+//TODO: Not operational yet; Better use 3 drop-downs for dow, hour and minute instead of that
+$frmAction->addRow(_('Time'), new CTextBox('period', $period, 48));
+//TODO: Not operational yet
+$frmAction->addRow(_('Maintenance'), new CCheckbox('maintenance', 'no'));
+//TODO: Not operational yet; Should send the updated request but doesn't do so yet
+$frmAction->addItemToBottomRow(array(
+	new CSubmit('re_eval', _('Re-evaluate')),
+	new CButton('close', _('Close'),'javascript: self.close();'),
+));
+$frmAction->Show();
+
+require_once dirname(__FILE__).'/include/page_footer.php';
