summaryrefslogtreecommitdiffstats
path: root/frontends/php/sysmaps.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-27 15:07:16 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-27 15:07:16 +0000
commit8305c6e35edf34036d417b70379d8f61ae53877a (patch)
tree4e9048c166a3b725ebf81df62082cda6a1f4a969 /frontends/php/sysmaps.php
parent2f3c1099996bca8c050b452852d52d91cb6be3f6 (diff)
downloadzabbix-8305c6e35edf34036d417b70379d8f61ae53877a.tar.gz
zabbix-8305c6e35edf34036d417b70379d8f61ae53877a.tar.xz
zabbix-8305c6e35edf34036d417b70379d8f61ae53877a.zip
- Frontend improvements (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2566 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/sysmaps.php')
-rw-r--r--frontends/php/sysmaps.php162
1 files changed, 25 insertions, 137 deletions
diff --git a/frontends/php/sysmaps.php b/frontends/php/sysmaps.php
index e670a74f..0b90ab72 100644
--- a/frontends/php/sysmaps.php
+++ b/frontends/php/sysmaps.php
@@ -20,6 +20,7 @@
?>
<?php
include "include/config.inc.php";
+ include "include/forms.inc.php";
$page["title"] = "S_NETWORK_MAPS";
$page["file"] = "sysmaps.php";
show_header($page["title"],0,0);
@@ -37,19 +38,25 @@
?>
<?php
- if(isset($_REQUEST["save"])&&!isset($_REQUEST["sysmapid"]))
+ if(isset($_REQUEST["save"]))
{
- $result=add_sysmap($_REQUEST["name"],$_REQUEST["width"],$_REQUEST["height"],$_REQUEST["background"],$_REQUEST["label_type"]);
- show_messages($result,"Network map added","Cannot add network map");
- }
+ if(isset($_REQUEST["sysmapid"]))
+ {
+ $result=update_sysmap($_REQUEST["sysmapid"],$_REQUEST["name"],$_REQUEST["width"],
+ $_REQUEST["height"],$_REQUEST["background"],$_REQUEST["label_type"]);
- if(isset($_REQUEST["save"])&&isset($_REQUEST["sysmapid"]))
- {
- $result=update_sysmap($_REQUEST["sysmapid"],$_REQUEST["name"],$_REQUEST["width"],$_REQUEST["height"],$_REQUEST["background"],$_REQUEST["label_type"]);
- show_messages($result,"Network map updated","Cannot update network map");
- }
+ show_messages($result,"Network map updated","Cannot update network map");
+ } else {
+ $result=add_sysmap($_REQUEST["name"],$_REQUEST["width"],$_REQUEST["height"],
+ $_REQUEST["background"],$_REQUEST["label_type"]);
- if(isset($_REQUEST["delete"]))
+ show_messages($result,"Network map added","Cannot add network map");
+ }
+ if($result){
+ unset($_REQUEST["form"]);
+ }
+ }
+ elseif(isset($_REQUEST["delete"])&&isset($_REQUEST["sysmapid"]))
{
$result=delete_sysmap($_REQUEST["sysmapid"]);
show_messages($result,"Network map deleted","Cannot delete network map");
@@ -58,19 +65,18 @@
?>
<?php
- $h1=S_CONFIGURATION_OF_NETWORK_MAPS;
- $h2="<input class=\"button\" type=\"submit\" name=\"form\" value=\"".S_CREATE_MAP."\">";
- show_header2($h1, $h2, "<form name=\"selection\" method=\"get\" action=\"sysmaps.php\">", "</form>");
+ $form = new CForm();
+ $form->AddItem(new CButton("form",S_CREATE_MAP));
+ show_header2(S_CONFIGURATION_OF_NETWORK_MAPS, $form);
?>
<?php
if(!isset($_REQUEST["form"]))
{
$table = new CTableInfo(S_NO_MAPS_DEFINED);
- $table->setHeader(array(S_ID,S_NAME,S_WIDTH,S_HEIGHT,S_ACTIONS));
+ $table->setHeader(array(S_ID,S_NAME,S_WIDTH,S_HEIGHT,S_MAP));
$result=DBselect("select s.sysmapid,s.name,s.width,s.height from sysmaps s order by s.name");
- $col=0;
while($row=DBfetch($result))
{
if(!check_right("Network map","U",$row["sysmapid"]))
@@ -80,137 +86,19 @@
$table->addRow(array(
$row["sysmapid"],
- "<a href=\"sysmap.php?sysmapid=".$row["sysmapid"]."\">".$row["name"]."</a>",
+ new CLink($row["name"], "sysmaps.php?form=0&sysmapid=".$row["sysmapid"]."#form"),
$row["width"],
$row["height"],
- "<A HREF=\"sysmaps.php?sysmapid=".$row["sysmapid"]."&amp;form=0#form\">Change</A>"
+ new CLink(S_SHOW,"sysmap.php?sysmapid=".$row["sysmapid"])
));
}
$table->show();
}
else
{
-
- if(isset($_REQUEST["sysmapid"]))
- {
- $result=DBselect("select * from sysmaps where sysmapid=".$_REQUEST["sysmapid"]);
- $row=DBfetch($result);
- $name=$row["name"];
- $width=$row["width"];
- $height=$row["height"];
- $background=$row["background"];
- $label_type=$row["label_type"];
- }
- else
- {
- $name="";
- $width=800;
- $height=600;
- $background="";
- $label_type=0;
- }
-
- show_form_begin("sysmaps.map");
- echo "New system map";
-
- $col=0;
-
- show_table2_v_delimiter($col++);
- echo "<form method=\"get\" enctype=\"multipart/form-data\" action=\"sysmaps.php\">";
- if(isset($_REQUEST["sysmapid"]))
- {
- echo "<input class=\"biginput\" name=\"sysmapid\" type=\"hidden\" value=".$_REQUEST["sysmapid"].">";
- }
- echo S_NAME;
- show_table2_h_delimiter();
- echo "<input class=\"biginput\" name=\"name\" value=\"$name\" size=32>";
-
- show_table2_v_delimiter($col++);
- echo S_WIDTH;
- show_table2_h_delimiter();
- echo "<input class=\"biginput\" name=\"width\" size=5 value=\"$width\">";
-
- show_table2_v_delimiter($col++);
- echo S_HEIGHT;
- show_table2_h_delimiter();
- echo "<input class=\"biginput\" name=\"height\" size=5 value=\"$height\">";
-
- show_table2_v_delimiter($col++);
- echo S_BACKGROUND_IMAGE;
- show_table2_h_delimiter();
- echo "<select class=\"biginput\" name=\"background\" size=1>";
- $result=DBselect("select name from images where imagetype=2 order by name");
- echo "<OPTION VALUE=''>No image...";
- while($row=DBfetch($result))
- {
- $name=$row["name"];
- if(isset($_REQUEST["sysmapid"]) && ($background==$name))
- {
- echo "<OPTION VALUE='".$name."' SELECTED>".$name;
- }
- else
- {
- echo "<OPTION VALUE='".$name."'>".$name;
- }
- }
- echo "</SELECT>";
-
- show_table2_v_delimiter($col++);
- echo S_ICON_LABEL_TYPE;
- show_table2_h_delimiter();
- echo "<select class=\"biginput\" name=\"label_type\" size=1>";
- if($label_type==0)
- {
- echo "<OPTION VALUE='0' SELECTED>".S_HOST_LABEL;
- echo "<OPTION VALUE='1'>".S_IP_ADDRESS;
- echo "<OPTION VALUE='2'>".S_HOST_NAME;
- echo "<OPTION VALUE='3'>".S_STATUS_ONLY;
- echo "<OPTION VALUE='4'>".S_NOTHING;
- }
- else if($label_type==1)
- {
- echo "<OPTION VALUE='0'>".S_HOST_LABEL;
- echo "<OPTION VALUE='1' SELECTED>".S_IP_ADDRESS;
- echo "<OPTION VALUE='2'>".S_HOST_NAME;
- echo "<OPTION VALUE='3'>".S_STATUS_ONLY;
- echo "<OPTION VALUE='4'>".S_NOTHING;
- }
- else if($label_type==2)
- {
- echo "<OPTION VALUE='0'>".S_HOST_LABEL;
- echo "<OPTION VALUE='1'>".S_IP_ADDRESS;
- echo "<OPTION VALUE='2' SELECTED>".S_HOST_NAME;
- echo "<OPTION VALUE='3'>".S_STATUS_ONLY;
- echo "<OPTION VALUE='4'>".S_NOTHING;
- }
- else if($label_type==3)
- {
- echo "<OPTION VALUE='0'>".S_HOST_LABEL;
- echo "<OPTION VALUE='1'>".S_IP_ADDRESS;
- echo "<OPTION VALUE='2'>".S_HOST_NAME;
- echo "<OPTION VALUE='3' SELECTED>".S_STATUS_ONLY;
- echo "<OPTION VALUE='4'>".S_NOTHING;
- }
- else if($label_type==4)
- {
- echo "<OPTION VALUE='0'>".S_HOST_LABEL;
- echo "<OPTION VALUE='1'>".S_IP_ADDRESS;
- echo "<OPTION VALUE='2'>".S_HOST_NAME;
- echo "<OPTION VALUE='3'>".S_STATUS_ONLY;
- echo "<OPTION VALUE='4' SELECTED>".S_NOTHING;
- }
- echo "</SELECT>";
-
- show_table2_v_delimiter2();
- echo "<input class=\"button\" type=\"submit\" name=\"save\" value=\"".S_SAVE."\">";
- if(isset($_REQUEST["sysmapid"]))
- {
- echo "<input class=\"button\" type=\"submit\" name=\"delete\" value=\"".S_DELETE."\" onClick=\"return Confirm('Delete system map?');\">";
- }
- echo "<input class=\"button\" type=\"submit\" name=\"cancel\" value=\"".S_CANCEL."\">";
-
+ echo BR;
+ insert_map_form();
}
- show_table2_header_end();
?>
<?php