Updated cmd.php to handle xCAT response for different platforms.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6833 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
cc74599359
commit
15ea47df00
@ -22,26 +22,17 @@ if (!isAuthenticated()) {
|
||||
function testCmdPhp() {
|
||||
$xml = docmd('rinv', 'ca4dsls08', array('all'));
|
||||
$rsp = array();
|
||||
|
||||
|
||||
foreach ($xml->children() as $child) {
|
||||
// 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");
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
$cont = $data->data->contents;
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if(strlen("$data") > 2) {
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rtn = array("rsp" => $rsp, "msg" => '');
|
||||
|
@ -44,12 +44,10 @@ hmc.prototype.loadInventory = function(data) {
|
||||
|
||||
// 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);
|
||||
}
|
||||
// Create a list item for each property
|
||||
item = $('<li></li>');
|
||||
item.append(inv[k].replace(node + ': ', ''));
|
||||
oList.append(item);
|
||||
}
|
||||
|
||||
// Append to inventory form
|
||||
|
@ -64,22 +64,13 @@ if (isset($_GET["cmd"])) {
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
// 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");
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
$cont = $data->data->contents;
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if(strlen("$data") > 2) {
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user