r2708 - employ unset to make further queries work
[racktables] / popup.php
CommitLineData
38ee0db8
DY
1<?php
2 require 'inc/init.php';
3?>
39106006
DO
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" />
b325120a 8<?php
e673ee24
DO
9 // This is our context.
10 $pageno = 'objects';
11 $tabno = 'default';
802deced 12 echo '<title>' . getTitle ($pageno) . "</title>\n";
39106006
DO
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%;">';
acc293fc 16 fixContext();
da958e52
DO
17 if (!permitted())
18 {
19 renderAccessDenied();
20 die;
21 }
39106006
DO
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__);
39106006 30 echo '<div style="background-color: #f0f0f0; border: 1px solid #3c78b5; padding: 10px; height: 100%; text-align: center; margin: 5px;">';
e8dd0422 31 echo '<h2>Choose a port:</h2><br><br>';
39106006
DO
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':
39106006 49 echo '<div style="background-color: #f0f0f0; border: 1px solid #3c78b5; padding: 10px; height: 100%; text-align: center; margin: 5px;">';
e8dd0422 50 echo '<h2>Choose a port:</h2><br><br>';
39106006
DO
51 echo '<form action="javascript:;">';
52 echo '<input type=hidden id=ip>';
53 echo '<select size=' . getConfigVar ('MAXSELSIZE') . ' id=addresses>';
54 renderAllIPv4Allocations();
23cdc7e9
DO
55 $addresses = getAllIPv4Allocations();
56 usort ($addresses, 'sortObjectAddressesAndNames');
57 foreach ($addresses as $address)
58 echo "<option value='${address['ip']}' onclick='getElementById(\"ip\").value=\"${address['ip']}\";'>" .
59 "${address['object_name']} ${address['name']} ${address['ip']}</option>\n";
39106006
DO
60 echo '</select><br><br>';
61 echo "<input type=submit value='Proceed' onclick='".
62 "if (getElementById(\"ip\")!=\"\") {".
63 " opener.document.getElementById(\"remoteip\").value=getElementById(\"ip\").value;".
64 " window.close();}'>";
65 echo '</form></div>';
66 break;
67 default:
68 showError ('Invalid parameter or internal error', __FILE__);
69 break;
70 }
e673ee24 71?>
e673ee24
DO
72</body>
73</html>
39106006 74