diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-30 10:27:04 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-30 10:27:04 +0000 |
| commit | 012b99f4e81fbe0b4fd67ef086353f5d45b6be96 (patch) | |
| tree | 99aacc6ec4c68bf8aaf56d08286a1672edf62e37 | |
| parent | 2d80a93148ef470b402b0e57ef892c63c85aae98 (diff) | |
| download | zabbix-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
| -rw-r--r-- | ChangeLog | 1 | ||||
| -rw-r--r-- | frontends/php/css.css | 6 | ||||
| -rw-r--r-- | frontends/php/include/forms.inc.php | 280 | ||||
| -rw-r--r-- | frontends/php/include/items.inc.php | 6 | ||||
| -rw-r--r-- | frontends/php/items.php | 68 |
5 files changed, 231 insertions, 130 deletions
@@ -1,5 +1,6 @@ Changes for 1.3: + - added availability of template items changing directly on host (Eugene) - developed multitemplate system (Eugene) - developed group permission system (Eugene) - added processing of distributed events (Alexei) diff --git a/frontends/php/css.css b/frontends/php/css.css index b4372fe3..5fe0d08a 100644 --- a/frontends/php/css.css +++ b/frontends/php/css.css @@ -604,6 +604,12 @@ table.sub_menu tr td .biginput:focus { border-color: black; } .biginput:hover { border-color: black; } +.biginput[readonly] /* NOTE: Ignored by IE */ +{ + border-color: #D0D0D0; + background-color: #EEEEEE; +} + .button { font-family: Verdana, Helvetica, Geneva; diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index 32a3e9f5..e3ce16d4 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -694,6 +694,7 @@ $add_groupid = get_request("add_groupid" ,get_request("groupid",0)); + $limited = null; if(is_null($host)){ $host_info = get_host_by_hostid($_REQUEST["hostid"]); @@ -704,58 +705,63 @@ { $frmItem->AddVar("itemid",$_REQUEST["itemid"]); - $result=DBselect("select i.*, h.host, h.hostid". + $item_data = DBfetch(DBselect("select i.*, h.host, h.hostid". " from items i,hosts h where i.itemid=".$_REQUEST["itemid"]. - " and h.hostid=i.hostid"); - $row=DBfetch($result); - } - - if(isset($_REQUEST["itemid"]) && !isset($_REQUEST["form_refresh"])) - { - $description = $row["description"]; - $key = $row["key_"]; - $host = $row["host"]; - $delay = $row["delay"]; - $history = $row["history"]; - $status = $row["status"]; - $type = $row["type"]; - $snmp_community = $row["snmp_community"]; - $snmp_oid = $row["snmp_oid"]; - $snmp_port = $row["snmp_port"]; - $value_type = $row["value_type"]; - $trapper_hosts = $row["trapper_hosts"]; - $units = $row["units"]; - $valuemapid = $row["valuemapid"]; - $multiplier = $row["multiplier"]; - $hostid = $row["hostid"]; - $delta = $row["delta"]; - $trends = $row["trends"]; - $db_delay_flex = $row["delay_flex"]; - - $snmpv3_securityname = $row["snmpv3_securityname"]; - $snmpv3_securitylevel = $row["snmpv3_securitylevel"]; - $snmpv3_authpassphrase = $row["snmpv3_authpassphrase"]; - $snmpv3_privpassphrase = $row["snmpv3_privpassphrase"]; - - $formula = $row["formula"]; - $logtimefmt = $row["logtimefmt"]; + " and h.hostid=i.hostid")); + + $limited = $item_data['templateid'] == 0 ? null : 'yes'; + } + + if((isset($_REQUEST["itemid"]) && !isset($_REQUEST["form_refresh"])) || isset($limited)) + { + $description = $item_data["description"]; + $key = $item_data["key_"]; + $host = $item_data["host"]; + $type = $item_data["type"]; + $snmp_community = $item_data["snmp_community"]; + $snmp_oid = $item_data["snmp_oid"]; + $snmp_port = $item_data["snmp_port"]; + $value_type = $item_data["value_type"]; + $trapper_hosts = $item_data["trapper_hosts"]; + $units = $item_data["units"]; + $valuemapid = $item_data["valuemapid"]; + $multiplier = $item_data["multiplier"]; + $hostid = $item_data["hostid"]; + + $snmpv3_securityname = $item_data["snmpv3_securityname"]; + $snmpv3_securitylevel = $item_data["snmpv3_securitylevel"]; + $snmpv3_authpassphrase = $item_data["snmpv3_authpassphrase"]; + $snmpv3_privpassphrase = $item_data["snmpv3_privpassphrase"]; - $db_applications = get_applications_by_itemid($_REQUEST["itemid"]); - while($db_app = DBfetch($db_applications)) - { - if(in_array($db_app["applicationid"],$applications)) continue; - array_push($applications,$db_app["applicationid"]); - } + $formula = $item_data["formula"]; + $logtimefmt = $item_data["logtimefmt"]; - if(isset($db_delay_flex)) + if(!isset($limited) || !isset($_REQUEST["form_refresh"])) { - $arr_of_dellays = explode(";",$db_delay_flex); - foreach($arr_of_dellays as $one_db_delay) + $delay = $item_data["delay"]; + $history = $item_data["history"]; + $status = $item_data["status"]; + $delta = $item_data["delta"]; + $trends = $item_data["trends"]; + $db_delay_flex = $item_data["delay_flex"]; + + if(isset($db_delay_flex)) { - @list($one_delay,$one_time_period) = explode("/",$one_db_delay); - if(!isset($one_delay) || !isset($one_time_period)) continue; + $arr_of_dellays = explode(";",$db_delay_flex); + foreach($arr_of_dellays as $one_db_delay) + { + @list($one_delay,$one_time_period) = explode("/",$one_db_delay); + if(!isset($one_delay) || !isset($one_time_period)) continue; - array_push($delay_flex,array("delay"=>$one_delay,"period"=>$one_time_period)); + array_push($delay_flex,array("delay"=>$one_delay,"period"=>$one_time_period)); + } + } + + $db_applications = get_applications_by_itemid($_REQUEST["itemid"]); + while($db_app = DBfetch($db_applications)) + { + if(in_array($db_app["applicationid"],$applications)) continue; + array_push($applications,$db_app["applicationid"]); } } } @@ -791,26 +797,32 @@ if(count($applications)==0) array_push($applications,0); if(isset($_REQUEST["itemid"])) { - $frmItem->SetTitle(S_ITEM." '$host:".$row["description"]."'"); + $frmItem->SetTitle(S_ITEM." '$host:".$item_data["description"]."'"); } else { $frmItem->SetTitle(S_ITEM." '$host:$description'"); } - $frmItem->AddRow(S_DESCRIPTION, new CTextBox("description",$description,40)); - - - $cmbType = new CComboBox("type",$type,"submit()"); - $cmbType->AddItem(ITEM_TYPE_ZABBIX,S_ZABBIX_AGENT); - $cmbType->AddItem(ITEM_TYPE_ZABBIX_ACTIVE,S_ZABBIX_AGENT_ACTIVE); - $cmbType->AddItem(ITEM_TYPE_SIMPLE,S_SIMPLE_CHECK); - $cmbType->AddItem(ITEM_TYPE_SNMPV1,S_SNMPV1_AGENT); - $cmbType->AddItem(ITEM_TYPE_SNMPV2C,S_SNMPV2_AGENT); - $cmbType->AddItem(ITEM_TYPE_SNMPV3,S_SNMPV3_AGENT); - $cmbType->AddItem(ITEM_TYPE_TRAPPER,S_ZABBIX_TRAPPER); - $cmbType->AddItem(ITEM_TYPE_INTERNAL,S_ZABBIX_INTERNAL); - $cmbType->AddItem(ITEM_TYPE_AGGREGATE,S_ZABBIX_AGGREGATE); - $frmItem->AddRow(S_TYPE, $cmbType); + $frmItem->AddRow(S_DESCRIPTION, new CTextBox("description",$description,40, $limited)); + if(isset($limited)) + { + $frmItem->AddRow(S_TYPE, new CTextBox("typename", item_type2str($type), 40, 'yes')); + $frmItem->AddVar('type', $type); + } + else + { + $cmbType = new CComboBox("type",$type,"submit()"); + $cmbType->AddItem(ITEM_TYPE_ZABBIX,S_ZABBIX_AGENT); + $cmbType->AddItem(ITEM_TYPE_ZABBIX_ACTIVE,S_ZABBIX_AGENT_ACTIVE); + $cmbType->AddItem(ITEM_TYPE_SIMPLE,S_SIMPLE_CHECK); + $cmbType->AddItem(ITEM_TYPE_SNMPV1,S_SNMPV1_AGENT); + $cmbType->AddItem(ITEM_TYPE_SNMPV2C,S_SNMPV2_AGENT); + $cmbType->AddItem(ITEM_TYPE_SNMPV3,S_SNMPV3_AGENT); + $cmbType->AddItem(ITEM_TYPE_TRAPPER,S_ZABBIX_TRAPPER); + $cmbType->AddItem(ITEM_TYPE_INTERNAL,S_ZABBIX_INTERNAL); + $cmbType->AddItem(ITEM_TYPE_AGGREGATE,S_ZABBIX_AGGREGATE); + $frmItem->AddRow(S_TYPE, $cmbType); + } if(($type==ITEM_TYPE_SNMPV1)||($type==ITEM_TYPE_SNMPV2C)) { @@ -819,32 +831,46 @@ $frmItem->AddVar("snmpv3_authpassphrase",$snmpv3_authpassphrase); $frmItem->AddVar("snmpv3_privpassphrase",$snmpv3_privpassphrase); - $frmItem->AddRow(S_SNMP_COMMUNITY, new CTextBox("snmp_community",$snmp_community,16)); - $frmItem->AddRow(S_SNMP_OID, new CTextBox("snmp_oid",$snmp_oid,40)); - $frmItem->AddRow(S_SNMP_PORT, new CTextBox("snmp_port",$snmp_port,5)); + $frmItem->AddRow(S_SNMP_COMMUNITY, new CTextBox("snmp_community",$snmp_community,16,$limited)); + $frmItem->AddRow(S_SNMP_OID, new CTextBox("snmp_oid",$snmp_oid,40,$limited)); + $frmItem->AddRow(S_SNMP_PORT, new CNumericBox("snmp_port",$snmp_port,5,$limited)); } else if($type==ITEM_TYPE_SNMPV3) { $frmItem->AddVar("snmp_community",$snmp_community); - $frmItem->AddRow(S_SNMP_OID, new CTextBox("snmp_oid",$snmp_oid,40)); + $frmItem->AddRow(S_SNMP_OID, new CTextBox("snmp_oid",$snmp_oid,40,$limited)); $frmItem->AddRow(S_SNMPV3_SECURITY_NAME, - new CTextBox("snmpv3_securityname",$snmpv3_securityname,64)); - - $cmbSecLevel = new CComboBox("snmpv3_securitylevel",$snmpv3_securitylevel); - $cmbSecLevel->AddItem(ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV,"NoAuthPriv"); - $cmbSecLevel->AddItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV,"AuthNoPriv"); - $cmbSecLevel->AddItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV,"AuthPriv"); - $frmItem->AddRow(S_SNMPV3_SECURITY_LEVEL, $cmbSecLevel); + new CTextBox("snmpv3_securityname",$snmpv3_securityname,64,$limited)); + if(isset($limited)) + { + $frmItem->AddVar("snmpv3_securitylevel", $snmpv3_securitylevel); + switch($snmpv3_securitylevel) + { + case ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV: $snmpv3_securitylevel="NoAuthPriv"; break; + case ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV: $snmpv3_securitylevel = "AuthNoPriv"; break; + case ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV: $snmpv3_securitylevel = "AuthPriv"; break; + } + $frmItem->AddRow(S_SNMPV3_SECURITY_LEVEL, new CTextBox("snmpv3_securitylevel_desc", + $snmpv3_securitylevel, $limited)); + } + else + { + $cmbSecLevel = new CComboBox("snmpv3_securitylevel",$snmpv3_securitylevel); + $cmbSecLevel->AddItem(ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV,"NoAuthPriv"); + $cmbSecLevel->AddItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV,"AuthNoPriv"); + $cmbSecLevel->AddItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV,"AuthPriv"); + $frmItem->AddRow(S_SNMPV3_SECURITY_LEVEL, $cmbSecLevel); + } $frmItem->AddRow(S_SNMPV3_AUTH_PASSPHRASE, - new CTextBox("snmpv3_authpassphrase",$snmpv3_authpassphrase,64)); + new CTextBox("snmpv3_authpassphrase",$snmpv3_authpassphrase,64,$limited)); $frmItem->AddRow(S_SNMPV3_PRIV_PASSPHRASE, - new CTextBox("snmpv3_privpassphrase",$snmpv3_privpassphrase,64)); + new CTextBox("snmpv3_privpassphrase",$snmpv3_privpassphrase,64,$limited)); - $frmItem->AddRow(S_SNMP_PORT, new CTextBox("snmp_port",$snmp_port,5)); + $frmItem->AddRow(S_SNMP_PORT, new CNumericBox("snmp_port",$snmp_port,5,$limited)); } else { @@ -857,30 +883,54 @@ $frmItem->AddVar("snmpv3_privpassphrase",$snmpv3_privpassphrase); } - $btnSelect = new CButton('btn1',S_SELECT, - "return PopUp('popup.php?dstfrm=".$frmItem->GetName(). - "&dstfld1=key&srctbl=help_items&srcfld1=key_','new_win',". - "'width=650,height=450,resizable=1,scrollbars=1');"); - $btnSelect->SetAccessKey('T'); - - $frmItem->AddRow(S_KEY, array(new CTextBox("key",$key,40), $btnSelect)); + if(isset($limited)) + { + $btnSelect = null; + } + else + { + $btnSelect = new CButton('btn1',S_SELECT, + "return PopUp('popup.php?dstfrm=".$frmItem->GetName(). + "&dstfld1=key&srctbl=help_items&srcfld1=key_','new_win',". + "'width=650,height=450,resizable=1,scrollbars=1');"); + $btnSelect->SetAccessKey('T'); + } + + $frmItem->AddRow(S_KEY, array(new CTextBox("key",$key,40,$limited), $btnSelect)); - $cmbValType = new CComboBox("value_type",$value_type,"submit()"); - $cmbValType->AddItem(ITEM_VALUE_TYPE_UINT64, S_NUMERIC_UINT64); - $cmbValType->AddItem(ITEM_VALUE_TYPE_FLOAT, S_NUMERIC_FLOAT); - $cmbValType->AddItem(ITEM_VALUE_TYPE_STR, S_CHARACTER); - $cmbValType->AddItem(ITEM_VALUE_TYPE_LOG, S_LOG); - $cmbValType->AddItem(ITEM_VALUE_TYPE_TEXT, S_TEXT); + if(isset($limited)) + { + $frmItem->AddVar("value_type", $value_type); + $cmbValType = new CTextBox('value_type_name', item_value_type2str($value_type), 40, 'yes'); + } + else + { + $cmbValType = new CComboBox("value_type",$value_type,"submit()"); + $cmbValType->AddItem(ITEM_VALUE_TYPE_UINT64, S_NUMERIC_UINT64); + $cmbValType->AddItem(ITEM_VALUE_TYPE_FLOAT, S_NUMERIC_FLOAT); + $cmbValType->AddItem(ITEM_VALUE_TYPE_STR, S_CHARACTER); + $cmbValType->AddItem(ITEM_VALUE_TYPE_LOG, S_LOG); + $cmbValType->AddItem(ITEM_VALUE_TYPE_TEXT, S_TEXT); + } $frmItem->AddRow(S_TYPE_OF_INFORMATION,$cmbValType); - + if( ($value_type==ITEM_VALUE_TYPE_FLOAT) || ($value_type==ITEM_VALUE_TYPE_UINT64)) { - $frmItem->AddRow(S_UNITS, new CTextBox("units",$units,40)); + $frmItem->AddRow(S_UNITS, new CTextBox("units",$units,40, $limited)); - $cmbMultipler = new CComboBox("multiplier",$multiplier,"submit()"); - $cmbMultipler->AddItem(0,S_DO_NOT_USE); - $cmbMultipler->AddItem(1,S_CUSTOM_MULTIPLIER); + if(isset($limited)) + { + $frmItem->AddVar("multiplier", $multiplier); + $cmbMultipler = new CTextBox('multiplier_name', $multiplier ? S_CUSTOM_MULTIPLIER : S_DO_NOT_USE, 20, 'yes'); + } + else + { + $cmbMultipler = new CComboBox("multiplier",$multiplier,"submit()"); + $cmbMultipler->AddItem(0,S_DO_NOT_USE); + $cmbMultipler->AddItem(1,S_CUSTOM_MULTIPLIER); + } $frmItem->AddRow(S_USE_MULTIPLIER, $cmbMultipler); + } else { @@ -890,7 +940,7 @@ if($multiplier == 1) { - $frmItem->AddRow(S_CUSTOM_MULTIPLIER, new CTextBox("formula",$formula,40)); + $frmItem->AddRow(S_CUSTOM_MULTIPLIER, new CTextBox("formula",$formula,40,$limited)); } else { @@ -898,12 +948,12 @@ } if($type != ITEM_TYPE_TRAPPER) { - $frmItem->AddRow(S_UPDATE_INTERVAL_IN_SEC, new CTextBox("delay",$delay,5)); + $frmItem->AddRow(S_UPDATE_INTERVAL_IN_SEC, new CNumericBox("delay",$delay,5)); $frmItem->AddRow("Flexible intervals (sec)", $delay_flex_el); $frmItem->AddRow("New flexible interval", array( S_DELAY, SPACE, - new CTextBox("new_delay_flex[delay]","50",5), + new CNumericBox("new_delay_flex[delay]","50",5), S_PERIOD, SPACE, new CTextBox("new_delay_flex[period]","1-7,00:00-23:59",27), BR, new CButton("add_delay_flex",S_ADD) @@ -916,24 +966,23 @@ } $frmItem->AddRow(S_KEEP_HISTORY_IN_DAYS, array( - new CTextBox("history",$history,8), + new CNumericBox("history",$history,8), (!isset($_REQUEST["itemid"])) ? null : new CButton("del_history", "Clean history", "return Confirm('History cleaning can take a long time. Continue?');") )); - $frmItem->AddRow(S_KEEP_TRENDS_IN_DAYS, new CTextBox("trends",$trends,8)); + $frmItem->AddRow(S_KEEP_TRENDS_IN_DAYS, new CNumericBox("trends",$trends,8)); $cmbStatus = new CComboBox("status",$status); $cmbStatus->AddItem(ITEM_STATUS_ACTIVE,S_MONITORED); $cmbStatus->AddItem(ITEM_STATUS_DISABLED,S_DISABLED); -# $cmbStatus->AddItem(2,"Trapper"); $cmbStatus->AddItem(ITEM_STATUS_NOTSUPPORTED,S_NOT_SUPPORTED); $frmItem->AddRow(S_STATUS,$cmbStatus); if($value_type==ITEM_VALUE_TYPE_LOG) { - $frmItem->AddRow(S_LOG_TIME_FORMAT, new CTextBox("logtimefmt",$logtimefmt,16)); + $frmItem->AddRow(S_LOG_TIME_FORMAT, new CTextBox("logtimefmt",$logtimefmt,16,$limited)); } else { @@ -955,12 +1004,25 @@ if(($value_type==ITEM_VALUE_TYPE_UINT64) || ($value_type == ITEM_VALUE_TYPE_STR)) { - $cmbMap = new CComboBox("valuemapid",$valuemapid); - $cmbMap->AddItem(0,S_AS_IS); - $db_valuemaps = DBselect("select * from valuemaps where ".DBid2nodeid("valuemapid")."=".$ZBX_CURNODEID); - while($db_valuemap = DBfetch($db_valuemaps)) - $cmbMap->AddItem($db_valuemap["valuemapid"],$db_valuemap["name"]); - + if(isset($limited)) + { + $frmItem->AddVar("valuemapid", $valuemapid); + $map_name = S_AS_IS; + if($map_data = DBfetch(DBselect('select name from valuemaps where valuemapid='.$valuemapid))) + { + $map_name = $map_data['name']; + } + $cmbMap = new CTextBox("valuemap_name", $map_name, 20, 'yes'); + } + else + { + $cmbMap = new CComboBox("valuemapid",$valuemapid); + $cmbMap->AddItem(0,S_AS_IS); + $db_valuemaps = DBselect("select * from valuemaps where ".DBid2nodeid("valuemapid")."=".$ZBX_CURNODEID); + while($db_valuemap = DBfetch($db_valuemaps)) + $cmbMap->AddItem($db_valuemap["valuemapid"],$db_valuemap["name"]); + } + $link = new CLink("throw map","config.php?config=6","action"); $link->AddOption("target","_blank"); $frmItem->AddRow(array(S_SHOW_VALUE.SPACE,$link),$cmbMap); @@ -971,9 +1033,9 @@ $frmItem->AddVar("valuemapid",0); } - if($type==2) + if($type==ITEM_TYPE_TRAPPER) { - $frmItem->AddRow(S_ALLOWED_HOSTS, new CTextBox("trapper_hosts",$trapper_hosts,40)); + $frmItem->AddRow(S_ALLOWED_HOSTS, new CTextBox("trapper_hosts",$trapper_hosts,40,$limited)); } else { @@ -991,7 +1053,7 @@ $frmItem->AddRow(S_APPLICATIONS,$cmbApps); $frmRow = array(new CButton("save",S_SAVE)); - if(isset($_REQUEST["itemid"])) + if(isset($_REQUEST["itemid"]) && !isset($limited)) { array_push($frmRow, SPACE, diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index cf7ae987..98a25bba 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -355,10 +355,6 @@ DBexecute("update items set lastlogsize=0 where itemid=$itemid and key_<>".zbx_dbstr($key)); - if($templateid==0){ - update_item_status($itemid, $status); - } - $result = DBexecute("delete from items_applications where itemid=$itemid"); foreach($applications as $appid) { @@ -368,7 +364,7 @@ $result=DBexecute( "update items set description=".zbx_dbstr($description).",key_=".zbx_dbstr($key).",". - "hostid=$hostid,delay=$delay,history=$history,nextcheck=0,type=$type,". + "hostid=$hostid,delay=$delay,history=$history,nextcheck=0,type=$type,status=".$status.','. "snmp_community=".zbx_dbstr($snmp_community).",snmp_oid=".zbx_dbstr($snmp_oid).",". "value_type=$value_type,trapper_hosts=".zbx_dbstr($trapper_hosts).",". "snmp_port=$snmp_port,units=".zbx_dbstr($units).",multiplier=$multiplier,delta=$delta,". 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"]. |
