summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/forms.inc.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-11-17 14:21:22 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-11-17 14:21:22 +0000
commite3a9c8732564acac5c5dce55cdfd201212752716 (patch)
tree9844116112cf4f8b9cbfdc848bfe15cc40c8626a /frontends/php/include/forms.inc.php
parentb206daa4f6b4ce7cc3236578c6124788e023ac74 (diff)
downloadzabbix-e3a9c8732564acac5c5dce55cdfd201212752716.tar.gz
zabbix-e3a9c8732564acac5c5dce55cdfd201212752716.tar.xz
zabbix-e3a9c8732564acac5c5dce55cdfd201212752716.zip
- added "Host group" element to maps (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3499 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/forms.inc.php')
-rw-r--r--frontends/php/include/forms.inc.php84
1 files changed, 66 insertions, 18 deletions
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index c35b82a8..227877ed 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -3194,6 +3194,7 @@
$cmbType = new CComboBox("elementtype",$elementtype,"submit()");
$denyed_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_MODE_LT);
+ $allowed_groups = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY);
$db_hosts = DBselect("select distinct n.name as node_name,h.hostid,h.host from hosts h,nodes n ".
" where h.hostid not in(".$denyed_hosts.")".
@@ -3206,7 +3207,8 @@
if(DBfetch($db_maps))
$cmbType->AddItem(SYSMAP_ELEMENT_TYPE_MAP, S_MAP);
- $cmbType->AddItem(SYSMAP_ELEMENT_TYPE_IMAGE, S_IMAGE);
+ $cmbType->AddItem(SYSMAP_ELEMENT_TYPE_TRIGGER, S_TRIGGER);
+ $cmbType->AddItem(SYSMAP_ELEMENT_TYPE_HOST_GROUP, S_HOST_GROUP);
$frmEl->AddRow(S_TYPE,$cmbType);
@@ -3224,9 +3226,9 @@
{
$host = "";
- $host_info = DBfetch(DBselect("select distinct n.name as node_name,h.hostid,h.host from hosts h,nodes n ".
+ $host_info = DBfetch(DBselect("select distinct n.name as node_name,h.hostid,h.host from hosts h ".
+ " left join nodes n on n.nodeid=".DBid2nodeid("h.hostid").
" where h.hostid not in(".$denyed_hosts.") and hostid=".$elementid.
- " and n.nodeid=".DBid2nodeid("h.hostid").
" order by node_name,h.host"));
if($host_info)
$host = $host_info["host"];
@@ -3260,24 +3262,62 @@
}
$frmEl->AddRow(S_MAP, $cmbMaps);
}
- elseif($elementtype==SYSMAP_ELEMENT_TYPE_IMAGE)
+ elseif($elementtype==SYSMAP_ELEMENT_TYPE_TRIGGER)
{
- $cmbTriggers= new CComboBox("elementid",$elementid);
- $cmbTriggers->AddItem(0,"-");
- $db_triggers = DBselect("select distinct n.name as node_name,h.hostid,h.host,t.*".
- " from triggers t,hosts h,items i,functions f,nodes n ".
- " where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid".
- " and h.hostid not in (".$denyed_hosts.")".
- " and ".DBid2nodeid("h.hostid")."=n.nodeid".
- " order by node_name,h.host,t.description");
+ $trigger = "";
+ $trigger_info = DBfetch(DBselect("select distinct n.name as node_name,h.hostid,h.host,t.*".
+ " from triggers t left join functions f on t.triggerid=f.triggerid ".
+ " left join items i on i.itemid=f.itemid left join hosts h on h.hostid=i.hostid ".
+ " left join nodes n on n.nodeid=".DBid2nodeid("t.triggerid").
+ " where h.hostid not in (".$denyed_hosts.") and t.triggerid=".$elementid.
+ " order by node_name,h.host,t.description"));
- while($db_trigger = DBfetch($db_triggers))
+ if($trigger_info)
+ $trigger = expand_trigger_description_by_data($trigger_info);
+ else
+ $elementid=0;
+
+ if($elementid==0)
{
- $cmbTriggers->AddItem(
- $db_trigger["triggerid"],
- "(".$db_trigger['node_name'].") ".expand_trigger_description($db_trigger["triggerid"]));
+ $trigger = "";
+ $elementid = 0;
}
- $frmEl->AddRow(S_TRIGGER, $cmbTriggers);
+
+ $frmEl->AddVar("elementid",$elementid);
+ $frmEl->AddRow(S_TRIGGER, array(
+ new CTextBox("trigger",$trigger,32,'yes'),
+ new CButton("btn1",S_SELECT,"return PopUp('popup.php?dstfrm=".$frmEl->GetName().
+ "&dstfld1=elementid&dstfld2=trigger&srctbl=triggers&srcfld1=triggerid&srcfld2=description','new_win',".
+ "'width=550,height=450,resizable=1,scrollbars=1');","T")
+ ));
+ }
+ elseif($elementtype==SYSMAP_ELEMENT_TYPE_HOST_GROUP)
+ {
+ $group = "";
+
+ $group_info = DBfetch(DBselect("select distinct n.name as node_name,g.groupid,g.name from groups g ".
+ " left join nodes n on n.nodeid=".DBid2nodeid("g.groupid").
+ " where g.groupid in (".$allowed_groups.") and g.groupid=".$elementid.
+ " order by node_name,g.name"));
+
+ if($group_info)
+ $group = $group_info["name"];
+ else
+ $elementid=0;
+
+ if($elementid==0)
+ {
+ $group = "";
+ $elementid = 0;
+ }
+
+ $frmEl->AddVar("elementid",$elementid);
+ $frmEl->AddRow(S_HOST_GROUP, array(
+ new CTextBox("group",$group,32,'yes'),
+ new CButton("btn1",S_SELECT,"return PopUp('popup.php?dstfrm=".$frmEl->GetName().
+ "&dstfld1=elementid&dstfld2=group&srctbl=host_group&srcfld1=groupid&srcfld2=name','new_win',".
+ "'width=450,height=450,resizable=1,scrollbars=1');","T")
+ ));
}
$cmbIconOff = new CComboBox("iconid_off",$iconid_off);
@@ -3362,13 +3402,21 @@
$db_map = get_sysmap_by_sysmapid($db_selement["elementid"]);
$label .= ":".$db_map["name"];
}
- elseif($db_selement["elementtype"] == SYSMAP_ELEMENT_TYPE_IMAGE)
+ elseif($db_selement["elementtype"] == SYSMAP_ELEMENT_TYPE_TRIGGER)
{
if($db_selement["elementid"]>0)
{
$label .= ":".expand_trigger_description($db_selement["elementid"]);
}
}
+ elseif($db_selement["elementtype"] == SYSMAP_ELEMENT_TYPE_HOST_GROUP)
+ {
+ if($db_selement["elementid"]>0)
+ {
+ $db_group = DBfetch(DBselect('select name from groups where groupid='.$db_selement["elementid"]));
+ $label .= ":".$db_group['name'];
+ }
+ }
$cmbElements1->AddItem($db_selement["selementid"],$label);
$cmbElements2->AddItem($db_selement["selementid"],$label);
}