summaryrefslogtreecommitdiffstats
path: root/frontends/php/items.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-30 10:27:04 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-30 10:27:04 +0000
commit012b99f4e81fbe0b4fd67ef086353f5d45b6be96 (patch)
tree99aacc6ec4c68bf8aaf56d08286a1672edf62e37 /frontends/php/items.php
parent2d80a93148ef470b402b0e57ef892c63c85aae98 (diff)
downloadzabbix-012b99f4e81fbe0b4fd67ef086353f5d45b6be96.tar.gz
zabbix-012b99f4e81fbe0b4fd67ef086353f5d45b6be96.tar.xz
zabbix-012b99f4e81fbe0b4fd67ef086353f5d45b6be96.zip
- added availability of template items changing directly on host (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3410 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/items.php')
-rw-r--r--frontends/php/items.php68
1 files changed, 52 insertions, 16 deletions
diff --git a/frontends/php/items.php b/frontends/php/items.php
index 5b8d8aea..29ff36d2 100644
--- a/frontends/php/items.php
+++ b/frontends/php/items.php
@@ -148,7 +148,40 @@ include_once "include/page_header.php";
if(isset($_REQUEST["itemid"]))
{
- $result=update_item($_REQUEST["itemid"],
+ $item_data = get_item_by_itemid($_REQUEST["itemid"]);
+ if($item_data['templateid'])
+ {
+ foreach(array(
+ "description" => null,
+ "key" => "key_",
+ "hostid" => null,
+ //"delay" => null,
+ //"history" => null,
+ //"status" => null,
+ "type" => null,
+ "snmp_community" => null,
+ "snmp_oid" => null,
+ "value_type" => null,
+ "trapper_hosts" => null,
+ "snmp_port" => null,
+ "units" => null,
+ "multiplier" => null,
+ //"delta" => null,
+ "snmpv3_securityname" => null,
+ "snmpv3_securitylevel" => null,
+ "snmpv3_authpassphrase" => null,
+ "snmpv3_privpassphrase" => null,
+ "formula" => null,
+ //"trends" => null,
+ "logtimefmt" => null,
+ "valuemapid" => null
+ ) as $req_var_name => $db_varname)
+ {
+ if(!isset($db_varname)) $db_varname = $req_var_name;
+ $_REQUEST[$req_var_name] = $item_data[$db_varname];
+ }
+ }
+ $result = update_item($_REQUEST["itemid"],
$_REQUEST["description"],$_REQUEST["key"],$_REQUEST["hostid"],$_REQUEST["delay"],
$_REQUEST["history"],$_REQUEST["status"],$_REQUEST["type"],
$_REQUEST["snmp_community"],$_REQUEST["snmp_oid"],$_REQUEST["value_type"],
@@ -156,7 +189,8 @@ include_once "include/page_header.php";
$_REQUEST["multiplier"],$_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],
$_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],
$_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],$_REQUEST["trends"],
- $_REQUEST["logtimefmt"],$_REQUEST["valuemapid"],$db_delay_flex,$applications);
+ $_REQUEST["logtimefmt"],$_REQUEST["valuemapid"],$db_delay_flex,$applications,
+ $item_data['templateid']);
$itemid = $_REQUEST["itemid"];
$action = AUDIT_ACTION_UPDATE;
@@ -496,27 +530,29 @@ include_once "include/page_header.php";
$show_applications == 1 ? S_APPLICATIONS : NULL,
S_ERROR));
- $db_items = DBselect("select i.* from hosts h,items i where h.hostid=i.hostid and".
- " h.hostid=".$_REQUEST["hostid"]." order by i.templateid,i.description, i.key_");
+ $db_items = DBselect('select i.*,th.host as template_host,th.hostid as template_hostid from items i '.
+ ' left join items ti on i.templateid=ti.itemid left join hosts th on ti.hostid=th.hostid '.
+ ' where i.hostid='.$_REQUEST['hostid'].
+ ' order by th.host,i.description, i.key_');
while($db_item = DBfetch($db_items))
{
- if($db_item["templateid"]==0)
+ $description = array();
+
+ if($db_item["templateid"])
{
- $description = new CLink(
- item_description($db_item["description"],$db_item["key_"]),
- "items.php?form=update&itemid=".
- $db_item["itemid"].url_param("hostid").url_param("groupid"),
- 'action');
- } else {
$template_host = get_realhost_by_itemid($db_item["templateid"]);
- $description = array(
+ array_push($description,
new CLink($template_host["host"],"items.php?".
"hostid=".$template_host["hostid"],
- 'action'),
- ":",
- item_description($db_item["description"],$db_item["key_"]),
- );
+ 'uncnown'),
+ ":");
}
+
+ array_push($description, new CLink(
+ item_description($db_item["description"],$db_item["key_"]),
+ "items.php?form=update&itemid=".
+ $db_item["itemid"].url_param("hostid").url_param("groupid"),
+ 'action'));
$status=new CCol(new CLink(item_status2str($db_item["status"]),
"items.php?group_itemid%5B%5D=".$db_item["itemid"].