summaryrefslogtreecommitdiffstats
path: root/frontends/php/acknow.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-23 07:34:27 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-23 07:34:27 +0000
commit28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 (patch)
tree8281ccd48964ee0dd11c5ea689091fa3cef706fb /frontends/php/acknow.php
parent495799b2aa61aab23d74d7faa110a0cd09d59bf0 (diff)
- developed group permission system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3371 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/acknow.php')
-rw-r--r--frontends/php/acknow.php72
1 files changed, 50 insertions, 22 deletions
diff --git a/frontends/php/acknow.php b/frontends/php/acknow.php
index b359b5df..4631fab6 100644
--- a/frontends/php/acknow.php
+++ b/frontends/php/acknow.php
@@ -19,51 +19,74 @@
**/
?>
<?php
- $page["title"]="S_ACKNOWLEDGES";
- $page["file"]="acknow.php";
- $page["menu.url"] = "tr_status.php";
+ require_once "include/config.inc.php";
+ require_once "include/acknow.inc.php";
+ require_once "include/triggers.inc.php";
+ require_once "include/forms.inc.php";
+
+ $page["title"] = "S_ACKNOWLEDGES";
+ $page["file"] = "acknow.php";
+
+include_once "include/page_header.php";
- include "include/config.inc.php";
- include "include/forms.inc.php";
-?>
-<?php
- show_header($page["title"],0,0);
?>
<?php
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
- "alarmid"=> array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, NULL),
+ "eventid"=> array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, NULL),
"message"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save})'),
- "save"=> array(T_ZBX_STR,O_OPT, P_ACT|P_SYS, NULL, NULL)
+ /* actions */
+ "save"=> array(T_ZBX_STR,O_OPT, P_ACT|P_SYS, NULL, NULL),
+ "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null)
);
check_fields($fields);
?>
<?php
+ $denyed_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, PERM_MODE_LT);
+
+ if(! ($db_data = DBfetch(DBselect('select distinct e.*,t.triggerid,t.expression,t.description,h.host,h.hostid '.
+ ' from hosts h, items i, functions f, events e, triggers t'.
+ ' where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=e.triggerid and e.eventid='.$_REQUEST["eventid"].
+ ' and i.hostid not in ('.$denyed_hosts.') and e.triggerid=t.triggerid'.
+ ' and '.DBid2nodeid('e.eventid').'='.$ZBX_CURNODEID
+ ))))
+ {
+ access_deny();
+ }
+ unset($denyed_hosts);
+
if(isset($_REQUEST["save"]))
{
$result = add_acknowledge_coment(
- $_REQUEST["alarmid"],
+ $db_data["eventid"],
$USER_DETAILS["userid"],
$_REQUEST["message"]);
show_messages($result, S_COMMENT_ADDED, S_CANNOT_ADD_COMMENT);
+ if($result)
+ {
+ add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_TRIGGER, S_ACKNOWLEDGE_ADDED.
+ ' ['.expand_trigger_description_by_data($db_data).']'.
+ ' ['.$_REQUEST["message"].']');
+ }
+ }
+ else if(isset($_REQUEST["cancel"]))
+ {
+ Redirect('tr_status.php?hostid='.$db_data['hostid']);
+ exit;
}
?>
<?php
-
- $alarm = get_alarm_by_alarmid($_REQUEST["alarmid"]);
- $trigger=get_trigger_by_triggerid($alarm["triggerid"]);
- $expression=explode_exp($trigger["expression"],1);
- $description=expand_trigger_description($alarm["triggerid"]);
-
- show_table_header(S_ALARM_ACKNOWLEDGES_BIG.":".$description.BR.$expression);
+ show_table_header(S_ALARM_ACKNOWLEDGES_BIG." : ".
+ "\"".expand_trigger_description_by_data($db_data)."\"".BR.
+ explode_exp($db_data["expression"],1));
echo BR;
$table = new CTable(NULL,"ack_msgs");
$table->SetAlign("center");
- $db_acks = get_acknowledges_by_alarmid($_REQUEST["alarmid"]);
+ $db_acks = get_acknowledges_by_eventid($db_data["eventid"]);
while($db_ack = DBfetch($db_acks))
{
$db_user = get_user_by_userid($db_ack["userid"]);
@@ -77,11 +100,16 @@
$table->AddRow($msgCol,"msg");
}
/**/
- $table->Show();
- echo BR;
+ if($table->GetNumRows() > 0)
+ {
+ $table->Show();
+ echo BR;
+ }
insert_new_message_form();
?>
<?php
- show_page_footer();
+
+include_once "include/page_footer.php";
+
?>