summaryrefslogtreecommitdiffstats
path: root/frontends/php/hostprofiles.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-02-03 08:58:45 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-02-03 08:58:45 +0000
commit1f829e896d022a4ed202d443d127346d26cbf7f2 (patch)
treef94630ee96cae994e22450e96848a5d61193a018 /frontends/php/hostprofiles.php
parent9d8c5c8048b648f6b92c51ac96cd3001f55c6253 (diff)
downloadzabbix-1f829e896d022a4ed202d443d127346d26cbf7f2.tar.gz
zabbix-1f829e896d022a4ed202d443d127346d26cbf7f2.tar.xz
zabbix-1f829e896d022a4ed202d443d127346d26cbf7f2.zip
- Frontend improvements (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2602 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/hostprofiles.php')
-rw-r--r--frontends/php/hostprofiles.php75
1 files changed, 38 insertions, 37 deletions
diff --git a/frontends/php/hostprofiles.php b/frontends/php/hostprofiles.php
index a1071bed..b3e0aacf 100644
--- a/frontends/php/hostprofiles.php
+++ b/frontends/php/hostprofiles.php
@@ -56,79 +56,80 @@
?>
<?php
- $h1="&nbsp;".S_HOST_PROFILES_BIG;
+ $form = new CForm();
+
+ $form->AddItem(S_GROUP.SPACE);
+ $cmbGroup = new CComboBox("groupid",get_request("groupid",0),"submit()");
+ $cmbGroup->AddItem(0,S_ALL_SMALL);
- $h2=S_GROUP."&nbsp;";
- $h2=$h2."<select class=\"biginput\" name=\"groupid\" onChange=\"submit()\">";
- $h2=$h2.form_select("groupid",0,S_ALL_SMALL);
$result=DBselect("select groupid,name from groups order by name");
while($row=DBfetch($result))
{
// Check if at least one host with read permission exists for this group
- $result2=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host");
- $cnt=0;
+ $result2=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg".
+ " where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and".
+ " hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host".
+ " order by h.host");
while($row2=DBfetch($result2))
{
- if(!check_right("Host","R",$row2["hostid"]))
- {
- continue;
- }
- $cnt=1; break;
- }
- if($cnt!=0)
- {
- $h2=$h2.form_select("groupid",$row["groupid"],$row["name"]);
+ if(!check_right("Host","R",$row2["hostid"])) continue;
+ $cmbGroup->AddItem($row["groupid"],$row["name"]);
+ break;
}
}
- $h2=$h2."</select>";
+ $form->AddItem($cmbGroup);
- $h2=$h2."&nbsp;".S_HOST."&nbsp;";
- $h2=$h2."<select class=\"biginput\" name=\"hostid\" onChange=\"submit()\">";
- $h2=$h2.form_select("hostid",0,S_SELECT_HOST_DOT_DOT_DOT);
+ $form->AddItem(SPACE.S_HOST.SPACE);
+
+ $cmbHost = new CComboBox("hostid",get_request("hostid",0),"submit()");
+ $cmbHost->AddItem(0,S_SELECT_HOST_DOT_DOT_DOT);
if(isset($_REQUEST["groupid"]))
{
- $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host";
+ $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg".
+ " where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid and".
+ " hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid".
+ " group by h.hostid,h.host order by h.host";
}
else
{
- $sql="select h.hostid,h.host from hosts h,items i where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid group by h.hostid,h.host order by h.host";
+ $sql="select h.hostid,h.host from hosts h,items i where h.status=".HOST_STATUS_MONITORED.
+ " and h.hostid=i.hostid group by h.hostid,h.host order by h.host";
}
$result=DBselect($sql);
while($row=DBfetch($result))
{
- if(!check_right("Host","R",$row["hostid"]))
- {
- continue;
- }
- $h2=$h2.form_select("hostid",$row["hostid"],$row["host"]);
+ if(!check_right("Host","R",$row["hostid"])) continue;
+ $cmbHost->AddItem($row["hostid"],$row["host"]);
}
- $h2=$h2."</select>";
-
- show_header2($h1, $h2, "<form name=\"form2\" method=\"get\" action=\"hostprofiles.php\">", "</form>");
+ $form->AddItem($cmbHost);
+
+ show_header2(S_HOST_PROFILES_BIG, $form);
?>
<?php
if(isset($_REQUEST["hostid"])&&($_REQUEST["hostid"]!=0))
{
- insert_host_profile_form($_REQUEST["hostid"],1);
+ echo BR;
+ insert_host_profile_form();
}
else
{
$table = new CTableInfo();
- $header=array();
- $header=array_merge($header,array(S_HOST,S_NAME,S_OS,S_SERIALNO,S_TAG,S_MACADDRESS));
-
- $table->setHeader($header);
+ $table->setHeader(array(S_HOST,S_NAME,S_OS,S_SERIALNO,S_TAG,S_MACADDRESS));
if(isset($_REQUEST["groupid"])&&($_REQUEST["groupid"]!=0))
{
- $sql="select h.hostid,h.host,p.name,p.os,p.serialno,p.tag,p.macaddress from hosts h,hosts_profiles p,hosts_groups hg where h.hostid=p.hostid and h.hostid=hg.hostid and hg.groupid=".$_REQUEST["groupid"]." order by h.host";
+ $sql="select h.hostid,h.host,p.name,p.os,p.serialno,p.tag,p.macaddress".
+ " from hosts h,hosts_profiles p,hosts_groups hg where h.hostid=p.hostid".
+ " and h.hostid=hg.hostid and hg.groupid=".$_REQUEST["groupid"].
+ " order by h.host";
}
else
{
- $sql="select h.hostid,h.host,p.name,p.os,p.serialno,p.tag,p.macaddress from hosts h,hosts_profiles p where h.hostid=p.hostid order by h.host";
+ $sql="select h.hostid,h.host,p.name,p.os,p.serialno,p.tag,p.macaddress".
+ " from hosts h,hosts_profiles p where h.hostid=p.hostid order by h.host";
}
$result=DBselect($sql);
@@ -139,7 +140,7 @@
continue;
}
- $table->addRow(array(
+ $table->AddRow(array(
$row["host"],
$row["name"],
$row["os"],