summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--frontends/php/chart2.php10
-rw-r--r--frontends/php/graphs.php32
-rw-r--r--frontends/php/include/forms.inc.php14
4 files changed, 50 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 8268cc9b..df65a2ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Changes for 1.1beta7:
+ - added Hostname for graphs displaying (Eugene)
- added hosekeeper support for frontend (Eugene)
- added table housekeeper (Alexei)
- added value mapping for e-mail content (Eugene)
diff --git a/frontends/php/chart2.php b/frontends/php/chart2.php
index 6df46a4f..34d7e47c 100644
--- a/frontends/php/chart2.php
+++ b/frontends/php/chart2.php
@@ -42,8 +42,14 @@
$result=DBselect("select name,width,height,yaxistype,yaxismin,yaxismax from graphs where graphid=".$_REQUEST["graphid"]);
$row=DBfetch($result);
-
+ $db_hosts = get_hosts_by_graphid($_REQUEST["graphid"]);
$name=$row["name"];
+
+ if(DBnum_rows($db_hosts)==1)
+ {
+ $db_host = DBfetch($db_hosts);
+ $name = $db_host["host"].":".$name;
+ }
if(isset($_REQUEST["width"])&&$_REQUEST["width"]>0)
{
$width=$_REQUEST["width"];
@@ -63,7 +69,7 @@
$graph->setWidth($width);
$graph->setHeight($height);
- $graph->setHeader($row["name"]);
+ $graph->setHeader($name);
$graph->setYAxisType($row["yaxistype"]);
$graph->setYAxisMin($row["yaxismin"]);
$graph->setYAxisMax($row["yaxismax"]);
diff --git a/frontends/php/graphs.php b/frontends/php/graphs.php
index 59981614..7fc30500 100644
--- a/frontends/php/graphs.php
+++ b/frontends/php/graphs.php
@@ -167,7 +167,9 @@
$form->AddItem(SPACE.S_HOST.SPACE);
$cmbHosts = new CComboBox("hostid", $_REQUEST["hostid"], "submit()");
- $cmbHosts->AddItem(0,S_ALL_SMALL);
+ if($_REQUEST["groupid"]==0)
+ $cmbHosts->AddItem(0,S_ALL_SMALL);
+
if(isset($_REQUEST["groupid"]) && $_REQUEST["groupid"] > 0)
{
$sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg".
@@ -181,13 +183,20 @@
" and h.status not in (".HOST_STATUS_DELETED.") group by h.hostid,h.host".
" order by h.host";
}
+
$result=DBselect($sql);
+ $host_ok = 0;
+ $first_host = 0;
while($row=DBfetch($result))
{
if(!check_right("Host","R",$row["hostid"])) continue;
$cmbHosts->AddItem($row["hostid"],$row["host"]);
+ if($first_host == 0) $first_host = $row["hostid"];
+ if($_REQUEST["hostid"] == $row["hostid"]) $host_ok = 1;
}
$form->AddItem($cmbHosts);
+ if(!$host_ok && $_REQUEST["hostid"]!=0)
+ $_REQUEST["hostid"] = $first_host;
$form->AddItem(SPACE."|".SPACE);
$form->AddItem(new CButton("form",S_CREATE_GRAPH));
@@ -196,7 +205,8 @@
/* TABLE */
$table = new CTableInfo(S_NO_GRAPHS_DEFINED);
- $table->setHeader(array(S_ID,S_NAME,S_WIDTH,S_HEIGHT,S_GRAPH));
+ $table->setHeader(array(S_ID,
+ $_REQUEST["hostid"] != 0 ? NULL : S_HOSTS, S_NAME,S_WIDTH,S_HEIGHT,S_GRAPH));
if(isset($_REQUEST["hostid"])&&($_REQUEST["hostid"]!=0))
{
@@ -212,12 +222,29 @@
{
if(!check_right("Graph","U",$row["graphid"])) continue;
+/*
if(!isset($_REQUEST["hostid"]))
{
$sql="select * from graphs_items where graphid=".$row["graphid"];
$result2=DBselect($sql);
if(DBnum_rows($result2)>0) continue;
}
+*/
+
+ if($_REQUEST["hostid"] != 0)
+ {
+ $host_list = NULL;
+ }
+ else
+ {
+ $host_list = "";
+ $db_hosts = get_hosts_by_graphid($row["graphid"]);
+ while($db_host = DBfetch($db_hosts))
+ {
+ $host_list .= $db_host["host"].",";
+ }
+ $host_list = trim($host_list,',');
+ }
if($row["templateid"]==0)
{
@@ -252,6 +279,7 @@
$table->AddRow(array(
$row["graphid"],
+ $host_list,
$name,
$row["width"],
$row["height"],
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 7b6b05f0..46a338ad 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -812,8 +812,6 @@
}
- show_table2_v_delimiter();
- echo "<form method=\"get\" action=\"graph.php\">";
$frmGItem->AddVar("graphid",$_REQUEST["graphid"]);
if(isset($_REQUEST["gitemid"]))
{
@@ -1633,7 +1631,17 @@
$cmbGraphs->AddItem(0,"(none)");
while($row=DBfetch($result))
{
- $cmbGraphs->AddItem($row["graphid"],$row["name"]);
+ $db_hosts = get_hosts_by_graphid($row["graphid"]);
+ if(DBnum_rows($db_hosts)==1)
+ {
+ $db_host = DBfetch($db_hosts);
+ $name = $db_host["host"].":".$row["name"];
+ }
+ else
+ {
+ $name = $row["name"];
+ }
+ $cmbGraphs->AddItem($row["graphid"],$name);
}
$form->AddRow(S_GRAPH_NAME,$cmbGraphs);