diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-06-24 17:14:02 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2001-06-24 17:14:02 +0000 |
| commit | 0db5010365e68d85776cc095012f95d6b2cdcd60 (patch) | |
| tree | f11d4dc01ff677630e7cce3cc02db6cc40117387 /frontends/php | |
| parent | 8a7434e7df3385c008a7825536eb4c069620fd98 (diff) | |
Change of sysmap information became possible.
git-svn-id: svn://svn.zabbix.com/trunk@107 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
| -rw-r--r-- | frontends/php/images/sysmaps/host.png | bin | 0 -> 4519 bytes | |||
| -rw-r--r-- | frontends/php/include/config.inc | 15 | ||||
| -rw-r--r-- | frontends/php/map.html | 6 | ||||
| -rw-r--r-- | frontends/php/sysmap.html | 81 | ||||
| -rw-r--r-- | frontends/php/sysmaps.html | 48 |
5 files changed, 110 insertions, 40 deletions
diff --git a/frontends/php/images/sysmaps/host.png b/frontends/php/images/sysmaps/host.png Binary files differnew file mode 100644 index 00000000..68f8b0d7 --- /dev/null +++ b/frontends/php/images/sysmaps/host.png diff --git a/frontends/php/include/config.inc b/frontends/php/include/config.inc index fc2d28bc..ad78f306 100644 --- a/frontends/php/include/config.inc +++ b/frontends/php/include/config.inc @@ -167,6 +167,7 @@ ($page["file"]=="latestalarms.html")|| ($page["file"]=="alerts.html")|| ($page["file"]=="history.html")|| + ($page["file"]=="maps.html")|| ($page["file"]=="index.html")) { $sql="select password_required from config"; @@ -874,6 +875,14 @@ } } + # Update System Map + + function update_sysmap($sysmapid,$name,$width,$height) + { + $sql="update sysmaps set name='$name',width=$width,height=$height where sysmapid=$sysmapid"; + $result=DBexecute($sql); + } + # Add System Map function add_sysmap($name,$width,$height) @@ -896,6 +905,12 @@ $result=DBexecute($sql); } + function update_sysmap_host($shostid,$sysmapid,$hostid,$label,$x,$y) + { + $sql="update sysmaps_hosts set hostid=$hostid,label='$label',x=$x,y=$y where shostid=$shostid"; + $result=DBexecute($sql); + } + # Add Host definition function add_host($host,$port,$status) diff --git a/frontends/php/map.html b/frontends/php/map.html index 0f91b263..35354041 100644 --- a/frontends/php/map.html +++ b/frontends/php/map.html @@ -6,6 +6,8 @@ # sysmapid # noedit + $grid=50; + $result=DBselect("select name,width,height from sysmaps where sysmapid=$sysmapid"); $name=DBget_field($result,0,0); @@ -37,12 +39,12 @@ if(!isset($noedit)) { - for($x=32;$x<$width;$x+=32) + for($x=$grid;$x<$width;$x+=$grid) { ImageDashedLine($im,$x,0,$x,$height,$black); ImageString($im, 2, $x+2,2, $x , $black); } - for($y=32;$y<$height;$y+=32) + for($y=$grid;$y<$height;$y+=$grid) { ImageDashedLine($im,0,$y,$width,$y,$black); ImageString($im, 2, 2,$y+2, $y , $black); diff --git a/frontends/php/sysmap.html b/frontends/php/sysmap.html index cebe1de5..5b7b196d 100644 --- a/frontends/php/sysmap.html +++ b/frontends/php/sysmap.html @@ -17,6 +17,10 @@ { add_host_to_sysmap($sysmapid,$hostid,$label,$x,$y); } + if($register=="update") + { + update_sysmap_host($shostid,$sysmapid,$hostid,$label,$x,$y); + } if($register=="add link") { add_link($sysmapid,$shostid1,$shostid2); @@ -35,7 +39,7 @@ echo "<TABLE BORDER=0 COLS=4 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>"; echo "<TR BGCOLOR=#DDDDDD>"; echo "<TD ALIGN=CENTER>"; - echo "<IMG SRC=\"map.html?noedit=1&sysmapid=$sysmapid\">"; + echo "<IMG SRC=\"map.html?sysmapid=$sysmapid\">"; echo "</TD>"; echo "</TR>"; echo "</TABLE>"; @@ -65,18 +69,18 @@ } $host=DBget_field($result,$i,0); - $shostid=DBget_field($result,$i,1); - $sysmapid=DBget_field($result,$i,2); - $hostid=DBget_field($result,$i,3); - $label=DBget_field($result,$i,4); - $x=DBget_field($result,$i,5); - $y=DBget_field($result,$i,6); + $shostid_=DBget_field($result,$i,1); + $sysmapid_=DBget_field($result,$i,2); + $hostid_=DBget_field($result,$i,3); + $label_=DBget_field($result,$i,4); + $x_=DBget_field($result,$i,5); + $y_=DBget_field($result,$i,6); echo "<TD>$host</TD>"; - echo "<TD><a href=\"sysmap.html?sysmapid=$sysmapid\">$label</a></TD>"; - echo "<TD>$x</TD>"; - echo "<TD>$y</TD>"; - echo "<TD><A HREF=\"sysmap.html?register=delete&sysmapid=$sysmapid&shostid=$shostid\">Delete</A></TD>"; + echo "<TD><a href=\"sysmap.html?sysmapid=$sysmapid_\">$label_</a></TD>"; + echo "<TD>$x_</TD>"; + echo "<TD>$y_</TD>"; + echo "<TD><A HREF=\"sysmap.html?sysmapid=$sysmapid_&shostid=$shostid_#form\">Change</A> - <A HREF=\"sysmap.html?register=delete&sysmapid=$sysmapid_&shostid=$shostid_\">Delete</A></TD>"; echo "</TR>"; } echo "</TABLE>"; @@ -85,13 +89,12 @@ <? show_table_header("CONNECTORS"); echo "<TABLE BORDER=0 COLS=4 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>"; - echo "<TD WIDTH=\"10%\" NOSAVE><B>ID</B></TD>"; echo "<TD WIDTH=\"10%\" NOSAVE><B>Host 1</B></TD>"; echo "<TD WIDTH=\"10%\" NOSAVE><B>Host 2</B></TD>"; echo "<TD WIDTH=\"10%\" NOSAVE><B>Actions</B></TD>"; echo "</TR>"; - $result=DBselect("select linkid,shostid1,shostid2 from sysmaps_links order by linkid"); + $result=DBselect("select linkid,shostid1,shostid2 from sysmaps_links where sysmapid=$sysmapid order by linkid"); echo "<CENTER>"; $col=0; for($i=0;$i<DBnum_rows($result);$i++) @@ -115,7 +118,6 @@ $result1=DBselect("select label from sysmaps_hosts where shostid=$shostid2"); $label2=DBget_field($result1,0,0); - echo "<TD>$linkid</TD>"; echo "<TD>$label1</TD>"; echo "<TD>$label2</TD>"; echo "<TD><A HREF=\"sysmap.html?register=delete_link&linkid=$linkid\">Delete</A></TD>"; @@ -124,49 +126,74 @@ echo "</TABLE>"; ?> - - - - - - - <? echo "<br>"; + echo "<a name=\"form\"></a>"; + + if(isset($shostid)) + { + $result=DBselect("select hostid,label,x,y from sysmaps_hosts where shostid=$shostid"); + $hostid=DBget_field($result,0,0); + $label=DBget_field($result,0,1); + $x=DBget_field($result,0,2); + $y=DBget_field($result,0,3); + } + else + { + $label=""; + $x=0; + $y=0; + } + show_table2_header_begin(); echo "New host to display"; show_table2_v_delimiter(); echo "<form method=\"post\" action=\"sysmap.html?sysmapid=$sysmapid\">"; + if(isset($shostid)) + { + echo "<input name=\"shostid\" type=\"hidden\" value=$shostid>"; + } echo "Host"; show_table2_h_delimiter(); $result=DBselect("select hostid,host from hosts order by host"); echo "<select name=\"hostid\" size=1>"; for($i=0;$i<DBnum_rows($result);$i++) { - $hostid=DBget_field($result,$i,0); - $host=DBget_field($result,$i,1); - echo "<OPTION VALUE='$hostid'>$host"; + $hostid_=DBget_field($result,$i,0); + $host_=DBget_field($result,$i,1); + if(isset($hostid) && ($hostid==$hostid_)) + { + echo "<OPTION VALUE='$hostid_' SELECTED>$host_"; + } + else + { + echo "<OPTION VALUE='$hostid_'>$host_"; + } } echo "</SELECT>"; show_table2_v_delimiter(); echo "Label"; show_table2_h_delimiter(); - echo "<input name=\"label\" size=32 value=\"\">"; + echo "<input name=\"label\" size=32 value=\"$label\">"; show_table2_v_delimiter(); echo "Coordinate X"; show_table2_h_delimiter(); - echo "<input name=\"x\" size=5 value=\"0\">"; + echo "<input name=\"x\" size=5 value=\"$x\">"; show_table2_v_delimiter(); echo "Coordinate Y"; show_table2_h_delimiter(); - echo "<input name=\"y\" size=5 value=\"0\">"; + echo "<input name=\"y\" size=5 value=\"$y\">"; show_table2_v_delimiter2(); echo "<input type=\"submit\" name=\"register\" value=\"add\">"; + if(isset($shostid)) + { + echo "<input type=\"submit\" name=\"register\" value=\"update\">"; + } show_table2_header_end(); ?> diff --git a/frontends/php/sysmaps.html b/frontends/php/sysmaps.html index 955e3b56..69324727 100644 --- a/frontends/php/sysmaps.html +++ b/frontends/php/sysmaps.html @@ -17,6 +17,10 @@ { add_sysmap($name,$width,$height); } + if($register=="update") + { + update_sysmap($sysmapid,$name,$width,$height); + } if($register=="delete") { delete_sysmap($sysmapid); @@ -48,14 +52,14 @@ $col=1; } - $sysmapid=DBget_field($result,$i,0); - $name=DBget_field($result,$i,1); - $width=DBget_field($result,$i,2); - $height=DBget_field($result,$i,3); - echo "<TD><a href=\"sysmap.html?sysmapid=$sysmapid\">$name</a></TD>"; - echo "<TD>$width</TD>"; - echo "<TD>$height</TD>"; - echo "<TD><A HREF=\"sysmaps.html?sysmapid=$sysmapid#form\">Change</A> - <A HREF=\"sysmaps.html?register=delete&sysmapid=$sysmapid\">Delete</A></TD>"; + $sysmapid_=DBget_field($result,$i,0); + $name_=DBget_field($result,$i,1); + $width_=DBget_field($result,$i,2); + $height_=DBget_field($result,$i,3); + echo "<TD><a href=\"sysmap.html?sysmapid=$sysmapid_\">$name_</a></TD>"; + echo "<TD>$width_</TD>"; + echo "<TD>$height_</TD>"; + echo "<TD><A HREF=\"sysmaps.html?sysmapid=$sysmapid_#form\">Change</A> - <A HREF=\"sysmaps.html?register=delete&sysmapid=$sysmapid_\">Delete</A></TD>"; echo "</TR>"; } echo "</TABLE>"; @@ -64,28 +68,50 @@ <? echo "<a name=\"form\"></a>"; + if(isset($sysmapid)) + { + $result=DBselect("select s.sysmapid,s.name,s.width,s.height from sysmaps s where sysmapid=$sysmapid"); + $name=DBget_field($result,0,1); + $width=DBget_field($result,0,2); + $height=DBget_field($result,0,3); + } + else + { + $name=""; + $width=800; + $height=600; + } + echo "<br>"; show_table2_header_begin(); echo "New system map"; show_table2_v_delimiter(); echo "<form method=\"post\" action=\"sysmaps.html\">"; + if(isset($sysmapid)) + { + echo "<input name=\"sysmapid\" type=\"hidden\" value=$sysmapid>"; + } echo "Name"; show_table2_h_delimiter(); - echo "<input name=\"name\" size=20>"; + echo "<input name=\"name\" value=\"$name\" size=20>"; show_table2_v_delimiter(); echo "Width"; show_table2_h_delimiter(); - echo "<input name=\"width\" size=5 value=\"800\">"; + echo "<input name=\"width\" size=5 value=\"$width\">"; show_table2_v_delimiter(); echo "Height"; show_table2_h_delimiter(); - echo "<input name=\"height\" size=5 value=\"600\">"; + echo "<input name=\"height\" size=5 value=\"$height\">"; show_table2_v_delimiter2(); echo "<input type=\"submit\" name=\"register\" value=\"add\">"; + if(isset($sysmapid)) + { + echo "<input type=\"submit\" name=\"register\" value=\"update\">"; + } show_table2_header_end(); ?> |
