Bladeren bron

Fix for out of bounds array index based on feedback
Properly handling of multiple configuration files matching
staged configuration. All will be highlighted.

Signed-off-by: Gleb Aronsky <gleb.aronsky@lexisnexis.com>

Gleb Aronsky 13 jaren geleden
bovenliggende
commit
963c065c91
1 gewijzigde bestanden met toevoegingen van 14 en 5 verwijderingen
  1. 14 5
      esp/files/scripts/configmgr/navtree.js

+ 14 - 5
esp/files/scripts/configmgr/navtree.js

@@ -1948,23 +1948,32 @@ function populateOpenEnvTable() {
 
           var files = result.split(/;/g);
           var objs = new Array();
-          var staged_configuration = "";
-          for (var i = 0,j = 0; i < files.length; i++, j++) {
+          var staged_configuration = new Array();
+          for (var i = 0,j = 0, k = 0; i < files.length; i++, j++) {
             if (files[i] == "<StagedConfiguration>")
             {
               i++;
-              staged_configuration = files[i];
+              staged_configuration[k] = files[i];
+              k++;
             }
             else if (files[i] == "</StagedConfiguration>")
             {
-              i++;
+              if (i+1 >= files.length)
+              {
+                break;
+              }
+              else
+              {
+                j--;
+                continue;
+              }
             }
             objs[j] = {};
             objs[j].name = files[i];
           }
 
           YAHOO.widget.DataTable.formatName = function(elLiner, oRecord, oColumn, oData) {
-          if (staged_configuration == oData)
+          if (staged_configuration.indexOf(oData) != -1)
            elLiner.innerHTML = "<font style=\"background-color:#004ADE;color:white\" title=\"Staged Configuration\">" + oData + "</font>";
           else
            elLiner.innerHTML = oData; };