r3186 - maintenance->trunk sync of changesets 3182~3185
authorDenis Ovsienko <infrastation@yandex.ru>
Mon, 9 Nov 2009 15:31:56 +0000 (15:31 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Mon, 9 Nov 2009 15:31:56 +0000 (15:31 +0000)
ChangeLog
inc/config.php
inc/interface.php
install/init-dictbase.sql
popup.php
upgrade.php

index 9ef45a0d51788c5583ca50189615c4b8bf33c8f6..87047e82df0c385b52430545651a7d7e8ded8e62 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+0.17.7 2009-11-09
+       bugfix: work around unbuffered query in ports pop-up (ticket:297)
+       update: add inline mode switcher by Jens Groh (ticket:298)
 0.17.6 2009-10-31
        update: voice/video devices
        bugfix: PHP warning
index cd5a732fdb6e3e8502a03ac86f598e51680813e8..a62ce47fc82d8331e7e8095fd1fc1e995eade883 100644 (file)
@@ -11,7 +11,7 @@
 
 
 // Current code version is subject to change with each new release.
-define ('CODE_VERSION', '0.17.6');
+define ('CODE_VERSION', '0.17.7');
 define ('CHAP_OBJTYPE', 1);
 define ('CHAP_PORTTYPE', 2);
 
@@ -24,6 +24,7 @@ $max_dict_key = array
        '0.17.4' => 1150,
        '0.17.5' => 1322,
        '0.17.6' => 1326,
+       '0.17.7' => 1326,
 );
 
 define ('TAGNAME_REGEXP', '^[[:alnum:]]([\. _~-]?[[:alnum:]])*$');
index 02e11f3f8b942d15ce57f9131a735c12b952fed1..747afc076fc0c2c6bc85545feeae9492924be1e1 100644 (file)
@@ -1162,9 +1162,6 @@ function renderPortsForObject ($object_id)
                        $helper_args = array
                        (
                                'port' => $port['id'],
-                               'type' => $port['type_id'],
-                               'object_id' => $object_id,
-                               'port_name' => $port['name'],
                                'in_rack' => 'n',
                        );
                        $popup_args = 'height=700, width=400, location=no, menubar=no, '.
index 0eeb7000a262907b249b7373281d470f9e917519..4af454402da7d442dc29e662c4d9b9a117eb1696 100644 (file)
@@ -392,6 +392,6 @@ INSERT INTO `Config` (varname, varvalue, vartype, emptyok, is_hidden, descriptio
 ('DEFAULT_PORT_OIF_IDS','1=24; 3=1078; 4=1077; 5=1079; 6=1080; 8=1082; 9=1084','string','no','no','Default port outer interface IDs'),
 ('IPV4_TREE_RTR_AS_CELL','yes','string','no','no','Show full router info for each network in IPv4 tree view'),
 ('PROXIMITY_RANGE','0','uint','yes','no','Proximity range (0 is current rack only)'),
-('DB_VERSION','0.17.6','string','no','yes','Database version.');
+('DB_VERSION','0.17.7','string','no','yes','Database version.');
 
 INSERT INTO `Script` VALUES ('RackCode','allow {$userid_1}');
index 4102c879974466bf094ab8dc2c768cd3f32be039..16db731215f7c961f8236f3ca1650bed11b4f204 100644 (file)
--- a/popup.php
+++ b/popup.php
@@ -34,7 +34,7 @@ function getProximateRacks ($rack_id, $proximity = 0)
 
 function findSparePorts ($port_id, $only_racks = array())
 {
-       $query = "SELECT id, type, object_id, name FROM Port WHERE " .
+       $query = "SELECT id, object_id, name FROM Port WHERE " .
                "id <> ${port_id} " .
                "AND type IN (SELECT type2 FROM PortCompat WHERE type1 = (SELECT type FROM Port WHERE id = ${port_id})) " .
                "AND reservation_comment IS NULL " .
@@ -44,11 +44,15 @@ function findSparePorts ($port_id, $only_racks = array())
                $query .= 'AND object_id IN (SELECT DISTINCT object_id FROM RackSpace WHERE rack_id IN (' .
                        implode (', ', $only_racks) . '))';
        $result = useSelectBlade ($query);
+       // avoid nested queries
+       $rows = $result->fetchAll (PDO::FETCH_ASSOC);
+       unset ($result);
        $ret = array();
-       while ($row = $result->fetch (PDO::FETCH_ASSOC))
+       foreach (array_keys ($rows) as $rkey)
        {
-               $object = spotEntity ('object', $row['object_id']);
-               $ret[$row['id']] = $object['dname'] . ' ' . $row['name'];
+               $object = spotEntity ('object', $rows[$rkey]['object_id']);
+               $ret[$rows[$rkey]['id']] = $object['dname'] . ' ' . $rows[$rkey]['name'];
+               unset ($rows[$rkey]);
        }
        return $ret;
 }
@@ -67,38 +71,34 @@ function findSparePorts ($port_id, $only_racks = array())
        switch ($_REQUEST['helper'])
        {
                case 'portlist':
-                       // FIXME: shouldn't this be derived from the URL?
-                       $pageno = 'object';
-                       $tabno = 'ports';
+                       $pageno = 'depot';
+                       $tabno = 'default';
                        fixContext();
                        if (!permitted())
                                renderAccessDenied();
                        assertUIntArg ('port');
-                       assertUIntArg ('object_id');
                        assertStringArg ('in_rack');
                        $localchoice = $_REQUEST['in_rack'] == 'y';
+                       $port_id = $_REQUEST['port'];
                        echo '<div style="background-color: #f0f0f0; border: 1px solid #3c78b5; padding: 10px; height: 100%; text-align: center; margin: 5px;"><h2>';
-                       echo $localchoice ? 'Nearest spare ports:' : 'All spare ports:';
+                       echo $localchoice ?
+                               ('Nearest spare ports (<a href="popup.php?helper=portlist&port=' . $port_id . '&in_rack=n">show all</a>)') :
+                               ('All spare ports (<a href="popup.php?helper=portlist&port=' . $port_id . '&in_rack=y">show nearest</a>)');
                        echo '</h2><form action="javascript:;">';
-                       $port_id = $_REQUEST['port'];
-                       $object_id = $_REQUEST['object_id'];
                        $only_racks = array();
-                       if ($_REQUEST['in_rack'] == 'y')
+                       $port_info = getPortInfo ($port_id);
+                       if ($_REQUEST['in_rack'] == 'y' and $port_info['object_id'])
                        {
-                               $port_info = getPortInfo ($port_id);
-                               if ($port_info['object_id'])
-                               {
-                                       $object = spotEntity ('object', $port_info['object_id']);
-                                       if ($object['rack_id'])
-                                               $only_racks = getProximateRacks ($object['rack_id'], getConfigVar ('PROXIMITY_RANGE'));
-                               }
+                               $object = spotEntity ('object', $port_info['object_id']);
+                               if ($object['rack_id'])
+                                       $only_racks = getProximateRacks ($object['rack_id'], getConfigVar ('PROXIMITY_RANGE'));
                        }
                        $spare_ports = findSparePorts ($port_id, $only_racks);
                        printSelect ($spare_ports, array ('name' => 'ports', 'id' => 'ports', 'size' => getConfigVar ('MAXSELSIZE')));
                        echo '<br><br>';
                        echo "<input type='submit' value='Link' onclick='".
                        "if (getElementById(\"ports\").value != \"\") {".
-                       "       opener.location=\"process.php?page=object&tab=ports&op=linkPort&object_id=$object_id&port_id=$port_id&remote_port_id=\"+getElementById(\"ports\").value; ".
+                       "       opener.location=\"process.php?page=object&tab=ports&op=linkPort&object_id=${port_info['object_id']}&port_id=$port_id&remote_port_id=\"+getElementById(\"ports\").value; ".
                        "       window.close();}'>";
                        echo '</form></div>';
                        break;
index 07135251d3b4b3053332e5ecefeca85aa9b2f8da..5e15f31987217e1ef38c85c5d8326042e7d699d5 100644 (file)
@@ -38,6 +38,7 @@ function getDBUpgradePath ($v1, $v2)
                '0.17.4',
                '0.17.5',
                '0.17.6',
+               '0.17.7',
        );
        if (!in_array ($v1, $versionhistory) or !in_array ($v2, $versionhistory))
                return NULL;
@@ -419,6 +420,9 @@ CREATE TABLE `PortInterfaceCompat` (
                        $query = array_merge ($query, reloadDictionary ($batchid));
                        $query[] = "UPDATE Config SET varvalue = '0.17.6' WHERE varname = 'DB_VERSION'";
                        break;
+               case '0.17.7':
+                       $query[] = "UPDATE Config SET varvalue = '0.17.7' WHERE varname = 'DB_VERSION'";
+                       break;
                default:
                        showFailure ("executeUpgradeBatch () failed, because batch '${batchid}' isn't defined", __FILE__);
                        die;