r2021 + fix IPv4 address bypass arg handling
authorDenis Ovsienko <infrastation@yandex.ru>
Tue, 1 Jul 2008 18:07:56 +0000 (18:07 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Tue, 1 Jul 2008 18:07:56 +0000 (18:07 +0000)
+ add "release" button to properties tab

inc/interface.php
inc/navigation.php
index.php

index b247c68..6a1914c 100644 (file)
@@ -2176,10 +2176,9 @@ function renderIPRangeProperties ($id)
 
 }
 
-function renderIPAddress ()
+function renderIPAddress ($ip)
 {
        global $root;
-       $ip = $_REQUEST['ip'];
        $address = getIPAddress ($ip);
        echo "<table border=0 class=objectview cellspacing=0 cellpadding=0>";
        echo "<tr><td colspan=2 align=center><h1>${ip}</h1></td></tr>\n";
@@ -2300,13 +2299,13 @@ function renderIPAddress ()
        echo "</table>\n";
 }
 
-function renderIPAddressProperties ()
+function renderIPAddressProperties ($ip)
 {
-       global $pageno, $tabno;
-       $ip = $_REQUEST['ip'];
+       global $pageno, $tabno, $root;
        showMessageOrError();
        $address = getIPAddress($ip);
        echo "<center><h1>$ip</h1></center>\n";
+       startPortlet ('update');
        echo "<table border=0 cellpadding=10 cellpadding=1 align='center'>\n";
        echo "<form action='process.php'><input type=hidden name=op value=editAddress>";
        echo "<input type=hidden name=page value='${pageno}'>\n";
@@ -2316,13 +2315,21 @@ function renderIPAddressProperties ()
        echo "<td class='tdright'>Reserved:</td><td class='tdleft'><input type=checkbox name=reserved size=20 ".($address['exists']==1?(($address['reserved']=='yes')?'checked':''):'')."></tr>";
        echo "<tr><td colspan=2 class='tdcenter'><input type=submit value='Update address'></td></form></tr>";
        echo "</table>\n";
-
+       finishPortlet();
+       if (empty ($address['name']) and $address['reserved'] == 'no')
+               return;
+       startPortlet ('release');
+       echo "<form action='${root}process.php?page=${pageno}&tab=${tabno}&op=editAddress' method=post>";
+       echo "<input type=hidden name=ip value='${ip}'>";
+       echo "<input type=hidden name=name value=''>";
+       echo "<input type=hidden name=reserved value=''>";
+       echo "<input type=submit value='release'></form>";
+       finishPortlet();
 }
 
-function renderIPAddressAssignment ()
+function renderIPAddressAssignment ($ip)
 {
        global $pageno, $tabno, $root;
-       $ip = $_REQUEST['ip'];
        $address = getIPAddress($ip);
 
        showMessageOrError();
index f73acd6..b20f698 100644 (file)
@@ -163,6 +163,7 @@ $ophandler['iprange']['tags']['saveTags'] = 'saveIPv4PrefixTags';
 $page['ipaddress']['title_handler'] = 'dynamic_title_ipaddress';
 $page['ipaddress']['parent'] = 'iprange';
 $page['ipaddress']['bypass'] = 'ip';
+$page['ipaddress']['bypass_type'] = 'inet4';
 $page['ipaddress']['autotagloader'] = 'loadIPv4AddressAutoTags';
 $tab['ipaddress']['default'] = 'Browse';
 $tab['ipaddress']['properties'] = 'Properties';
@@ -171,6 +172,7 @@ $tab['ipaddress']['editrslist'] = '[SLB real servers]';
 $tabhandler['ipaddress']['default'] = 'renderIPAddress';
 $tabhandler['ipaddress']['properties'] = 'renderIPAddressProperties';
 $tabhandler['ipaddress']['assignment'] = 'renderIPAddressAssignment';
+$tabhandler['ipaddress']['editrslist'] = 'dragon';
 $ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
 $ophandler['ipaddress']['assignment']['delIPv4Allocation'] = 'delIPv4Allocation';
 $ophandler['ipaddress']['assignment']['updIPv4Allocation'] = 'updIPv4Allocation';
index 5f79edd..424c0ad 100644 (file)
--- a/index.php
+++ b/index.php
@@ -88,6 +88,9 @@ if (isset ($tabhandler[$pageno][$tabno]))
                        case 'uint0':
                                assertUIntArg ($page[$pageno]['bypass'], 'index', TRUE);
                                break;
+                       case 'inet4':
+                               assertIPv4Arg ($page[$pageno]['bypass'], 'index');
+                               break;
                        default:
                                showError ("Dispatching error for bypass parameter");
                                break;