summaryrefslogtreecommitdiffstats
path: root/frontends/php/sysmaps.php
blob: a0133059f4f6491ef94f53525ca9ad3d0b9fed67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?
	include "include/config.inc";
	$page["title"] = "Network maps";
	$page["file"] = "sysmaps.php";
	show_header($page["title"],0,0);
?>

<?
	if(isset($register))
	{
		if($register=="add")
		{
			$result=add_sysmap($name,$width,$height);
			show_messages($result,"Network map added","Cannot add network map");
		}
		if($register=="update")
		{
			$result=update_sysmap($sysmapid,$name,$width,$height);
			show_messages($result,"Network map updated","Cannot update network map");
		}
		if($register=="delete")
		{
			$result=delete_sysmap($sysmapid);
			show_messages($result,"Network map deleted","Cannot delete network map");
			unset($sysmapid);
		}
	}
?>

<?
	show_table_header("CONFIGURATION OF NETWORK MAPS");
	echo "<br>";
?>

<?
	show_table_header("NETWORK MAPS");
	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>Name</B></TD>";
	echo "<TD WIDTH=\"10%\" NOSAVE><B>Width</B></TD>";
	echo "<TD WIDTH=\"10%\" NOSAVE><B>Height</B></TD>";
	echo "<TD WIDTH=\"10%\" NOSAVE><B>Actions</B></TD>";
	echo "</TR>";

	$result=DBselect("select s.sysmapid,s.name,s.width,s.height from sysmaps s order by s.name");
	echo "<CENTER>";
	$col=0;
	while($row=DBfetch($result))
	{
	        if(!check_right("Network map","R",$row["sysmapid"]))
	        {
	                continue;
	        }

		if($col==1)
		{
			echo "<TR BGCOLOR=#EEEEEE>";
			$col=0;
		} else
		{
			echo "<TR BGCOLOR=#DDDDDD>";
			$col=1;
		}
	
		echo "<TD>".$row["sysmapid"]."</TD>";
		echo "<TD><a href=\"sysmap.php?sysmapid=".$row["sysmapid"]."\">".$row["name"]."</a></TD>";
		echo "<TD>".$row["width"]."</TD>";
		echo "<TD>".$row["height"]."</TD>";
		echo "<TD><A HREF=\"sysmaps.php?sysmapid=".$row["sysmapid"]."#form\">Change</A> - <A HREF=\"sysmaps.php?register=delete&sysmapid=".$row["sysmapid"]."\">Delete</A></TD>";
		echo "</TR>";
	}
	echo "</TABLE>";
?>

<?
	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.php\">";
	if(isset($sysmapid))
	{
		echo "<input name=\"sysmapid\" type=\"hidden\" value=$sysmapid>";
	}
	echo "Name";
	show_table2_h_delimiter();
	echo "<input name=\"name\" value=\"$name\" size=32>";

	show_table2_v_delimiter();
	echo "Width";
	show_table2_h_delimiter();
	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=\"$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();
?>

<?
	show_footer();
?>