diff options
Diffstat (limited to 'frontends/php/include/forms.inc.php')
| -rw-r--r-- | frontends/php/include/forms.inc.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index 46fe70bb..e398c8a8 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -1418,4 +1418,73 @@ show_table2_header_end(); } + + # Insert autoregistration form + function insert_autoregistration_form($id) + { + if(isset($id)) + { + $result=DBselect("select * from autoreg where id=$id"); + + $row=DBfetch($result); + + $pattern=$row["pattern"]; + $priority=$row["priority"]; + $hopstid=$row["hostid"]; + } + else + { + $pattern="*"; + $priority=10; + $hostid=0; + } + + $col=0; + + show_form_begin("autoregistration"); + echo S_AUTOREGISTRATION; + + show_table2_v_delimiter($col++); + echo "<form method=\"get\" action=\"config.php\">"; + echo "<input class=\"biginput\" name=\"config\" type=\"hidden\" value=\"".$_GET["config"]."\" size=8>"; + if(isset($id)) + { + echo "<input class=\"biginput\" name=\"id\" type=\"hidden\" value=\"$id\" size=8>"; + } + + echo S_PATTERN; + show_table2_h_delimiter(); + echo "<input class=\"biginput\" name=\"pattern\" size=64 value=\"$pattern\">"; + + show_table2_v_delimiter($col++); + echo S_PRIORITY; + show_table2_h_delimiter(); + echo "<input class=\"biginput\" name=\"priority\" size=4 value=\"$priority\">"; + + show_table2_v_delimiter($col++); + echo S_HOST; + show_table2_h_delimiter(); + + echo "<select class=\"biginput\" name=\"hostid\">"; + echo form_select("hostid",0,S_SELECT_HOST_DOT_DOT_DOT); + + $sql="select h.hostid,h.host from hosts h where h.status<>".HOST_STATUS_DELETED." group by h.hostid,h.host order by h.host"; + + $result=DBselect($sql); + while($row=DBfetch($result)) + { + echo form_select("hostid",$row["hostid"],$row["host"]); + } + echo "</select>"; + + show_table2_v_delimiter2($col++); + echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"add autoregistration\">"; + if(isset($id)) + { + echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"update autoregistration\">"; + echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"delete autoregistration\" onClick=\"return Confirm('Delete selected autoregistration rule?');\">"; + } + + show_table2_header_end(); + } ?> |
