r2623 move user-modifiable files to a separate dir (closes: 39)
[racktables] / popup.php
1 <?php
2 require 'inc/init.php';
3 ?>
4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" style="height: 100%;">
6 <head>
7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
8 <?php
9 // This is our context.
10 $pageno = 'objects';
11 $tabno = 'default';
12 echo '<title>' . getTitle ($pageno, $tabno) . "</title>\n";
13 echo "<link rel=stylesheet type='text/css' href=pi.css />\n";
14 echo "<link rel=icon href='" . getFaviconURL() . "' type='image/x-icon' />";
15 echo '</head><body style="height: 100%;">';
16 fixContext();
17 if (!permitted())
18 {
19 renderAccessDenied();
20 die;
21 }
22 assertStringArg ('helper', __FILE__);
23 switch ($_REQUEST['helper'])
24 {
25 case 'portlist':
26 assertUIntArg ('type', __FILE__);
27 assertUIntArg ('port', __FILE__);
28 assertUIntArg ('object_id', __FILE__);
29 assertStringArg ('port_name', __FILE__);
30 echo '<div style="background-color: #f0f0f0; border: 1px solid #3c78b5; padding: 10px; height: 100%; text-align: center; margin: 5px;">';
31 echo '<h2>Choose a port:</h2><br><br>';
32 echo '<form action="javascript:;">';
33 echo '<input type=hidden id=remote_port_name>';
34 echo '<input type=hidden id=remote_object_name>';
35 echo '<select size=' . getConfigVar ('MAXSELSIZE') . ' id=ports>';
36 $type_id = $_REQUEST['type'];
37 $port_id = $_REQUEST['port'];
38 $object_id = $_REQUEST['object_id'];
39 $port_name = $_REQUEST['port_name'];
40 renderEmptyPortsSelect ($port_id, $type_id);
41 echo '</select><br><br>';
42 echo "<input type='submit' value='Proceed' onclick='".
43 "if (getElementById(\"ports\").value != \"\") {".
44 " opener.location=\"${root}process.php?page=object&tab=ports&op=linkPort&object_id=$object_id&port_id=$port_id&port_name=$port_name&remote_port_name=\"+getElementById(\"remote_port_name\").value+\"&remote_object_name=\"+getElementById(\"remote_object_name\").value+\"&remote_port_id=\"+getElementById(\"ports\").value; ".
45 " window.close();}'>";
46 echo '</form></div>';
47 break;
48 case 'inet4list':
49 echo '<div style="background-color: #f0f0f0; border: 1px solid #3c78b5; padding: 10px; height: 100%; text-align: center; margin: 5px;">';
50 echo '<h2>Choose a port:</h2><br><br>';
51 echo '<form action="javascript:;">';
52 echo '<input type=hidden id=ip>';
53 echo '<select size=' . getConfigVar ('MAXSELSIZE') . ' id=addresses>';
54 renderAllIPv4Allocations();
55 echo '</select><br><br>';
56 echo "<input type=submit value='Proceed' onclick='".
57 "if (getElementById(\"ip\")!=\"\") {".
58 " opener.document.getElementById(\"remoteip\").value=getElementById(\"ip\").value;".
59 " window.close();}'>";
60 echo '</form></div>';
61 break;
62 default:
63 showError ('Invalid parameter or internal error', __FILE__);
64 break;
65 }
66 ?>
67 </body>
68 </html>
69