r3153 - maintenance->trunk sync of changeset:3136
[racktables] / popup.php
CommitLineData
38ee0db8 1<?php
f77323f1 2 require 'inc/interface.php';
38ee0db8
DY
3 require 'inc/init.php';
4?>
39106006
DO
5<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" style="height: 100%;">
7<head>
8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
b325120a 9<?php
4dc8e857 10 echo "<title>RackTables pop-up</title>\n";
39106006
DO
11 echo "<link rel=stylesheet type='text/css' href=pi.css />\n";
12 echo "<link rel=icon href='" . getFaviconURL() . "' type='image/x-icon' />";
13 echo '</head><body style="height: 100%;">';
39106006
DO
14 assertStringArg ('helper', __FILE__);
15 switch ($_REQUEST['helper'])
16 {
17 case 'portlist':
4dc8e857
DO
18 // FIXME: shouldn't this be derived from the URL?
19 $pageno = 'object';
20 $tabno = 'ports';
21 fixContext();
22 if (!permitted())
4dc8e857 23 renderAccessDenied();
39106006
DO
24 assertUIntArg ('type', __FILE__);
25 assertUIntArg ('port', __FILE__);
26 assertUIntArg ('object_id', __FILE__);
27 assertStringArg ('port_name', __FILE__);
39106006 28 echo '<div style="background-color: #f0f0f0; border: 1px solid #3c78b5; padding: 10px; height: 100%; text-align: center; margin: 5px;">';
e8dd0422 29 echo '<h2>Choose a port:</h2><br><br>';
39106006
DO
30 echo '<form action="javascript:;">';
31 echo '<input type=hidden id=remote_port_name>';
32 echo '<input type=hidden id=remote_object_name>';
33 echo '<select size=' . getConfigVar ('MAXSELSIZE') . ' id=ports>';
34 $type_id = $_REQUEST['type'];
35 $port_id = $_REQUEST['port'];
36 $object_id = $_REQUEST['object_id'];
37 $port_name = $_REQUEST['port_name'];
38 renderEmptyPortsSelect ($port_id, $type_id);
39 echo '</select><br><br>';
40 echo "<input type='submit' value='Proceed' onclick='".
41 "if (getElementById(\"ports\").value != \"\") {".
790a60e8 42 " opener.location=\"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; ".
39106006
DO
43 " window.close();}'>";
44 echo '</form></div>';
45 break;
46 case 'inet4list':
4dc8e857
DO
47 $pageno = 'ipv4space';
48 $tabno = 'default';
49 fixContext();
50 if (!permitted())
4dc8e857 51 renderAccessDenied();
39106006 52 echo '<div style="background-color: #f0f0f0; border: 1px solid #3c78b5; padding: 10px; height: 100%; text-align: center; margin: 5px;">';
e8dd0422 53 echo '<h2>Choose a port:</h2><br><br>';
39106006
DO
54 echo '<form action="javascript:;">';
55 echo '<input type=hidden id=ip>';
56 echo '<select size=' . getConfigVar ('MAXSELSIZE') . ' id=addresses>';
23cdc7e9
DO
57 $addresses = getAllIPv4Allocations();
58 usort ($addresses, 'sortObjectAddressesAndNames');
59 foreach ($addresses as $address)
60 echo "<option value='${address['ip']}' onclick='getElementById(\"ip\").value=\"${address['ip']}\";'>" .
61 "${address['object_name']} ${address['name']} ${address['ip']}</option>\n";
39106006
DO
62 echo '</select><br><br>';
63 echo "<input type=submit value='Proceed' onclick='".
64 "if (getElementById(\"ip\")!=\"\") {".
65 " opener.document.getElementById(\"remoteip\").value=getElementById(\"ip\").value;".
66 " window.close();}'>";
67 echo '</form></div>';
68 break;
69 default:
70 showError ('Invalid parameter or internal error', __FILE__);
71 break;
72 }
e673ee24 73?>
e673ee24
DO
74</body>
75</html>