r2127 - implemented extended listing of IPv4 addresses
authorDenis Ovsienko <infrastation@yandex.ru>
Tue, 12 Aug 2008 17:08:28 +0000 (17:08 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Tue, 12 Aug 2008 17:08:28 +0000 (17:08 +0000)
inc/interface.php
inc/ophandlers.php
install/init-dictbase.sql
upgrade.php

index 09f7a9e4a36ea3fbf1018e410d7dcf33df76ee8c..a38df3754554a6f7010e77ec4e6ea7ce2689f8e4 100644 (file)
@@ -823,7 +823,10 @@ function renderRackObject ($object_id = 0)
        {
                startPortlet ('IPv4 addresses');
                echo "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>\n";
-               echo "<tr><th>OS interface</th><th>IP address</th><th>description</th><th>misc</th></tr>\n";
+               if (getConfigVar ('DECODE_IPV4_ADDR') == 'yes')
+                       echo "<tr><th>OS interface</th><th>IP address</th><th>network</th><th>routed by</th><th>peers</th></tr>\n";
+               else
+                       echo "<tr><th>OS interface</th><th>IP address</th><th>peers</th></tr>\n";
                $hl_ipv4_addr = '';
                if (isset ($_REQUEST['hl_ipv4_addr']))
                {
@@ -835,18 +838,57 @@ function renderRackObject ($object_id = 0)
                        $address_name = niftyString ($alloc['addrinfo']['name']);
                        $class = $alloc['addrinfo']['class'];
                        $secondclass = ($hl_ipv4_addr == $dottedquad) ? 'tdleft port_highlight' : 'tdleft';
-                       if (NULL === ($netid = getIPv4AddressNetworkId ($dottedquad)))
-                               $suffix = '/??';
-                       else
+                       $netid = getIPv4AddressNetworkId ($dottedquad);
+                       echo "<tr class='${class}' valign=top><td class=tdleft>${alloc['osif']}</td><td class='${secondclass}'>";
+                       echo "<a href='${root}?page=ipaddress&ip=" . $dottedquad . "&hl_object_id=${object_id}'>${dottedquad}</a>";
+                       if (getConfigVar ('DECODE_IPV4_ADDR') != 'yes')
+                       {
+                               if (NULL === $netid)
+                                       $suffix = '/??';
+                               else
+                               {
+                                       $netinfo = getIPv4NetworkInfo ($netid);
+                                       echo '<small>/' . $netinfo['mask'] . '</small>';
+                               }
+                       }
+                       echo ' ' . $aac[$alloc['type']];
+                       if (!empty ($alloc['addrinfo']['name']))
+                               echo '(' . niftyString ($alloc['addrinfo']['name']) . ')';
+                       echo '</td>';
+                       if (getConfigVar ('DECODE_IPV4_ADDR') == 'yes')
                        {
-                               $netinfo = getIPv4NetworkInfo ($netid);
-                               $suffix = '/' . $netinfo['mask'];
+                               echo "<td class='${secondclass}'>";
+                               if (NULL === $netid)
+                                       echo '?';
+                               else
+                               {
+                                       $netinfo = getIPv4NetworkInfo ($netid);
+                                       echo "<a href='${root}?page=iprange&id=${netinfo['id']}&hl_ipv4_addr=${dottedquad}'>";
+                                       echo $netinfo['ip'] . '/' . $netinfo['mask'] . '</a>';
+                                       if (!empty ($netinfo['name']))
+                                               echo ' (' . $netinfo['name'] . ')';
+                                       $nettags = loadIPv4PrefixTags ($netid);
+                                       if (count ($nettags))
+                                               echo '<br><small>' . serializeTags ($nettags, "${root}?page=ipv4space&") . '</small>';
+                               }
+                               echo "</td><td class='${secondclass}'>";
+                               // FIXME: These cals are really heavy, replace them with a more appropriate dedicated function.
+                               $netdata = getIPv4Network ($netid);
+                               $newline = '';
+                               foreach (findRouters ($netdata['addrlist']) as $router)
+                               {
+                                       if ($router['id'] == $object_id)
+                                               continue;
+                                       echo $newline . $router['addr'] . ", <a href='${root}?page=object&object_id=${router['id']}&hl_ipv4_addr=${router['addr']}'>";
+                                       echo (empty ($router['iface']) ? '' : $router['iface'] . '@') . $router['dname'] . '</a>';
+                                       $routertags = loadRackObjectTags ($router['id']);
+                                       if (count ($routertags))
+                                               echo '<br><small>' . serializeTags ($routertags, "${root}?page=objects&") . '</small>';
+                                       $newline = '<br>';
+                               }
+                               echo '</td>';
                        }
-                       echo "<tr class='${class}'><td class=tdleft>${alloc['osif']}</td><td class='${secondclass}'>";
-                       echo "<a href='${root}?page=ipaddress&ip=" . $dottedquad . "&hl_object_id=${object_id}'>";
-                       echo $dottedquad;
-                       echo "</a><small>${suffix}</small>" . $aac[$alloc['type']];
-                       echo "</td><td class='${secondclass} description'>$address_name</td>";
+                       // peers
                        echo "<td class='${secondclass}'>\n";
                        $prefix = '';
                        if ($alloc['addrinfo']['reserved'] == 'yes')
@@ -4771,6 +4813,7 @@ function renderEntityTagChainEditor ($entity_realm = '', $bypass_name, $entity_i
        global $root, $pageno, $tabno, $expl_tags;
        showMessageOrError();
        startPortlet ('Tag list (' . count ($expl_tags) . ')');
+       echo '<h3>hold Ctrl to select more, than one</h3>';
        printOpFormIntro ('saveTags', array ($bypass_name => $entity_id));
        echo '<select name=taglist[] multiple size=' . getConfigVar ('MAXSELSIZE') . '>';
        foreach ($tagtree as $taginfo)
index b03b3b71724ce29424a2e1e93931c4d5140284e9..f557964fd4906c09c0f3283d261cb14c9c8f727f 100644 (file)
@@ -813,6 +813,7 @@ function resetUIConfig()
        setConfigVar ('IPV4_AUTO_RELEASE','1');
        setConfigVar ('SHOW_LAST_TAB', 'no');
        setConfigVar ('COOKIE_TTL', '1209600');
+       setConfigVar ('DECODE_IPV4_ADDR', 'yes');
        return buildRedirectURL ('OK');
 }
 
@@ -1414,7 +1415,7 @@ function querySNMPData ()
 {
        assertUIntArg ('object_id', __FUNCTION__);
        assertStringArg ('community', __FUNCTION__);
-       return buildWideRedirectURL ((doSNMPmining ($_REQUEST['object_id'], $_REQUEST['community'])));
+       return buildWideRedirectURL (doSNMPmining ($_REQUEST['object_id'], $_REQUEST['community']));
 }
 
 ?>
index 1b5791f8090f7cd06ea3a939f999ede8dd367b37..e04ff33511d933dbdeeacbd042ca3b8641f45a7d 100644 (file)
@@ -257,5 +257,6 @@ INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, descriptio
 INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('SHOW_LAST_TAB','no','string','yes','no','Remember last tab shown for each page');
 INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('COOKIE_TTL','1209600','uint','yes','no','Cookies lifetime in seconds');
 INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('DB_VERSION','0.16.1','string','no','yes','Database version.');
+INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('DECODE_IPV4_ADDR','yes','string','no','no','Display parent network info for IPv4 addresses');
 
 INSERT INTO `Script` VALUES ('RackCode','allow {$userid_1}');
index 0c61f398703b52e1983c77d8457392e7d82e251a..c04a8523711b871ce11be48b6dad7cb8895be4df 100644 (file)
@@ -1378,6 +1378,7 @@ CREATE TABLE `TagTree` (
                case '0.16.2':
                        $query[] = "alter table IPBonds modify column type enum('regular','shared','virtual','router')";
                        $query[] = "update Dictionary set dict_value = 'spacer' where dict_key = 11";
+                       $query[] = "INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, description) VALUES ('DECODE_IPV4_ADDR','yes','string','no','no','Display parent network info for IPv4 addresses')";
                        $query[] = "update Config set varvalue = '0.16.2' where varname = 'DB_VERSION'";
                        break;
                default: