diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-01 19:12:49 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-01 19:12:49 +0000 |
| commit | f2fe9b26d4ea08aa35e4e25ba471033e60784438 (patch) | |
| tree | d59e90991bc52bc8490e4125b6d45b6fe933be28 /frontends/php | |
| parent | 48f36a600707df682879ab0143aa668776a422db (diff) | |
Update of actions in GUI.
git-svn-id: svn://svn.zabbix.com/trunk@2466 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
| -rw-r--r-- | frontends/php/actionconf.php | 31 | ||||
| -rw-r--r-- | frontends/php/include/actions.inc.php | 30 | ||||
| -rw-r--r-- | frontends/php/include/db.inc.php | 2 | ||||
| -rw-r--r-- | frontends/php/include/forms.inc.php | 25 | ||||
| -rw-r--r-- | frontends/php/include/locales/en_gb.inc.php | 3 |
5 files changed, 47 insertions, 44 deletions
diff --git a/frontends/php/actionconf.php b/frontends/php/actionconf.php index b88a324f..458ff316 100644 --- a/frontends/php/actionconf.php +++ b/frontends/php/actionconf.php @@ -63,12 +63,12 @@ if(isset($_REQUEST["userid"])) { $user=get_user_by_userid($_REQUEST["userid"]); - add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_ACTION,"User [".$user["alias"]."] when [".$_REQUEST["good"]."] subject [".$_REQUEST["subject"]."]"); + add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_ACTION,"User [".$user["alias"]."] subject [".$_REQUEST["subject"]."]"); } else { $group=get_group_by_groupid($_REQUEST["usrgrpid"]); - add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_ACTION,"User [".$group["name"]."] when [".$_REQUEST["good"]."] subject [".$_REQUEST["subject"]."]"); + add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_ACTION,"User [".$group["name"]."] subject [".$_REQUEST["subject"]."]"); } } } @@ -79,24 +79,33 @@ $_REQUEST["maxrepeats"]=0; $_REQUEST["repeatdelay"]=600; } - - $result=update_action( $_REQUEST["actionid"], $_REQUEST["filter_triggerid"], $_REQUEST["userid"], $_REQUEST["good"], $_REQUEST["delay"], $_REQUEST["subject"], $_REQUEST["message"],$_REQUEST["scope"],$_REQUEST["severity"],$_REQUEST["recipient"],$_REQUEST["usrgrpid"],$_REQUEST["maxrepeats"],$_REQUEST["repeatdelay"]); - update_action_from_linked_hosts($_REQUEST["actionid"]); - show_messages($result,S_ACTION_UPDATED,S_CANNOT_UPDATE_ACTION); - if($result) + + $actionid=$_REQUEST["actionid"]; + + update_action($actionid, $_REQUEST["userid"], $_REQUEST["delay"], $_REQUEST["subject"], $_REQUEST["message"],$_REQUEST["recipient"],$_REQUEST["usrgrpid"],$_REQUEST["maxrepeats"],$_REQUEST["repeatdelay"]); + $sql="delete from conditions where actionid=$actionid"; + DBexecute($sql); + for($i=1;$i<=1000;$i++) + { + if(isset($_REQUEST["conditiontype$i"])) + { + add_action_condition($actionid,$_REQUEST["conditiontype$i"], $_REQUEST["conditionop$i"], $_REQUEST["conditionvalue$i"]); + } + } + show_messages($actionid,S_ACTION_UPDATED,S_CANNOT_UPDATE_ACTION); + if($actionid) { if(isset($_REQUEST["userid"])) { $user=get_user_by_userid($_REQUEST["userid"]); - add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ACTION,"User [".$user["alias"]."] when [".$_REQUEST["good"]."] subject [".$_REQUEST["subject"]."]"); + add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ACTION,"User [".$user["alias"]."] subject [".$_REQUEST["subject"]."]"); } else { $group=get_group_by_groupid($_REQUEST["usrgrpid"]); - add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ACTION,"User [".$group["name"]."] when [".$_REQUEST["good"]."] subject [".$_REQUEST["subject"]."]"); + add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_ACTION,"User [".$group["name"]."] subject [".$_REQUEST["subject"]."]"); } } - unset($_REQUEST["actionid"]); } if($_REQUEST["register"]=="delete") { @@ -105,7 +114,7 @@ show_messages($result,S_ACTION_DELETED,S_CANNOT_DELETE_ACTION); if($result) { - add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_ACTION,"When [".$_REQUEST["good"]."] subject [".$_REQUEST["subject"]."]"); + add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_ACTION,"Subject [".$_REQUEST["subject"]."]"); } unset($_REQUEST["actionid"]); } diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php index 31e73ffd..afa34a76 100644 --- a/frontends/php/include/actions.inc.php +++ b/frontends/php/include/actions.inc.php @@ -34,15 +34,15 @@ return $result; } - # Update Action + # Add Action - function update_action( $actionid, $filter_triggerid, $userid, $good, $delay, $subject, $message, $severity, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) + function add_action( $userid, $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) { @@ -52,19 +52,17 @@ { $id = $usrgrpid; } - $subject=addslashes($subject); - $message=addslashes($message); - $sql="update actions set filter_triggerid=$filter_triggerid,userid=$id,good=$good,delay=$delay,nextcheck=0,subject='$subject',message='$message',severity=$severity,recipient=$recipient,maxrepeats=$maxrepeats,repeatdelay=$repeatdelay where actionid=$actionid"; + $sql="insert into actions (userid,delay,nextcheck,subject,message,recipient,maxrepeats,repeatdelay) values ($id,$delay,0,'$subject','$message',$recipient,$maxrepeats,$repeatdelay)"; $result=DBexecute($sql); - return $result; + return DBinsert_id($result,"actions","actionid"); } - # Add Action + # Update Action - function add_action( $userid, $delay, $subject, $message, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) + function update_action($actionid, $userid, $delay, $subject, $message, $recipient, $usrgrpid, $maxrepeats, $repeatdelay) { -// if(!check_right_on_trigger("A",$triggerid)) +// if(!check_right_on_trigger("U",$triggerid)) // { // error("Insufficient permissions"); // return 0; @@ -79,9 +77,9 @@ $id = $usrgrpid; } - $sql="insert into actions (userid,delay,nextcheck,subject,message,recipient,maxrepeats,repeatdelay) values ($id,$delay,0,'$subject','$message',$recipient,$maxrepeats,$repeatdelay)"; + $sql="update actions set userid=$id,delay=$delay,nextcheck=0,subject='$subject',message='$message',recipient=$recipient,maxrepeats=$maxrepeats, repeatdelay=$repeatdelay where actionid=$actionid"; $result=DBexecute($sql); - return DBinsert_id($result,"actions","actionid"); + return $result; } # Delete Action by userid diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index 26716087..395a454f 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -79,7 +79,7 @@ { global $DB,$DB_TYPE; -// echo $query."<br>"; + echo $query."<br>"; if($DB_TYPE == "MYSQL") { diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index cf5455df..6b3e2492 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -986,7 +986,7 @@ } show_form_begin("triggers.trigger"); - echo "Trigger configuration"; + echo S_TRIGGER; show_table2_v_delimiter($col++); if(isset($hostid)) @@ -1503,7 +1503,6 @@ $actionid=$action["actionid"]; $actiontype=$action["actiontype"]; $source=$action["source"]; - $good=$action["good"]; $delay=$action["delay"]; // Otherwise symbols like ",' will not be shown $subject=htmlspecialchars($action["subject"]); @@ -1548,27 +1547,22 @@ // $delay=30; $delay=@iif(isset($_REQUEST["delay"]),$_REQUEST["delay"],30); // $subject=$description; - $subject=@iif(isset($_REQUEST["subject"]),$_REQUEST["subject"],$description); + $subject=@iif(isset($_REQUEST["subject"]),$_REQUEST["subject"],"{TRIGGER.NAME}: {STATUS}"); + $message=@iif(isset($_REQUEST["message"]),$_REQUEST["message"],"{TRIGGER.NAME}: {STATUS}"); $scope=@iif(isset($_REQUEST["scope"]),$_REQUEST["scope"],0); - $good=@iif(isset($_REQUEST["good"]),$_REQUEST["good"],1); $recipient=@iif(isset($_REQUEST["recipient"]),$_REQUEST["recipient"],RECIPIENT_TYPE_GROUP); // $severity=0; $severity=@iif(isset($_REQUEST["severity"]),$_REQUEST["severity"],0); $maxrepeats=@iif(isset($_REQUEST["maxrepeats"]),$_REQUEST["maxrepeats"],0); $repeatdelay=@iif(isset($_REQUEST["repeatdelay"]),$_REQUEST["repeatdelay"],600); $repeat=@iif(isset($_REQUEST["repeat"]),$_REQUEST["repeat"],0); - - if(isset($_REQUEST["message"])) - { - $message=$_REQUEST["message"]; - } } $conditiontype=@iif(isset($_REQUEST["conditiontype"]),$_REQUEST["conditiontype"],0); show_form_begin("actions.action"); - echo nbsp(S_NEW_ACTION); + echo nbsp(S_ACTION); $col=0; show_table2_v_delimiter($col++); @@ -1579,19 +1573,21 @@ } echo nbsp(S_SOURCE); show_table2_h_delimiter(); - echo "<select class=\"biginput\" name=\"good\" size=1>"; + echo "<select class=\"biginput\" name=\"source\" size=1>"; echo "<OPTION VALUE=\"0\""; if($source==0) echo "SELECTED"; echo ">".S_TRIGGER; echo "</SELECT>"; show_table2_v_delimiter($col); - echo nbsp("Conditions"); + echo nbsp(S_CONDITIONS); show_table2_h_delimiter(); + $found=0; for($i=1;$i<=1000;$i++) { if(isset($_REQUEST["conditiontype$i"])) { echo "<input type=checkbox name=\"conditionchecked$i\">".get_condition_desc($_REQUEST["conditiontype$i"],$_REQUEST["conditionop$i"],$_REQUEST["conditionvalue$i"]); echo "<br>"; + $found=1; } } @@ -1604,6 +1600,7 @@ echo "<input name=\"conditionvalue$i\" type=\"hidden\" value=\"".$_REQUEST["conditionvalue$i"]."\">"; } } + if($found==0) echo S_NO_CONDITIONS_DEFINED; show_table2_v_delimiter($col++); echo nbsp(" "); @@ -1638,11 +1635,9 @@ if(in_array($conditiontype,array(CONDITION_TYPE_TRIGGER_SEVERITY))) $h2=$h2.form_select("operator",CONDITION_OPERATOR_MORE_EQUAL,">="); $h2=$h2."</SELECT>"; -// echo $h2; - show_table2_v_delimiter($col); - echo nbsp(" Condition"); + echo nbsp(S_CONDITION); show_table2_h_delimiter(); if($conditiontype == CONDITION_TYPE_GROUP) diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php index 19078856..7d6d90a8 100644 --- a/frontends/php/include/locales/en_gb.inc.php +++ b/frontends/php/include/locales/en_gb.inc.php @@ -63,6 +63,8 @@ "S_TIME_PERIOD"=> "Time period", "S_TRIGGER_DESCRIPTION"=> "Trigger description", "S_CONDITIONS"=> "Conditions", + "S_CONDITION"=> "Condition", + "S_NO_CONDITIONS_DEFINED"=> "No conditions defined", // actions.php "S_ACTIONS"=> "Actions", @@ -80,7 +82,6 @@ "S_ON"=> "ON", "S_OFF"=> "OFF", "S_NO_ACTIONS_DEFINED"=> "No actions defined", - "S_NEW_ACTION"=> "New action", "S_SINGLE_USER"=> "Single user", "S_USER_GROUP"=> "User group", "S_GROUP"=> "Group", |
