Created blade, fsp, hmc, ipmi, ivm, and zvm classes.
Changed cmd.php to handle xCAT response that is embedded in multiple layers. Worked on hmc inventory. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6832 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -20,15 +20,30 @@ if (!isAuthenticated()) {
 | 
			
		||||
 * Test lib/cmd.php
 | 
			
		||||
 */
 | 
			
		||||
function testCmdPhp() {
 | 
			
		||||
	$xml = docmd('lsdef', NULL, array('all'));
 | 
			
		||||
	$xml = docmd('rinv', 'ca4dsls08', array('all'));
 | 
			
		||||
	$rsp = array();
 | 
			
		||||
 | 
			
		||||
	foreach ($xml->children() as $child) {
 | 
			
		||||
		foreach ($child->children() as $data) {
 | 
			
		||||
			array_push($rsp, "$data");
 | 
			
		||||
		// Get the 1st level child
 | 
			
		||||
		foreach ($child->children() as $level_one) {
 | 
			
		||||
			if ($level_one->children()) {
 | 
			
		||||
				// Get the 2nd level child
 | 
			
		||||
				foreach ($level_one->children() as $level_two) {
 | 
			
		||||
					if ($level_two->children()) {
 | 
			
		||||
						// Get the 3rd level child
 | 
			
		||||
						foreach ($level_two->children() as $level_three) {
 | 
			
		||||
							array_push($rsp, "$level_three");
 | 
			
		||||
						}
 | 
			
		||||
					} else {
 | 
			
		||||
						array_push($rsp, "$level_two");
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				array_push($rsp, "$level_one");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
  	
 | 
			
		||||
	$rtn = array("rsp" => $rsp, "msg" => '');
 | 
			
		||||
	echo json_encode($rtn);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,15 @@ $(document).ready(function(){
 | 
			
		||||
	// Include utility scripts
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Constructor
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
var blade = function() {
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load node inventory
 | 
			
		||||
 * 
 | 
			
		||||
@@ -9,9 +18,9 @@ $(document).ready(function(){
 | 
			
		||||
 *            Data from HTTP request
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadInventory(data) {
 | 
			
		||||
blade.prototype.loadInventory = function(data) {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load clone page
 | 
			
		||||
@@ -20,9 +29,9 @@ function loadInventory(data) {
 | 
			
		||||
 *            Source node to clone
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadClonePage(node) {
 | 
			
		||||
blade.prototype.loadClonePage = function(node) {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load provision page
 | 
			
		||||
@@ -31,7 +40,7 @@ function loadClonePage(node) {
 | 
			
		||||
 *            The provision tab ID
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadProvisionPage(tabId) {
 | 
			
		||||
blade.prototype.loadProvisionPage = function(tabId) {
 | 
			
		||||
	var errMsg;
 | 
			
		||||
 | 
			
		||||
	// Get the OS image names
 | 
			
		||||
@@ -197,13 +206,13 @@ function loadProvisionPage(tabId) {
 | 
			
		||||
		// Insert provision code here
 | 
			
		||||
	});
 | 
			
		||||
	provForm.append(provisionBtn);
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load resources
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadResources() {
 | 
			
		||||
blade.prototype.loadResources = function() {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
@@ -2,6 +2,15 @@ $(document).ready(function(){
 | 
			
		||||
	// Include utility scripts
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Constructor
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
var fsp = function() {
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load node inventory
 | 
			
		||||
 * 
 | 
			
		||||
@@ -9,9 +18,9 @@ $(document).ready(function(){
 | 
			
		||||
 *            Data from HTTP request
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadInventory(data) {
 | 
			
		||||
fsp.prototype.loadInventory = function(data) {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load clone page
 | 
			
		||||
@@ -20,9 +29,9 @@ function loadInventory(data) {
 | 
			
		||||
 *            Source node to clone
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadClonePage(node) {
 | 
			
		||||
fsp.prototype.loadClonePage = function(node) {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load provision page
 | 
			
		||||
@@ -31,7 +40,7 @@ function loadClonePage(node) {
 | 
			
		||||
 *            The provision tab ID
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadProvisionPage(tabId) {
 | 
			
		||||
fsp.prototype.loadProvisionPage = function(tabId) {
 | 
			
		||||
	var errMsg;
 | 
			
		||||
 | 
			
		||||
	// Get the OS image names
 | 
			
		||||
@@ -197,13 +206,13 @@ function loadProvisionPage(tabId) {
 | 
			
		||||
		// Insert provision code here
 | 
			
		||||
	});
 | 
			
		||||
	provForm.append(provisionBtn);
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load resources
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadResources() {
 | 
			
		||||
fsp.prototype.loadResources = function() {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
@@ -2,6 +2,15 @@ $(document).ready(function(){
 | 
			
		||||
	// Include utility scripts
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Constructor
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
var hmc = function() {
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load node inventory
 | 
			
		||||
 * 
 | 
			
		||||
@@ -9,9 +18,45 @@ $(document).ready(function(){
 | 
			
		||||
 *            Data from HTTP request
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadInventory(data) {
 | 
			
		||||
hmc.prototype.loadInventory = function(data) {
 | 
			
		||||
	var args = data.msg.split(',');
 | 
			
		||||
 | 
			
		||||
	// Get tab ID
 | 
			
		||||
	var tabId = args[0].replace('out=', '');
 | 
			
		||||
	// Get node
 | 
			
		||||
	var node = args[1].replace('node=', '');
 | 
			
		||||
	// Get node inventory
 | 
			
		||||
	var inv = data.rsp;
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
	// Remove loader
 | 
			
		||||
	var loaderId = node + 'TabLoader';
 | 
			
		||||
	$('#' + loaderId).remove();
 | 
			
		||||
	
 | 
			
		||||
	// Create division to hold inventory
 | 
			
		||||
	var invDivId = node + 'Inventory';
 | 
			
		||||
	var invDiv = $('<div class="inventory" id="' + invDivId + '"></div>');
 | 
			
		||||
	
 | 
			
		||||
	var fieldSet = $('<fieldset></fieldset>');
 | 
			
		||||
	var legend = $('<legend>Inventory</legend>');
 | 
			
		||||
	fieldSet.append(legend);
 | 
			
		||||
	var oList = $('<ol></ol>');
 | 
			
		||||
	var item, label, input, args;
 | 
			
		||||
 | 
			
		||||
	// Loop through each property
 | 
			
		||||
	for ( var k = 0; k < inv.length; k++) {
 | 
			
		||||
		if (inv[k] != '0' && inv[k].indexOf(node) < 0) {
 | 
			
		||||
    		// Create a list item for each property
 | 
			
		||||
    		item = $('<li></li>');
 | 
			
		||||
    		item.append(inv[k]);
 | 
			
		||||
    		oList.append(item);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Append to inventory form
 | 
			
		||||
	fieldSet.append(oList);
 | 
			
		||||
	invDiv.append(fieldSet);
 | 
			
		||||
	$('#' + tabId).append(invDiv);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load clone page
 | 
			
		||||
@@ -20,9 +65,9 @@ function loadInventory(data) {
 | 
			
		||||
 *            Source node to clone
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadClonePage(node) {
 | 
			
		||||
hmc.prototype.loadClonePage = function(node) {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load provision page
 | 
			
		||||
@@ -31,7 +76,7 @@ function loadClonePage(node) {
 | 
			
		||||
 *            The provision tab ID
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadProvisionPage(tabId) {
 | 
			
		||||
hmc.prototype.loadProvisionPage = function(tabId) {
 | 
			
		||||
	var errMsg;
 | 
			
		||||
 | 
			
		||||
	// Get the OS image names
 | 
			
		||||
@@ -197,13 +242,13 @@ function loadProvisionPage(tabId) {
 | 
			
		||||
		// Insert provision code here
 | 
			
		||||
	});
 | 
			
		||||
	provForm.append(provisionBtn);
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load resources
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadResources() {
 | 
			
		||||
hmc.prototype.loadResources = function() {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
@@ -2,6 +2,15 @@ $(document).ready(function(){
 | 
			
		||||
	// Include utility scripts
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Constructor
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
var ipmi = function() {
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load node inventory
 | 
			
		||||
 * 
 | 
			
		||||
@@ -9,9 +18,9 @@ $(document).ready(function(){
 | 
			
		||||
 *            Data from HTTP request
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadInventory(data) {
 | 
			
		||||
ipmi.prototype.loadInventory = function(data) {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load clone page
 | 
			
		||||
@@ -20,9 +29,9 @@ function loadInventory(data) {
 | 
			
		||||
 *            Source node to clone
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadClonePage(node) {
 | 
			
		||||
ipmi.prototype.loadClonePage = function(node) {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load provision page
 | 
			
		||||
@@ -31,7 +40,7 @@ function loadClonePage(node) {
 | 
			
		||||
 *            The provision tab ID
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadProvisionPage(tabId) {
 | 
			
		||||
ipmi.prototype.loadProvisionPage = function(tabId) {
 | 
			
		||||
	var errMsg;
 | 
			
		||||
 | 
			
		||||
	// Get the OS image names
 | 
			
		||||
@@ -197,13 +206,13 @@ function loadProvisionPage(tabId) {
 | 
			
		||||
		// Insert provision code here
 | 
			
		||||
	});
 | 
			
		||||
	provForm.append(provisionBtn);
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load resources
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadResources() {
 | 
			
		||||
ipmi.prototype.loadResources = function() {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
@@ -2,6 +2,15 @@ $(document).ready(function(){
 | 
			
		||||
	// Include utility scripts
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Constructor
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
var ivm = function() {
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load node inventory
 | 
			
		||||
 * 
 | 
			
		||||
@@ -9,9 +18,9 @@ $(document).ready(function(){
 | 
			
		||||
 *            Data from HTTP request
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadInventory(data) {
 | 
			
		||||
ivm.prototype.loadInventory = function(data) {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load clone page
 | 
			
		||||
@@ -20,9 +29,9 @@ function loadInventory(data) {
 | 
			
		||||
 *            Source node to clone
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadClonePage(node) {
 | 
			
		||||
ivm.prototype.loadClonePage = function(node) {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load provision page
 | 
			
		||||
@@ -31,7 +40,7 @@ function loadClonePage(node) {
 | 
			
		||||
 *            The provision tab ID
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadProvisionPage(tabId) {
 | 
			
		||||
ivm.prototype.loadProvisionPage = function(tabId) {
 | 
			
		||||
	var errMsg;
 | 
			
		||||
 | 
			
		||||
	// Get the OS image names
 | 
			
		||||
@@ -197,13 +206,13 @@ function loadProvisionPage(tabId) {
 | 
			
		||||
		// Insert provision code here
 | 
			
		||||
	});
 | 
			
		||||
	provForm.append(provisionBtn);
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load resources
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadResources() {
 | 
			
		||||
ivm.prototype.loadResources = function() {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
@@ -3,6 +3,15 @@ $(document).ready(function() {
 | 
			
		||||
	includeJs("js/custom/zvmUtils.js");
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Constructor
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
var zvm = function() {
 | 
			
		||||
	
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load clone page
 | 
			
		||||
 * 
 | 
			
		||||
@@ -10,7 +19,7 @@ $(document).ready(function() {
 | 
			
		||||
 *            Source node to clone
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadClonePage(node) {
 | 
			
		||||
zvm.prototype.loadClonePage = function(node) {
 | 
			
		||||
	// Get nodes tab
 | 
			
		||||
	var tab = getNodesTab();
 | 
			
		||||
	var newTabId = node + 'CloneTab';
 | 
			
		||||
@@ -261,7 +270,7 @@ function loadClonePage(node) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tab.select(newTabId);
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load node inventory
 | 
			
		||||
@@ -270,7 +279,7 @@ function loadClonePage(node) {
 | 
			
		||||
 *            Data from HTTP request
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadInventory(data) {
 | 
			
		||||
zvm.prototype.loadInventory = function(data) {
 | 
			
		||||
	var args = data.msg.split(',');
 | 
			
		||||
 | 
			
		||||
	// Get tab ID
 | 
			
		||||
@@ -889,7 +898,7 @@ function loadInventory(data) {
 | 
			
		||||
	$('#' + tabId).append(toggleLnkDiv);
 | 
			
		||||
	$('#' + tabId).append(ueDiv);
 | 
			
		||||
	$('#' + tabId).append(invDiv);
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load provision page
 | 
			
		||||
@@ -898,7 +907,7 @@ function loadInventory(data) {
 | 
			
		||||
 *            The provision tab ID
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadProvisionPage(tabId) {
 | 
			
		||||
zvm.prototype.loadProvisionPage = function(tabId) {
 | 
			
		||||
	var errMsg;
 | 
			
		||||
 | 
			
		||||
	// Get the OS image names
 | 
			
		||||
@@ -1343,14 +1352,14 @@ function loadProvisionPage(tabId) {
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
	provForm.append(provisionBtn);
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load the resources
 | 
			
		||||
 * 
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function loadResources() {
 | 
			
		||||
zvm.prototype.loadResources = function() {
 | 
			
		||||
	// Reset resource table
 | 
			
		||||
	setDiskDataTable('');
 | 
			
		||||
	setNetworkDataTable('');
 | 
			
		||||
@@ -1367,4 +1376,4 @@ function loadResources() {
 | 
			
		||||
		},
 | 
			
		||||
		success : getZResources
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
@@ -108,9 +108,30 @@ function loadMonitorPage() {
 | 
			
		||||
			loader = $('<center></center>').append(loader);
 | 
			
		||||
			tab.add(newTabId, hw, loader);
 | 
			
		||||
 | 
			
		||||
			// Load plugin code
 | 
			
		||||
			includeJs("js/custom/" + hw + ".js");
 | 
			
		||||
			loadResources();
 | 
			
		||||
			// Create an instance of the plugin
 | 
			
		||||
			var plugin;
 | 
			
		||||
			switch(hw) {
 | 
			
		||||
				case "blade":
 | 
			
		||||
		    		plugin = new blade();
 | 
			
		||||
		    		break;
 | 
			
		||||
				case "fsp":
 | 
			
		||||
					plugin = new fsp();
 | 
			
		||||
					break;
 | 
			
		||||
				case "hmc":
 | 
			
		||||
					plugin = new hmc();
 | 
			
		||||
					break;
 | 
			
		||||
				case "ipmi":
 | 
			
		||||
					plugin = new ipmi();
 | 
			
		||||
					break;		
 | 
			
		||||
				case "ivm":
 | 
			
		||||
					plugin = new ivm();
 | 
			
		||||
					break;
 | 
			
		||||
				case "zvm":
 | 
			
		||||
					plugin = new zvm();
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			plugin.loadResources();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Select tab
 | 
			
		||||
 
 | 
			
		||||
@@ -169,8 +169,6 @@ function loadNodes(data) {
 | 
			
		||||
	var attrs = new Object();
 | 
			
		||||
	// Node attributes
 | 
			
		||||
	var headers = new Object();
 | 
			
		||||
	// Plugins hash
 | 
			
		||||
	var plugins = new Object();
 | 
			
		||||
 | 
			
		||||
	var node;
 | 
			
		||||
	var args;
 | 
			
		||||
@@ -194,19 +192,6 @@ function loadNodes(data) {
 | 
			
		||||
		// Create a hash table
 | 
			
		||||
		attrs[node][key] = val;
 | 
			
		||||
		headers[key] = 1;
 | 
			
		||||
 | 
			
		||||
		// Create a plugins hash
 | 
			
		||||
		if (key == 'mgt') {
 | 
			
		||||
			plugins[val] = 1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Load the plugin code
 | 
			
		||||
	// Plugin code should be located under js/custom/
 | 
			
		||||
	// Plugin names should be valid values of nodehm.mgt
 | 
			
		||||
	for ( var p in plugins) {
 | 
			
		||||
		resetJs();
 | 
			
		||||
		includeJs("js/custom/" + p + ".js");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Sort headers
 | 
			
		||||
@@ -296,7 +281,32 @@ function loadNodes(data) {
 | 
			
		||||
	cloneLnk.bind('click', function(event) {
 | 
			
		||||
		var tgtNodes = getNodesChecked().split(',');
 | 
			
		||||
		for ( var i = 0; i < tgtNodes.length; i++) {
 | 
			
		||||
			loadClonePage(tgtNodes[i]);
 | 
			
		||||
			var mgt = getNodeMgt(tgtNodes[i]);
 | 
			
		||||
			
 | 
			
		||||
			// Create an instance of the plugin
 | 
			
		||||
			var plugin;
 | 
			
		||||
			switch(mgt) {
 | 
			
		||||
				case "blade":
 | 
			
		||||
		    		plugin = new blade();
 | 
			
		||||
		    		break;
 | 
			
		||||
				case "fsp":
 | 
			
		||||
					plugin = new fsp();
 | 
			
		||||
					break;
 | 
			
		||||
				case "hmc":
 | 
			
		||||
					plugin = new hmc();
 | 
			
		||||
					break;
 | 
			
		||||
				case "ipmi":
 | 
			
		||||
					plugin = new ipmi();
 | 
			
		||||
					break;		
 | 
			
		||||
				case "ivm":
 | 
			
		||||
					plugin = new ivm();
 | 
			
		||||
					break;
 | 
			
		||||
				case "zvm":
 | 
			
		||||
					plugin = new zvm();
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			plugin.loadClonePage(tgtNodes[i]);
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
@@ -598,6 +608,29 @@ function loadNode(e) {
 | 
			
		||||
	// Get node that was clicked
 | 
			
		||||
	var node = (e.target) ? e.target.id : e.srcElement.id;
 | 
			
		||||
	var mgt = getNodeMgt(node);
 | 
			
		||||
	
 | 
			
		||||
	// Create an instance of the plugin
 | 
			
		||||
	var plugin;
 | 
			
		||||
	switch(mgt) {
 | 
			
		||||
		case "blade":
 | 
			
		||||
    		plugin = new blade();
 | 
			
		||||
    		break;
 | 
			
		||||
		case "fsp":
 | 
			
		||||
			plugin = new fsp();
 | 
			
		||||
			break;
 | 
			
		||||
		case "hmc":
 | 
			
		||||
			plugin = new hmc();
 | 
			
		||||
			break;
 | 
			
		||||
		case "ipmi":
 | 
			
		||||
			plugin = new ipmi();
 | 
			
		||||
			break;		
 | 
			
		||||
		case "ivm":
 | 
			
		||||
			plugin = new ivm();
 | 
			
		||||
			break;
 | 
			
		||||
		case "zvm":
 | 
			
		||||
			plugin = new zvm();
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Get tab area where a new tab will be inserted
 | 
			
		||||
	var myTab = getNodesTab();
 | 
			
		||||
@@ -623,7 +656,7 @@ function loadNode(e) {
 | 
			
		||||
			msg : msg
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		success : loadInventory
 | 
			
		||||
		success : plugin.loadInventory
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	// Select new tab
 | 
			
		||||
 
 | 
			
		||||
@@ -98,13 +98,32 @@ function loadProvisionPage() {
 | 
			
		||||
 | 
			
		||||
		tab.add(newTabId, hw, '');
 | 
			
		||||
 | 
			
		||||
		// Load plugin code
 | 
			
		||||
		resetJs();
 | 
			
		||||
		includeJs("js/custom/" + hw + ".js");
 | 
			
		||||
		// Create an instance of the plugin
 | 
			
		||||
		var plugin;
 | 
			
		||||
		switch(hw) {
 | 
			
		||||
			case "blade":
 | 
			
		||||
	    		plugin = new blade();
 | 
			
		||||
	    		break;
 | 
			
		||||
			case "fsp":
 | 
			
		||||
				plugin = new fsp();
 | 
			
		||||
				break;
 | 
			
		||||
			case "hmc":
 | 
			
		||||
				plugin = new hmc();
 | 
			
		||||
				break;
 | 
			
		||||
			case "ipmi":
 | 
			
		||||
				plugin = new ipmi();
 | 
			
		||||
				break;		
 | 
			
		||||
			case "ivm":
 | 
			
		||||
				plugin = new ivm();
 | 
			
		||||
				break;
 | 
			
		||||
			case "zvm":
 | 
			
		||||
				plugin = new zvm();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// Select tab
 | 
			
		||||
		tab.select(newTabId);
 | 
			
		||||
		loadProvisionPage(newTabId);
 | 
			
		||||
		plugin.loadProvisionPage(newTabId);
 | 
			
		||||
	});
 | 
			
		||||
	provForm.append(okBtn);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -404,6 +404,14 @@ function initPage() {
 | 
			
		||||
	includeJs("js/monitor/monitor.js");
 | 
			
		||||
	includeJs("js/nodes/nodes.js");
 | 
			
		||||
	includeJs("js/provision/provision.js");
 | 
			
		||||
	
 | 
			
		||||
	// Custom plugins
 | 
			
		||||
	includeJs("js/custom/blade.js");
 | 
			
		||||
	includeJs("js/custom/fsp.js");
 | 
			
		||||
	includeJs("js/custom/hmc.js");
 | 
			
		||||
	includeJs("js/custom/ipmi.js");
 | 
			
		||||
	includeJs("js/custom/ivm.js");
 | 
			
		||||
	includeJs("js/custom/zvm.js");
 | 
			
		||||
 | 
			
		||||
	// Get the page being loaded
 | 
			
		||||
	var url = window.location.pathname;
 | 
			
		||||
@@ -425,9 +433,6 @@ function initPage() {
 | 
			
		||||
	} else if (page == 'monitor.php') {
 | 
			
		||||
		headers.eq(3).css('background-color', '#A9D0F5');
 | 
			
		||||
		loadMonitorPage();
 | 
			
		||||
	} else if (page == 'update.php') {
 | 
			
		||||
		headers.eq(4).css('background-color', '#A9D0F5');
 | 
			
		||||
		loadUpdatePage();
 | 
			
		||||
	} else {
 | 
			
		||||
		headers.eq(0).css('background-color', '#A9D0F5');
 | 
			
		||||
		loadNodesPage();
 | 
			
		||||
@@ -451,37 +456,8 @@ function includeJs(file) {
 | 
			
		||||
		script.attr( {
 | 
			
		||||
			type : 'text/javascript',
 | 
			
		||||
			src : file
 | 
			
		||||
		})
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		$('head').append(script);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Reset the javascript files in <head> to its original content
 | 
			
		||||
 * 
 | 
			
		||||
 * @param file
 | 
			
		||||
 *            File to include
 | 
			
		||||
 * @return Nothing
 | 
			
		||||
 */
 | 
			
		||||
function resetJs() {
 | 
			
		||||
	var scripts = $('head script');
 | 
			
		||||
	for ( var i = 0; i < scripts.length; i++) {
 | 
			
		||||
		var file = scripts.eq(i).attr('src');
 | 
			
		||||
		
 | 
			
		||||
		// Remove ipmi, blade, hmc, ivm, fsp javascripts
 | 
			
		||||
		if (file == 'js/custom/ipmi.js') {
 | 
			
		||||
			scripts.eq(i).remove();
 | 
			
		||||
		} else if (file == 'js/custom/blade.js') {
 | 
			
		||||
			scripts.eq(i).remove();
 | 
			
		||||
		} else if (file == 'js/custom/hmc.js') {
 | 
			
		||||
			scripts.eq(i).remove();
 | 
			
		||||
		} else if (file == 'js/custom/ivm.js') {
 | 
			
		||||
			scripts.eq(i).remove();
 | 
			
		||||
		} else if (file == 'js/custom/fsp.js') {
 | 
			
		||||
			scripts.eq(i).remove();
 | 
			
		||||
		} else if (file == 'js/custom/zvm.js') {
 | 
			
		||||
			scripts.eq(i).remove();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -64,8 +64,23 @@ if (isset($_GET["cmd"])) {
 | 
			
		||||
	// Handle the typical output
 | 
			
		||||
	else {
 | 
			
		||||
		foreach ($xml->children() as $child) {
 | 
			
		||||
			foreach ($child->children() as $data) {
 | 
			
		||||
				array_push($rsp, "$data");
 | 
			
		||||
			// Get the 1st level child
 | 
			
		||||
			foreach ($child->children() as $level_one) {
 | 
			
		||||
				if ($level_one->children()) {
 | 
			
		||||
					// Get the 2nd level child
 | 
			
		||||
					foreach ($level_one->children() as $level_two) {
 | 
			
		||||
						if ($level_two->children()) {
 | 
			
		||||
							// Get the 3rd level child
 | 
			
		||||
							foreach ($level_two->children() as $level_three) {
 | 
			
		||||
								array_push($rsp, "$level_three");
 | 
			
		||||
							}
 | 
			
		||||
						} else {
 | 
			
		||||
							array_push($rsp, "$level_two");
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					array_push($rsp, "$level_one");
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user