summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/forms.inc.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-18 10:19:40 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-18 10:19:40 +0000
commitb4726586d8164b091529c2105b80e647139c13c8 (patch)
tree56465cac603d80607d0f8820f5ec21ad6954d14f /frontends/php/include/forms.inc.php
parent5ee0e65e708340172b938d324ca316b0204b7dc5 (diff)
- [ZBX-362] improvements in linkage form (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5636 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/forms.inc.php')
-rw-r--r--frontends/php/include/forms.inc.php33
1 files changed, 26 insertions, 7 deletions
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index b6cce472..c62fa5a6 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -4645,11 +4645,11 @@ include_once 'include/discovery.inc.php';
global $USER_DETAILS;
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE, PERM_RES_IDS_ARRAY);
- $frm_title = S_TEMPLATE;
+ $frm_title = S_TEMPLATE_LINKAGE;
if(isset($_REQUEST["hostid"])){
$template = get_host_by_hostid($_REQUEST["hostid"]);
- $frm_title = S_TEMPLATE.' ['.$template['host'].']';
+ $frm_title.= ' ['.$template['host'].']';
}
if(isset($_REQUEST['hostid']) && !isset($_REQUEST["form_refresh"])){
@@ -4669,20 +4669,39 @@ include_once 'include/discovery.inc.php';
$frmHostT->AddRow(S_TEMPLATE,new CTextBox("tname",$name,60));
$cmbHosts = new CListBox('hosts[]',null,10);
-
+
+ $hosts_in_tpl = array();
$sql = 'SELECT DISTINCT h.hostid,h.host '.
- ' FROM hosts h'.
- ' WHERE ( h.status='.HOST_STATUS_MONITORED.' OR h.status='.HOST_STATUS_NOT_MONITORED.' ) '.
+ ' FROM hosts h,hosts_templates ht'.
+ ' WHERE ht.templateid='.$_REQUEST['hostid'].
+ ' AND h.hostid=ht.hostid'.
+ ' AND h.status IN ('.HOST_STATUS_MONITORED.','.HOST_STATUS_NOT_MONITORED.') '.
' AND '.DBcondition('h.hostid',$available_hosts).
' ORDER BY h.host';
-
+
$db_hosts=DBselect($sql);
-
while($db_host=DBfetch($db_hosts)){
$cmbHosts->AddItem(
$db_host["hostid"],
get_node_name_by_elid($db_host["hostid"]).$db_host["host"]
);
+ $hosts_in_tpl[] = $db_host["hostid"];
+ }
+
+ $available_hosts = array_diff($available_hosts,$hosts_in_tpl);
+ $sql = 'SELECT DISTINCT h.hostid,h.host '.
+ ' FROM hosts h'.
+ ' WHERE ( h.status='.HOST_STATUS_MONITORED.' OR h.status='.HOST_STATUS_NOT_MONITORED.' ) '.
+ ' AND '.DBcondition('h.hostid',$available_hosts).
+ ' ORDER BY h.host';
+
+ $db_hosts=DBselect($sql);
+
+ while($db_host=DBfetch($db_hosts)){
+ $cmbitem = new CComboItem($db_host["hostid"],get_node_name_by_elid($db_host["hostid"]).$db_host["host"]);
+ $cmbitem->AddOption('style','color: grey;');
+
+ $cmbHosts->AddItem($cmbitem);
}
$frmHostT->AddRow(S_HOSTS,$cmbHosts);