Fix menu in IE and started frame view page.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2279 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
bp-sawyers 2008-10-03 13:11:57 +00:00
parent e2a4902ef1
commit d71ffa4c4f
11 changed files with 543 additions and 526 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 986 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 980 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 984 B

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -57,7 +57,7 @@ EOS;
* @param String nodeGroup The group.
*/
function insertGroupTableRow($nodeGroupName, $status) {
$img_string = getStatusImage(GroupNodeTable::determineStatus($status));
$img_string = getStatusImage(mapStatus($status));
//echo '<tr bgcolor="#FFCC00"><td align=left>';
echo '<tr class=TableRow><td align=left width=140>';
@ -120,18 +120,5 @@ function getNodeTableRow($nodeName, $attrs) {
return $html;
}
/**
* @param String nodestatStr The status of the node as output by the nodestat command
* @return "good", "bad", "warning", or "unknown"
*/
function determineStatus($statStr) {
$status = NULL;
if ($statStr == "alive" || $statStr == "ready" || $statStr == "pbs" || $statStr == "sshd") { $status = "good"; }
else if ($statStr == "noping") { $status = "bad"; }
else if ($statStr == "ping") { $status = "warning"; }
else { $status = "unknown"; }
return $status;
}
} // end the class
?>

View File

@ -55,8 +55,8 @@ echo "</head><body>\n";
echo <<<EOS
<table id=headingTable border=0 cellspacing=0 cellpadding=0>
<tr valign=top>
<td><img src='$TOPDIR/images/topl2.jpg'></td>
<td class=TopMiddle><img id=xcatImage src='$TOPDIR/images/xCAT_icon-l.gif' height=40px></td>
<td><img class=ImgTop src='$TOPDIR/images/topl2.jpg'></td>
<td class=TopMiddle><img id=xcatImage src='$TOPDIR/images/xCAT_icon-l.gif'></td>
<td class=TopMiddle width='100%'>
EOS;
@ -64,7 +64,7 @@ EOS;
insertMenus($currents);
echo "</td><td><img src='$TOPDIR/images/topr2.jpg'></td></tr></table>\n";
echo "</td><td><img class=ImgTop src='$TOPDIR/images/topr2.jpg'></td></tr></table>\n";
//echo "</div></div>\n"; // end the top div
} // end insertHeader
@ -132,7 +132,7 @@ $MENU = array(
'manpages' => array('label' => 'Man Pages', 'url' => getDocURL('manpage')),
'maillist' => array('label' => 'Mail List', 'url' => getDocURL('web','mailinglist')),
'wiki' => array('label' => 'Wiki', 'url' => getDocURL('web','wiki')),
'suggest' => array('label' => 'Suggestions', 'url' => "$TOPDIR/support/suggest.php"),
'suggest' => array('label' => 'Suggest', 'url' => "$TOPDIR/support/suggest.php"),
'about' => array('label' => 'About', 'url' => "$TOPDIR/support/about.php"),
)
),
@ -145,7 +145,7 @@ $MENU = array(
function insertMenus($currents) {
global $TOPDIR;
global $MENU;
echo "<table border=0 cellspacing=0 cellpadding=0>\n";
echo "<table class=MenuTable border=0 cellspacing=0 cellpadding=0>\n";
insertMenuRow($currents[0], 1, $MENU);
@ -160,13 +160,15 @@ function insertMenus($currents) {
function insertMenuRow($current, $isTop, $items) {
global $TOPDIR;
//$img = "$TOPDIR/images/h3bg_new.gif";
$menuRowClass = $isTop ? '' : 'class=MenuRowBottom';
$menuItemClass = $isTop ? 'class=MenuItemTop' : '';
$currentClass = $isTop ? 'class=CurrentMenuItemTop' : '';
//$menuRowClass = $isTop ? '' : 'class=MenuRowBottom';
$menuItemClass = $isTop ? '' : 'class=MenuItemBottom';
//$currentClass = $isTop ? 'class=CurrentMenuItemTop' : '';
//echo "<TABLE class=MenuTable id=mainNav cellpadding=0 cellspacing=0 border=0><tr>\n";
//echo "<div class=$menuRowClass><ul id=mainNav>\n";
echo "<tr><td $menuRowClass><ul id=mainNav>\n";
//echo "<tr><td $menuRowClass><ul id=mainNav>\n";
//echo "<tr><td><ul id=mainNav>\n";
echo "<tr><td>\n";
foreach ($items as $key => $value) {
$label = $value['label'];
@ -177,16 +179,21 @@ function insertMenuRow($current, $isTop, $items) {
}
if ($key == $current){
//echo "<TD><a id=$key href='$link[1]'>$link[0]</a></TD>\n";
echo "<li><p $currentClass>$label</p></li>";
//echo "<li><p $currentClass>$label</p></li>";
//echo "<li><p>$label</p></li>";
//echo "<p class=CurrentMenuItem>$label</p>";
echo "<span class=CurrentMenuItem>$label</span>";
} else {
//echo "<TD><a class=NavItem id=$key href='$link[1]'>$link[0]</a></TD>\n";
echo "<li><a $menuItemClass id=$key href='$url'>$label</a></li>";
//echo "<li><a $menuItemClass id=$key href='$url'>$label</a></li>";
echo "<a $menuItemClass id=$key href='$url'>$label</a>";
}
}
//echo "</TR></TABLE>\n";
//echo "</ul></div>\n";
echo "\n</ul></td></tr>\n";
//echo "\n</ul></td></tr>\n";
echo "\n</td></tr>\n";
}
@ -471,76 +478,125 @@ function getDocURL($book, $section = NULL) {
}
$HWTypeInfo = array (
'x335' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8676' ),
'x336' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8837' ),
'x306' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8836' ),
'x306m' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8849,8491' ),
'x3550' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7978' ),
'e325' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8835' ),
'e326' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8848' ),
'e326m' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7969' ),
'e327' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'' ),
'x3250' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'4190,4194' ),
'x3350' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'4192,4193,hmc' ), # just guessed about hmc
'x3450' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7948' ),
'x3455' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7940,ipmi,xseries,default' ),
'x3550' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7978' ),
'x340' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8656' ),
'x342' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8669' ),
'x345' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8670' ),
'x346' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8840' ),
'x3650' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'7979' ),
'x3655' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'7943' ),
'x360' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8686' ),
'x365' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8862' ),
'x366' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8863' ),
'x445' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ),
'x450' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ),
'x455' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ),
'x460' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ),
'x3755' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>4, 'aliases'=>'7163,8877' ),
'x3850' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>4, 'aliases'=>'7141,7233' ),
'x3950' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>4, 'aliases'=>'' ), # 7141,7233
'hs20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8678,8843,7981,blade' ), # removed 8832 because it is older and it made this entry to wide in the drop down boxes
'hs12' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8014,8028' ),
'hs21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'7995,8853' ),
'js20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8842' ),
'js12' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'799860X' ),
'js21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8844,7998J21' ),
'js22' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'799861X' ),
'qs21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'0792' ),
'qs22' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'0793' ),
'ls20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8850' ),
'ls21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'7971' ),
'ls22' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'7901' ),
'hs40' => array ( 'image'=>'blade2.gif', 'rackimage'=>'blade2-front', 'u'=>7, 'aliases'=>'8839' ),
'ls41' => array ( 'image'=>'blade2.gif', 'rackimage'=>'blade2-front', 'u'=>7, 'aliases'=>'7972' ),
'ls42' => array ( 'image'=>'blade2.gif', 'rackimage'=>'blade2-front', 'u'=>7, 'aliases'=>'7902' ),
# POWER 4 servers
'p610' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>5, 'aliases'=>'7028' ),
'p615' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>4, 'aliases'=>'7029' ),
'p630' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>4, 'aliases'=>'' ), # 7026
'p640' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>5, 'aliases'=>'7026' ),
'p650' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>8, 'aliases'=>'7038' ),
'p655' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7039' ),
'p670' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'' ), # 7040
'p690' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7040' ),
# OpenPOWER servers
'p710' => array ( 'image'=>'342.gif', 'rackimage'=>'x335-front', 'u'=>2, 'aliases'=>'9123' ),
'p720' => array ( 'image'=>'520.gif', 'rackimage'=>'x345-front', 'u'=>4, 'aliases'=>'9124' ),
# POWER 5 servers
'p5-505' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'' ), # 9115
'p5-505Q' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'9115' ),
'p5-510' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9110' ),
'p5-510Q' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'' ), # 9110
'p5-575' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9118' ),
'p5-520' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9111' ),
'p5-520Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9131' ),
'p5-550' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9113' ),
'p5-550Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9133' ),
'p5-560' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9116' ),
'p5-560Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'' ), # 9116
'p5-570' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'' ), # 9117
'p5-590' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'' ), # 9119
'p5-595' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'' ), # 9119
# POWER 6 servers
'520' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'8203' ),
'550' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'8204' ),
'570' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9117' ),
'575' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9125' ),
'595' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'9119' ),
);
//-----------------------------------------------------------------------------
// This returns important display info about each type of hardware, so we can easily add new hw types.
function getHWTypeInfo($hwtype, $attr) {
//todo: get the aliases to be keys in this hash too
$hwhash = array (
'x335' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8676' ),
'x336' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8837' ),
'x306' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8836' ),
'x306m' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8849,8491' ),
'x3550' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7978' ),
'e325' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8835' ),
'e326' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'8848' ),
'e326m' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'7969' ),
'e327' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'' ),
function getHWTypeInfo($hwtype, $attr=NULL) {
global $HWTypeInfo;
'x340' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8656' ),
'x342' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8669' ),
'x345' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8670' ),
'x346' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'8840' ),
'x3650' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'7979' ),
// Get the aliases defined as keys, if we have not done that yet
if (!array_key_exists('9119',$HWTypeInfo)) {
$keys = array_keys($HWTypeInfo); // make a copy of the keys, because we will be adding some in the loop below
foreach ($keys as $key) {
$value = $HWTypeInfo[$key];
if (array_key_exists('aliases',$value) && !empty($value['aliases'])) {
$aliases = explode(',', $value['aliases']);
foreach ($aliases as $a) {
if (array_key_exists($a,$HWTypeInfo)) { msg('W', "Internal warning: Duplicate alias in HWTypeInfo array: $a"); }
else { $HWTypeInfo[$a] = $value; }
}
}
}
}
'x360' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8686' ),
'x365' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8862' ),
'x366' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8863' ),
'x3850' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'8863' ),
'x445' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ),
'x450' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ),
'x455' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ),
'x460' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ),
'x3950' => array ( 'image'=>'342.gif', 'rackimage'=>'x366-front', 'u'=>3, 'aliases'=>'' ),
'hs20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8678,8843,7981' ), # removed 8832 because it is older and it made this entry to wide in the drop down boxes
'js20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8842' ),
'js21' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8844' ),
'ls20' => array ( 'image'=>'blade.gif', 'rackimage'=>'blade-front', 'u'=>7, 'aliases'=>'8850' ),
'hs40' => array ( 'image'=>'blade2.gif', 'rackimage'=>'blade2-front', 'u'=>7, 'aliases'=>'8839' ),
'p5-505' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'9115' ),
'p5-505Q' => array ( 'image'=>'330.gif', 'rackimage'=>'x335-front', 'u'=>1, 'aliases'=>'9115' ),
'p5-510' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9110' ),
'p5-510Q' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9110' ),
'p5-575' => array ( 'image'=>'342.gif', 'rackimage'=>'x345-front', 'u'=>2, 'aliases'=>'9118' ),
'p5-520' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9111' ),
'p5-520Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9131' ),
'p5-550' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9113' ),
'p5-550Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9133' ),
'p5-560' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9116' ),
'p5-560Q' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9116' ),
'p5-570' => array ( 'image'=>'520.gif', 'rackimage'=>'p5-520-front', 'u'=>4, 'aliases'=>'9117' ),
'p5-590' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'9119' ),
'p5-595' => array ( 'image'=>'590.gif', 'rackimage'=>'p5-590-front', 'u'=>42, 'aliases'=>'9119' ),
'p710' => array ( 'image'=>'342.gif', 'rackimage'=>'x335-front', 'u'=>2, 'aliases'=>'9123' ),
'p720' => array ( 'image'=>'520.gif', 'rackimage'=>'x345-front', 'u'=>4, 'aliases'=>'9124' ),
'p610' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>5, 'aliases'=>'7028' ),
'p615' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>4, 'aliases'=>'7029' ),
'p630' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>4, 'aliases'=>'7026' ),
'p640' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>5, 'aliases'=>'7026' ),
'p650' => array ( 'image'=>'520.gif', 'rackimage'=>'x335-front', 'u'=>8, 'aliases'=>'7038' ),
'p655' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7039' ),
'p670' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7040' ),
'p690' => array ( 'image'=>'590.gif', 'rackimage'=>'x335-front', 'u'=>42, 'aliases'=>'7040' ),
);
$info = $hwhash[strtolower($hwtype)];
if (isset($attr)) { return $info[$attr]; }
else { return $info; }
// Now return the info requested
$k = strtolower($hwtype);
if (!array_key_exists($k,$HWTypeInfo)) { return NULL; }
$info = $HWTypeInfo[$k];
if (isset($attr)) { return $info[$attr]; }
else { return $info; }
}
@ -549,19 +605,57 @@ function getHWTypeInfo($hwtype, $attr) {
function getHWTypeImage($hwtype, $powermethod) {
# 1st try to match the hw type
$info = getHWTypeInfo($hwtype, 'image');
if ($info) { return $info['image']; }
if (!empty($info)) { return $info; }
# No matches yet. Use the power method to get a generic type.
if (isset($powermethod)) {
$powermethod = strtolower($powermethod);
if ($powermethod == 'blade') { return getHWTypeInfo('hs20', 'image'); }
elseif ($powermethod == 'hmc') { return getHWTypeInfo('p5-520', 'image'); }
elseif ($powermethod == 'bmc') { return getHWTypeInfo('x335','image'); }
elseif ($powermethod == 'xseries') { return getHWTypeInfo('x335', 'image'); }
$info = getHWTypeInfo($powermethod, 'image');
if (!empty($info)) { return $info; }
}
# As a last resort, return the most common node image
return getHWTypeInfo('x335', 'image');
return getHWTypeInfo('default', 'image');
}
//-----------------------------------------------------------------------------
// Map the many possible values of nodelist.status into one of four: good, bad, warning, unknown
//todo: update this list from Lings new status work
function mapStatus($statStr) {
$status = NULL;
if ($statStr == "alive" || $statStr == "ready" || $statStr == "pbs" || $statStr == "sshd") { $status = "good"; }
else if ($statStr == "noping" || $statStr=='unreachable') { $status = "bad"; }
else if ($statStr == "ping") { $status = "warning"; }
else { $status = "unknown"; }
return $status;
}
//-----------------------------------------------------------------------------
// For 2 status strings from nodestat or nodelist.status, return the "lowest" (worst).
// Use this function when trying to aggregate multiple status values into one.
//todo: update this list from Lings new status work
function minStatus($s1, $s2) {
$statnum = array( 'unknown' => 0,
'unreachable' => 1,
'noping' => 1,
'ping' => 2,
'snmp' => 3,
'sshd' => 4,
'pbs' => 5,
'ready' => 6,
'alive' => 6,
);
// if either value is empty, just return the other one
if (!isset($s1)) { return $s2; }
if (!isset($s2)) { return $s1; }
// if either value does not map into the hash, then return unknown
if (!isset($statnum[$s1]) || !isset($statnum[$s2])) { return 'unknown'; }
if ($statnum[$s1] < $statnum[$s2]) { return $s1; }
else { return $s2; }
}
@ -599,13 +693,16 @@ function getNodes($noderange, $attrs) {
//my ($hostname, $type, $osname, $distro, $version, $mode, $status, $conport, $hcp, $nodeid, $pmethod, $location, $comment) = split(/:\|:/, $na);
//$nodes[] = array('hostname'=>"node$i.cluster.com", 'type'=>'x3655', 'osname'=>'Linux', 'distro'=>'RedHat', 'version'=>'4.5', 'status'=>1, 'conport'=>$i, 'hcp'=>"node$i-bmc.cluster.com", 'nodeid'=>'', 'pmethod'=>'bmc', 'location'=>"frame=1 u=$", 'comment'=>'');
$nodes = array();
if (empty($noderange)) { $nodrange = '/.*'; }
//$xml = docmd('nodels',$noderange,implode(' ',$attrs));
$xml = docmd('nodels',$noderange,$attrs);
$output = $xml->xcatresponse->children(); // technically, we should iterate over the xcatresponses, because there can be more than one
foreach ($output as $o) {
//$output = $xml->xcatresponse->children(); // technically, we should iterate over the xcatresponses, because there can be more than one
//foreach ($output as $o) {
foreach ($xml->children() as $response) foreach ($response->children() as $o) {
$nodename = (string)$o->name;
$data = $o->data;
$attrval = (string)$data->contents;
if (empty($attrval)) { continue; }
$attrname = (string)$data->desc;
//echo "<p> $attrname = $attrval </p>\n";
//echo "<p>"; print_r($nodename); echo "</p>\n";

View File

@ -3,10 +3,11 @@
/* background-color: #002432; */
}
.TopTop { background: #FFF url(../images/toptop.jpg) repeat-x top; }
.TopMiddle { background: #FFF url(../images/top2.jpg) repeat-x top; padding-top: 1px; }
.TopMiddle { background: #FFF url(../images/top2.jpg) repeat-x top; }
/*
.TopTop { background: #FFF url(../images/toptop.jpg) repeat-x top; }
#top {
margin: 0 auto 10px auto;
padding: 0;
@ -29,91 +30,102 @@
*/
#xcatImage {
/* float: left; */
margin: 10px 8px 5px 0px;
/* height: 30px; todo: create a smaller icon instead of scaling this on the fly */
margin: 3px 8px 5px 0px;
}
.MenuRowBottom { /* this is to help with the white border around the current menu items */
border-left: 2px solid white;
border-right: 2px solid white;
/* The next 7 (or so) classes are for the menu at the top of each window.
See lib/functions.php insertMenus() for the code that uses these. */
.MenuTable { /* the table that holds all the menu items */
padding-top: 2px;
font-family: Sans-Serif;
font-size: 8pt;
font-weight: bold;
margin: 0px;
}
.MenuTable TR { padding-top: 0px; } /* avoid the inheritance */
.CurrentMenuItem { /* the <span> menu items that are currently selected */
display: inline-block; /* display: block; */
padding: 0 1em; /*2em;*/
background: #0F5B7F; /*#116893;*/ /* #0B4360; #09334b; */
color: white; /* #fafafa; */
border-left: 1px solid #273942;
line-height: 2.15em; /*2.5em;*/
}
#mainNav { /* the UL that contains the LIs of one row of menu items */
/* position: absolute;
float: left; */
.MenuTable a { /* the non-current menu items */
display: inline-block; /* display: block; */
/* float: left; IE/Mac 5.2 Fix */
padding: 0 1em; /*2em;*/
text-decoration: none;
color: #a1a1a1;
border-left: 1px solid #273942;
cursor: pointer;
line-height: 2.15em; /*2.5em;*/
}
.MenuTable a:hover { /* when the mouse is over a non-current menu item */
background: #0F5B7F; /*#116893;*/ /* #0B4360; #09334b; */
color: white; /* #fafafa; */
}
.MenuItemBottom { /* the non-current LIs in the bottom row */
/* border-bottom: 2px solid white; */
background-color: #0F5B7F; /*#116893;*/
}
/* The rest of these menu-related styles are not used...
#mainNav { the UL that contains the LIs of one row of menu items
list-style: none;
margin: 0px;
padding: 0px;
}
#mainNav li { /* each menu item */
/* float: left; */
/* Start: cross-browser inline-block */
display: -moz-inline-stack; /* firefox specific */
display: inline-block; /* the right way (standards compliant browsers) */
zoom: 1; /* internet explorer specific */
*display: inline; /* internet explorer specific */
/* End: cross-browser inline-block */
line-height: 2.15em; /*2.5em;*/
#mainNav li { each menu item
Start cross-browser inline-block
display: -moz-inline-stack; firefox specific
display: inline-block; the right way (standards compliant browsers)
zoom: 1; internet explorer specific
*display: inline; internet explorer specific
End cross-browser inline-block
line-height: 2.15em;
font-weight: bold;
/* border: 1px solid white; */
}
#mainNav p { /* the LIs that are currently selected */
display: block;
padding: 0 2em; /*2em;*/
margin: 0px;
background: #0B4360; /* #09334b; */
color: #fafafa;
IE/Win 5.x Fix
* html #mainNav a {
width: 1px;
}
.CurrentMenuItemTop { /* additional style for the current LI in the top menu row */
#mainNav li a.active { not sure if this is needed
color: white;
}
.MenuRowBottom { this is to help with the white border around the current menu items
border-left: 2px solid white;
border-right: 2px solid white;
}
.CurrentMenuItemTop { additional style for the current LI in the top menu row
border-left: 2px solid white;
border-top: 2px solid white;
border-right: 2px solid white;
/* border-bottom: 2px solid #09334b; */
background-color: #0F5B7F;
}
.MenuItemTop { /* the non-current LIs in the top row */
/* border-top: 2px solid black; */
.MenuItemTop { the non-current LIs in the top row
border-bottom: 2px solid white;
}
#mainNav a { /* the non-current menu items */
display: block;
/* float: left; IE/Mac 5.2 Fix */
padding: 0 2em; /*2em;*/
text-decoration: none;
color: #a1a1a1;
border-left: 1px solid #273942;
cursor: pointer;
}
/* IE/Win 5.x Fix
* html #mainNav a {
width: 1px;
} */
#mainNav a:hover {
background: #0B4360; /* #09334b; */
color: #fafafa;
}
/*
body.home #mainNav a#home, body.tutorials #mainNav a#tutorials {
background: #09334b;
color: #fafafa;
cursor: default;
}
*/
#mainNav li a.active {
color: #fafafa;
}
/*
div#content {
background-color : #fcfaeb;
position: absolute;
@ -155,6 +167,8 @@ BODY {
}
IMG { vertical-align: middle; }
.ImgBaseline { vertical-align: baseline; }
.ImgTop { vertical-align: top; }
INPUT {vertical-align : middle; font-size : 8pt; font-family : sans-serif; font-weight : bold;}
SELECT {vertical-align : middle; font-size : 8pt; font-family : sans-serif; font-weight : bold;}
TEXTAREA {vertical-align : middle; font-size : 8pt; font-family : sans-serif; font-weight : bold;}

View File

@ -0,0 +1,19 @@
/* Styles specific to the frames.php page */
.AllRacksTable { padding-top: 10px; }
.RackTable {
background-color: #303030;
border: 2px solid #303030;
}
.RackTable TD {
white-space: nowrap;
font-size: 1px;
}
.RackTable IMG { vertical-align: baseline; }
.RackEmptyCell { background-color: #999999; }

109
xCAT-web/machines/frames.js Normal file
View File

@ -0,0 +1,109 @@
// Javascript functions needed by the frames (racks) page, mostly
// to handle the check boxes that are actually images.
function imageCBClick(image, mode)
{
if (mode==1 || (mode==2 && (image.checked === undefined || !image.checked))) {
image.src = '../images/checked-box.gif';
image.checked = true;
} else {
image.src = '../images/unchecked-box.gif';
image.checked = false;
var s=image.alt.split(/-/);
var rackCB = document.frameForm['selAll'+s[0]+'Checkbox'];
rackCB.checked = false;
}
}
function selectAll(element, rack) // element is the select all checkbox, rack is the rack #
{
var sel = element.checked;
for (var i=0; i < document.images.length; i++) {
var image = document.images[i];
if (image.src.search(/checked-box\.gif$/)>-1 && image.alt.search('^'+rack+'-')>-1) { imageCBClick(image,sel); }
}
}
/*
function isNodeSelected(form)
{
if (document.paramForm.rack.checked) { return (form.Nodes.value.length>0 || form.rackNodes.value.length>0); }
// we only continue here if it is the non-rack display
for(var i = 0; i < form.length; i++)
{
var e = form.elements[i];
if (e.type == "checkbox" && e.name.search(/^node\d/) > -1 && e.checked) { return true; }
}
return false;
}
function numNodesSelected(form)
{
if (document.paramForm.rack.checked) {
if (form.Nodes.value.length>0) { return 2; } // just have to guess that the group or range has more than 1
var val = form.rackNodes.value;
var matches = val.match(/,/g);
if (!matches) { return (val.length>0 ? 1 : 0); }
else { return matches.length + 1; }
}
// we only continue here if it is the non-rack display
var j = 0;
for(var i = 0; i < form.length; i++)
{
var e = form.elements[i];
if (e.type == "checkbox" && e.name.search(/^node\d/) > -1 && e.checked)
{
if (++j == 2) { return j; }
}
}
return j;
}
function gatherRackNodes(form)
{
if (allSelected(form)) {
if (document.paramForm.nodeRange.value.length > 0) { form.Nodes.value = document.paramForm.nodeRange.value; }
else { form.Nodes.value = '+' + document.paramForm.nodegrps.value; }
form.rackNodes.value='';
return;
}
else { form.Nodes.value=''; }
if (!document.paramForm.rack.checked) { form.rackNodes.value=''; return; }
var nodes='';
for (var i=0; i < document.images.length; i++) {
var image = document.images[i];
if (image.checked) { var s=image.alt.split(/-/); nodes += s[1] + ','; }
}
form.rackNodes.value = nodes.replace(/,$/, '');
}
function allSelected(form)
{
if (document.paramForm.rack.checked) {
for(var i = 0; i < form.length; i++)
{
var e = form.elements[i];
if (e.type=="checkbox" && e.name.search(/^selAll\d+Checkbox/)>-1 && !e.checked) { return false; }
}
return true;
}
else { return form.selAllCheckbox.checked; } // non-rack display
}
function frameFormSubmit(form) {
gatherRackNodes(form);
if (form.nodesNeeded === undefined || form.nodesNeeded == 2) { // need 1 or more nodes
if (isNodeSelected(form)) { return true; }
else { alert('Select one or more nodes before pressing an action button.'); return false; }
}
else if (form.nodesNeeded == 1) { // need exactly 1 node
if (numNodesSelected(form) == 1) { return true; }
else { alert('Exactly one node must be selected for this action.'); form.nodesNeeded=undefined; return false; }
}
else if (form.nodesNeeded == 0) { return true; } // 0 or more nodes is ok
else { return true; }
}
*/

View File

@ -2,353 +2,168 @@
/* session_start(); */
$TOPDIR = '..';
require_once "$TOPDIR/lib/functions.php";
insertHeader('xCAT Frame Node List', NULL, NULL, array('machines','frames'));
insertHeader('xCAT Frames and Nodes', array('frames.css'), array('frames.js'), array('machines','frames'));
if (isAIX()) { $aixDisabled = 'disabled'; }
insertNotDoneYet();
echo '</body></html>';
/* This was copied from the csm web interface and can be used as the beginning code
for the frame view.
<SCRIPT language="JavaScript">
function _reloadMe(form)
{
var url = 'nodes.cgi?';
url += 'rack=' + (form.rack.checked?1:0);
url += '&group=' + form.nodegrps.value;
url += '&nodeRange=' + form.nodeRange.value;
window.location = url;
echo "<div id=content align=center><form name=frameForm class=ContentForm>\n";
insertButtons(
array('label' => 'Attributes', 'onclick' => ''),
array('label' => 'Create Group', 'onclick' => ''),
array('label' => 'Ping', 'onclick' => ''),
//'Updatenode',
array('label' => 'Run Cmd', 'onclick' => ''),
array('label' => 'Copy Files', 'onclick' => ''),
array('label' => 'Sync Files', 'onclick' => '')
);
insertButtons(
//'Soft Maint',
array('label' => 'HW Ctrl', 'onclick' => ''),
array('label' => 'RSA/MM/FSP', 'onclick' => ''),
array('label' => 'Deploy', 'onclick' => ''),
array('label' => 'Diagnose', 'onclick' => ''),
array('label' => 'Remove', 'onclick' => '')
);
// Get the attributes for all nodes
$attrlist = array('nodepos.rack','nodepos.u','nodepos.chassis','nodepos.slot','nodepos.room','vpd.mtm','nodetype.arch','nodehm.power','nodehm.mgt','mp.mpa','mp.id');
$nodes = getNodes('/.*', $attrlist);
$frames = array();
// Process the node list & attrs to build the arrays we need for display: an array of frames.
// Each frame is an array where each index is a u # that has a machine it in. If the machine
// is really a BC chassis, then the chassis array has the list of blades.
foreach ($nodes as $nodename => $attrs) {
$isBlade=0;
// Get the display info for this node (image, size, etc.)
$info = getHWInfo(array_key_exists('vpd.mtm',$attrs)?$attrs['vpd.mtm']:'',
array_key_exists('nodehm.power',$attrs)?$attrs['nodehm.power']:'',
array_key_exists('nodehm.mgt',$attrs)?$attrs['nodehm.mgt']:'');
if (empty($info)) { continue; }
$image = $info['rackimage'];
$size = $info['u'];
// Try to detect if this node is a MM
if (array_key_exists('mp.mpa',$attrs) && $attrs['mp.mpa']==$nodename) { $isMM = 1; }
else { $isMM = 0; }
// If this is a blade, have to get the position from its MM
if ($size == 7 && !$isMM) { # blade
$isBlade = 1;
if (!array_key_exists('mp.mpa',$attrs) || !array_key_exists('mp.id',$attrs)) { continue; }
if (!array_key_exists($attrs['mp.mpa'],$nodes)) { continue; }
$mmattrs = & $nodes[$attrs['mp.mpa']];
if (!array_key_exists('nodepos.rack',$mmattrs)) continue;
$f = $mmattrs['nodepos.rack'];
if (!array_key_exists('nodepos.u',$mmattrs)) continue;
$u = $mmattrs['nodepos.u'];
$slot = $attrs['mp.id'];
}
else { # non-blade
if (!array_key_exists('nodepos.rack',$attrs)) continue;
$f = $attrs['nodepos.rack'];
if (!array_key_exists('nodepos.u',$attrs)) continue;
$u = $attrs['nodepos.u'];
//echo "<p>nodename=$nodename, f=$f, u=$u</p>\n";
}
$alt = "$nodename: U=$u";
if ($isBlade) { $alt .= " Slot=$slot"; }
// Choose the image for the node, based on the status
if (array_key_exists('nodelist.status',$attrs)) $status = $attrs['nodelist.status'];
else $status = 'unknown';
$status = mapStatus($status);
if ($status == 'good') { $image .= '-green.jpg'; }
elseif ($status == 'bad') { $image .= '-red.jpg'; }
elseif ($status == 'warning') { $image .= '-yellow.jpg'; }
else { $image .= '-blue.jpg'; }
// Create an array for each frame, using the u # as the index for the node
if (!array_key_exists($f,$frames)) { $frames[$f] = array(); } # start an array for this frame
$frame = & $frames[$f];
$findex = 43 - $u - ($size-1);
if ($findex < 1) { $findex = 1; }
if ($isBlade) {
if (!array_key_exists($findex,$frame) || !array_key_exists('chassis',$frame[$findex])) { $frame[$findex] = array('nodename'=>$attrs['mp.mpa'], 'chassis'=>array(), 'size'=>$size); }
$chassis = & $frame[$findex]['chassis'];
$chassis[$slot] = array('nodename'=>$nodename, 'image'=>$image, 'alt'=>$alt);
}
else { // this is either a regular svr or a BC chassis
if ($isMM) {
if (!array_key_exists($findex,$frame)) { $frame[$findex] = array('nodename'=>$nodename, 'chassis'=>array(), 'size'=>$size); }
}
else { $frame[$findex] = array('nodename'=>$nodename, 'image'=>$image, 'alt'=>$alt, 'size'=>$size); }
}
}
function setCookies(form)
{
var value = (form.rack.checked?1:0) + '&' + form.nodegrps.value + '&' + form.nodeRange.value;
setCookie('mainpage', value);
}
function selectAll(element, rack)
{
var sel = element.checked;
if (rack) {
for (var i=0; i < document.images.length; i++) {
var image = document.images[i];
if (image.src.search(/checked-box\\.gif\$/)>-1 && image.alt.search('^'+rack+'-')>-1) { imageCBClick(image,sel); }
}
}
else { // the form checkboxes
var form = element.form;
for(var i = 0; i < form.length; i++)
{
var e = form.elements[i];
if (e.type == "checkbox" && e.name.search(/^node\\d/) > -1) { e.checked = sel; }
}
}
}
function isNodeSelected(form)
{
if (document.paramForm.rack.checked) { return (form.Nodes.value.length>0 || form.rackNodes.value.length>0); }
// we only continue here if it is the non-rack display
for(var i = 0; i < form.length; i++)
{
var e = form.elements[i];
if (e.type == "checkbox" && e.name.search(/^node\\d/) > -1 && e.checked) { return true; }
}
return false;
}
function numNodesSelected(form)
{
if (document.paramForm.rack.checked) {
if (form.Nodes.value.length>0) { return 2; } // just have to guess that the group or range has more than 1
var val = form.rackNodes.value;
var matches = val.match(/,/g);
if (!matches) { return (val.length>0 ? 1 : 0); }
else { return matches.length + 1; }
}
// we only continue here if it is the non-rack display
var j = 0;
for(var i = 0; i < form.length; i++)
{
var e = form.elements[i];
if (e.type == "checkbox" && e.name.search(/^node\\d/) > -1 && e.checked)
{
if (++j == 2) { return j; }
}
}
return j;
}
function CBClick(cb) { if (!cb.checked) { cb.form.selAllCheckbox.checked=false; } }
function imageCBClick(image, mode)
{
if (mode==1 || (mode==2 && (image.checked === undefined || !image.checked))) {
image.src = 'images/checked-box.gif';
image.checked = true;
} else {
image.src = 'images/unchecked-box.gif';
image.checked = false;
var s=image.alt.split(/-/);
var rackCB = document.nodesForm['selAll'+s[0]+'Checkbox'];
rackCB.checked = false;
}
}
function gatherRackNodes(form)
{
if (allSelected(form)) {
if (document.paramForm.nodeRange.value.length > 0) { form.Nodes.value = document.paramForm.nodeRange.value; }
else { form.Nodes.value = '+' + document.paramForm.nodegrps.value; }
form.rackNodes.value='';
return;
}
else { form.Nodes.value=''; }
if (!document.paramForm.rack.checked) { form.rackNodes.value=''; return; }
var nodes='';
for (var i=0; i < document.images.length; i++) {
var image = document.images[i];
if (image.checked) { var s=image.alt.split(/-/); nodes += s[1] + ','; }
}
form.rackNodes.value = nodes.replace(/,\$/, '');
}
function allSelected(form)
{
if (document.paramForm.rack.checked) {
for(var i = 0; i < form.length; i++)
{
var e = form.elements[i];
if (e.type=="checkbox" && e.name.search(/^selAll\\d+Checkbox/)>-1 && !e.checked) { return false; }
}
return true;
}
else { return form.selAllCheckbox.checked; } // non-rack display
}
</SCRIPT>
<div id=content>
<P align="center"><IMG src="images/csmlogo.gif" border="0"></P>
<H2>Node List on Management Server <?= $_SERVER["SERVER_NAME"] ?></H2>
<FORM name="paramForm" action="nodes.cgi" onsubmit="setCookies(this);">
<TABLE>
<TBODY>
<TR valign="middle">
<TD>
<P class="BlueBack"><B>Which Nodes:</B></P>
</TD>
<TD><B>&nbsp;Group: <SELECT name="nodegrps" size="1" onchange="setCookies(this.form);_reloadMe(this.form);" class="Middle">
<!--CSM
my $currentGroup = $::in{group};
if (!$currentGroup) { $currentGroup = 'AllNodes'; }
foreach my $group (@$nodegrp){
my $selected = '';
if($group eq "$currentGroup") { $selected = 'selected'; }
print qq(<OPTION value='$group' $selected>$group</OPTION>\n);
}
CSM-->
</SELECT> &nbsp;</B>or<B> &nbsp;Node Range: </B><INPUT size="20" type="text" name="nodeRange" value="$::in{nodeRange}" onchange="setCookies(this.form);_reloadMe(this.form);" class="Middle"></TD>
</TR>
<TR>
<TD></TD>
<TD>
<INPUT type="checkbox" name="rack" onclick="setCookies(this.form);_reloadMe(this.form);"> Show Nodes in Racks (have to first <A href="hwctrl/rack.cgi">set the physical location</A>)</TD>
</TR>
</TBODY>
</TABLE>
</FORM>
<!--
<SCRIPT language="JavaScript"> document.paramForm.rack.checked = ($rackChecked==1 ? true : false); </SCRIPT>
-->
<FORM name="nodesForm" action="nodes.cgi"
onsubmit="
gatherRackNodes(this);
if (this.nodesNeeded === undefined || this.nodesNeeded == 2) { // need 1 or more nodes
if (isNodeSelected(this)) { return true; }
else { alert('Select one or more nodes before pressing an action button.'); return false; }
}
else if (this.nodesNeeded == 1) { // need exactly 1 node
if (numNodesSelected(this) == 1) { return true; }
else { alert('Exactly one node must be selected for this action.'); this.nodesNeeded=undefined; return false; }
}
else if (this.nodesNeeded == 0) { return true; } // 0 or more nodes is ok
else { return true; }
">
<TABLE>
<TBODY>
<TR>
<TD><P class="BlueBack"><B>Node<BR>Actions:</B></P></TD>
<TD>
<TABLE cellpadding=0 cellspacing=2>
<TBODY>
<TR><TD nowrap>
<INPUT type=submit name=propButton value="Attributes" class=but>
<INPUT type=submit name=defineButton value="Define Like" class=but>
<INPUT type=submit name=createGroupButton value="Create Group" class=but>
<INPUT type=submit name=pingNodesButton value="Ping" class=but>
<INPUT type=submit name=updateButton value="Updatenode" class=but>
<INPUT type=submit name=runcmdButton value="Run Cmd" class=but>
<INPUT type=submit name=copyFilesButton value="Copy Files" class=but>
</TD></TR>
</TBODY>
</TABLE>
<TABLE cellpadding=0 cellspacing=2>
<TBODY>
<TR><TD nowrap>
<INPUT type=submit name=softMaintButton value="Soft Maint" class=but onclick="this.form.nodesNeeded=1;">
<INPUT type=submit name=hwctrlButton value="HW Ctrl" class=but>
<INPUT type=submit name=rsaButton value="RSA/MM/FSP" class=but onclick="this.form.nodesNeeded=1;">
<INPUT type=submit name=installButton value="Install" class=but>
<INPUT type=submit name=perfmonButton value="Perf Mon" class=but>
<INPUT type=submit name=webminButton value="Webmin" class=but onclick="this.form.nodesNeeded=1;">
<INPUT type=submit name=diagButton value="Diagnose" class=but onclick="this.form.nodesNeeded=1;">
<INPUT type=submit name=removeButton value="Remove" class=but>
</TD></TR>
</TBODY>
</TABLE>
</TD>
</TR>
<TR>
<TD colspan="2" height="5"></TD>
</TR>
<TR valign="top">
<TD colspan="2" align="center">
<!--CSM if (!($rackChecked==1)) { -->
<?php
echo "<TABLE cellpadding=0><TBODY align=center valign=middle><TR valign=bottom class=BlueBack>\n";
echo "<TD align=left><INPUT type=checkbox name=selAllCheckbox onclick='selectAll(this,0)'><FONT size='-2'>Select All</FONT> &nbsp; <B>Name</B></TD>\n";
echo "<TD><B>HW Type</B></TD><TD><B>OS</B></TD><TD><B>Mode</B></TD><TD><B>Status</B></TD><TD><B>HW Ctrl Pt</B></TD><TD><B>Comment</B></TD></TR>\n";
$index =0;
?>
<!--CSM
foreach my $na (@$nodeAttrs)
{
$index++;
if ($index > $::config{MaxNodesDisplayed})
{
print qq(<TR><TD colspan=7 align=center><I>Note: Number of nodes to be displayed exceeds the maximum of $::config{MaxNodesDisplayed} specified on the <A href="/config.cgi?csm" target=_parent>Module Config page</A>. To see the rest of the nodes, specify a node range or node group at the top of this page, or change the maximum value.</I></TD></TR>\n);
last;
}
my ($hostname, $type, $osname, $distro, $version, $mode, $status, $conport, $hcp, $nodeid, $pmethod, $location, $comment) = split(/:\|:/, $na);
print "<TR bgcolor='#d8dff1'><TD align=left nowrap><INPUT type='checkbox' name='node$index' value='$hostname' onclick='CBClick(this)'><A href='properties.cgi?nodes=$hostname'>$hostname</A></TD>\n";
my $image = GuiUtils->getHWTypeImage($type, $pmethod);
my $alt = $type;
print qq(<TD><IMG src="images/$image" alt="$alt" title="$alt" border=0></TD>\n);
if ($osname=~/aix/i) { $image = 'aix-s.gif'; $alt = 'AIX'; }
elsif ($distro=~/redhat/i) { $image = 'redhat-s.gif'; $alt = 'RedHat'; }
elsif ($distro=~/suse|sles/i) { $image = 'suse-s.gif'; $alt = 'SuSE/SLES'; }
else { $image = ''; $alt = 'Unknown';}
if (length($image)) { print qq(<TD nowrap><IMG src="images/$image" alt="$alt" title="$alt" border=0 align=top> $version</TD>\n); }
else { print "<TD>$osname $distro $version</TD>\n"; }
print "<TD>$mode</TD>\n";
if ($status == 1) { $image = 'green-ball-m.gif'; $alt = 'On'; }
elsif ($status == 127 && $mode eq 'PreManaged') { $image = 'blue-ball-m.gif'; $alt = 'Unconfigured'; }
elsif ($status == 127) { $image = 'yellow-ball-m.gif'; $alt = 'Unknown'; }
else { $image = 'red-ball-m.gif'; $alt = 'Off'; }
print qq(<TD><IMG src="images/$image" alt="$alt" title="$alt" border=0></TD>\n);
print "<TD>$hcp</TD>\n";
print "<TD>$comment</TD></TR>\n";
} -->
<?= "</TBODY></TABLE>\n" ?>
<!--CSM
} # not rack
else { # show nodes in racks
print qq(<TABLE><TBODY valign=bottom><TR>\n);
echo "<TABLE class=AllRacksTable><TBODY valign=bottom><TR>\n";
# xSeries frames are 78.7in H x 23.6in W (3.3 ratio). The server enclosure area is approx 71.4 x 19 (3.75 ratio). Each U is approx 1.725
my $bord=0;
my $index=0;
for (my $fnum=1; $fnum<scalar(@frames); $fnum++) {
my $frame = $frames[$fnum];
if (!defined($frame)) { next; } # no nodes in this frame
print qq(<TD><INPUT type=checkbox name=selAll${fnum}Checkbox onclick='selectAll(this,$fnum)'><B> Rack $fnum</B>\n);
print qq(<TABLE bgcolor="#303030" cellpadding=0 cellspacing=2><TBODY><TR><TD width=1 height=$bord></TD><TD></TD><TD width=1 height=$bord></TD></TR>\n);
for (my $i=1; $i<=42;)
{
my $u = $$frame[$i];
if (defined($u))
{
my ($hostname, $image, $alt, $size) = @$u;
if (ref($image)) { # this a bladecenter chassis
my $chassis = $image; # this is really a ref to an array of blades
print qq(<TR><TD></TD><TD><TABLE bgcolor="#303030" cellpadding=0 cellspacing=1><TBODY><TR>\n);
for (my $j=1; $j<=14; $j++) {
my $b = $$chassis[$j];
if (defined($b)) {
my ($h, $im, $a) = @$b;
$index++;
print qq(<TD><IMG src='images/unchecked-box.gif' alt='$fnum-$h' title='$fnum-$h' border=0 onclick='imageCBClick(this,2);'><BR>);
print qq(<IMG src="images/$im" alt="$a" title="$a" border=0></TD>\n);
}
else { print qq(<TD bgcolor="#999999" height=25 width=12></TD>\n); } # empty blade slot
}
print qq(</TR></TBODY></TABLE></TD></TR>\n);
}
else { # this is regular rack mounted node
$index++;
print qq(<TR><TD></TD><TD><IMG src='images/unchecked-box.gif' alt='$fnum-$hostname' title='$fnum-$hostname' border=0 align=middle onclick='imageCBClick(this,2);'>);
print qq(<IMG src="images/$image" alt="$alt" title="$alt" border=0 align=middle></TD></TR>\n);
}
$i += $size;
}
else { print qq(<TR><TD></TD><TD bgcolor="#999999" height=5 width=50></TD></TR>\n); $i++; } # empty slot
}
print qq(<TR><TD height=$bord></TD></TR></TBODY></TABLE></TD>\n);
ksort($frames, SORT_NUMERIC);
foreach ($frames as $fnum => $frame) {
echo "<TD><INPUT type=checkbox name=selAll${fnum}Checkbox onclick='selectAll(this,$fnum)'><B> Rack $fnum</B>\n";
echo "<TABLE class=RackTable cellpadding=0 cellspacing=2><TBODY>\n";
// Go thru each u position and either draw the svr or fill in an empty slot
for ($i=1; $i<=42;) {
if (array_key_exists($i,$frame)) { # this slot has a server in it
$u = & $frame[$i]; // $u is the machine info at that u #
// $u has keys of (nodename, image, alt, size) for rack mounted and (nodename, chassis, size) for blades
if (array_key_exists('chassis',$u)) { # this a bladecenter chassis
$chassis = & $u['chassis']; # this is really a ref to an array of blades
echo "<TR><TD><TABLE class=RackTable cellpadding=0 cellspacing=1><TBODY><TR>\n";
for ($j=1; $j<=14; $j++) {
if (array_key_exists($j,$chassis)) { // there is a blade in this slot
$b = & $chassis[$j]; // keys in $b are: nodename, image, alt
$h = $b['nodename'];
$im = $b['image'];
$a = $b['alt'];
echo "<TD><IMG src='$TOPDIR/images/unchecked-box.gif' alt='$fnum-$h' title='$fnum-$h' border=0 onclick='imageCBClick(this,2);'><BR>";
echo "<IMG src='$TOPDIR/images/$im' alt='$a' title='$a' border=0></TD>\n";
}
else { echo "<TD class=RackEmptyCell height=25 width=12>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>\n"; } # empty blade slot
}
echo "</TR></TBODY></TABLE></TD></TR>\n";
}
else { # this is regular rack mounted node
$nodename = $u['nodename'];
$image = $u['image'];
$alt = $u['alt'];
echo "<TR><TD><IMG src='$TOPDIR/images/unchecked-box.gif' alt='$fnum-$nodename' title='$fnum-$nodename' border=0 onclick='imageCBClick(this,2);'>";
echo "<IMG src='$TOPDIR/images/$image' alt='$alt' title='$alt' border=0></TD></TR>\n";
}
$i += $u['size']; // move up the height of this svr
}
else { # empty slot
echo "<TR><TD class=RackEmptyCell height=5 width=50></TD></TR>\n"; $i++;
}
} // end of the for $i loop
echo "</TBODY></TABLE></TD>\n";
}
print qq(</TR></TBODY></TABLE>\n);
} # rack
CSM-->
</TD>
</TR>
</TBODY>
</TABLE>
<INPUT type=hidden name=rackNodes value=''>
<INPUT type=hidden name=Nodes value=''>
</FORM>
<!--
<SCRIPT language="JavaScript">
if ($AIXdisable) {
document.nodesForm.softMaintButton.disabled = true;
document.nodesForm.rsaButton.disabled = true;
document.nodesForm.installButton.disabled = true;
echo "</TR></TBODY></TABLE>\n";
echo '</form></div>';
insertFooter();
//-----------------------------------------------------------------------------
// Use a variety of the attributes to try to figure out what kind of hw this is and return
// the info that should be displayed for this type of hw. Gets this from functions::getHWTypeInfo()
function getHWInfo($mtm, $powermethod, $mgt) {
# 1st try to match the Model-MachineType
if (!empty($mtm)) {
$model = explode('-', $mtm);
$info = getHWTypeInfo($model[0]);
if (isset($info)) { return $info; }
}
# No matches yet. Use the power method to get a generic type.
if (!empty($powermethod)) { $powermethod = $powermethod; }
elseif (!empty($mgt)) { $powermethod = $mgt; }
if (!empty($powermethod)) { return getHWTypeInfo($powermethod); }
else { return NULL; }
}
</SCRIPT>
-->
<H4 class="BlueBack">Tips:</H4>
<UL>
<LI>Select 1 or more nodes &amp; click on an&nbsp;action button. &nbsp;Or choose
1 of the main tasks on the left. &nbsp;The&nbsp;<A href="/help.cgi/csm/intro" target="_blank">Help&nbsp;link</A>&nbsp;at&nbsp;the&nbsp;top&nbsp;left&nbsp;really&nbsp;does&nbsp;help.&nbsp; It describes what all these buttons do.
<LI>The Status colors: &nbsp;<FONT color="#00cc00">green</FONT>=reachable, <FONT color="#ff0000">red</FONT>=not reachable, <FONT color="#cccc00">yellow</FONT>=unknown/error, <FONT color="#0000ff">blue</FONT>=node not managed.
<LI>If too many nodes are displayed, use the Group or Node Range selections
to focus what is displayed.
<LI>The <A href="/config.cgi?csm" target="_parent">Console/Settings link</A> at the top left is the way to set preferences. &nbsp;There is a verbose
option there to have this interface display the commands it is running.
<LI>If you are running this over a phone line, we recommend using the <A href="../webmin/change_theme.cgi?theme=">Old Webmin theme</A> (which is now the default) for faster loading. &nbsp;Of course, the <A href="../webmin/change_theme.cgi?theme=mscstyle3">MSC Linux theme</A> looks nicer. &nbsp;(If you change the theme, you will have to navigate
back to this page in the Cluster category.)
<LI>Did you know you can run as many browser windows with this interface as
you want? &nbsp;This can be handy to view information from multiple pages&nbsp;of&nbsp;this&nbsp;interface
at the same time.
</UL>
<P align="center"><FONT size="-1"><B>CSM Version:</B> $rpmVersions{'csm.server'} &nbsp; &nbsp; &nbsp; <B>CSM Web Interface Version:</B>&nbsp;$rpmVersions{'xcsm.web'}</FONT></P>
</div>
</body>
</HTML>
?>

View File

@ -8,7 +8,7 @@ if (isAIX()) { $aixDisabled = 'disabled'; }
require_once("$TOPDIR/lib/GroupNodeTable.class.php");
insertHeader('Groups', array('groups.css'),
insertHeader('xCAT Groups and Nodes', array('groups.css'),
array("$TOPDIR/lib/GroupNodeTableUpdater.js","$TOPDIR/js/prototype.js","$TOPDIR/js/scriptaculous.js?load=effects"),
array('machines','groups'));
@ -100,7 +100,7 @@ function getGroupStatus() {
preg_match('/^"([^"]*)"/', $rest, $status);
if (count($status) < 2) { $status[1] = 'unknown'; }
foreach ($grplist as $g) {
if (array_key_exists($g,$groups)) { $groups[$g] = minstat($groups[$g], $status[1]); }
if (array_key_exists($g,$groups)) { $groups[$g] = minStatus($groups[$g], $status[1]); }
else { $groups[$g] = $status[1]; }
}
}
@ -109,28 +109,4 @@ function getGroupStatus() {
}
//-----------------------------------------------------------------------------
// For 2 status strings from nodestat or nodelist.status, return the "lowest".
function minstat($s1, $s2) {
$statnum = array( 'unknown' => 0,
'noping' => 1,
'ping' => 2,
'snmp' => 3,
'sshd' => 4,
'pbs' => 5,
'ready' => 6,
);
// if either value is empty, just return the other one
if (!isset($s1)) { return $s2; }
if (!isset($s2)) { return $s1; }
// if either value does not map into the hash, then return unknown
if (!isset($statnum[$s1]) || !isset($statnum[$s2])) { return 'unknown'; }
if ($statnum[$s1] < $statnum[$s2]) { return $s1; }
else { return $s2; }
}
?>