r2167 - make SLB summary more narrow
authorDenis Ovsienko <infrastation@yandex.ru>
Fri, 22 Aug 2008 11:14:13 +0000 (11:14 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Fri, 22 Aug 2008 11:14:13 +0000 (11:14 +0000)
 - produce correct redirect URLs for IPv4 addresses in search results
 - accept empty ports for real servers, use VS port for config generation in this case

inc/database.php
inc/functions.php
inc/interface.php
inc/ophandlers.php

index 85d52866a1706553068f816aa2449893f638d022..873de665110525d99c77d6550264bdcdba19b03c 100644 (file)
@@ -2278,11 +2278,13 @@ function getRSPoolInfo ($id = 0)
 
 function addRStoRSPool ($pool_id = 0, $rsip = '', $rsport = 0, $inservice = 'no', $rsconfig = '')
 {
 
 function addRStoRSPool ($pool_id = 0, $rsip = '', $rsport = 0, $inservice = 'no', $rsconfig = '')
 {
-       if ($pool_id <= 0 or $rsport <= 0)
+       if ($pool_id <= 0)
        {
                showError ('Invalid arguments', __FUNCTION__);
                die;
        }
        {
                showError ('Invalid arguments', __FUNCTION__);
                die;
        }
+       if (empty ($rsport) or $rsport == 0)
+               $rsport = 'NULL';
        return useInsertBlade
        (
                'IPRealServer',
        return useInsertBlade
        (
                'IPRealServer',
@@ -2371,7 +2373,7 @@ function commitDeleteLB ($object_id = 0, $pool_id = 0, $vs_id = 0)
 
 function commitUpdateRS ($rsid = 0, $rsip = '', $rsport = 0, $rsconfig = '')
 {
 
 function commitUpdateRS ($rsid = 0, $rsip = '', $rsport = 0, $rsconfig = '')
 {
-       if ($rsid <= 0 or $rsport <= 0)
+       if ($rsid <= 0)
        {
                showError ('Invalid args', __FUNCTION__);
                die;
        {
                showError ('Invalid args', __FUNCTION__);
                die;
@@ -2381,6 +2383,8 @@ function commitUpdateRS ($rsid = 0, $rsip = '', $rsport = 0, $rsconfig = '')
                showError ("Invalid IP address '${rsip}'", __FUNCTION__);
                die;
        }
                showError ("Invalid IP address '${rsip}'", __FUNCTION__);
                die;
        }
+       if (empty ($rsport) or $rsport == 0)
+               $rsport = 'NULL';
        global $dbxlink;
        $query =
                "update IPRealServer set rsip = inet_aton('${rsip}'), rsport = ${rsport}, rsconfig = " .
        global $dbxlink;
        $query =
                "update IPRealServer set rsip = inet_aton('${rsip}'), rsport = ${rsport}, rsconfig = " .
index 0f33eb052c8ef6043688998823a5013ee81bf308..9db6790e461c49f54ae38a5cf04af037c6f764df 100644 (file)
@@ -1330,6 +1330,8 @@ function buildLVSConfig ($object_id = 0)
                );
                foreach ($vsinfo['rslist'] as $rs)
                {
                );
                foreach ($vsinfo['rslist'] as $rs)
                {
+                       if (empty ($rs['rsport']))
+                               $rs['rsport'] = $vsinfo['vport'];
                        $macros['%RSIP%'] = $rs['rsip'];
                        $macros['%RSPORT%'] = $rs['rsport'];
                        $newconfig .=  "\treal_server ${rs['rsip']} ${rs['rsport']} {\n";
                        $macros['%RSIP%'] = $rs['rsip'];
                        $macros['%RSPORT%'] = $rs['rsport'];
                        $newconfig .=  "\treal_server ${rs['rsip']} ${rs['rsport']} {\n";
index 34bd86ae295024c1df5116e1e26634e6274ab67f..eaa642d81c066a7d94cd765d0b0f198f98ce24a8 100644 (file)
@@ -2034,9 +2034,9 @@ function renderIPv4SLB ()
                                else
                                {
                                        echo $vsdata['lblist'][$lb_object_id]['size'];
                                else
                                {
                                        echo $vsdata['lblist'][$lb_object_id]['size'];
-                                       echo " (<a href='${root}?page=ipv4rsp&pool_id=";
-                                       echo $vsdata['lblist'][$lb_object_id]['id'] . "'>";
-                                       echo $vsdata['lblist'][$lb_object_id]['name'] . '</a>)';
+//                                     echo " (<a href='${root}?page=ipv4rsp&pool_id=";
+//                                     echo $vsdata['lblist'][$lb_object_id]['id'] . "'>";
+//                                     echo $vsdata['lblist'][$lb_object_id]['name'] . '</a>)';
                                }
                                echo '</td>';
                        }
                                }
                                echo '</td>';
                        }
@@ -2885,14 +2885,14 @@ function renderSearchResults ()
                        case 'ipv4addressbydq':
                                $parentnet = getIPv4AddressNetworkId ($record);
                                if ($parentnet !== NULL)
                        case 'ipv4addressbydq':
                                $parentnet = getIPv4AddressNetworkId ($record);
                                if ($parentnet !== NULL)
-                                       echo "<script language='Javascript'>document.location='${root}?page=iprange&id=${parentnet}&hl_ipv4_addr=${record}';//</script>";
+                                       echo "<script language='Javascript'>document.location='${root}?page=iprange&tab=default&id=${parentnet}&hl_ipv4_addr=${record}';//</script>";
                                else
                                        echo "<script language='Javascript'>document.location='${root}?page=ipaddress&ip=${record}';//</script>";
                                break;
                        case 'ipv4addressbydescr':
                                $parentnet = getIPv4AddressNetworkId ($record['ip']);
                                if ($parentnet !== NULL)
                                else
                                        echo "<script language='Javascript'>document.location='${root}?page=ipaddress&ip=${record}';//</script>";
                                break;
                        case 'ipv4addressbydescr':
                                $parentnet = getIPv4AddressNetworkId ($record['ip']);
                                if ($parentnet !== NULL)
-                                       echo "<script language='Javascript'>document.location='${root}?page=iprange&id=${parentnet}&hl_ipv4_addr=${record['ip']}';//</script>";
+                                       echo "<script language='Javascript'>document.location='${root}?page=iprange&tab=default&id=${parentnet}&hl_ipv4_addr=${record['ip']}';//</script>";
                                else
                                        echo "<script language='Javascript'>document.location='${root}?page=ipaddress&ip=${record['ip']}';//</script>";
                                break;
                                else
                                        echo "<script language='Javascript'>document.location='${root}?page=ipaddress&ip=${record['ip']}';//</script>";
                                break;
index f99e72d4c12559e56c2e86016e0dd7761d2b5a6b..4c40d45967ec70e9fb04a4520aa1aad143d01049 100644 (file)
@@ -822,7 +822,7 @@ function addRealServer ()
 {
        assertUIntArg ('pool_id', __FUNCTION__);
        assertIPv4Arg ('remoteip', __FUNCTION__);
 {
        assertUIntArg ('pool_id', __FUNCTION__);
        assertIPv4Arg ('remoteip', __FUNCTION__);
-       assertUIntArg ('rsport', __FUNCTION__);
+       assertStringArg ('rsport', __FUNCTION__, TRUE);
        assertStringArg ('rsconfig', __FUNCTION__, TRUE);
        if (!addRStoRSPool (
                $_REQUEST['pool_id'],
        assertStringArg ('rsconfig', __FUNCTION__, TRUE);
        if (!addRStoRSPool (
                $_REQUEST['pool_id'],
@@ -951,7 +951,7 @@ function updateRealServer ()
 {
        assertUIntArg ('rs_id', __FUNCTION__);
        assertIPv4Arg ('rsip', __FUNCTION__);
 {
        assertUIntArg ('rs_id', __FUNCTION__);
        assertIPv4Arg ('rsip', __FUNCTION__);
-       assertUIntArg ('rsport', __FUNCTION__);
+       assertStringArg ('rsport', __FUNCTION__, TRUE);
        assertStringArg ('rsconfig', __FUNCTION__, TRUE);
        if (!commitUpdateRS (
                $_REQUEST['rs_id'],
        assertStringArg ('rsconfig', __FUNCTION__, TRUE);
        if (!commitUpdateRS (
                $_REQUEST['rs_id'],