Formatted code.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12434 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
075a6e49e9
commit
4ad9216707
@ -10,8 +10,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -30,11 +30,11 @@ body {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#login label{
|
||||
#login label {
|
||||
font: bold 12px sans-serif;
|
||||
}
|
||||
|
||||
#login_status {
|
||||
#login-status {
|
||||
font: bold 12px sans-serif;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ body {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#login_form {
|
||||
#login-form {
|
||||
background-color: #f5f5f5;
|
||||
height: 280px;
|
||||
-moz-border-radius: 3px;
|
||||
@ -52,9 +52,9 @@ body {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#loginfo {
|
||||
#log-info {
|
||||
margin: 5px 0px;
|
||||
text-align: right;
|
||||
color: #f5f5f5;
|
||||
font-weight:bold;
|
||||
font-weight: bold;
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
/*--------------- Dialogs ---------------*/
|
||||
/*--- Dialogs ---*/
|
||||
.ui-dialog input {
|
||||
border: solid 1px #BDBDBD;
|
||||
font: 12px sans-serif;
|
||||
}
|
||||
|
||||
.ui-dialog label,.ui-dialog input,.ui-dialog p,.ui-dialog button,.ui-dialog td
|
||||
{
|
||||
.ui-dialog label,.ui-dialog input,.ui-dialog p,.ui-dialog button,.ui-dialog td {
|
||||
font: 12px sans-serif;
|
||||
}
|
||||
|
||||
@ -13,12 +12,11 @@
|
||||
font: 12px sans-serif;
|
||||
}
|
||||
|
||||
.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button
|
||||
{
|
||||
.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button {
|
||||
font: 12px sans-serif;
|
||||
}
|
||||
|
||||
/*--------------- Tooltip ---------------*/
|
||||
/*--- Tooltip ---*/
|
||||
.tooltip {
|
||||
background-color: #000;
|
||||
border: 1px solid #fff;
|
||||
@ -37,7 +35,7 @@
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
/*--------------- Header ---------------*/
|
||||
/*--- Header ---*/
|
||||
#header {
|
||||
height: 39px;
|
||||
width: 1000px;
|
||||
@ -90,15 +88,7 @@
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
#layoutselector {
|
||||
padding: 2px 10px 0px 2px; /* Top right left bottom*/
|
||||
text-align: right;
|
||||
color: #FFC125;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*--------------- Body and content ---------------*/
|
||||
/*--- Body and content ---*/
|
||||
body {
|
||||
background: #1C1C1C;
|
||||
font: 12px sans-serif;
|
||||
@ -124,7 +114,7 @@ pre {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
/*--------------- Groups ---------------*/
|
||||
/*--- Groups ---*/
|
||||
#groups {
|
||||
width: 150px;
|
||||
vertical-align: top;
|
||||
@ -178,7 +168,7 @@ pre {
|
||||
border-top: thin solid #E7EBFF;
|
||||
}
|
||||
|
||||
/*--------------- Nodes section ---------------*/
|
||||
/*--- Nodes section ---*/
|
||||
#nodes {
|
||||
width: 790px;
|
||||
min-height: 570px;
|
||||
@ -204,7 +194,7 @@ pre {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/*--------------- Info/warning bar ---------------*/
|
||||
/*--- Info and warning bar ---*/
|
||||
span.ui-icon-info {
|
||||
float: left;
|
||||
margin-right: 0.3em;
|
||||
@ -227,7 +217,7 @@ span.ui-icon-info {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
/*--------------- jQuery tabs ---------------*/
|
||||
/*--- jQuery tabs ---*/
|
||||
.tab {
|
||||
font: 12px sans-serif;
|
||||
border-style: none;
|
||||
@ -248,7 +238,7 @@ span.ui-icon-info {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*--------------- Inventory and user entry ---------------*/
|
||||
/*--- Inventory and user entry ---*/
|
||||
.tab table {
|
||||
border-width: 1px;
|
||||
border-spacing: 0px;
|
||||
@ -326,7 +316,7 @@ legend {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
/*--------------- menu Div Actions bar ---------------*/
|
||||
/*--- menu Div Actions bar ---*/
|
||||
.menuDiv {
|
||||
padding: 0.5em;
|
||||
height: 30px;
|
||||
@ -373,7 +363,7 @@ legend {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/*--------------- jQuery datatable ---------------*/
|
||||
/*--- jQuery datatable ---*/
|
||||
.dataTables_wrapper {
|
||||
overflow: auto;
|
||||
width: auto;
|
||||
@ -414,8 +404,7 @@ legend {
|
||||
}
|
||||
|
||||
/*** < > buttons ***/
|
||||
.paginate_disabled_previous,.paginate_enabled_previous,.paginate_disabled_next,.paginate_enabled_next
|
||||
{
|
||||
.paginate_disabled_previous,.paginate_enabled_previous,.paginate_disabled_next,.paginate_enabled_next {
|
||||
height: 19px;
|
||||
width: 19px;
|
||||
margin-left: 2px;
|
||||
@ -472,7 +461,7 @@ legend {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
/*--------------- Editable column ---------------*/
|
||||
/*--- Editable column ---*/
|
||||
.tab .datatable textarea {
|
||||
font: 12px sans-serif;
|
||||
border: solid 1px #BDBDBD;
|
||||
@ -498,7 +487,7 @@ legend {
|
||||
background: none;
|
||||
}
|
||||
|
||||
/*--------------- jQuery context menu ---------------*/
|
||||
/*--- jQuery context menu ---*/
|
||||
.context-menu-theme-vista {
|
||||
background: #FAFAFA url(../images/contextmenu/context-menu-bg.gif)
|
||||
repeat-y left top;
|
||||
@ -536,8 +525,7 @@ legend {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.context-menu-theme-vista .context-menu-item-hover .context-menu-item-inner
|
||||
{
|
||||
.context-menu-theme-vista .context-menu-item-hover .context-menu-item-inner {
|
||||
padding: 3px 15px 3px 35px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
@ -546,7 +534,7 @@ legend {
|
||||
color: #A7A7A7;
|
||||
}
|
||||
|
||||
/*--------------- Forms ---------------*/
|
||||
/*--- Forms ---*/
|
||||
.form label {
|
||||
color: #424242;
|
||||
line-height: 1.5;
|
||||
@ -613,7 +601,7 @@ table a:hover {
|
||||
border: solid 1px #d4d4d4;
|
||||
}
|
||||
|
||||
/*--------------- Provision disk table ---------------*/
|
||||
/*--- Provision disk table ---*/
|
||||
.provision table {
|
||||
border-width: 1px;
|
||||
border-spacing: 0px;
|
||||
@ -630,7 +618,7 @@ table a:hover {
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
/*--------------- Provision and clone table ---------------*/
|
||||
/*--- Provision and clone table ---*/
|
||||
.special table {
|
||||
border-width: 1px;
|
||||
border-spacing: 0px;
|
||||
@ -646,52 +634,52 @@ table a:hover {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
/*--------------- Provision and monitor forms ---------------*/
|
||||
.monitornormal {
|
||||
/*--- Provision and monitor forms ---*/
|
||||
.monitor-normal {
|
||||
background: #66CD00;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mornitorwarning {
|
||||
.mornitor-warning {
|
||||
background: #FFD700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.monitorerror {
|
||||
.monitor-error {
|
||||
background: #FF3030;
|
||||
}
|
||||
|
||||
.monitorunknown {
|
||||
.monitor-unknown {
|
||||
background: #8B8B7A;
|
||||
}
|
||||
|
||||
.monitornodeli {
|
||||
.monitor-node-li {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
float: left;
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
.monitorsumdiv {
|
||||
.monitor-sum-div {
|
||||
width: 300px;
|
||||
height: 180px;
|
||||
float: left;
|
||||
margin: 0px 0px 10px 10px;
|
||||
}
|
||||
|
||||
.monitorsumdiv td {
|
||||
.monitor-sum-div td {
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.monitornodediv {
|
||||
.monitor-node-div {
|
||||
width: 240px;
|
||||
height: 120px;
|
||||
margin: 0px 0px 15px 0px;
|
||||
}
|
||||
|
||||
.monitorzoomlink {
|
||||
.monitor-zoom-link {
|
||||
cursor: pointer;
|
||||
color: blue;
|
||||
}
|
||||
@ -710,7 +698,7 @@ table a:hover {
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
/*--------------- Physical layout section ---------------*/
|
||||
/*--- Physical layout section ---*/
|
||||
.frameDiv {
|
||||
width: 179px;
|
||||
height: 500px;
|
||||
@ -768,7 +756,7 @@ table a:hover {
|
||||
height: 11px;
|
||||
}
|
||||
|
||||
.fspcheckbox {
|
||||
.fspCheckbox {
|
||||
padding: 0px;
|
||||
margin: 3px 3px 1px 3px;
|
||||
}
|
||||
@ -796,7 +784,7 @@ table a:hover {
|
||||
background: url(../images/nodes/blade.jpg);
|
||||
}
|
||||
|
||||
.xnodeDiv {
|
||||
.xNodeDiv {
|
||||
font-size: 12px;
|
||||
height: 21px;
|
||||
line-height: 21px;
|
||||
@ -809,45 +797,7 @@ table a:hover {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/*--------------- Discovery section ---------------*/
|
||||
.discoverstep {
|
||||
width: 960px;
|
||||
vertical-align: top;
|
||||
background-color: #A9D0F5;
|
||||
padding: 0px 0px 0px 5px;
|
||||
-moz-border-radius: .3em;
|
||||
-webkit-border-radius: .3em;
|
||||
border-radius: .3em;
|
||||
}
|
||||
|
||||
.discovercurrentstep {
|
||||
background-color: yellow;
|
||||
font: normal bold 12px/35px sans-serif;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.discovercontent {
|
||||
width: 960px;
|
||||
display: inline-table;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.discovercontent table {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.discovercontent td {
|
||||
border: none;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.discovercontent th {
|
||||
font: normal bold 15px sans-serif;
|
||||
text-align: center;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/*--------------- jqPlot Pie legend ---------------*/
|
||||
/*--- jqPlot Pie legend ---*/
|
||||
td.jqplot-table-legend {
|
||||
border-width: 0px;
|
||||
}
|
||||
|
@ -1,17 +1,18 @@
|
||||
<?php
|
||||
echo <<<EEE
|
||||
<html>
|
||||
<head>
|
||||
<title>Node {$_GET['n']} Ganglia Report</title>
|
||||
<meta content="600" http-equiv="refresh">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link href="css/style.css" rel=stylesheet type="text/css">
|
||||
<link href="css/jquery.jqplot.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
<head>
|
||||
<title>Node {$_GET['n']} Ganglia Report</title>
|
||||
<meta content="600" http-equiv="refresh">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link href="css/style.css" rel=stylesheet type="text/css">
|
||||
<link href="css/jquery.jqplot.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
EEE;
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.onload=function() {
|
||||
var nodepath = $('#nodepath').val();
|
||||
@ -37,9 +38,9 @@ window.onload=function() {
|
||||
};
|
||||
|
||||
function drawNodesummary(summaryString){
|
||||
var nodename = $('#nodename').val();
|
||||
var nodeData = new Object();
|
||||
var metricArray = summaryString.split(';');
|
||||
var nodename = $('#nodename').val();
|
||||
var nodeData = new Object();
|
||||
var metricArray = summaryString.split(';');
|
||||
var metricname = '';
|
||||
var valueArray = '';
|
||||
var position = 0;
|
||||
@ -64,27 +65,28 @@ function drawNodesummary(summaryString){
|
||||
drawNetworkFlot('ganglianodenetwork', nodename, nodeData['bytes_in'], nodeData['bytes_out']);
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo <<<EEE
|
||||
</head>
|
||||
<body>
|
||||
<input id="nodename" type="hidden" value="{$_GET['n']}"></input>
|
||||
<input id="nodepath" type="hidden" value="{$_GET['p']}"></input>
|
||||
<div style="background-color:white;" class="tab">
|
||||
<table style="border-style:none;">
|
||||
<tr>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodeload" class="monitorsumdiv"></div></td>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodecpu" class="monitorsumdiv"></div></td>
|
||||
<td style="padding:0;border-style: none;"><div id="ganglianodemem" class="monitorsumdiv"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodedisk" class="monitorsumdiv"></div></td>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodenetwork" class="monitorsumdiv"></div></td>
|
||||
<td style="padding:0;border-style:none;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</head>
|
||||
<body>
|
||||
<input id="nodename" type="hidden" value="{$_GET['n']}"></input>
|
||||
<input id="nodepath" type="hidden" value="{$_GET['p']}"></input>
|
||||
<div style="background-color:white;" class="tab">
|
||||
<table style="border-style:none;">
|
||||
<tr>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodeload" class="monitor-sum-div"></div></td>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodecpu" class="monitor-sum-div"></div></td>
|
||||
<td style="padding:0;border-style: none;"><div id="ganglianodemem" class="monitor-sum-div"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodedisk" class="monitor-sum-div"></div></td>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodenetwork" class="monitor-sum-div"></div></td>
|
||||
<td style="padding:0;border-style:none;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
EEE;
|
||||
?>
|
@ -10,8 +10,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -11,8 +11,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -476,11 +476,11 @@ function drawGridSummary() {
|
||||
}
|
||||
|
||||
gridDrawArea.empty();
|
||||
showStr = '<table style="border-style:none;"><tr><td style="padding:0;border-style:none;"><div id="gangliasummaryload" class="monitorsumdiv"></div></td>' +
|
||||
'<td style="padding:0;border-style:none;"><div id="gangliasummarycpu" class="monitorsumdiv"></div></td>' +
|
||||
'<td style="padding:0;border-style:none;"><div id="gangliasummarymem" class="monitorsumdiv"></div></td></tr>' +
|
||||
'<tr><td style="padding:0;border-style:none;"><div id="gangliasummarydisk" class="monitorsumdiv"></div></td>' +
|
||||
'<td style="padding:0;border-style:none;"><div id="gangliasummarynetwork" class="monitorsumdiv"></div></td>' +
|
||||
showStr = '<table style="border-style:none;"><tr><td style="padding:0;border-style:none;"><div id="gangliasummaryload" class="monitor-sum-div"></div></td>' +
|
||||
'<td style="padding:0;border-style:none;"><div id="gangliasummarycpu" class="monitor-sum-div"></div></td>' +
|
||||
'<td style="padding:0;border-style:none;"><div id="gangliasummarymem" class="monitor-sum-div"></div></td></tr>' +
|
||||
'<tr><td style="padding:0;border-style:none;"><div id="gangliasummarydisk" class="monitor-sum-div"></div></td>' +
|
||||
'<td style="padding:0;border-style:none;"><div id="gangliasummarynetwork" class="monitor-sum-div"></div></td>' +
|
||||
'<td style="padding:0;border-style:none;"></td></tr></table>';
|
||||
gridDrawArea.append(showStr);
|
||||
drawLoadFlot('gangliasummaryload', 'Grid', gridData['load_one'], gridData['cpu_num']);
|
||||
@ -906,23 +906,23 @@ function drawGangliaNodesAreaPic(type, name) {
|
||||
nodename = temparray[index];
|
||||
switch (nodeStatus[nodename]) {
|
||||
case 'ERROR':
|
||||
showStr = '<li class="monitorerror ui-corner-all monitornodeli" title="' + nodename + '"></li>';
|
||||
showStr = '<li class="monitor-error ui-corner-all monitor-node-li" title="' + nodename + '"></li>';
|
||||
break;
|
||||
case 'WARNING':
|
||||
showStr = '<li class="mornitorwarning ui-corner-all monitornodeli" title="' + nodename + '"></li>';
|
||||
showStr = '<li class="mornitor-warning ui-corner-all monitor-node-li" title="' + nodename + '"></li>';
|
||||
break;
|
||||
case 'NORMAL':
|
||||
showStr = '<li class="monitornormal ui-corner-all monitornodeli" title="' + nodename + '"></li>';
|
||||
showStr = '<li class="monitor-normal ui-corner-all monitor-node-li" title="' + nodename + '"></li>';
|
||||
break;
|
||||
default:
|
||||
showStr = '<li class="monitorunknown ui-corner-all monitornodeli" title="' + nodename + '"></li>';
|
||||
showStr = '<li class="monitor-unknown ui-corner-all monitor-node-li" title="' + nodename + '"></li>';
|
||||
break;
|
||||
}
|
||||
$('#gangliaNodes ul').append(showStr);
|
||||
}
|
||||
|
||||
// Bind all normal and warning nodes click event
|
||||
$('.monitornormal,.monitorwarning').bind('click', function() {
|
||||
$('.monitor-normal,.monitorwarning').bind('click', function() {
|
||||
var nodename = $(this).attr('title');
|
||||
window.open('ganglianode.php?n=' + nodename + '&p=' + nodePath[nodename],
|
||||
'nodedetail','height=430,width=950,scrollbars=yes,status =no');
|
||||
@ -1077,7 +1077,7 @@ function updateZoom(obj) {
|
||||
while ($('#zoomDiv span:last').attr('name') != type) {
|
||||
$('#zoomDiv span:last').remove();
|
||||
}
|
||||
$(obj).removeClass('monitorzoomlinkli');
|
||||
$(obj).removeClass('monitor-zoom-link');
|
||||
$(obj).unbind('click');
|
||||
|
||||
drawGangliaNodesArea();
|
||||
@ -1093,7 +1093,7 @@ function addZoomDiv(obj) {
|
||||
var type = $(obj).attr('name');
|
||||
|
||||
var lastzoomobj = $('#zoomDiv span:last');
|
||||
lastzoomobj.addClass('monitorzoomlink');
|
||||
lastzoomobj.addClass('monitor-zoom-link');
|
||||
lastzoomobj.bind('click', function() {
|
||||
updateZoom(this);
|
||||
});
|
||||
|
@ -273,13 +273,13 @@ function showRmcSummary(returnData) {
|
||||
summaryTable.append(summaryRow);
|
||||
}
|
||||
summaryRow.append(tempTd);
|
||||
attrDiv = $('<div id="monitorsumdiv' + attr + '" class="monitorsumdiv"></div>');
|
||||
attrDiv = $('<div id="monitor-sum-div' + attr + '" class="monitor-sum-div"></div>');
|
||||
tempTd.append(attrDiv);
|
||||
for (var i in attrValues) {
|
||||
tempArray.push( [ globalTimeStamp[i], Number(attrValues[i]) ]);
|
||||
}
|
||||
|
||||
$.jqplot('monitorsumdiv' + attr, [ tempArray ], {
|
||||
$.jqplot('monitor-sum-div' + attr, [ tempArray ], {
|
||||
series: [{
|
||||
showMarker : false
|
||||
}],
|
||||
@ -348,13 +348,13 @@ function parseRmcData(returnData) {
|
||||
}
|
||||
|
||||
function createUnkownNode(nodeName) {
|
||||
var tempLi = '<li class="monitorunknown ui-corner-all monitornodeli" id="' + nodeName + '" ' +
|
||||
var tempLi = '<li class="monitor-unknown ui-corner-all monitor-node-li" id="' + nodeName + '" ' +
|
||||
'title="Name:' + nodeName + '<br/>Unknown"></li>';
|
||||
return tempLi;
|
||||
}
|
||||
|
||||
function createErrorNode(nodeName) {
|
||||
var tempLi = '<li class="monitorerror ui-corner-all monitornodeli id="' + nodeName + '" ' +
|
||||
var tempLi = '<li class="monitor-error ui-corner-all monitor-node-li id="' + nodeName + '" ' +
|
||||
'title="Name:' + nodeName + '<br/>Error"></li>';
|
||||
}
|
||||
|
||||
@ -403,12 +403,12 @@ function showRmcNodes(data, nodename) {
|
||||
memAvg = parseInt(tempSum / index);
|
||||
|
||||
if (cpuAvg >= 10 && memAvg <= 90){
|
||||
classname = 'monitornormal';
|
||||
classname = 'monitor-normal';
|
||||
} else {
|
||||
classname = 'mornitorwarning';
|
||||
classname = 'mornitor-warning';
|
||||
}
|
||||
|
||||
var normalLi = $('<li class="' + classname + ' ui-corner-all monitornodeli" id="' + nodename + '" title="' +
|
||||
var normalLi = $('<li class="' + classname + ' ui-corner-all monitor-node-li" id="' + nodename + '" title="' +
|
||||
'Name:' + nodename + '<br/> CpuIdle: ' + cpuAvg + '%<br/> MemFree: ' + memAvg + '%"></li>');
|
||||
|
||||
$('#rmcmonDetail ul').append(normalLi);
|
||||
@ -440,8 +440,8 @@ function showNode(nodeName) {
|
||||
|
||||
for ( var attr in globalNodesDetail[nodeName]) {
|
||||
var tempTd = $('<td style="border:0px;padding:1px 1px;"></td>');
|
||||
var attrChat = $('<div id="monitornodediv' + nodeName + attr
|
||||
+ '" class="monitornodediv"></div>');
|
||||
var attrChat = $('<div id="monitor-node-div' + nodeName + attr
|
||||
+ '" class="monitor-node-div"></div>');
|
||||
if (0 == parseNum % 4) {
|
||||
nodeRow = $('<tr></tr>');
|
||||
nodeTable.append(nodeRow);
|
||||
@ -457,7 +457,7 @@ function showNode(nodeName) {
|
||||
tempArray.push( [ globalTimeStamp[i], Number(tempData[i]) ]);
|
||||
}
|
||||
|
||||
$.jqplot('monitornodediv' + nodeName + attr, [ tempArray ], {
|
||||
$.jqplot('monitor-node-div' + nodeName + attr, [ tempArray ], {
|
||||
series : [{
|
||||
showMarker : false
|
||||
}],
|
||||
|
@ -312,7 +312,7 @@ function createSystempGraphical(bpa, fsp, area){
|
||||
|
||||
var td = $('<td style="padding:0;border-color: transparent;"></td>');
|
||||
var frameDiv = $('<div class="frameDiv"></div>');
|
||||
frameDiv.append('<div style="height:27px;" title="' + bpaName + '"><input type="checkbox" class="fspcheckbox" name="check_'+ bpaName +'"></div>');
|
||||
frameDiv.append('<div style="height:27px;" title="' + bpaName + '"><input type="checkbox" class="fspCheckbox" name="check_'+ bpaName +'"></div>');
|
||||
|
||||
//for P7-IH, all the cecs are insert into the frame from down to up, so we had to show the cecs same as the
|
||||
//physical layout.
|
||||
@ -445,7 +445,7 @@ function createSystempGraphical(bpa, fsp, area){
|
||||
updateSelectNodeDiv();
|
||||
});
|
||||
|
||||
$('.fspcheckbox').bind('click', function(){
|
||||
$('.fspCheckbox').bind('click', function(){
|
||||
var itemName = $(this).attr('name');
|
||||
name = itemName.substr(6);
|
||||
|
||||
@ -571,8 +571,8 @@ function createSystemxGraphical(xnodes, area){
|
||||
}
|
||||
xnodenum++;
|
||||
var td = $('<td style="padding:0;border-color: transparent;"></td>');
|
||||
var xnodeDiv = '<div id="' + xnodename + '" class="xnodeDiv" title="' + xnodename +'"></div>';
|
||||
td.append(xnodeDiv);
|
||||
var xNodeDiv = '<div id="' + xnodename + '" class="xNodeDiv" title="' + xnodename +'"></div>';
|
||||
td.append(xNodeDiv);
|
||||
row.append(td);
|
||||
}
|
||||
}
|
||||
@ -801,7 +801,7 @@ function createFspDiv(fspName, mtm, fsp){
|
||||
}
|
||||
|
||||
//create return value
|
||||
var retHtml = '<input style="padding:0;" class="fspcheckbox" type="checkbox" name="check_' + fspName + '">';
|
||||
var retHtml = '<input style="padding:0;" class="fspCheckbox" type="checkbox" name="check_' + fspName + '">';
|
||||
retHtml += '<div value="' + fspName + '" class="' + divClass + '">';
|
||||
retHtml += '<div class="lparDiv"><table><tbody><tr>' + lparStatusRow + '</tr></tbody></table></div></div>';
|
||||
return retHtml;
|
||||
|
@ -24,8 +24,8 @@ $(document).ready(function() {
|
||||
}).button();
|
||||
|
||||
if (document.location.protocol == 'http:') {
|
||||
$('#login_status').html('You are using an unencrypted session!');
|
||||
$('#login_status').css('color', 'red');
|
||||
$('#login-status').html('You are using an unencrypted session!');
|
||||
$('#login-status').css('color', 'red');
|
||||
}
|
||||
|
||||
if (!$("#login input[name='username']").val()) {
|
||||
@ -62,7 +62,7 @@ function onlogin(data, txtStatus) {
|
||||
var usrName = $("#login input[name='username']").val();
|
||||
$("#login input[name='password']").val('');
|
||||
if (data.authenticated == 'yes') {
|
||||
$('#login_status').text('Login successful');
|
||||
$('#login-status').text('Login successful');
|
||||
window.location = 'service.php';
|
||||
|
||||
// Set user name cookie
|
||||
@ -70,8 +70,8 @@ function onlogin(data, txtStatus) {
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie('xcat_username', usrName, { expires: exDate });
|
||||
} else {
|
||||
$('#login_status').text('Authentication failure');
|
||||
$('#login_status').css('color', '#FF0000');
|
||||
$('#login-status').text('Authentication failure');
|
||||
$('#login-status').css('color', '#FF0000');
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,8 +79,8 @@ function onlogin(data, txtStatus) {
|
||||
* Authenticate user for new session
|
||||
*/
|
||||
function authenticate() {
|
||||
$('#login_status').css('color', '#000000');
|
||||
$('#login_status').html('Authenticating...');
|
||||
$('#login-status').css('color', '#000000');
|
||||
$('#login-status').html('Authenticating...');
|
||||
|
||||
var passwd = $("#login input[name='password']").val();
|
||||
$.post('lib/srv_log.php', {
|
||||
|
@ -26,8 +26,8 @@ $(document).ready(function() {
|
||||
$('#login button').button();
|
||||
|
||||
if (document.location.protocol == "http:") {
|
||||
$("#login_status").html("You are using an unencrypted session!");
|
||||
$("#login_status").css("color", "#ff0000");
|
||||
$("#login-status").html("You are using an unencrypted session!");
|
||||
$("#login-status").css("color", "#ff0000");
|
||||
}
|
||||
|
||||
if ($("#login input[name='username']").val() == "") {
|
||||
@ -64,7 +64,7 @@ function onlogin(data, txtStatus) {
|
||||
// Clear password field regardless of what happens
|
||||
$("#login input[name='password']").val("");
|
||||
if (data.authenticated == "yes") {
|
||||
$("#login_status").text("Login successful");
|
||||
$("#login-status").text("Login successful");
|
||||
|
||||
// Not the first time to log
|
||||
if ($.cookie('logonflag')){
|
||||
@ -87,7 +87,7 @@ function onlogin(data, txtStatus) {
|
||||
});
|
||||
|
||||
} else {
|
||||
$("#login_status").text("Authentication failure").css("color", "#FF0000");
|
||||
$("#login-status").text("Authentication failure").css("color", "#FF0000");
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,8 +97,8 @@ function onlogin(data, txtStatus) {
|
||||
* @return Nothing
|
||||
*/
|
||||
function authenticate() {
|
||||
$("#login_status").css("color", "#000000");
|
||||
$("#login_status").html('Authenticating...');
|
||||
$("#login-status").css("color", "#000000");
|
||||
$("#login-status").html('Authenticating...');
|
||||
var passwd = $("#login input[name='password']").val();
|
||||
$.post("lib/log.php", {
|
||||
username : $("#login input[name='username']").val(),
|
||||
|
@ -6,26 +6,26 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all
|
||||
* This will handle most commands. If not, you can create your
|
||||
* own .php. Look at zCmd.php for an example.
|
||||
* This will handle most commands. If not, you can create your own .php.
|
||||
* Look at zCmd.php for an example.
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
|
||||
// File contents in case of file write
|
||||
if (isset($_GET["cont"])) {
|
||||
$cont = $_GET["cont"];
|
||||
}
|
||||
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
@ -34,7 +34,7 @@ if (isset($_GET["cmd"])) {
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
@ -52,12 +52,12 @@ if (isset($_GET["cmd"])) {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
@ -74,7 +74,7 @@ if (isset($_GET["cmd"])) {
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
@ -90,7 +90,7 @@ if (isset($_GET["cmd"])) {
|
||||
// This command gets the nodes and groups
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
}
|
||||
// Write contents to file
|
||||
else if(strncasecmp($cmd, "write", 4) == 0) {
|
||||
// Directory should be /var/opt/xcat/profiles
|
||||
@ -99,7 +99,7 @@ if (isset($_GET["cmd"])) {
|
||||
$handle = fopen($file, 'w') or die("Cannot open $file");
|
||||
fwrite($handle, $cont);
|
||||
fclose($handle);
|
||||
|
||||
|
||||
$rsp = "Directory entry written to $file";
|
||||
}
|
||||
// Handle the typical output
|
||||
@ -108,20 +108,20 @@ if (isset($_GET["cmd"])) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
|
||||
if ($data->data->contents) {
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
|
||||
if ($data->data->desc) {
|
||||
$cont = $data->data->desc . ": " . $cont;
|
||||
}
|
||||
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if(strlen("$data") > 2) {
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
@ -137,8 +137,8 @@ if (isset($_GET["cmd"])) {
|
||||
/**
|
||||
* Extract the output for a webrun command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
@ -149,7 +149,7 @@ function extractWebrun($xml) {
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
@ -166,8 +166,8 @@ function extractWebrun($xml) {
|
||||
/**
|
||||
* Extract the output for a nodels command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
@ -195,8 +195,8 @@ function extractNodels($xml) {
|
||||
/**
|
||||
* Extract the output for a extnoderange command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
|
@ -5,22 +5,21 @@
|
||||
|
||||
// Retain session variables across page requests
|
||||
session_start();
|
||||
session_write_close(); // Do not block HTTP requests
|
||||
session_write_close(); // Do not block other HTTP requests
|
||||
|
||||
// The settings below display error on the screen,
|
||||
// instead of giving blank pages.
|
||||
// The settings below display error on the screen, instead of giving blank pages.
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', true);
|
||||
|
||||
/**
|
||||
* Run a command using the xCAT client/server protocol
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $nr Node range or group
|
||||
* @param $args_array Command arguments
|
||||
* @param $opts_array Command options
|
||||
* @return A tree of SimpleXML objects.
|
||||
* See perl-xCAT/xCAT/Client.pm for the format
|
||||
* @param $cmd The xCAT command
|
||||
* @param $nr Node range or group
|
||||
* @param $args_array Command arguments
|
||||
* @param $opts_array Command options
|
||||
* @return A tree of SimpleXML objects.
|
||||
* See perl-xCAT/xCAT/Client.pm for the format
|
||||
*/
|
||||
function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
// If we are not logged in,
|
||||
@ -34,7 +33,9 @@ function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if(!empty($nr)) { $request->addChild('noderange', $nr); }
|
||||
if (!empty($nr)) {
|
||||
$request->addChild('noderange', $nr);
|
||||
}
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
@ -53,9 +54,9 @@ function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
/**
|
||||
* Used by docmd() to submit request to xCAT
|
||||
*
|
||||
* @param $req Tree of SimpleXML objects
|
||||
* @param $opts_array Request options
|
||||
* @return A tree of SimpleXML objects
|
||||
* @param $req Tree of SimpleXML objects
|
||||
* @param $opts_array Request options
|
||||
* @return A tree of SimpleXML objects
|
||||
*/
|
||||
function submit_request($req, $skipVerify, $opts_array){
|
||||
$xcathost = "localhost";
|
||||
@ -63,46 +64,46 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
|
||||
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
|
||||
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
|
||||
// Open syslog, include the process ID and also send
|
||||
// the log to standard error, and use a user defined
|
||||
// logging mechanism
|
||||
|
||||
// Open syslog, include the process ID and also send the log to standard error,
|
||||
// and use a user defined logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
if ($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
|
||||
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
while(!feof($fp)) { // Read until there is no more
|
||||
while (!feof($fp)) {
|
||||
// Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
|
||||
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
// Strip HTML tags from output
|
||||
@ -117,50 +118,48 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if(preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done,
|
||||
// Package up XML and return it
|
||||
if (preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done, package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) { $response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/'; } // if its not there, then remove the short pattern
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) {
|
||||
$response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/';
|
||||
}
|
||||
$response = "<xcat>$response</xcat>";
|
||||
//delete the \n between '>' and '<'
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
//replace the '\n' by ':|:' in the data area.
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
|
||||
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
|
||||
// Close syslog
|
||||
closelog();
|
||||
|
||||
|
||||
if(! $cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
elseif(!$skipVerify) {
|
||||
} else if(!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
@ -170,10 +169,6 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
|
||||
/**
|
||||
* Enable password storage to split between cookie and session variable
|
||||
*
|
||||
* @param $data
|
||||
* @param $key
|
||||
* @return
|
||||
*/
|
||||
function xorcrypt($data, $key) {
|
||||
$datalen = strlen($data);
|
||||
@ -187,9 +182,6 @@ function xorcrypt($data, $key) {
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*
|
||||
* @param Nothing
|
||||
* @return
|
||||
*/
|
||||
function getpassword() {
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
@ -204,13 +196,11 @@ function getpassword() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the password splitting knowledge between server
|
||||
* and client side persistant storage. Caller should regenerate
|
||||
* session ID when contemplating a new user/password, to preclude
|
||||
* session fixation, though fixation is limited without the secret.
|
||||
* Get the password splitting knowledge between server and client side persistant storage.
|
||||
* Caller should regenerate session ID when contemplating a new user/password,
|
||||
* to preclude session fixation, though fixation is limited without the secret.
|
||||
*
|
||||
* @param $password Password
|
||||
* @return Nothing
|
||||
* @param $password Password
|
||||
*/
|
||||
function setpassword($password) {
|
||||
$randlen = strlen($password);
|
||||
@ -227,8 +217,8 @@ function setpassword($password) {
|
||||
/**
|
||||
* Get RAND characters
|
||||
*
|
||||
* @param $length Length of characters
|
||||
* @return RAND characters
|
||||
* @param $length Length of characters
|
||||
* @return RAND characters
|
||||
*/
|
||||
function getrandchars($length) {
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
@ -246,9 +236,7 @@ function getrandchars($length) {
|
||||
/**
|
||||
* Determine if a user/password session exists
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If user has a session.
|
||||
* False Otherwise
|
||||
* @return True if user has a session, false otherwise
|
||||
*/
|
||||
function is_logged() {
|
||||
if (isset($_SESSION["username"]) and !is_bool(getpassword())) {
|
||||
@ -260,10 +248,8 @@ function is_logged() {
|
||||
|
||||
/**
|
||||
* Determine if a user is currently logged in successfully
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If the user is currently logged in successfully
|
||||
* False Otherwise
|
||||
*
|
||||
* @return True if the user is currently logged in successfully, false otherwise
|
||||
*/
|
||||
function isAuthenticated() {
|
||||
if (is_logged()) {
|
||||
@ -290,12 +276,10 @@ function isAuthenticated() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a user has root access
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If the user has root access
|
||||
* False Otherwise
|
||||
*/
|
||||
* Determine if a user has root access
|
||||
*
|
||||
* @return True if the user has root access, false otherwise
|
||||
*/
|
||||
function isRootAcess() {
|
||||
if (is_logged() && $_SESSION["xcatpassvalid"]) {
|
||||
$testacc = docmd('tabdump', '', array('policy', '-w', "name==" . $_SESSION["username"]), array());
|
||||
@ -304,7 +288,7 @@ function isRootAcess() {
|
||||
$result = str_replace('"', '', $result);
|
||||
$args = array();
|
||||
$args = explode(",", $result);
|
||||
|
||||
|
||||
// Get the comments which contains the privilege
|
||||
$comments = $args[8];
|
||||
$args = explode(";", $comments);
|
||||
@ -319,13 +303,13 @@ function isRootAcess() {
|
||||
$privilege = 'root';
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (strcmp($_SESSION["username"], 'root') == 0) {
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
@ -338,10 +322,7 @@ function isRootAcess() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out of the current user session
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
* Log out of current user session
|
||||
*/
|
||||
function logout() {
|
||||
// Clear the secret cookie from browser
|
||||
@ -360,12 +341,9 @@ function logout() {
|
||||
|
||||
/**
|
||||
* Format a given string and echo it back to the browser
|
||||
*
|
||||
* @param $str String
|
||||
* @return Nothing
|
||||
*/
|
||||
function format_TBD($str) {
|
||||
// Format a given string however you want it
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
}
|
||||
|
@ -77,14 +77,14 @@ function rconsSynchronise($parameter) {
|
||||
if (0 == strlen($line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ('<' == substr($line, 0, 1)) {
|
||||
$flag = true;
|
||||
$return .= $line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($flag) {
|
||||
while (!feof($fp)) {
|
||||
$return .= fgets($fp, 1024);
|
||||
|
@ -5,22 +5,21 @@ require_once "$TOPDIR/lib/srv_functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all
|
||||
* This will handle most commands. If not, you can create your
|
||||
* own .php. Look at zCmd.php for an example.
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all. This will handle most commands.
|
||||
* If not, you can create your own .php. Look at zCmd.php for an example.
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
@ -29,7 +28,7 @@ if (isset($_GET["cmd"])) {
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
@ -47,12 +46,12 @@ if (isset($_GET["cmd"])) {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
@ -69,7 +68,7 @@ if (isset($_GET["cmd"])) {
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
@ -92,17 +91,16 @@ if (isset($_GET["cmd"])) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
|
||||
if($data->data->contents){
|
||||
$cont = $data->data->contents;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if(strlen("$data") > 2) {
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
@ -118,8 +116,8 @@ if (isset($_GET["cmd"])) {
|
||||
/**
|
||||
* Extract the output for a webrun command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
@ -130,7 +128,7 @@ function extractWebrun($xml) {
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
@ -147,8 +145,8 @@ function extractWebrun($xml) {
|
||||
/**
|
||||
* Extract the output for a nodels command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
@ -176,8 +174,8 @@ function extractNodels($xml) {
|
||||
/**
|
||||
* Extract the output for a extnoderange command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Retain session variables across page requests
|
||||
session_start();
|
||||
session_write_close(); // Do not block HTTP requests
|
||||
session_write_close(); // Do not block HTTP requests
|
||||
|
||||
// The settings below display error on the screen,
|
||||
// instead of giving blank pages.
|
||||
@ -15,310 +15,286 @@ ini_set('display_errors', true);
|
||||
/**
|
||||
* Run a command using the xCAT client/server protocol
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $nr Node range or group
|
||||
* @param $args_array Command arguments
|
||||
* @param $opts_array Command options
|
||||
* @return A tree of SimpleXML objects.
|
||||
* See perl-xCAT/xCAT/Client.pm for the format
|
||||
* @param $cmd The xCAT command
|
||||
* @param $nr Node range or group
|
||||
* @param $args_array Command arguments
|
||||
* @param $opts_array Command options
|
||||
* @return A tree of SimpleXML objects. See perl-xCAT/xCAT/Client.pm for the format
|
||||
*/
|
||||
function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
// If we are not logged in,
|
||||
// do not try to communicate with xcatd
|
||||
if (!is_logged()) {
|
||||
echo "<p>You are not logged in! Failed to run command.</p>";
|
||||
return simplexml_load_string('<xcat></xcat>', 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
// If we are not logged in,
|
||||
// do not try to communicate with xcatd
|
||||
if (!is_logged()) {
|
||||
echo "<p>You are not logged in! Failed to run command.</p>";
|
||||
return simplexml_load_string('<xcat></xcat>', 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
|
||||
// Create xCAT request
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if(!empty($nr)) { $request->addChild('noderange', $nr); }
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
}
|
||||
}
|
||||
// Create xCAT request
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if (!empty($nr)) { $request->addChild('noderange', $nr); }
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
}
|
||||
}
|
||||
|
||||
// Add user and password to request
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode->addChild('username',$_SESSION["srv_username"]);
|
||||
$usernode->addChild('password',getpassword());
|
||||
// Add user and password to request
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode->addChild('username',$_SESSION["srv_username"]);
|
||||
$usernode->addChild('password',getpassword());
|
||||
|
||||
$xml = submit_request($request, 0, $opts_array);
|
||||
return $xml;
|
||||
$xml = submit_request($request, 0, $opts_array);
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by docmd() to submit request to xCAT
|
||||
*
|
||||
* @param $req Tree of SimpleXML objects
|
||||
* @param $opts_array Request options
|
||||
* @return A tree of SimpleXML objects
|
||||
* @param $req Tree of SimpleXML objects
|
||||
* @param $opts_array Request options
|
||||
* @return A tree of SimpleXML objects
|
||||
*/
|
||||
function submit_request($req, $skipVerify, $opts_array){
|
||||
$xcathost = "localhost";
|
||||
$port = "3001";
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
|
||||
// Open syslog, include the process ID and also send
|
||||
// the log to standard error, and use a user defined
|
||||
// logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
$xcathost = "localhost";
|
||||
$port = "3001";
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
|
||||
// Open syslog, include the process ID and also send
|
||||
// the log to standard error, and use a user defined
|
||||
// logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
while(!feof($fp)) { // Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
// Strip HTML tags from output
|
||||
if ($tmp = trim(strip_tags($str))) {
|
||||
// Format the output based on what was given for $flush_format
|
||||
if ($flush_format == "TDB") {
|
||||
format_TBD($tmp);
|
||||
} else {
|
||||
// Print out output by default
|
||||
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if(preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done,
|
||||
// Package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) { $response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/'; } // if its not there, then remove the short pattern
|
||||
$response = "<xcat>$response</xcat>";
|
||||
//delete the \n between '>' and '<'
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
//replace the '\n' by ':|:' in the data area.
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if ($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
while(!feof($fp)) { // Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
// Strip HTML tags from output
|
||||
if ($tmp = trim(strip_tags($str))) {
|
||||
// Format the output based on what was given for $flush_format
|
||||
if ($flush_format == "TDB") {
|
||||
format_TBD($tmp);
|
||||
} else {
|
||||
// Print out output by default
|
||||
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if(preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done, package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) { $response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/'; }
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
|
||||
// Close syslog
|
||||
closelog();
|
||||
|
||||
if(! $cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
elseif(!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
}
|
||||
return $rsp;
|
||||
// Close syslog
|
||||
closelog();
|
||||
|
||||
if(! $cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
} else if (!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
}
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable password storage to split between cookie and session variable
|
||||
*
|
||||
* @param $data
|
||||
* @param $key
|
||||
* @return
|
||||
*/
|
||||
function xorcrypt($data, $key) {
|
||||
$datalen = strlen($data);
|
||||
$keylen = strlen($key);
|
||||
for ($i=0;$i<$datalen;$i++) {
|
||||
$data[$i] = chr(ord($data[$i])^ord($key[$i]));
|
||||
}
|
||||
$datalen = strlen($data);
|
||||
$keylen = strlen($key);
|
||||
for ($i=0;$i<$datalen;$i++) {
|
||||
$data[$i] = chr(ord($data[$i])^ord($key[$i]));
|
||||
}
|
||||
|
||||
return $data;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get RAND characters
|
||||
*
|
||||
* @param $length Length of characters
|
||||
* @return RAND characters
|
||||
* @param $length Length of characters
|
||||
* @return RAND characters
|
||||
*/
|
||||
function getrandchars($length) {
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
$charsize = strlen($charset);
|
||||
srand();
|
||||
$chars = '';
|
||||
for ($i=0;$i<$length;$i++) {
|
||||
$num=rand()%$charsize;
|
||||
$chars=$chars.substr($charset,$num,1);
|
||||
}
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
$charsize = strlen($charset);
|
||||
srand();
|
||||
$chars = '';
|
||||
for ($i=0;$i<$length;$i++) {
|
||||
$num=rand()%$charsize;
|
||||
$chars=$chars.substr($charset,$num,1);
|
||||
}
|
||||
|
||||
return $chars;
|
||||
return $chars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a given string and echo it back to the browser
|
||||
*
|
||||
* @param $str String
|
||||
* @return Nothing
|
||||
*/
|
||||
function format_TBD($str) {
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*
|
||||
* @param Nothing
|
||||
* @return
|
||||
*/
|
||||
function getpassword() {
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return xorcrypt($_SESSION["secretkey"], base64_decode($cryptext));
|
||||
return xorcrypt($_SESSION["secretkey"], base64_decode($cryptext));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the password splitting knowledge between server
|
||||
* and client side persistant storage. Caller should regenerate
|
||||
* session ID when contemplating a new user/password, to preclude
|
||||
* session fixation, though fixation is limited without the secret.
|
||||
* Get the password splitting knowledge between server and client side persistant storage.
|
||||
* Caller should regenerate session ID when contemplating a new user/password,
|
||||
* to preclude session fixation, though fixation is limited without the secret.
|
||||
*
|
||||
* @param $password Password
|
||||
* @return Nothing
|
||||
* @param $password Password
|
||||
*/
|
||||
function setpassword($password) {
|
||||
$randlen = strlen($password);
|
||||
$key = getrandchars($randlen);
|
||||
$cryptext = xorcrypt($password,$key);
|
||||
$randlen = strlen($password);
|
||||
$key = getrandchars($randlen);
|
||||
$cryptext = xorcrypt($password,$key);
|
||||
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a user/password session exists
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If user has a session.
|
||||
* False Otherwise
|
||||
* @return True if user has a session, false otherwise
|
||||
*/
|
||||
function is_logged() {
|
||||
if (isset($_SESSION["srv_username"]) and !is_bool(getpassword())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["srv_username"]) and !is_bool(getpassword())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a user is currently logged in successfully
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If the user is currently logged in successfully
|
||||
* False Otherwise
|
||||
*
|
||||
* @return True if the user is currently logged in successfully, false otherwise
|
||||
*/
|
||||
function isAuthenticated() {
|
||||
if (is_logged()) {
|
||||
if ($_SESSION["srv_xcatpassvalid"] != 1) {
|
||||
$testcred = docmd("authcheck", "", NULL, NULL);
|
||||
if (isset($testcred->{'xcatresponse'}->{'data'})) {
|
||||
$result = "".$testcred->{'xcatresponse'}->{'data'};
|
||||
if (is_numeric(strpos("Authenticated",$result))) {
|
||||
// Logged in successfully
|
||||
$_SESSION["srv_xcatpassvalid"] = 1;
|
||||
} else {
|
||||
// Not logged in
|
||||
$_SESSION["srv_xcatpassvalid"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_logged()) {
|
||||
if ($_SESSION["srv_xcatpassvalid"] != 1) {
|
||||
$testcred = docmd("authcheck", "", NULL, NULL);
|
||||
if (isset($testcred->{'xcatresponse'}->{'data'})) {
|
||||
$result = "".$testcred->{'xcatresponse'}->{'data'};
|
||||
if (is_numeric(strpos("Authenticated",$result))) {
|
||||
// Logged in successfully
|
||||
$_SESSION["srv_xcatpassvalid"] = 1;
|
||||
} else {
|
||||
// Not logged in
|
||||
$_SESSION["srv_xcatpassvalid"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION["srv_xcatpassvalid"]) and $_SESSION["srv_xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["srv_xcatpassvalid"]) and $_SESSION["srv_xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out of the current user session
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
*/
|
||||
function logout() {
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
}
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
}
|
||||
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
}
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
}
|
||||
|
||||
// Clear server store of data
|
||||
$_SESSION=array();
|
||||
// Clear server store of data
|
||||
$_SESSION=array();
|
||||
}
|
||||
?>
|
||||
|
@ -11,29 +11,29 @@ header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
if (isset($_REQUEST["password"])) {
|
||||
// Clear data from session
|
||||
$_SESSION = array();
|
||||
// Clear data from session
|
||||
$_SESSION = array();
|
||||
|
||||
// Zap existing session entirely
|
||||
session_regenerate_id(true);
|
||||
setpassword($_REQUEST["password"]);
|
||||
// Zap existing session entirely
|
||||
session_regenerate_id(true);
|
||||
setpassword($_REQUEST["password"]);
|
||||
|
||||
// Invalid password
|
||||
$_SESSION["srv_xcatpassvalid"] = -1;
|
||||
// Invalid password
|
||||
$_SESSION["srv_xcatpassvalid"] = -1;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST["username"])) {
|
||||
$_SESSION["srv_username"] = $_REQUEST["username"];
|
||||
$_SESSION["srv_username"] = $_REQUEST["username"];
|
||||
|
||||
// Invalid user name
|
||||
$_SESSION["srv_xcatpassvalid"]=-1;
|
||||
// Invalid user name
|
||||
$_SESSION["srv_xcatpassvalid"]=-1;
|
||||
}
|
||||
|
||||
$jdata = array();
|
||||
if (isAuthenticated()) {
|
||||
$jdata["authenticated"]="yes";
|
||||
$jdata["authenticated"]="yes";
|
||||
} else {
|
||||
$jdata["authenticated"]="no";
|
||||
$jdata["authenticated"]="no";
|
||||
}
|
||||
|
||||
echo json_encode($jdata);
|
||||
|
@ -7,30 +7,30 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
/**
|
||||
* This will handle system commands, e.g. rpm -qa xCAT
|
||||
*
|
||||
* @param $cmd The system command
|
||||
* @return The system response. Replies are in the form of JSON
|
||||
* @param $cmd The system command
|
||||
* @return The system response. Replies are in the form of JSON
|
||||
*/
|
||||
if (!isAuthenticated()) {
|
||||
echo ("<b>Please login before continuing!</b>");
|
||||
exit;
|
||||
echo ("<b>Please login before continuing!</b>");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$msg = NULL;
|
||||
$ret = "";
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$msg = NULL;
|
||||
$ret = "";
|
||||
|
||||
if (isset($_GET["msg"])) {
|
||||
$msg = $_GET["msg"];
|
||||
}
|
||||
|
||||
if ($cmd == "ostype") {
|
||||
$ret = strtolower(PHP_OS);
|
||||
} else {
|
||||
$ret = shell_exec($cmd);
|
||||
}
|
||||
if (isset($_GET["msg"])) {
|
||||
$msg = $_GET["msg"];
|
||||
}
|
||||
|
||||
if ($cmd == "ostype") {
|
||||
$ret = strtolower(PHP_OS);
|
||||
} else {
|
||||
$ret = shell_exec($cmd);
|
||||
}
|
||||
|
||||
echo json_encode(array("rsp"=>$ret, "msg" => $msg));
|
||||
echo json_encode(array("rsp"=>$ret, "msg" => $msg));
|
||||
}
|
||||
?>
|
@ -7,8 +7,8 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
/**
|
||||
* Replace the contents of an xCAT table
|
||||
*
|
||||
* @param $tab The xCAT table
|
||||
* @param $cont The xCAT table contents
|
||||
* @param $tab The xCAT table
|
||||
* @param $cont The xCAT table contents
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_POST["table"])) {
|
||||
@ -24,7 +24,7 @@ $request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', 'tabrestore');
|
||||
|
||||
// Setup authentication
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode = $request->addChild('becomeuser');
|
||||
$usernode->addChild('username', $_SESSION["username"]);
|
||||
$usernode->addChild('password', getpassword());
|
||||
|
||||
@ -43,7 +43,7 @@ foreach($cont as $line){
|
||||
}
|
||||
|
||||
// Go through each column
|
||||
foreach($line as &$col){
|
||||
foreach ($line as &$col){
|
||||
// If the column does begins and end with a quote
|
||||
// Change quotes to "
|
||||
if(!empty($col) && !preg_match('/^".*"$/', $col)) {
|
||||
@ -55,9 +55,11 @@ foreach($cont as $line){
|
||||
ksort($line, SORT_NUMERIC);
|
||||
$keys = array_keys($line);
|
||||
$max = count($line) - 1;
|
||||
if($keys[$max] != $max){
|
||||
if ($keys[$max] != $max){
|
||||
for ($i = 0; $i <= $keys[$max]; $i++) {
|
||||
if (!isset($line[$i])) {$line[$i]='';}
|
||||
if (!isset($line[$i])) {
|
||||
$line[$i]='';
|
||||
}
|
||||
}
|
||||
ksort($line, SORT_NUMERIC);
|
||||
}
|
||||
|
@ -1,96 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Load page
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
*/
|
||||
function loadPage() {
|
||||
// Include CSS and Javascripts
|
||||
echo
|
||||
'<html>
|
||||
<head>
|
||||
<title>xCAT</title>
|
||||
<link rel="shortcut icon" href="images/favicon.ico">
|
||||
<link href="css/login.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
</head>';
|
||||
// Include CSS and Javascripts
|
||||
echo
|
||||
'<html>
|
||||
<head>
|
||||
<title>xCAT</title>
|
||||
<link rel="shortcut icon" href="images/favicon.ico">
|
||||
<link href="css/login.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
</head>';
|
||||
|
||||
// Header menu
|
||||
echo
|
||||
'<body>
|
||||
<div id="header">
|
||||
<ul>
|
||||
<li><img src="images/logo.gif" height="39px" style="margin-right: 60px;"/></li>
|
||||
<li><a href="index.php" class="top_link">Nodes</a></li>
|
||||
<li><a href="configure.php" class="top_link">Configure</a></li>
|
||||
<li><a href="provision.php" class="top_link">Provision</a></li>
|
||||
<li><a href="monitor.php" class="top_link">Monitor</a></li>
|
||||
<li><a href="help.php" class="top_link">Help</a></li>
|
||||
</ul>';
|
||||
|
||||
// User name and log out section
|
||||
if (isset($_SESSION['username'])){
|
||||
echo
|
||||
"<div>
|
||||
<span id='login_user' style='padding: 0 6px; font-weight: bold;'>{$_SESSION['username']}</span> | <a id='xcat_settings'>Settings</a> | <a href='lib/logout.php'>Log out</a>
|
||||
</div>";
|
||||
}
|
||||
// Header menu
|
||||
echo
|
||||
'<body>
|
||||
<div id="header">
|
||||
<ul>
|
||||
<li><img src="images/logo.gif" height="39px" style="margin-right: 60px;"/></li>
|
||||
<li><a href="index.php" class="top_link">Nodes</a></li>
|
||||
<li><a href="configure.php" class="top_link">Configure</a></li>
|
||||
<li><a href="provision.php" class="top_link">Provision</a></li>
|
||||
<li><a href="monitor.php" class="top_link">Monitor</a></li>
|
||||
<li><a href="help.php" class="top_link">Help</a></li>
|
||||
</ul>';
|
||||
|
||||
// User name and log out section
|
||||
if (isset($_SESSION['username'])){
|
||||
echo
|
||||
"<div>
|
||||
<span id='login_user' style='padding: 0 6px; font-weight: bold;'>{$_SESSION['username']}</span> | <a id='xcat_settings'>Settings</a> | <a href='lib/logout.php'>Log out</a>
|
||||
</div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
// Content
|
||||
echo '<div class="content" id="content"></div>';
|
||||
echo '</div>';
|
||||
// Content
|
||||
echo '<div class="content" id="content"></div>';
|
||||
|
||||
// End of page
|
||||
echo
|
||||
'</body>
|
||||
</html>';
|
||||
// End of page
|
||||
echo
|
||||
'</body>
|
||||
</html>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load page content
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
*/
|
||||
function loadContent() {
|
||||
// Initialize page
|
||||
echo
|
||||
'<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
initPage();
|
||||
});
|
||||
</script>';
|
||||
// Initialize page
|
||||
echo
|
||||
'<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
initPage();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Login user into a new session
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
*/
|
||||
function login() {
|
||||
// xcatauth.js will open a dialog box
|
||||
// asking for the user name and password
|
||||
echo
|
||||
'<script src="js/jquery/jquery.cookie.min.js" type="text/javascript"></script>
|
||||
<script src="js/xcatauth.js" type="text/javascript"></script>
|
||||
<div id="login">
|
||||
<div id="login_form">
|
||||
<table>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td align=right><img src="images/logo.png" width="50" height="35"></img></td><td colspan=4 style="font-size: 18px;">eXtreme Cloud Administration Toolkit</td></tr>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
|
||||
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
|
||||
<tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
|
||||
<tr><td></td><td colspan=4><span id=login_status></span></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="loginfo">Open Source. EPL License.</div>
|
||||
</div>';
|
||||
// xcatauth.js will open a dialog box
|
||||
// asking for the user name and password
|
||||
echo
|
||||
'<script src="js/jquery/jquery.cookie.min.js" type="text/javascript"></script>
|
||||
<script src="js/xcatauth.js" type="text/javascript"></script>
|
||||
<div id="login">
|
||||
<div id="login-form">
|
||||
<table>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td align=right><img src="images/logo.png" width="50" height="35"></img></td><td colspan=4 style="font-size: 18px;">eXtreme Cloud Administration Toolkit</td></tr>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
|
||||
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
|
||||
<tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
|
||||
<tr><td></td><td colspan=4><span id=login-status></span></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="log-info">Open Source. EPL License.</div>
|
||||
</div>';
|
||||
}
|
||||
?>
|
@ -4,26 +4,26 @@
|
||||
*/
|
||||
$type = $_FILES["file"]["type"];
|
||||
if ($type == "text/plain" || $type == "application/octet-stream" || $type == "application/x-shellscript" || $type == "application/x-sh") {
|
||||
$error = $_FILES["file"]["error"];
|
||||
if ($error) {
|
||||
echo "Return Code: " . $error;
|
||||
} else {
|
||||
$file = $_FILES["file"]["name"];
|
||||
$path = "/var/tmp/" . $file;
|
||||
move_uploaded_file($_FILES["file"]["tmp_name"], $path);
|
||||
$error = $_FILES["file"]["error"];
|
||||
if ($error) {
|
||||
echo "Return Code: " . $error;
|
||||
} else {
|
||||
$file = $_FILES["file"]["name"];
|
||||
$path = "/var/tmp/" . $file;
|
||||
move_uploaded_file($_FILES["file"]["tmp_name"], $path);
|
||||
|
||||
// Open and read given file
|
||||
$handler = fopen($path, "r");
|
||||
$data = fread($handler, filesize($path));
|
||||
fclose($handler);
|
||||
// Open and read given file
|
||||
$handler = fopen($path, "r");
|
||||
$data = fread($handler, filesize($path));
|
||||
fclose($handler);
|
||||
|
||||
// Print out file contents
|
||||
echo $data;
|
||||
// Print out file contents
|
||||
echo $data;
|
||||
|
||||
// Remove this file
|
||||
unlink($path);
|
||||
}
|
||||
// Remove this file
|
||||
unlink($path);
|
||||
}
|
||||
} else {
|
||||
echo "(Error) File type $type not supported";
|
||||
echo "(Error) File type $type not supported";
|
||||
}
|
||||
?>
|
@ -7,9 +7,9 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
/**
|
||||
* Issue an xCAT command (only for z)
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
@ -56,7 +56,7 @@ if (isset($_GET["cmd"])) {
|
||||
$rsp = array();
|
||||
|
||||
// Replace user entry
|
||||
if(strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
if (strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
@ -77,7 +77,7 @@ if (isset($_GET["cmd"])) {
|
||||
}
|
||||
|
||||
// Create virtual server
|
||||
else if(strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
else if (strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
|
@ -10,8 +10,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -10,8 +10,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -1,21 +1,21 @@
|
||||
<?php
|
||||
echo <<<EEE
|
||||
<html>
|
||||
<head>
|
||||
<title>{$_GET['rconsnd']}</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="css/ajaxterm.css"/>
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/rcons/rcons.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.onload=function() {
|
||||
t=new rconsTerm("{$_GET['rconsnd']}", 80, 25);
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="term"></div>
|
||||
</body>
|
||||
<head>
|
||||
<title>{$_GET['rconsnd']}</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="css/ajaxterm.css"/>
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/rcons/rcons.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.onload=function() {
|
||||
t=new rconsTerm("{$_GET['rconsnd']}", 80, 25);
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="term"></div>
|
||||
</body>
|
||||
</html>
|
||||
EEE;
|
||||
?>
|
||||
|
@ -12,30 +12,30 @@ require_once "lib/jsonwrapper.php";
|
||||
// Include CSS and Javascripts
|
||||
echo
|
||||
'<html>
|
||||
<head>
|
||||
<title>xCAT Service Portal</title>
|
||||
<link rel="shortcut icon" href="images/favicon.ico">
|
||||
<link href="css/login.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
<script type="text/javascript" src="js/service/service.js"></script>
|
||||
</head>';
|
||||
<head>
|
||||
<title>xCAT Service Portal</title>
|
||||
<link rel="shortcut icon" href="images/favicon.ico">
|
||||
<link href="css/login.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
<script type="text/javascript" src="js/service/service.js"></script>
|
||||
</head>';
|
||||
|
||||
// Create header menu
|
||||
echo
|
||||
'<body>
|
||||
<div id="header" class="ui-widget-header">
|
||||
<img style="margin: 0px 20px; position: relative; float: left;" src="images/logo.gif" height="100%"/>
|
||||
<div style="margin: 10px 20px; position: relative; float: left; color: white; font: bold 14px sans-serif;">xCAT Service Portal</div>';
|
||||
|
||||
<div id="header" class="ui-widget-header">
|
||||
<img style="margin: 0px 20px; position: relative; float: left;" src="images/logo.gif" height="100%"/>
|
||||
<div style="margin: 10px 20px; position: relative; float: left; color: white; font: bold 14px sans-serif;">xCAT Service Portal</div>';
|
||||
|
||||
// Create user name and log out section
|
||||
if (isset($_SESSION['srv_username'])){
|
||||
echo
|
||||
"<div>
|
||||
<span style='padding: 0 6px; color: white; font-weight: bold;'>{$_SESSION['srv_username']}</span> | <a id='xcat_settings'>Settings</a> | <a href='lib/srv_logout.php'>Log out</a>
|
||||
</div>";
|
||||
echo
|
||||
"<div>
|
||||
<span style='padding: 0 6px; color: white; font-weight: bold;'>{$_SESSION['srv_username']}</span> | <a id='xcat_settings'>Settings</a> | <a href='lib/srv_logout.php'>Log out</a>
|
||||
</div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
@ -45,35 +45,35 @@ echo '<div class="content" id="content"></div>';
|
||||
|
||||
// End of page
|
||||
echo
|
||||
'</body>
|
||||
'</body>
|
||||
</html>';
|
||||
|
||||
// Login user
|
||||
if (!isAuthenticated()) {
|
||||
// xcatauth.js will open a dialog box asking for the user name and password
|
||||
echo
|
||||
'<script src="js/srv_xcatauth.js" type="text/javascript"></script>
|
||||
<div id="login">
|
||||
<div id="login_form">
|
||||
<table>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td align=right><img src="images/logo.png" width="50" height="35"></img></td><td colspan=4 style="font-size: 18px;">eXtreme Cloud Administration Toolkit</td></tr>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
|
||||
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
|
||||
<tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
|
||||
<tr><td></td><td colspan=4><span id=login_status></span></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="loginfo">Open Source. EPL License.</div>
|
||||
</div>';
|
||||
// xcatauth.js will open a dialog box asking for the user name and password
|
||||
echo
|
||||
'<script src="js/srv_xcatauth.js" type="text/javascript"></script>
|
||||
<div id="login">
|
||||
<div id="login-form">
|
||||
<table>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td align=right><img src="images/logo.png" width="50" height="35"></img></td><td colspan=4 style="font-size: 18px;">eXtreme Cloud Administration Toolkit</td></tr>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
|
||||
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
|
||||
<tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
|
||||
<tr><td></td><td colspan=4><span id=login-status></span></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="log-info">Open Source. EPL License.</div>
|
||||
</div>';
|
||||
} else {
|
||||
// Initialize page
|
||||
echo
|
||||
'<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
initServicePage();
|
||||
});
|
||||
</script>';
|
||||
// Initialize page
|
||||
echo
|
||||
'<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
initServicePage();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
?>
|
||||
|
@ -120,7 +120,7 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/webportal
|
||||
echo "Installing xCAT-UI on AIX..."
|
||||
else
|
||||
echo ""
|
||||
echo "Error! IBM HTTP Server is not installed or not installed in the default directory (/usr/IBM/HTTPServer/)."
|
||||
echo "Error! IBM HTTP Server has not been installed or has not been installed in the default directory (/usr/IBM/HTTPServer/)."
|
||||
exit -1;
|
||||
fi
|
||||
%endif
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user