From 546e672bbc33aae643ff0ed08275db89da9bde31 Mon Sep 17 00:00:00 2001 From: hugetoad Date: Sat, 4 Jun 2005 12:45:23 +0000 Subject: Minor changes. git-svn-id: svn://svn.zabbix.com/trunk@1815 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/include/db.inc.php | 1 + frontends/php/include/defines.inc.php | 1 + frontends/php/include/escalations.inc.php | 21 +++++++++ frontends/php/include/forms.inc.php | 72 +++++++++++++++++++++++++++++++ frontends/php/include/local_en.inc.php | 2 + 5 files changed, 97 insertions(+) (limited to 'frontends/php/include') diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index 64f07f63..007f58e1 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -85,6 +85,7 @@ if(!$result) { error("SQL error: ".mysql_error()); + error("Query: $query"); } return $result; } diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php index c179dbd1..0951452f 100644 --- a/frontends/php/include/defines.inc.php +++ b/frontends/php/include/defines.inc.php @@ -39,6 +39,7 @@ define("AUDIT_RESOURCE_GRAPH", 6); define("AUDIT_RESOURCE_GRAPH_ELEMENT", 7); define("AUDIT_RESOURCE_ESCALATION", 8); + define("AUDIT_RESOURCE_ESCALATION_RULE",9); diff --git a/frontends/php/include/escalations.inc.php b/frontends/php/include/escalations.inc.php index 32c70e96..7f0576b8 100644 --- a/frontends/php/include/escalations.inc.php +++ b/frontends/php/include/escalations.inc.php @@ -101,4 +101,25 @@ return $result; } + + # Add escalation rule definition + + function add_escalation_rule($escalationid,$level,$period,$delay,$actiontype) + { + if(!check_right("Configuration of Zabbix","U",0)) + { + error("Insufficient permissions"); + return 0; + } + + $sql="insert into escalation_rules (escalationid,level,period,delay,actiontype) values ($escalationid,$level,'$period',$delay,$actiontype)"; + $result=DBexecute($sql); + if(!$result) + { + return $result; + } + $escalationruleid=DBinsert_id($result,"escalation_rules","escalationruleid"); + + return $result; + } ?> diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index f25fd897..80a3253a 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -1110,4 +1110,76 @@ show_table2_header_end(); } + + # Insert escalation rule form + function insert_escalation_rule_form($escalationid,$escalationruleid) + { + if(isset($escalationruleid)) + { + $result=DBselect("select * from escalation_rules where escalationruleid=$escalationruleid"); + + $row=DBfetch($result); + + $level=$row["level"]; + $period=$row["period"]; + $delay=$row["delay"]; + $actiontype=$row["actiontype"]; + } + else + { + $level=1; + $period="1-7,00:00-23:59"; + $delay=0; + $actiontype=0; + } + + $col=0; + + show_form_begin("escalationrule"); + echo S_ESCALATION_RULE; + + show_table2_v_delimiter($col++); + echo "
"; + echo ""; + echo ""; + if(isset($escalationruleid)) + { + echo ""; + } + + echo S_LEVEL; + show_table2_h_delimiter(); + echo ""; + + show_table2_v_delimiter($col++); + echo S_PERIOD; + show_table2_h_delimiter(); + echo ""; + + show_table2_v_delimiter($col++); + echo S_DELAY; + show_table2_h_delimiter(); + echo ""; + + show_table2_v_delimiter($col++); + echo S_ACTION; + show_table2_h_delimiter(); + echo ""; + + + show_table2_v_delimiter2($col++); + echo ""; + if(isset($escalationid)) + { + echo ""; + echo ""; + } + + show_table2_header_end(); + } ?> diff --git a/frontends/php/include/local_en.inc.php b/frontends/php/include/local_en.inc.php index d36fc027..1b100c33 100644 --- a/frontends/php/include/local_en.inc.php +++ b/frontends/php/include/local_en.inc.php @@ -171,6 +171,8 @@ define("S_ESCALATION_DETAILS_BIG", "ESCALATION DETAILS"); define("S_ESCALATION_ADDED", "Escalation added"); define("S_ESCALATION_WAS_NOT_ADDED", "Escalation was not added"); + define("S_ESCALATION_RULE_ADDED", "Escalation rule added"); + define("S_ESCALATION_RULE_WAS_NOT_ADDED", "Escalation rule was not added"); define("S_ESCALATION_UPDATED", "Escalation updated"); define("S_ESCALATION_WAS_NOT_UPDATED", "Escalation was not updated"); define("S_ESCALATION_DELETED", "Escalation deleted"); -- cgit