summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/forms.inc.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-02-17 14:16:25 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-02-17 14:16:25 +0000
commiteeb19c96867c981d71e977813e0536f6e90f1adc (patch)
treec128a1dc44937620541c426d37b99ab1f0f0a38d /frontends/php/include/forms.inc.php
parent42a2ee7629091fc45c463d28cb560c8bdd15d960 (diff)
downloadzabbix-eeb19c96867c981d71e977813e0536f6e90f1adc.tar.gz
zabbix-eeb19c96867c981d71e977813e0536f6e90f1adc.tar.xz
zabbix-eeb19c96867c981d71e977813e0536f6e90f1adc.zip
- improved templates logic for graphs (Eugene)
- improved templates logic for triggers (Eugene) git-svn-id: svn://svn.zabbix.com/trunk@2650 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/forms.inc.php')
-rw-r--r--frontends/php/include/forms.inc.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 1ff57644..a0dc5f4e 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -842,11 +842,32 @@
$frmGItem = new CFormTable(S_NEW_ITEM_FOR_THE_GRAPH,"graph.php");
$frmGItem->SetHelp("web.graph.item.php");
+
+ $db_hosts = get_hosts_by_graphid($_REQUEST["graphid"]);
+ if(DBnum_rows($db_hosts)==0)
+ {
+ // empty graph, can contain any item
+ $host_condition = " and h.status in(".HOST_STATUS_MONITORED.",".HOST_STATUS_TEMPLATE.")";
+ }
+ else
+ {
+ $db_host = DBfetch($db_hosts);
+ if($db_host["status"]==HOST_STATUS_TEMPLATE)
+ {// graph for template must use only one host
+ $host_condition = " and h.hostid=".$db_host["hostid"];
+ }
+ else
+ {
+ $host_condition = " and h.status in(".HOST_STATUS_MONITORED.")";
+ }
+ }
+
if(isset($_REQUEST["gitemid"]))
{
$result=DBselect("select itemid,color,drawtype,sortorder,yaxisside from graphs_items".
" where gitemid=".$_REQUEST["gitemid"]);
$row=DBfetch($result);
+
}
if(isset($_REQUEST["gitemid"]) && !isset($_REQUEST["form_refresh"]))
@@ -878,7 +899,7 @@
$cmbItems = new CComboBox("itemid", $itemid);
$result=DBselect("select h.host,i.description,i.itemid,i.key_ from hosts h,items i".
" where h.hostid=i.hostid".
- " and h.status in(".HOST_STATUS_MONITORED.",".HOST_STATUS_TEMPLATE.")".
+ $host_condition.
" and i.status=".ITEM_STATUS_ACTIVE." order by h.host,i.description");
while($row=DBfetch($result))
{