summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-09-19 16:57:19 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-09-19 16:57:19 +0000
commite5ef8796293a7d36face4704fb59831e1a3d4f47 (patch)
tree6fdcb8a5e1e29273a95f68f88a2daac1a07d5b1f /frontends/php
parent2c98552c995515bd63182ae937a009c062e82cf8 (diff)
downloadzabbix-e5ef8796293a7d36face4704fb59831e1a3d4f47.tar.gz
zabbix-e5ef8796293a7d36face4704fb59831e1a3d4f47.tar.xz
zabbix-e5ef8796293a7d36face4704fb59831e1a3d4f47.zip
- added support of macros $1,..., $9 (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2061 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/graph.php8
-rw-r--r--frontends/php/history.php4
-rw-r--r--frontends/php/include/classes.inc.php1
-rw-r--r--frontends/php/include/items.inc.php29
-rw-r--r--frontends/php/latest.php6
-rw-r--r--frontends/php/screenedit.php8
6 files changed, 43 insertions, 13 deletions
diff --git a/frontends/php/graph.php b/frontends/php/graph.php
index 3584f112..6cbcc77b 100644
--- a/frontends/php/graph.php
+++ b/frontends/php/graph.php
@@ -120,7 +120,7 @@
echo "<TD WIDTH=10% NOSAVE><B>".S_ACTIONS."</B></TD>";
echo "</TR>";
- $sql="select i.itemid,h.host,i.description,gi.gitemid,gi.color,gi.drawtype,gi.sortorder from hosts h,graphs_items gi,items i where i.itemid=gi.itemid and gi.graphid=".$_GET["graphid"]." and h.hostid=i.hostid order by gi.sortorder";
+ $sql="select i.itemid,h.host,i.description,gi.gitemid,gi.color,gi.drawtype,gi.sortorder,i.key_ from hosts h,graphs_items gi,items i where i.itemid=gi.itemid and gi.graphid=".$_GET["graphid"]." and h.hostid=i.hostid order by gi.sortorder";
$result=DBselect($sql);
$col=0;
while($row=DBfetch($result))
@@ -130,7 +130,7 @@
echo "<TD>".$row["sortorder"]."</TD>";
echo "<TD>".$row["host"]."</TD>";
- echo "<TD><a href=\"chart.php?itemid=".$row["itemid"]."&period=3600&from=0\">".$row["description"]."</a></TD>";
+ echo "<TD><a href=\"chart.php?itemid=".$row["itemid"]."&period=3600&from=0\">".item_description($row["description"],$row["key_"])."</a></TD>";
echo "<TD>".get_drawtype_description($row["drawtype"])."</TD>";
echo "<TD>".$row["color"]."</TD>";
echo "<TD>";
@@ -176,12 +176,12 @@
echo S_PARAMETER;
show_table2_h_delimiter();
- $result=DBselect("select h.host,i.description,i.itemid from hosts h,items i where h.hostid=i.hostid and h.status in(".HOST_STATUS_MONITORED.",".HOST_STATUS_TEMPLATE.") and i.status=".ITEM_STATUS_ACTIVE." order by h.host,i.description");
+ $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.") and i.status=".ITEM_STATUS_ACTIVE." order by h.host,i.description");
echo "<select name=\"itemid\" size=1>";
for($i=0;$i<DBnum_rows($result);$i++)
{
$host_=DBget_field($result,$i,0);
- $description_=DBget_field($result,$i,1);
+ $description_=item_description(DBget_field($result,$i,1),DBget_field($result,$i,3));
$itemid_=DBget_field($result,$i,2);
if(isset($itemid)&&($itemid==$itemid_))
{
diff --git a/frontends/php/history.php b/frontends/php/history.php
index 934027d7..6e86468a 100644
--- a/frontends/php/history.php
+++ b/frontends/php/history.php
@@ -26,9 +26,9 @@
$now=time();
- $result=DBselect("select h.host,i.description,i.nextcheck-$now,h.hostid from items i,hosts h where i.itemid=".$_GET["itemid"]." and h.hostid=i.hostid");
+ $result=DBselect("select h.host,i.description,i.nextcheck-$now,h.hostid,i.key_ from items i,hosts h where i.itemid=".$_GET["itemid"]." and h.hostid=i.hostid");
$host=DBget_field($result,0,0);
- $description=DBget_field($result,0,1);
+ $description=item_description(DBget_field($result,0,1),DBget_field($result,0,4));
$beforenextcheck=DBget_field($result,0,2)+5;
if($beforenextcheck<=0)
{
diff --git a/frontends/php/include/classes.inc.php b/frontends/php/include/classes.inc.php
index 5c078c47..60b47c5e 100644
--- a/frontends/php/include/classes.inc.php
+++ b/frontends/php/include/classes.inc.php
@@ -130,6 +130,7 @@
function addItem($itemid)
{
$this->items[$this->num]=get_item_by_itemid($itemid);
+ $this->items[$this->num]["description"]=item_description($this->items[$this->num]["description"],$this->items[$this->num]["key_"]);
$host=get_host_by_hostid($this->items[$this->num]["hostid"]);
$this->items[$this->num]["host"]=$host["host"];
$this->itemids[$this->items[$this->num]["itemid"]]=$this->num;
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php
index c4d240e9..cb57ef9e 100644
--- a/frontends/php/include/items.inc.php
+++ b/frontends/php/include/items.inc.php
@@ -338,4 +338,33 @@
}
return $result;
}
+
+ function get_n_param($key, $num)
+ {
+ $param="";
+
+// echo $key." ".$num."<br>";
+
+// $params=split('[\[\]\,]', $description);
+ $params=preg_split('/[\]\[,]/', $key);
+
+ if(isset($params[$num]))
+ {
+ $param=$params[$num];
+ }
+
+ return $param;
+ }
+
+ function item_description($description, $key)
+ {
+ $descr=$description;
+
+ for($i=9;$i>0;$i--)
+ {
+ $descr=str_replace("$$i",get_n_param($key,$i),$descr);
+ }
+
+ return $descr;
+ }
?>
diff --git a/frontends/php/latest.php b/frontends/php/latest.php
index 07fbe946..2d9df7c6 100644
--- a/frontends/php/latest.php
+++ b/frontends/php/latest.php
@@ -257,9 +257,9 @@
$_GET["sort"]="order by i.description";
}
if(isset($_GET["select"]))
- $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier from items i,hosts h where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 and i.description like '%".$_GET["select"]."%' ".$_GET["sort"];
+ $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier,i.key_ from items i,hosts h where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 and i.description like '%".$_GET["select"]."%' ".$_GET["sort"];
else
- $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier from items i,hosts h where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 and h.hostid=".$_GET["hostid"]." ".$_GET["sort"];
+ $sql="select h.host,i.itemid,i.description,i.lastvalue,i.prevvalue,i.lastclock,i.status,h.hostid,i.value_type,i.units,i.multiplier,i.key_ from items i,hosts h where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 and h.hostid=".$_GET["hostid"]." ".$_GET["sort"];
$result=DBselect($sql);
while($row=DBfetch($result))
{
@@ -279,7 +279,7 @@
{
table_td($row["host"],"");
}
- table_td($row["description"],"");
+ table_td(item_description($row["description"],$row["key_"]),"");
echo "<td>";
if($row["status"] == 2)
diff --git a/frontends/php/screenedit.php b/frontends/php/screenedit.php
index ba7ed66c..b2555041 100644
--- a/frontends/php/screenedit.php
+++ b/frontends/php/screenedit.php
@@ -154,13 +154,13 @@
show_table2_v_delimiter();
echo nbsp(S_PARAMETER);
show_table2_h_delimiter();
- $result=DBselect("select h.host,i.description,i.itemid from hosts h,items i where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 order by h.host,i.description");
+ $result=DBselect("select h.host,i.description,i.itemid,i.key_ from hosts h,items i where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 order by h.host,i.description");
echo "<select name=\"resourceid\" size=1>";
echo "<OPTION VALUE='0'>(none)";
for($i=0;$i<DBnum_rows($result);$i++)
{
$host_=DBget_field($result,$i,0);
- $description_=DBget_field($result,$i,1);
+ $description_=item_description(DBget_field($result,$i,1),DBget_field($result,$i,3));
$itemid_=DBget_field($result,$i,2);
echo "<OPTION VALUE='$itemid_' ".iif($resourceid==$itemid_,"selected","").">$host_: $description_";
}
@@ -172,13 +172,13 @@
show_table2_v_delimiter();
echo nbsp(S_PARAMETER);
show_table2_h_delimiter();
- $result=DBselect("select h.host,i.description,i.itemid from hosts h,items i where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 order by h.host,i.description");
+ $result=DBselect("select h.host,i.description,i.itemid,i.key_ from hosts h,items i where h.hostid=i.hostid and h.status=".HOST_STATUS_MONITORED." and i.status=0 order by h.host,i.description");
echo "<select name=\"resourceid\" size=1>";
echo "<OPTION VALUE='0'>(none)";
for($i=0;$i<DBnum_rows($result);$i++)
{
$host_=DBget_field($result,$i,0);
- $description_=DBget_field($result,$i,1);
+ $description_=item_description(DBget_field($result,$i,1),DBget_field($result,$i,3));
$itemid_=DBget_field($result,$i,2);
echo "<OPTION VALUE='$itemid_' ".iif($resourceid==$itemid_,"selected","").">$host_: $description_";
}