Replaced newline "\n" with ":|:" in submit_request() in functions.php. Changed code to have newline.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6914 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2010-07-29 20:22:09 +00:00
parent b1410412eb
commit afde8f4435
9 changed files with 151 additions and 137 deletions

View File

@ -400,6 +400,7 @@ span.ui-icon-info {
.tab .datatable textarea {
font: 12px verdana, arial, helvetica, sans-serif;
border: solid 1px #BDBDBD;
overflow: hidden;
}
.tab .datatable button {

View File

@ -20,7 +20,7 @@ if (!isAuthenticated()) {
* Test lib/cmd.php
*/
function testCmdPhp() {
$xml = docmd('rinv', 'ca4dsls08', array('all'));
$xml = docmd('rinv', 'gpok6', array('all'));
$rsp = array();
foreach ($xml->children() as $child) {
@ -28,8 +28,10 @@ function testCmdPhp() {
if($data->name) {
$node = $data->name;
$cont = $data->data->contents;
$cont = str_replace(":|:", "\n", $cont);
array_push($rsp, "$node: $cont");
} else if(strlen("$data") > 2) {
$data = str_replace(":|:", "\n", $data);
array_push($rsp, "$data");
}
}

View File

@ -44,6 +44,7 @@ hmcPlugin.prototype.loadInventory = function(data) {
for ( var k = 0; k < inv.length; k++) {
// Remove node name in front
var str = inv[k].replace(node + ': ', '');
str = jQuery.trim(str);
// If string is a header
if (str.indexOf('I/O Bus Information') > -1 || str.indexOf('Machine Configuration Info') > -1) {

View File

@ -286,7 +286,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
var node = args[1].replace('node=', '');
// Get node inventory
var inv = data.rsp[0].split(node + ':');
// Remove loader
var loaderId = tabId + 'TabLoader';
$('#' + loaderId).remove();
@ -320,7 +320,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
// Create hash table for node attributes
var attrs = getNodeAttrs(keys, attrNames, inv);
// Create division to hold user entry
var ueDivId = node + 'UserEntry';
var ueDiv = $('<div class="userEntry" id="' + ueDivId + '"></div>');
@ -504,53 +504,55 @@ zvmPlugin.prototype.loadInventory = function(data) {
var n, temp;
var procType, procAddr, procLink;
for (l = 0; l < attrs[keys[k]].length; l++) {
args = attrs[keys[k]][l].split(' ');
// Get processor type, address, ID, and affinity
n = 3;
temp = args[args.length - n];
while (!jQuery.trim(temp)) {
n = n + 1;
temp = args[args.length - n];
if (attrs[keys[k]][l]) {
args = attrs[keys[k]][l].split(' ');
// Get processor type, address, ID, and affinity
n = 3;
temp = args[args.length - n];
while (!jQuery.trim(temp)) {
n = n + 1;
temp = args[args.length - n];
}
procType = $('<td>' + temp + '</td>');
procAddr = $('<td></td>');
procLink = $('<a href="#">' + args[1] + '</a>');
// Append context menu to link
procLink.contextMenu(contextMenu, {
theme : 'vista'
});
procAddr.append(procLink);
procId = $('<td>' + args[5] + '</td>');
procAff = $('<td>' + args[args.length - 1] + '</td>');
// Base processor
if (args[6] == '(BASE)') {
baseProc = $('<td>' + true + '</td>');
} else {
baseProc = $('<td>' + false + '</td>');
}
// Dedicated processor
if (args[args.length - 3] == 'DEDICATED') {
dedicatedProc = $('<td>' + true + '</td>');
} else {
dedicatedProc = $('<td>' + false + '</td>');
}
// Create a new row for each processor
procTabRow = $('<tr></tr>');
procTabRow.append(procType);
procTabRow.append(procAddr);
procTabRow.append(procId);
procTabRow.append(baseProc);
procTabRow.append(dedicatedProc);
procTabRow.append(procAff);
procBody.append(procTabRow);
}
procType = $('<td>' + temp + '</td>');
procAddr = $('<td></td>');
procLink = $('<a href="#">' + args[1] + '</a>');
// Append context menu to link
procLink.contextMenu(contextMenu, {
theme : 'vista'
});
procAddr.append(procLink);
procId = $('<td>' + args[5] + '</td>');
procAff = $('<td>' + args[args.length - 1] + '</td>');
// Base processor
if (args[6] == '(BASE)') {
baseProc = $('<td>' + true + '</td>');
} else {
baseProc = $('<td>' + false + '</td>');
}
// Dedicated processor
if (args[args.length - 3] == 'DEDICATED') {
dedicatedProc = $('<td>' + true + '</td>');
} else {
dedicatedProc = $('<td>' + false + '</td>');
}
// Create a new row for each processor
procTabRow = $('<tr></tr>');
procTabRow.append(procType);
procTabRow.append(procAddr);
procTabRow.append(procId);
procTabRow.append(baseProc);
procTabRow.append(dedicatedProc);
procTabRow.append(procAff);
procBody.append(procTabRow);
}
procTable.append(procBody);
/**
@ -617,33 +619,35 @@ zvmPlugin.prototype.loadInventory = function(data) {
// Loop through each DASD
for (l = 0; l < attrs[keys[k]].length; l++) {
args = attrs[keys[k]][l].split(' ');
if (attrs[keys[k]][l]) {
args = attrs[keys[k]][l].split(' ');
// Get DASD virtual device, type, volume ID, access, and size
dasdVDev = $('<td></td>');
dasdLink = $('<a href="#">' + args[1] + '</a>');
// Append context menu to link
dasdLink.contextMenu(contextMenu, {
theme : 'vista'
});
dasdVDev.append(dasdLink);
dasdType = $('<td>' + args[2] + '</td>');
dasdVolId = $('<td>' + args[3] + '</td>');
dasdAccess = $('<td>' + args[4] + '</td>');
dasdSize = $('<td>' + args[args.length - 9] + ' '
+ args[args.length - 8] + '</td>');
// Create a new row for each DASD
dasdTabRow = $('<tr></tr>');
dasdTabRow.append(dasdVDev);
dasdTabRow.append(dasdType);
dasdTabRow.append(dasdVolId);
dasdTabRow.append(dasdAccess);
dasdTabRow.append(dasdSize);
dasdBody.append(dasdTabRow);
// Get DASD virtual device, type, volume ID, access, and size
dasdVDev = $('<td></td>');
dasdLink = $('<a href="#">' + args[1] + '</a>');
// Append context menu to link
dasdLink.contextMenu(contextMenu, {
theme : 'vista'
});
dasdVDev.append(dasdLink);
dasdType = $('<td>' + args[2] + '</td>');
dasdVolId = $('<td>' + args[3] + '</td>');
dasdAccess = $('<td>' + args[4] + '</td>');
dasdSize = $('<td>' + args[args.length - 9] + ' '
+ args[args.length - 8] + '</td>');
// Create a new row for each DASD
dasdTabRow = $('<tr></tr>');
dasdTabRow.append(dasdVDev);
dasdTabRow.append(dasdType);
dasdTabRow.append(dasdVolId);
dasdTabRow.append(dasdAccess);
dasdTabRow.append(dasdSize);
dasdBody.append(dasdTabRow);
}
}
dasdTable.append(dasdBody);
@ -721,36 +725,38 @@ zvmPlugin.prototype.loadInventory = function(data) {
// Loop through each NIC (Data contained in 2 lines)
for (l = 0; l < attrs[keys[k]].length; l = l + 2) {
args = attrs[keys[k]][l].split(' ');
// Get NIC virtual device, type, port name, and number of devices
nicVDev = $('<td></td>');
nicLink = $('<a href="#">' + args[1] + '</a>');
// Append context menu to link
nicLink.contextMenu(contextMenu, {
theme : 'vista'
});
nicVDev.append(nicLink);
nicType = $('<td>' + args[3] + '</td>');
nicPortName = $('<td>' + args[10] + '</td>');
nicNumOfDevs = $('<td>' + args[args.length - 1] + '</td>');
args = attrs[keys[k]][l + 1].split(' ');
nicLanName = $('<td>' + args[args.length - 2] + ' '
+ args[args.length - 1] + '</td>');
// Create a new row for each DASD
nicTabRow = $('<tr></tr>');
nicTabRow.append(nicVDev);
nicTabRow.append(nicType);
nicTabRow.append(nicPortName);
nicTabRow.append(nicNumOfDevs);
nicTabRow.append(nicLanName);
nicBody.append(nicTabRow);
if (attrs[keys[k]][l]) {
args = attrs[keys[k]][l].split(' ');
// Get NIC virtual device, type, port name, and number of devices
nicVDev = $('<td></td>');
nicLink = $('<a href="#">' + args[1] + '</a>');
// Append context menu to link
nicLink.contextMenu(contextMenu, {
theme : 'vista'
});
nicVDev.append(nicLink);
nicType = $('<td>' + args[3] + '</td>');
nicPortName = $('<td>' + args[10] + '</td>');
nicNumOfDevs = $('<td>' + args[args.length - 1] + '</td>');
args = attrs[keys[k]][l + 1].split(' ');
nicLanName = $('<td>' + args[args.length - 2] + ' '
+ args[args.length - 1] + '</td>');
// Create a new row for each DASD
nicTabRow = $('<tr></tr>');
nicTabRow.append(nicVDev);
nicTabRow.append(nicType);
nicTabRow.append(nicPortName);
nicTabRow.append(nicNumOfDevs);
nicTabRow.append(nicLanName);
nicBody.append(nicTabRow);
}
}
nicTable.append(nicBody);

View File

@ -212,7 +212,7 @@ function incrementNodeProcess(node) {
* Data returned from HTTP request
* @return Nothing
*/
function updateProvisionNewStatus(data) {
function updateZProvisionNewStatus(data) {
// Get ajax response
var rsp = data.rsp;
var args = data.msg.split(';');
@ -253,7 +253,7 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=makehosts;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
}
@ -279,7 +279,7 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=makedns;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
}
@ -310,7 +310,7 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=mkvm;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
@ -348,7 +348,7 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=mkvm;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
} else {
$('#' + loaderId).hide();
@ -358,7 +358,7 @@ function updateProvisionNewStatus(data) {
$.cookie('tries4' + tabId, 0);
// Set cookie for number of disks
var diskRows = $('#' + tabId + ' table tr');
var diskRows = $('#' + tabId + ' table:visible tr');
$.cookie('zProvisionDisks2Add' + out2Id, diskRows.length);
if (diskRows.length > 0) {
for ( var i = 0; i < diskRows.length; i++) {
@ -384,10 +384,8 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=chvm;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
} else {
$('#' + loaderId).hide();
}
}
} else {
@ -419,7 +417,7 @@ function updateProvisionNewStatus(data) {
$.cookie('tries4' + tabId, tries);
// Set cookie for number of disks
var diskRows = $('#' + tabId + ' table tr');
var diskRows = $('#' + tabId + ' table:visible tr');
$.cookie('zProvisionDisks2Add' + out2Id, diskRows.length);
if (diskRows.length > 0) {
for ( var i = 0; i < diskRows.length; i++) {
@ -443,7 +441,7 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=chvm;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
} else {
@ -457,7 +455,7 @@ function updateProvisionNewStatus(data) {
$.cookie('tries4' + tabId, 0);
// Get operating system image
var osImage = $('#' + tabId + ' input[name=os]').val();
var osImage = $('#' + tabId + ' input[name=os]:visible').val();
// Get cookie for number of disks
var disks2add = $.cookie('zProvisionDisks2Add' + out2Id);
@ -469,11 +467,10 @@ function updateProvisionNewStatus(data) {
// If an operating system image is given
if (osImage) {
var tmp = osImage.split('-');
// Get operating system, architecture, provision method, and profile
var os = tmp[0];
var arch = tmp[1];
var provisionMethod = tmp[2];
var profile = tmp[3];
// If the last disk is added
@ -490,7 +487,7 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=noderes;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
} else {
@ -520,7 +517,7 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=makedhcp;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
}
@ -544,7 +541,7 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=nodeset;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
@ -571,7 +568,7 @@ function updateProvisionNewStatus(data) {
msg : 'cmd=rnetboot;out=' + out2Id
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
}
@ -599,7 +596,7 @@ function updateProvisionNewStatus(data) {
* Data returned from HTTP request
* @return Nothing
*/
function updateProvisionExistingStatus(data) {
function updateZProvisionExistingStatus(data) {
// Get ajax response
var rsp = data.rsp;
var args = data.msg.split(';');
@ -635,7 +632,7 @@ function updateProvisionExistingStatus(data) {
msg : 'cmd=nodeset;out=' + inst
},
success : updateProvisionExistingStatus
success : updateZProvisionExistingStatus
});
}
@ -670,7 +667,7 @@ function updateProvisionExistingStatus(data) {
msg : 'cmd=rnetboot;out=' + inst
},
success : updateProvisionExistingStatus
success : updateZProvisionExistingStatus
});
}
@ -1298,6 +1295,8 @@ function getDiskPool(data) {
// Get contents of each disk pool
for ( var i in pools) {
if (pools[i]) {
pools[i] = jQuery.trim(pools[i]);
// Get used space
$.ajax( {
url : 'lib/cmd.php',
@ -1414,6 +1413,7 @@ function loadDiskPoolTable(data) {
// Skip index 0 and 1 because it contains nothing
for ( var i = 2; i < tmp.length; i++) {
tmp[i] = jQuery.trim(tmp[i]);
var diskAttrs = tmp[i].split(' ');
dTable.fnAddData( [ hcp, pool, stat, diskAttrs[0], diskAttrs[1], diskAttrs[2], diskAttrs[3] ]);
}
@ -1680,7 +1680,7 @@ function createZProvisionExisting(inst) {
$('#zProvisionLoader' + inst).show();
// Disable all inputs
var inputs = $('#' + thisTabId + ' input');
var inputs = $('#' + thisTabId + ' input:visible');
inputs.attr('disabled', 'disabled');
// Disable all selects
@ -1707,7 +1707,7 @@ function createZProvisionExisting(inst) {
msg : 'cmd=nodeadd;out=' + inst
},
success : updateProvisionExistingStatus
success : updateZProvisionExistingStatus
});
} else {
alert('(Error) ' + errMsg);
@ -1898,7 +1898,7 @@ function createZProvisionNew(inst) {
var inst = thisTabId.replace('zvmProvisionTab', '');
// Check node name, userId, hardware control point, and group
var inputs = $('#' + thisTabId + ' input');
var inputs = $('#' + thisTabId + ' input:visible');
for ( var i = 0; i < inputs.length; i++) {
// Do not check OS or disk password
if (!inputs.eq(i).val()
@ -1931,7 +1931,7 @@ function createZProvisionNew(inst) {
// If no operating system is specified, create only user entry
os = $('#' + thisTabId + ' input[name=os]:visible');
// Check number of disks
var diskRows = $('#' + thisTabId + ' table tr');
// If an OS is given, disks are needed
@ -2029,7 +2029,7 @@ function createZProvisionNew(inst) {
msg : 'cmd=nodeadd;out=' + inst
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
} else {
@ -2104,7 +2104,7 @@ function createZProvisionNew(inst) {
msg : 'cmd=nodeadd;out=' + inst
},
success : updateProvisionNewStatus
success : updateZProvisionNewStatus
});
}
} else {

View File

@ -868,8 +868,7 @@ function deleteNode(tgtNodes) {
// Create status bar, hide on load
var statBarId = 'DeleteStatusBar' + inst;
var statBar = $('<div class="statusBar" id="' + statBarId + '"></div>')
.hide();
var statBar = $('<div class="statusBar" id="' + statBarId + '"></div>').hide();
// Create loader
var loader = createLoader('');
@ -931,8 +930,7 @@ function deleteNode(tgtNodes) {
// Show status bar loader
statBar.show();
// Stop this function from executing again
// Unbind event
// Disable delete button
$(this).unbind(event);
$(this).css( {
'background-color' : '#F2F2F2',

View File

@ -68,8 +68,10 @@ if (isset($_GET["cmd"])) {
if($data->name) {
$node = $data->name;
$cont = $data->data->contents;
$cont = str_replace(":|:", "\n", $cont);
array_push($rsp, "$node: $cont");
} else if(strlen("$data") > 2) {
$data = str_replace(":|:", "\n", $data);
array_push($rsp, "$data");
}
}
@ -98,6 +100,7 @@ function extractWebrun($xml) {
$name = $node->name;
// Get the content
$status = $node->data->contents;
$status = str_replace(":|:", "\n", $status);
// Add to return array
$rsp[$i] = array("$name", "$status");

View File

@ -67,7 +67,7 @@ function submit_request($req, $skipVerify){
fwrite($fp,$req->asXML()); // Send XML to xcatd
while(!feof($fp)){ // Read until there is no more
// Remove newlines and add it to the response
$response .= preg_replace('/\n/', '', fread($fp, 8192));
$response .= preg_replace('/\n/', ':|:', fread($fp, 8192));
// Look for serverdone response
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
@ -86,7 +86,7 @@ function submit_request($req, $skipVerify){
}
}
fclose($fp);
}else{
} else{
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
}

View File

@ -70,6 +70,7 @@ if (isset($_GET["cmd"])) {
$xml = docmd($cmd, $tgt, $arr);
foreach ($xml->children() as $child) {
foreach ($child->children() as $data) {
$data = str_replace(":|:", "\n", $data);
array_push($rsp, "$data");
}
}
@ -90,6 +91,7 @@ if (isset($_GET["cmd"])) {
$xml = docmd($cmd, $tgt, $arr);
foreach ($xml->children() as $child) {
foreach ($child->children() as $data) {
$data = str_replace(":|:", "\n", $data);
array_push($rsp, "$data");
}
}
@ -119,6 +121,7 @@ if (isset($_GET["cmd"])) {
$xml = docmd($cmd, $tgt, $arr);
foreach ($xml->children() as $child) {
foreach ($child->children() as $data) {
$data = str_replace(":|:", "\n", $data);
array_push($rsp, "$data");
}
}