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 | |
| 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')
| -rw-r--r-- | frontends/php/hosts.php | 111 | ||||
| -rw-r--r-- | frontends/php/include/config.inc.php | 9 | ||||
| -rw-r--r-- | frontends/php/include/local_en.inc.php | 7 |
3 files changed, 126 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"]); } ?> diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index fc229949..38519007 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -139,6 +139,15 @@ return "$s $u$units"; } + + function get_template_permission_str($num) + { + $str=" "; + if(($num&1)==1) $str=$str.S_ADD." "; + if(($num&2)==2) $str=$str.S_UPDATE." "; + if(($num&4)==4) $str=$str.S_DELETE." "; + return $str; + } function get_media_count_by_userid($userid) { diff --git a/frontends/php/include/local_en.inc.php b/frontends/php/include/local_en.inc.php index 0fa07718..a2b77a2a 100644 --- a/frontends/php/include/local_en.inc.php +++ b/frontends/php/include/local_en.inc.php @@ -227,6 +227,9 @@ // hosts.php define("S_HOSTS", "Hosts"); + define("S_ITEMS", "Items"); + define("S_TRIGGERS", "Triggers"); + define("S_GRAPHS", "Graphs"); define("S_HOST_ADDED", "Host added"); define("S_CANNOT_ADD_HOST", "Cannot add host"); define("S_ITEMS_ADDED", "Items added"); @@ -260,6 +263,7 @@ define("S_GROUP_NAME", "Group name"); define("S_HOST_GROUP", "Host group"); define("S_HOST_GROUPS", "Host groups"); + define("S_UPDATE", "Update"); // items.php define("S_CONFIGURATION_OF_ITEMS", "Configuration of items"); @@ -585,6 +589,9 @@ define("S_USERS_BIG", "USERS"); define("S_USER_GROUPS", "User groups"); define("S_MEMBERS", "Members"); + define("S_TEMPLATES", "Templates"); + define("S_CONFIGURATION_OF_TEMPLATES_LINKAGE", "CONFIGURATION OF TEMPLATES LINKAGE"); + define("S_LINKED_TEMPLATES_BIG", "LINKED TEMPLATES"); define("S_NO_USER_GROUPS_DEFINED", "No user groups defined"); define("S_ALIAS", "Alias"); define("S_NAME", "Name"); |
