diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-06-04 12:45:23 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-06-04 12:45:23 +0000 |
| commit | 546e672bbc33aae643ff0ed08275db89da9bde31 (patch) | |
| tree | 642923d9ac4467debb0dd2b3c2ad5bb3043bddb8 /frontends/php/include | |
| parent | 4aa6a1f2f879f2564386c713e3e601e3012db512 (diff) | |
| download | zabbix-546e672bbc33aae643ff0ed08275db89da9bde31.tar.gz zabbix-546e672bbc33aae643ff0ed08275db89da9bde31.tar.xz zabbix-546e672bbc33aae643ff0ed08275db89da9bde31.zip | |
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@1815 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/db.inc.php | 1 | ||||
| -rw-r--r-- | frontends/php/include/defines.inc.php | 1 | ||||
| -rw-r--r-- | frontends/php/include/escalations.inc.php | 21 | ||||
| -rw-r--r-- | frontends/php/include/forms.inc.php | 72 | ||||
| -rw-r--r-- | frontends/php/include/local_en.inc.php | 2 |
5 files changed, 97 insertions, 0 deletions
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 "<form method=\"get\" action=\"config.php\">"; + echo "<input class=\"biginput\" name=\"config\" type=\"hidden\" value=\"".$_GET["config"]."\" size=8>"; + echo "<input class=\"biginput\" name=\"escalationid\" type=\"hidden\" value=\"$escalationid\" size=8>"; + if(isset($escalationruleid)) + { + echo "<input class=\"biginput\" name=\"escalationruleid\" type=\"hidden\" value=\"$escalationruleid\" size=8>"; + } + + echo S_LEVEL; + show_table2_h_delimiter(); + echo "<input class=\"biginput\" name=\"level\" size=2 value=\"$level\">"; + + show_table2_v_delimiter($col++); + echo S_PERIOD; + show_table2_h_delimiter(); + echo "<input class=\"biginput\" name=\"period\" size=32 value=\"$period\">"; + + show_table2_v_delimiter($col++); + echo S_DELAY; + show_table2_h_delimiter(); + echo "<input class=\"biginput\" name=\"delay\" size=32 value=\"$delay\">"; + + show_table2_v_delimiter($col++); + echo S_ACTION; + show_table2_h_delimiter(); + echo "<SELECT class=\"biginput\" NAME=\"actiontype\" size=\"1\">"; + echo "<OPTION VALUE=\"0\" "; if($actiontype==0) echo "SELECTED"; echo ">Do nothing"; + echo "<OPTION VALUE=\"1\" "; if($actiontype==1) echo "SELECTED"; echo ">Execute actions"; + echo "<OPTION VALUE=\"2\" "; if($actiontype==2) echo "SELECTED"; echo ">Increase severity"; + echo "<OPTION VALUE=\"3\" "; if($actiontype==3) echo "SELECTED"; echo ">Increase administrative hierarcy"; + echo "</SELECT>"; + + + show_table2_v_delimiter2($col++); + echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"add rule\">"; + if(isset($escalationid)) + { + echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"update rule\">"; + echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"delete rule\" onClick=\"return Confirm('Delete selected escalation rule?');\">"; + } + + 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"); |
