diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-01-04 10:35:24 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-01-04 10:35:24 +0000 |
| commit | bd443d5587cb568520c8ca2ea0e98ac0c7e5ac29 (patch) | |
| tree | 340429f3012365b1aa16813e6bf46fcafe7faf56 /frontends/php/hosts.php | |
| parent | e13f6fe7b67ca1e1a7538ae44c34126e111b5619 (diff) | |
| download | zabbix-bd443d5587cb568520c8ca2ea0e98ac0c7e5ac29.tar.gz zabbix-bd443d5587cb568520c8ca2ea0e98ac0c7e5ac29.tar.xz zabbix-bd443d5587cb568520c8ca2ea0e98ac0c7e5ac29.zip | |
Added screen for host-templates linkage.
git-svn-id: svn://svn.zabbix.com/trunk@1578 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/hosts.php')
| -rw-r--r-- | frontends/php/hosts.php | 111 |
1 files changed, 110 insertions, 1 deletions
diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php index 2f1dcdb1..c1a3d4cb 100644 --- a/frontends/php/hosts.php +++ b/frontends/php/hosts.php @@ -133,12 +133,84 @@ $h2=$h2."<select class=\"biginput\" name=\"config\" onChange=\"submit()\">"; $h2=$h2."<option value=\"0\" ".iif(isset($_GET["config"])&&$_GET["config"]==0,"selected","").">".S_HOSTS; $h2=$h2."<option value=\"1\" ".iif(isset($_GET["config"])&&$_GET["config"]==1,"selected","").">".S_HOST_GROUPS; + $h2=$h2."<option value=\"2\" ".iif(isset($_GET["config"])&&$_GET["config"]==2,"selected","").">".S_TEMPLATES; $h2=$h2."</select>"; show_header2($h1, $h2, "<form name=\"selection\" method=\"get\" action=\"hosts.php\">", "</form>"); ?> + + +<?php + if($_GET["config"]==2) + { + $h1=S_CONFIGURATION_OF_TEMPLATES_LINKAGE; + + if(isset($_GET["groupid"])&&($_GET["groupid"]==0)) + { + unset($_GET["groupid"]); + } + if(isset($_GET["hostid"])&&($_GET["hostid"]==0)) + { + unset($_GET["hostid"]); + } + + $h2=S_GROUP." "; + $h2=$h2."<input class=\"biginput\" name=\"config\" type=\"hidden\" value=\"".$_GET["config"]."\">"; + $h2=$h2."<select class=\"biginput\" name=\"groupid\" onChange=\"submit()\">"; + $h2=$h2."<option value=\"0\" ".iif(!isset($_GET["groupid"]),"selected","").">".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,hosts_groups hg where hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid group by h.hostid,h.host order by h.host"); + $cnt=0; + while($row2=DBfetch($result2)) + { + if(!check_right("Host","U",$row2["hostid"])) + { + continue; + } + $cnt=1; break; + } + if($cnt!=0) + { + $h2=$h2."<option value=\"".$row["groupid"]."\" ".iif(isset($_GET["groupid"])&&($_GET["groupid"]==$row["groupid"]),"selected","").">".$row["name"]; + } + } + $h2=$h2."</select>"; + + $h2=$h2." ".S_HOST." "; + $h2=$h2."<select class=\"biginput\" name=\"hostid\" onChange=\"submit()\">"; + $h2=$h2."<option value=\"0\" ".iif(!isset($_GET["hostid"]),"selected","").">".S_SELECT_HOST_DOT_DOT_DOT; + + if(isset($_GET["groupid"])) + { + $sql="select h.hostid,h.host from hosts h,hosts_groups hg where hg.groupid=".$_GET["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 group by h.hostid,h.host order by h.host"; + } + + $result=DBselect($sql); + while($row=DBfetch($result)) + { + if(!check_right("Host","U",$row["hostid"])) + { + continue; + } + $h2=$h2."<option value=\"".$row["hostid"]."\"".iif(isset($_GET["hostid"])&&($_GET["hostid"]==$row["hostid"]),"selected","").">".$row["host"]; + } + $h2=$h2."</select>"; + + echo "<br>"; + show_header2($h1, $h2, "<form name=\"form2\" method=\"get\" action=\"hosts.php\">", "</form>"); + } +?> + <?php if($_GET["config"]==1) { @@ -190,6 +262,43 @@ } ?> +<? + if(isset($_GET["hostid"])&&($_GET["config"]==2)) + { + table_begin(); + table_header(array(S_HOST,S_TEMPLATE,S_ITEMS,S_TRIGGERS,S_ACTIONS,S_GRAPHS,S_SCREENS,S_ACTIONS)); + + $result=DBselect("select hostid,templateid,items,triggers,actions,graphs,screens from hosts_templates where hostid=".$_GET["hostid"]); + $col=0; + while($row=DBfetch($result)) + { + $host=get_host_by_hostid($row["hostid"]); + $template=get_host_by_hostid($row["templateid"]); +// $members=array("hide"=>1,"value"=>""); +# $actions="<A HREF=\"hosts.php?config=".$_GET["config"]."&groupid=".$row["groupid"]."#form\">".S_CHANGE."</A>"; + $actions="ZZZ"; + + table_row(array( + $host["host"], + $template["host"], + get_template_permission_str($row["items"]), + get_template_permission_str($row["triggers"]), + get_template_permission_str($row["actions"]), + get_template_permission_str($row["graphs"]), + get_template_permission_str($row["screens"]), + $actions + ),$col++); + } + if(DBnum_rows($result)==0) + { + echo "<TR BGCOLOR=#EEEEEE>"; + echo "<TD COLSPAN=4 ALIGN=CENTER>".S_NO_HOST_GROUPS_DEFINED."</TD>"; + echo "<TR>"; + } + table_end(); + } +?> + <?php if(!isset($_GET["hostid"])&&($_GET["config"]==0)) { @@ -341,7 +450,7 @@ <?php if($_GET["config"]==1) { - insert_hostgroups_form($_GET["groupid"]); + @insert_hostgroups_form($_GET["groupid"]); } ?> |
