From bd14a10fd849d483c8dd3dceaefcd80f2104f80e Mon Sep 17 00:00:00 2001 From: osmiy Date: Mon, 6 Feb 2006 14:14:18 +0000 Subject: - Frontend improvements (Eugene) + Configuration -> Actions (finished) git-svn-id: svn://svn.zabbix.com/trunk@2609 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/actionconf.php | 123 ++++++++++++++++++++++++++----------------- 1 file changed, 74 insertions(+), 49 deletions(-) (limited to 'frontends/php/actionconf.php') diff --git a/frontends/php/actionconf.php b/frontends/php/actionconf.php index 863b60fb..73c0507f 100644 --- a/frontends/php/actionconf.php +++ b/frontends/php/actionconf.php @@ -38,6 +38,50 @@ // exit; // } ?> + array(T_ZBX_INT, O_OPT, NULL, IN("0,1"), NULL), + + "actionid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), + "source"=> array(T_ZBX_INT, O_OPT, NULL, IN("0"), 'isset({save})'), + "recipient"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1"), 'isset({save})'), + "userid"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, 'isset({save})'), + "delay"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535),'isset({save})'), + "subject"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save})'), + "message"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save})'), + "repeat"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1"), 'isset({save})'), + + "maxrepeats"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535),'{repeat}==1&&isset({save})'), + "repeatdelay"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535),'{repeat}==1&&isset({save})'), + + "conditions"=> array(NULL, O_OPT, NULL, NULL, NULL), +// "conditions[i][type]"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL), +// "conditions[i][operator]"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL), +// "conditions[i][value]"=> array(NULL, O_OPT, NULL, NULL, NULL), + + "rem_condition"=> array(NULL, O_OPT, NULL, NULL, NULL), +// "rem_condition[i][type]"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL); +// "rem_condition[i][operator]"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL); +// "rem_condition[i][value]"=> array(NULL, O_OPT, NULL, NULL, NULL); + + "new_condition_type"=> array(T_ZBX_INT, O_OPT, NULL, NULL, 'isset({add_condition})'), + "new_condition_operator"=> array(T_ZBX_INT, O_OPT, NULL, NULL, 'isset({add_condition})'), + "new_condition_value"=> array(NULL, O_OPT, NULL, NULL, 'isset({add_condition})'), + +/* actions */ + "add_condition"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + "del_condition"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), + "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), +/* other */ + "form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), + "form_refresh"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL) + ); + + check_fields($fields); +?> $_REQUEST["new_condition_type"], + "operator"=> $_REQUEST["new_condition_operator"], + "value"=> $_REQUEST["new_condition_value"]); + + $_REQUEST["conditions"] = get_request("conditions",array()); + if(!in_array($new_condition,$_REQUEST["conditions"])) + array_push($_REQUEST["conditions"],$new_condition); + } + elseif(isset($_REQUEST["del_condition"])&&isset($_REQUEST["rem_condition"])) + { + $_REQUEST["conditions"] = get_request("conditions",array()); + foreach($_REQUEST["rem_condition"] as $val){ + unset($_REQUEST["conditions"][$val]); } } ?> @@ -166,7 +190,7 @@ /* table */ $tblActions = new CTableInfo(S_NO_ACTIONS_DEFINED); $tblActions->SetHeader(array(S_SOURCE,S_CONDITIONS,S_SEND_MESSAGE_TO, - S_DELAY,S_SUBJECT,S_REPEATS,S_ACTIONS)); + S_DELAY,S_SUBJECT,S_REPEATS)); if(isset($_REQUEST["actiontype"])&&($_REQUEST["actiontype"]==1)) { @@ -200,13 +224,14 @@ } $tblActions->AddRow(array( - get_source_description($row["source"]), + new CLink( + get_source_description($row["source"]), + "actionconf.php?form=update&actionid=".$row['actionid'],'action'), $conditions, $recipient, htmlspecialchars($row["delay"]), htmlspecialchars($row["subject"]), - $row["maxrepeats"] == 0 ? S_NO_REPEATS : $row["maxrepeats"], - new CLink(S_CHANGE,"actionconf.php?form=update&actionid=".$row['actionid']) + $row["maxrepeats"] == 0 ? S_NO_REPEATS : $row["maxrepeats"] )); } $tblActions->Show(); -- cgit