summaryrefslogtreecommitdiffstats
path: root/frontends/php/hosts.php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-11-20 10:13:38 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-11-20 10:13:38 +0000
commitabaab8acc5b75de465ca5e1fb6d77f3c8d02ce4b (patch)
tree6705c4e3454abd57dc0d47fddc3749e8173c7454 /frontends/php/hosts.php
parentf617fb752abb648c642d4a42944e84ba8d97c7ee (diff)
downloadzabbix-abaab8acc5b75de465ca5e1fb6d77f3c8d02ce4b.tar.gz
zabbix-abaab8acc5b75de465ca5e1fb6d77f3c8d02ce4b.tar.xz
zabbix-abaab8acc5b75de465ca5e1fb6d77f3c8d02ce4b.zip
Cosmetic changes.
git-svn-id: svn://svn.zabbix.com/trunk@1494 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/hosts.php')
-rw-r--r--frontends/php/hosts.php55
1 files changed, 51 insertions, 4 deletions
diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php
index 9a21b27d..644790cf 100644
--- a/frontends/php/hosts.php
+++ b/frontends/php/hosts.php
@@ -41,7 +41,16 @@
{
if($_GET["register"]=="add")
{
- $result=add_host($_GET["host"],$_GET["port"],$_GET["status"],$_GET["useip"],$_GET["ip"],$_GET["host_templateid"],$_GET["newgroup"],$_GET["groups"]);
+ $groups=array();
+ $result=DBselect("select groupid from groups");
+ while($row=DBfetch($result))
+ {
+ if(isset($_GET[$row["groupid"]]))
+ {
+ $groups=array_merge($groups,$row["groupid"]);
+ }
+ }
+ $result=add_host($_GET["host"],$_GET["port"],$_GET["status"],$_GET["useip"],$_GET["ip"],$_GET["host_templateid"],$_GET["newgroup"],$groups);
show_messages($result, S_HOST_ADDED, S_CANNOT_ADD_HOST);
if($result)
add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_HOST,"Host [".addslashes($_GET["host"])."] IP [".$_GET["ip"]."] Status [".$_GET["status"]."]");
@@ -55,7 +64,16 @@
}
if($_GET["register"]=="update")
{
- $result=@update_host($_GET["hostid"],$_GET["host"],$_GET["port"],$_GET["status"],$_GET["useip"],$_GET["ip"],$_GET["newgroup"],$_GET["groups"]);
+ $groups=array();
+ $result=DBselect("select groupid from groups");
+ while($row=DBfetch($result))
+ {
+ if(isset($_GET[$row["groupid"]]))
+ {
+ $groups=array_merge($groups,$row["groupid"]);
+ }
+ }
+ $result=@update_host($_GET["hostid"],$_GET["host"],$_GET["port"],$_GET["status"],$_GET["useip"],$_GET["ip"],$_GET["newgroup"],$groups);
show_messages($result, S_HOST_UPDATED, S_CANNOT_UPDATE_HOST);
if($result)
add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_HOST,"Host [".addslashes($_GET["host"])."] IP [".$_GET["ip"]."] Status [".$_GET["status"]."]");
@@ -115,7 +133,8 @@
$col=0;
while($row=DBfetch($result))
{
- $members=array("hide"=>1,"value"=>"");
+// $members=array("hide"=>1,"value"=>"");
+ $members=array("hide"=>0,"value"=>"");
$result1=DBselect("select distinct h.host from hosts h, hosts_groups hg where h.hostid=hg.hostid and hg.groupid=".$row["groupid"]." order by host");
for($i=0;$i<DBnum_rows($result1);$i++)
{
@@ -354,7 +373,7 @@
show_table2_h_delimiter();
echo "<input class=\"biginput\" name=\"host\" value=\"$host\" size=20>";
- show_table2_v_delimiter($col++);
+/* show_table2_v_delimiter($col++);
echo S_GROUPS;
show_table2_h_delimiter();
echo "<select multiple class=\"biginput\" name=\"groups[]\" size=\"5\">";
@@ -380,6 +399,34 @@
echo "<option value=\"".$row["groupid"]."\">".$row["name"];
}
}
+ echo "</select>";*/
+
+ show_table2_v_delimiter($col++);
+ echo S_GROUPS;
+ show_table2_h_delimiter();
+ $result=DBselect("select distinct groupid,name from groups order by name");
+ while($row=DBfetch($result))
+ {
+ if(isset($_GET["hostid"]))
+ {
+ $sql="select count(*) as count from hosts_groups where hostid=".$_GET["hostid"]." and groupid=".$row["groupid"];
+ $result2=DBselect($sql);
+ $row2=DBfetch($result2);
+ if($row2["count"]==0)
+ {
+ echo "<input type=checkbox name=\"".$row["groupid"]."\">".$row["name"];
+ }
+ else
+ {
+ echo "<input type=checkbox name=\"".$row["groupid"]."\" checked>".$row["name"];
+ }
+ }
+ else
+ {
+ echo "<input type=checkbox name=\"".$row["groupid"]."\">".$row["name"];
+ }
+ echo "<br>";
+ }
echo "</select>";
show_table2_v_delimiter($col++);