r2471 Fixed a hack introduced in changeset#2468
[racktables] / popup.php
CommitLineData
39106006
DO
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" style="height: 100%;">
3<head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
b325120a 5<?php
e673ee24
DO
6 require 'inc/init.php';
7 // This is our context.
8 $pageno = 'objects';
9 $tabno = 'default';
39106006
DO
10 echo '<title>' . getTitle ($pageno, $tabno) . "</title>\n";
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%;">';
acc293fc 14 fixContext();
da958e52
DO
15 if (!permitted())
16 {
17 renderAccessDenied();
18 die;
19 }
39106006
DO
20 assertStringArg ('helper', __FILE__);
21 switch ($_REQUEST['helper'])
22 {
23 case 'portlist':
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 != \"\") {".
42 " 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; ".
43 " window.close();}'>";
44 echo '</form></div>';
45 break;
46 case 'inet4list':
39106006 47 echo '<div style="background-color: #f0f0f0; border: 1px solid #3c78b5; padding: 10px; height: 100%; text-align: center; margin: 5px;">';
e8dd0422 48 echo '<h2>Choose a port:</h2><br><br>';
39106006
DO
49 echo '<form action="javascript:;">';
50 echo '<input type=hidden id=ip>';
51 echo '<select size=' . getConfigVar ('MAXSELSIZE') . ' id=addresses>';
52 renderAllIPv4Allocations();
53 echo '</select><br><br>';
54 echo "<input type=submit value='Proceed' onclick='".
55 "if (getElementById(\"ip\")!=\"\") {".
56 " opener.document.getElementById(\"remoteip\").value=getElementById(\"ip\").value;".
57 " window.close();}'>";
58 echo '</form></div>';
59 break;
60 default:
61 showError ('Invalid parameter or internal error', __FILE__);
62 break;
63 }
e673ee24 64?>
e673ee24
DO
65</body>
66</html>
39106006 67