summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-07 09:42:00 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-07 09:42:00 +0000
commitdc18c3c54aa5bd3d198b6ab480b6d42c4731df18 (patch)
treed307e0e8a516fdc94ad9f910f9d875e814d70358 /frontends/php
parent3766bb922ed8071a08c4d80c6754b41ad9155e47 (diff)
downloadzabbix-dc18c3c54aa5bd3d198b6ab480b6d42c4731df18.tar.gz
zabbix-dc18c3c54aa5bd3d198b6ab480b6d42c4731df18.tar.xz
zabbix-dc18c3c54aa5bd3d198b6ab480b6d42c4731df18.zip
- [DEV-137] fixes to popup screen, charts refresh and few SQL's (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5679 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/charts.php10
-rw-r--r--frontends/php/graphs.php1
-rw-r--r--frontends/php/include/blocks.inc.php3
-rw-r--r--frontends/php/include/db.inc.php18
-rw-r--r--frontends/php/js/sbinit.js13
-rw-r--r--frontends/php/popup.php33
-rw-r--r--frontends/php/sysmaps.php6
7 files changed, 45 insertions, 39 deletions
diff --git a/frontends/php/charts.php b/frontends/php/charts.php
index 067cd805..90a752b1 100644
--- a/frontends/php/charts.php
+++ b/frontends/php/charts.php
@@ -128,7 +128,7 @@ include_once 'include/page_header.php';
$available_groups = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_LIST);
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_LIST);
- $available_graphs = get_accessible_graphs(PERM_READ_LIST, null, get_current_nodeid());
+ $available_graphs = get_accessible_graphs(PERM_READ_LIST, PERM_RES_IDS_ARRAY, get_current_nodeid());
if(($_REQUEST['graphid']>0) && ($row=DBfetch(DBselect('SELECT DISTINCT graphid, name FROM graphs WHERE graphid='.$_REQUEST['graphid'])))){
if(!graph_accessible($_REQUEST['graphid'])){
@@ -182,7 +182,7 @@ include_once 'include/page_header.php';
' AND h.hostid=i.hostid '.
' AND hg.hostid=h.hostid '.
($_REQUEST['groupid']?' AND hg.groupid='.$_REQUEST['groupid']:'').
- ' AND gi.graphid IN ('.$available_graphs.')';
+ ' AND '.DBcondition('gi.graphid',$available_graphs);
// ' AND h.hostid IN ('.$available_hosts.') ';
@@ -206,7 +206,7 @@ include_once 'include/page_header.php';
($_REQUEST['hostid']?' AND h.hostid='.$_REQUEST['hostid']:'').
' AND h.status='.HOST_STATUS_MONITORED.
' AND '.DBin_node('g.graphid').
- ' AND g.graphid IN ('.$available_graphs.')';
+ ' AND '.DBcondition('g.graphid',$available_graphs);
// ' AND h.hostid IN ('.$available_hosts.') ';
if($cnt_row = DBfetch(DBselect($sql))){
@@ -247,7 +247,7 @@ include_once 'include/page_header.php';
' AND h.hostid=i.hostid '.
' AND hg.hostid=h.hostid '.
($_REQUEST['groupid']?' AND hg.groupid='.$_REQUEST['groupid']:'').
- ' AND gi.graphid IN ('.$available_graphs.')'.
+ ' AND '.DBcondition('gi.graphid',$available_graphs).
// ' AND h.hostid IN ('.$available_hosts.') '.
' ORDER BY h.host';
@@ -271,7 +271,7 @@ include_once 'include/page_header.php';
($_REQUEST['groupid']?' AND hg.groupid='.$_REQUEST['groupid']:'').
($_REQUEST['hostid']?' AND h.hostid='.$_REQUEST['hostid']:'').
' AND '.DBin_node('g.graphid').
- ' AND g.graphid IN ('.$available_graphs.')'.
+ ' AND '.DBcondition('g.graphid',$available_graphs).
// ' AND h.hostid IN ('.$available_hosts.') ';
' ORDER BY g.name';
diff --git a/frontends/php/graphs.php b/frontends/php/graphs.php
index 3b5d50f9..e486817e 100644
--- a/frontends/php/graphs.php
+++ b/frontends/php/graphs.php
@@ -265,6 +265,7 @@ include_once "include/page_header.php";
}
}
// ----</ACTIONS>----
+ $available_graphs = get_accessible_graphs(PERM_READ_WRITE);
?>
<?php
$form = new CForm();
diff --git a/frontends/php/include/blocks.inc.php b/frontends/php/include/blocks.inc.php
index c685acc8..bf51d24c 100644
--- a/frontends/php/include/blocks.inc.php
+++ b/frontends/php/include/blocks.inc.php
@@ -527,11 +527,12 @@ function make_latest_issues(){
' AND t.triggerid=f.triggerid '.
' AND t.status='.TRIGGER_STATUS_ENABLED.
' AND i.status='.ITEM_STATUS_ACTIVE.
- ' AND '.DBin_node('t.triggerid').
+// ' AND '.DBin_node('t.triggerid').
' AND '.DBcondition('t.triggerid',$available_triggers).
' AND h.status='.HOST_STATUS_MONITORED.
' AND t.value='.TRIGGER_VALUE_TRUE.
' ORDER BY t.lastchange DESC';
+
$result = DBselect($sql);
while($row=DBfetch($result)){
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index 850a15bd..e7d4b644 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -598,26 +598,22 @@ else {
return (int)bcdiv("$id_var",'100000000000000');
}
- function DBin_node( $id_name, $nodes = null )
- {
- if ( is_null($nodes) ) $nodes = get_current_nodeid();
+ function DBin_node( $id_name, $nodes = null ){
+ if(is_null($nodes)) $nodes = get_current_nodeid();
- if ( empty($nodes) ) $nodes = 0;
+ if(empty($nodes)) $nodes = 0;
- if ( is_array($nodes) )
- {
+ if(is_array($nodes)){
$nodes = implode(',', $nodes);
}
- else if ( is_string($nodes) )
- {
+ else if(is_string($nodes)){
if ( !eregi('([0-9\,]+)', $nodes ) )
fatal_error('Incorrect "nodes" for "DBin_node". Passed ['.$nodes.']');
}
- else if ( !is_numeric($nodes) )
- {
+ else if(!is_numeric($nodes)){
fatal_error('Incorrect type of "nodes" for "DBin_node". Passed ['.gettype($nodes).']');
}
- return (' '.DBid2nodeid($id_name).' in ('.$nodes.') ');
+ return (' '.DBid2nodeid($id_name).' in ('.$nodes.') ');
}
function in_node( $id_var, $nodes = null ){
diff --git a/frontends/php/js/sbinit.js b/frontends/php/js/sbinit.js
index 0d3acc5a..54bcc88a 100644
--- a/frontends/php/js/sbinit.js
+++ b/frontends/php/js/sbinit.js
@@ -89,13 +89,18 @@ function graphsubmit(){
var scrl = $('scroll');
scrl.style.display = 'none';
-
+
var uri = new url(location.href);
+ var stime = SCROLL_BAR.getsTime();
-// if((SCROLL_BAR.dt.getTime()-(SCROLL_BAR.period * 1000)) != SCROLL_BAR.sdt.getTime())
- uri.setArgument('stime', SCROLL_BAR.getsTime());
-
+ if((SCROLL_BAR.dt.getTime()-(SCROLL_BAR.period * 1000)) == SCROLL_BAR.sdt.getTime()){
+// alert((SCROLL_BAR.dt.getTime()-(SCROLL_BAR.period * 1000))+' != '+SCROLL_BAR.sdt.getTime());
+ stime=parseInt(stime)+100000000;
+ }
+
+ uri.setArgument('stime', stime);
uri.setArgument('period', SCROLL_BAR.getPeriod());
+
location.href = uri.getUrl();
}
diff --git a/frontends/php/popup.php b/frontends/php/popup.php
index b3585c8e..154f34b7 100644
--- a/frontends/php/popup.php
+++ b/frontends/php/popup.php
@@ -931,30 +931,34 @@ include_once "include/page_header.php";
}
$table->Show();
}
- else if($srctbl == "graphs")
- {
+ else if($srctbl == "graphs"){
+
$table = new CTableInfo(S_NO_GRAPHS_DEFINED);
- $table->SetHeader(array(S_NAME,S_GRAPH_TYPE));
+ $table->SetHeader(array(
+ isset($hostid)?null:S_HOST,
+ S_NAME,
+ S_GRAPH_TYPE
+ ));
- $available_graphs = get_accessible_graphs(PERM_READ_LIST, null, get_current_nodeid());
+ $available_graphs = get_accessible_graphs(PERM_READ_ONLY, PERM_RES_IDS_ARRAY, get_current_nodeid());
- $sql = 'SELECT DISTINCT g.graphid,g.name,g.graphtype,n.name as node_name, h.host'.
- ' FROM graphs g '.
- ' LEFT JOIN graphs_items gi ON g.graphid=gi.graphid '.
- ' LEFT JOIN items i ON gi.itemid=i.itemid '.
- ' LEFT JOIN hosts h ON h.hostid=i.hostid '.
- ' LEFT JOIN nodes n ON n.nodeid='.DBid2nodeid('g.graphid').
- ' WHERE '.DBcondition('g.graphid',$available_graphs).
- ' AND '.DBin_node('g.graphid', $nodeid);
+ $sql = 'SELECT DISTINCT g.graphid,g.name,g.graphtype,h.host '.
+ ' FROM graphs g,graphs_items gi,items i,hosts h '.
+ ' WHERE gi.graphid=g.graphid '.
+ ' AND i.itemid=gi.itemid '.
+ ' AND h.hostid=i.hostid '.
+ ' AND h.status='.HOST_STATUS_MONITORED.
+ ' AND '.DBin_node('g.graphid').
+ ' AND '.DBcondition('g.graphid',$available_graphs);
if(isset($hostid))
$sql .= ' AND h.hostid='.$hostid;
- $sql .= ' ORDER BY node_name,host,name,graphid';
+ $sql .= ' ORDER BY h.host,g.name';
$result=DBselect($sql);
while($row=DBfetch($result)){
- $row['node_name'] = isset($row['node_name']) ? '('.$row['node_name'].') ' : '';
+ $row['node_name'] = get_node_name_by_elid($row['graphid']);
$name = $row['node_name'].$row['host'].':'.$row['name'];
$description = new CLink($row['name'],'#','action');
@@ -986,6 +990,7 @@ include_once "include/page_header.php";
}
$table->AddRow(array(
+ isset($hostid)?null:$row['host'],
$description,
$graphtype
));
diff --git a/frontends/php/sysmaps.php b/frontends/php/sysmaps.php
index b7436d9f..ac2090b8 100644
--- a/frontends/php/sysmaps.php
+++ b/frontends/php/sysmaps.php
@@ -55,8 +55,7 @@ include_once "include/page_header.php";
check_fields($fields);
validate_sort_and_sortorder('sm.name',ZBX_SORT_UP);
- if(isset($_REQUEST["sysmapid"]))
- {
+ if(isset($_REQUEST["sysmapid"])){
if(!sysmap_accessible($_REQUEST["sysmapid"],PERM_READ_WRITE))
access_deny();
@@ -131,8 +130,7 @@ include_once "include/page_header.php";
' WHERE '.DBin_node('sm.sysmapid').
order_by('sm.name,sm.width,sm.height','sm.sysmapid'));
- while($row=DBfetch($result))
- {
+ while($row=DBfetch($result)){
if(!sysmap_accessible($row["sysmapid"],PERM_READ_WRITE)) continue;
$table->AddRow(array(