diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-08-13 08:22:32 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-08-13 08:22:32 +0000 |
commit | abaab90a1c9d3367f1ef636557cfe8e661716749 (patch) | |
tree | 3e266e5523a635c45a7e7ef6d4571e7323f26065 /frontends/php/popup.php | |
parent | 8901654871973b4267f106a97183001189189c82 (diff) | |
download | zabbix-abaab90a1c9d3367f1ef636557cfe8e661716749.tar.gz zabbix-abaab90a1c9d3367f1ef636557cfe8e661716749.tar.xz zabbix-abaab90a1c9d3367f1ef636557cfe8e661716749.zip |
- merger rev. 4546:4547 of branches/1.4.j [developed data monitoring of multiple nodes]
git-svn-id: svn://svn.zabbix.com/trunk@4549 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/popup.php')
-rw-r--r-- | frontends/php/popup.php | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/frontends/php/popup.php b/frontends/php/popup.php index 46c8f746..929c225b 100644 --- a/frontends/php/popup.php +++ b/frontends/php/popup.php @@ -195,10 +195,10 @@ include_once "include/page_header.php"; validate_group(PERM_READ_LIST,$validation_param); } - $accessible_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST); + $accessible_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST,null,null,get_current_nodeid(true)); $denyed_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_MODE_LT); $accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY); - $nodeid = $ZBX_CURNODEID; + $nodeid = get_current_nodeid(); if(isset($only_hostid)) { @@ -211,7 +211,7 @@ include_once "include/page_header.php"; { if(ZBX_DISTRIBUTED) { - $nodeid = get_request("nodeid", $ZBX_CURNODEID); + $nodeid = get_request("nodeid", $nodeid); $cmbNode = new CComboBox("nodeid", $nodeid, "submit()"); $db_nodes = DBselect("select * from nodes where nodeid in (".$accessible_nodes.")"); while($node_data = DBfetch($db_nodes)) @@ -222,7 +222,7 @@ include_once "include/page_header.php"; $frmTitle->AddItem(array(SPACE,S_NODE,SPACE,$cmbNode)); } } - if(!isset($ok)) $nodeid = $ZBX_CURNODEID; + if(!isset($ok)) $nodeid = get_current_nodeid(); unset($ok); if(in_array($srctbl,array('hosts','templates','triggers','logitems','items','applications','host_templates'))) @@ -232,7 +232,7 @@ include_once "include/page_header.php"; $cmbGroups = new CComboBox("groupid",$groupid,"submit()"); $cmbGroups->AddItem(0,S_ALL_SMALL); $db_groups = DBselect("select distinct g.groupid,g.name from groups g, hosts_groups hg, hosts h ". - " where ".DBid2nodeid("g.groupid")."=".$nodeid. + ' where '.DBin_node('g.groupid', $nodeid). " and g.groupid=hg.groupid and hg.hostid in (".$accessible_hosts.") ". " and hg.hostid = h.hostid ". ($monitored_hosts ? " and h.status=".HOST_STATUS_MONITORED : ""). @@ -273,7 +273,7 @@ include_once "include/page_header.php"; $cmbHosts->AddItem(0,S_ALL_SMALL); } - $sql .= DBid2nodeid("h.hostid")."=".$nodeid. + $sql .= DBin_node('h.hostid', $nodeid). " and h.hostid in (".$accessible_hosts.")". ($monitored_hosts ? " and h.status=".HOST_STATUS_MONITORED : ""). ($real_hosts ? ' and h.status<>'.HOST_STATUS_TEMPLATE : ''). @@ -316,7 +316,7 @@ include_once "include/page_header.php"; else $sql .= " where "; - $sql .= DBid2nodeid("h.hostid")."=".$nodeid. + $sql .= DBin_node('h.hostid', $nodeid). " and h.hostid in (".$accessible_hosts.") ". ($monitored_hosts ? " and h.status=".HOST_STATUS_MONITORED : ""). ($real_hosts ? " and h.status<>".HOST_STATUS_TEMPLATE : ""). @@ -433,7 +433,7 @@ include_once "include/page_header.php"; else $sql .= " where "; - $sql .= DBid2nodeid("h.hostid")."=".$nodeid. + $sql .= DBin_node('h.hostid', $nodeid). " and h.hostid in (".$accessible_hosts.") ". " and h.status=".HOST_STATUS_TEMPLATE. " order by h.host,h.hostid"; @@ -479,7 +479,7 @@ include_once "include/page_header.php"; $table->SetHeader(array(S_NAME)); $db_groups = DBselect("select distinct groupid,name from groups ". - " where ".DBid2nodeid("groupid")."=".$nodeid. + ' where '.DBin_node('groupid', $nodeid). " and groupid in (".$accessible_groups.") ". " order by name"); while($row = DBfetch($db_groups)) @@ -506,7 +506,7 @@ include_once "include/page_header.php"; else $sql .= ' where '; - $sql .= DBid2nodeid('h.hostid').'='.$nodeid.' and status='.HOST_STATUS_TEMPLATE. + $sql .= DBin_node('h.hostid',$nodeid).' and status='.HOST_STATUS_TEMPLATE. ' and h.hostid in ('.$accessible_hosts.') '. ' order by h.host,h.hostid'; $db_hosts = DBselect($sql); @@ -527,10 +527,14 @@ include_once "include/page_header.php"; $table = new CTableInfo(S_NO_GROUPS_DEFINED); $table->SetHeader(array(S_NAME)); - $result = DBselect("select * from usrgrp where ".DBid2nodeid("usrgrpid")."=".$ZBX_CURNODEID." order by name"); + $result = DBselect('select * from usrgrp where '.DBin_node('usrgrpid').' order by name'); while($row = DBfetch($result)) { - $name = new CLink($row["name"],"#","action"); + $name = new CLink( + get_node_name_by_elid($row['usrgrpid']).$row['name'], + '#', + 'action' + ); $name->SetAction( get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]). (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : ''). @@ -545,10 +549,14 @@ include_once "include/page_header.php"; $table = new CTableInfo(S_NO_USERS_DEFINED); $table->SetHeader(array(S_NAME)); - $result = DBselect("select * from users where ".DBid2nodeid("userid")."=".$ZBX_CURNODEID." order by name"); + $result = DBselect('select * from users where '.DBin_node('userid').' order by name'); while($row = DBfetch($result)) { - $name = new CLink($row["alias"],"#","action"); + $name = new CLink( + get_node_name_by_elid($row['userid']).$row['alias'], + '#', + 'action' + ); $name->SetAction( get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]). (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : ''). @@ -591,7 +599,7 @@ include_once "include/page_header.php"; $sql = "select h.host,t.triggerid,t.description,t.priority,t.status,count(d.triggerid_up) as dep_count ". " from hosts h,items i,functions f, triggers t left join trigger_depends d on d.triggerid_down=t.triggerid ". " where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid". - " and ".DBid2nodeid("t.triggerid")."=".$nodeid. + ' and '.DBin_node('t.triggerid', $nodeid). " and h.hostid not in (".$denyed_hosts.")". ($monitored_hosts ? " and h.status=".HOST_STATUS_MONITORED : ""). ($real_hosts ? " and h.status<>".HOST_STATUS_TEMPLATE : ""); @@ -689,7 +697,7 @@ function add_item_variable(s_formname,x_value) $db_items = DBselect("select distinct h.host,i.* from items i,hosts h". " where i.value_type=".ITEM_VALUE_TYPE_LOG." and h.hostid=i.hostid". - " and ".DBid2nodeid("i.itemid")."=".$nodeid. + ' and '.DBin_node('i.itemid', $nodeid). (isset($hostid) ? " and ".$hostid."=i.hostid " : ""). " and i.hostid in (".$accessible_hosts.")". ($monitored_hosts ? " and h.status=".HOST_STATUS_MONITORED : ""). @@ -732,7 +740,7 @@ function add_item_variable(s_formname,x_value) )); $sql = "select distinct h.host,i.* from hosts h,items i ". - " where h.hostid=i.hostid and ".DBid2nodeid("i.itemid")."=".$nodeid. + ' where h.hostid=i.hostid and '.DBin_node('i.itemid', $nodeid). " and h.hostid not in (".$denyed_hosts.")". ($monitored_hosts ? " and h.status=".HOST_STATUS_MONITORED : ''). ($real_hosts ? " and h.status<>".HOST_STATUS_TEMPLATE : ''); @@ -774,7 +782,7 @@ function add_item_variable(s_formname,x_value) S_NAME)); $sql = "select distinct h.host,a.* from hosts h,applications a ". - " where h.hostid=a.hostid and ".DBid2nodeid("a.applicationid")."=".$nodeid. + ' where h.hostid=a.hostid and '.DBin_node('a.applicationid', $nodeid). " and h.hostid not in (".$denyed_hosts.")". ($monitored_hosts ? " and h.status=".HOST_STATUS_MONITORED : ""). ($real_hosts ? " and h.status<>".HOST_STATUS_TEMPLATE : ""); @@ -826,7 +834,7 @@ function add_item_variable(s_formname,x_value) $table = new CTableInfo(S_NO_NODES_DEFINED); $table->SetHeader(S_NAME); - $result = DBselect('select screenid,name from screens where '.DBid2nodeid('screenid').'='.$nodeid.' order by name'); + $result = DBselect('select screenid,name from screens where '.DBin_node('screenid',$nodeid).' order by name'); while($row=DBfetch($result)) { if(!screen_accessiable($row["screenid"], PERM_READ_ONLY)) |