From ffce4b50729fa5ee0e11a666fb0ee4b76eebf342 Mon Sep 17 00:00:00 2001 From: hugetoad Date: Tue, 27 Dec 2005 13:28:14 +0000 Subject: Minor changes. git-svn-id: svn://svn.zabbix.com/trunk@2431 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/include/actions.inc.php | 51 +++++++++++++++--- frontends/php/include/defines.inc.php | 11 ++++ frontends/php/include/forms.inc.php | 83 +++++++++++++++++++---------- frontends/php/include/locales/en_gb.inc.php | 1 + 4 files changed, 111 insertions(+), 35 deletions(-) (limited to 'frontends/php/include') diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php index fed442eb..7b6b4370 100644 --- a/frontends/php/include/actions.inc.php +++ b/frontends/php/include/actions.inc.php @@ -62,13 +62,13 @@ # Add Action - function add_action( $filter_triggerid, $userid, $good, $delay, $subject, $message, $scope, $severity, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) + function add_action( $userid, $good, $delay, $subject, $message, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) { - if(!check_right_on_trigger("A",$triggerid)) - { - error("Insufficient permissions"); - return 0; - } +// if(!check_right_on_trigger("A",$triggerid)) +// { +// error("Insufficient permissions"); +// return 0; +// } if($recipient == RECIPIENT_TYPE_USER) { @@ -79,7 +79,7 @@ $id = $usrgrpid; } - $sql="insert into actions (tilter_triggerid,userid,good,delay,nextcheck,subject,message,severity,recipient,maxrepeats,repeatdelay) values ($filter_triggerid,$id,$good,$delay,0,'$subject','$message',$severity,$recipient,$maxrepeats,$repeatdelay)"; + $sql="insert into actions (userid,good,delay,nextcheck,subject,message,recipient,maxrepeats,repeatdelay) values ($id,$good,$delay,0,'$subject','$message',$recipient,$maxrepeats,$repeatdelay)"; $result=DBexecute($sql); return DBinsert_id($result,"actions","actionid"); } @@ -264,4 +264,41 @@ } return $desc; } + + function get_condition_desc($conditiontype, $operator, $value) + { + if($operator == CONDITION_OPERATOR_EQUAL) + { + $op="="; + } + else if($operator == CONDITION_OPERATOR_NOT_EQUAL) + { + $op="<>"; + } + + $desc=S_UNKNOWN; + if($conditiontype==CONDITION_TYPE_GROUP) + { + $group=get_group_by_groupid($value); + if($group) $desc=S_HOST_GROUP." $op "."\"".$group["name"]."\""; + } + else if($conditiontype==CONDITION_TYPE_TRIGGER_NAME) + { + $desc=S_TRIGGER_DESCRIPTION." $op "."\"".$value."\""; + } + else + { + } + return $desc; + } + + # Add Action's condition + + function add_action_condition($actionid, $conditiontype, $operator, $value) + { + $value=addslashes($value); + $sql="insert into conditions (actionid,conditiontype,operator,value) values ($actionid,$conditiontype,$operator,'$value')"; + $result=DBexecute($sql); + return DBinsert_id($result,"conditions","conditionid"); + } ?> diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php index 1b8bf426..76fbdc72 100644 --- a/frontends/php/include/defines.inc.php +++ b/frontends/php/include/defines.inc.php @@ -42,6 +42,17 @@ define("AUDIT_RESOURCE_ESCALATION_RULE",9); define("AUDIT_RESOURCE_AUTOREGISTRATION",10); + define("CONDITION_TYPE_GROUP", 0); + define("CONDITION_TYPE_HOST", 1); + define("CONDITION_TYPE_TRIGGER", 2); + define("CONDITION_TYPE_TRIGGER_NAME", 3); + define("CONDITION_TYPE_TRIGGER_SEVERITY",4); + define("CONDITION_TYPE_TRIGGER_VALUE", 5); + define("CONDITION_TYPE_TIME_PERIOD", 6); + + define("CONDITION_OPERATOR_EQUAL", 0); + define("CONDITION_OPERATOR_NOT_EQUAL", 1); + define("HOST_STATUS_MONITORED", 0); define("HOST_STATUS_NOT_MONITORED", 1); // define("HOST_STATUS_UNREACHABLE", 2); diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index bb1e7d38..deb740b7 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -1501,11 +1501,7 @@ $actionid=$action["actionid"]; $actiontype=$action["actiontype"]; - $filter_triggerid=$action["filter_triggerid"]; - $filter_groupid=$action["filter_groupid"]; - $filter_hostid=$action["filter_hostid"]; $source=$action["source"]; - $filter_trigger_name=$action["filter_trigger_name"]; $good=$action["good"]; $delay=$action["delay"]; // Otherwise symbols like ",' will not be shown @@ -1513,7 +1509,6 @@ $message=$action["message"]; $uid=$action["userid"]; $scope=@iif(isset($_REQUEST["scope"]),$_REQUEST["scope"],$action["scope"]); - $severity=$action["severity"]; $recipient=@iif(isset($_REQUEST["recipient"]),$_REQUEST["recipient"],$action["recipient"]); $maxrepeats=$action["maxrepeats"]; $repeatdelay=$action["repeatdelay"]; @@ -1559,7 +1554,7 @@ } } - $filtertype=@iif(isset($_REQUEST["filtertype"]),$_REQUEST["filtertype"],0); + $conditiontype=@iif(isset($_REQUEST["conditiontype"]),$_REQUEST["conditiontype"],0); show_form_begin("actions.action"); @@ -1578,43 +1573,73 @@ echo "