<?php
require("../../inc/header.inc");
require("./function.inc");
?>
<body onload="javascript:adjust();" onresize="javascript:adjust();" leftmargin="15" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">

<?php
adjust_head();

adjust_title_head();
echo "<FORM NAME=\"downForm\" action=\"./raidStatus.php\" method=\"post\">";
echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
	echo "<tr>";
		echo "<td width=\"50%\">";
		echo "$strSysStatus > NSS > RAID";
		echo "</td>";
		echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
		$helpId="1.2.7";
		showHelp($helpId);
		echo "</td>";
	echo "</tr>";
	echo "<tr>";
		echo "<td width=\"50%\">";
		echo "&nbsp;";
		echo "</td>";
		echo "<td width=\"50%\" align=\"right\">";
		echo "<a href=\"./raidStatus.php\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
		echo "</td>";
	echo "</tr>";
echo "</table>";
adjust_title_tail();
adjust_content_head();

$diskInfo=GetDiskInfo($sysTypeNo,$sysNo);

echo "<br>";
echo "<center><font size=2 color=\"blue\">{$diskInfo[ServerName][Value]} Raid detail information</font></center>";
echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#ffffff\">";
echo "<tr>";
echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Card Name</td>";
echo "<td><span id=\"td_card_name\">--</span>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Disk Count</td>";
echo "<td><span id=\"td_disk_count\">--</span>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
echo "<td bgcolor=\"#E6E6E6\" width=\"50%\">Update Time</td>";
echo "<td><span id=\"td_update_time\">--</span>&nbsp;</td>";
echo "</tr>";
echo "</table>";

echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#ffffff\">";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td>Disk No.</td>";
echo "<td>State</td>";
echo "<td>Size</td>";
echo "<td>Vendor ID</td>";
echo "<td>Product ID</td>";
echo "<td>Disk Slot</td>";
echo "<td>Error Count</td>";
echo "<td>Operation Progress</td>";
echo "<tr id=\"blank_line\">";
echo "<td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td>";
echo "</tr>";
for($index=0;$index<6;$index++)
{
	echo "<tr id=\"tr_{$index}\">";
	echo "<td>$index</td>";
	echo "<td><span id=\"td_{$index}_1\">--</span>&nbsp;</td>";
	echo "<td><span id=\"td_{$index}_2\">--</span>&nbsp;</td>";
	echo "<td><span id=\"td_{$index}_3\">--</span>&nbsp;</td>";
	echo "<td><span id=\"td_{$index}_4\">--</span>&nbsp;</td>";
	echo "<td><span id=\"td_{$index}_5\">--</span>&nbsp;</td>";
	echo "<td><span id=\"td_{$index}_6\">--</span>&nbsp;</td>";
	echo "<td><span id=\"td_{$index}_7\">--</span>&nbsp;</td>";
	echo "</tr>";
}
echo "</table>";

//Alarm Table
echo "<br><div id=\"AlarmTable\">";
echo "</div>";

adjust_content_tail();

?>


<script language="JavaScript">
function updateStatus(sysTypeNo,sysNo)
{
	var fixurl="./diskStatus_update.php?sysTypeNo="+sysTypeNo+"&sysNo="+sysNo;
	var browserr = navigator.appName;
	if(browserr == "Microsoft Internet Explorer")
	{
		request_oo = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		request_oo = new XMLHttpRequest();
	}
	request_oo.open("GET",fixurl,"false");

	request_oo.onreadystatechange=function()
	{ 
		checkUpdateState(); 
	}
	request_oo.send(null);
	setTimeout("updateStatus('"+sysTypeNo+"','"+sysNo+"')", 10000);
}

function checkUpdateState()
{
	//not
	if(request_oo.readyState == 3)
	{
		//alert("not finish");
	}
	if(request_oo.readyState == 4)
	{
		var response = request_oo.responseText;
		//alert(response);
		var module=response.split(';;');
		for(i=0;i<module.length;i++)
		{
			var items=module[i].split(',,');
			//alert(items.length);
			if(items.length < 1)
				continue;
			
			var kind=items[0].replace(/(^\s*)|(\s*$)/g, "");
			if(kind == 'tr')
			{
				var line_id=items[1].replace(/(^\s*)|(\s*$)/g, "");
				var line_display=items[2].replace(/(^\s*)|(\s*$)/g, "");
				if(line_display == 'none')
					document.getElementById(line_id).style.display='none';
				else
					document.getElementById(line_id).style.display='';
			}
			else if(kind == 'td')
			{
				var item_id=items[1].replace(/(^\s*)|(\s*$)/g, "");
				var item_value=items[2].replace(/(^\s*)|(\s*$)/g, "");
				var item_color=items[3].replace(/(^\s*)|(\s*$)/g, "");
				document.getElementById(item_id).style.color=item_color;
				document.getElementById(item_id).innerHTML=item_value;
			}
			else if(kind == 'alarm')
			{
				var item_id=items[1].replace(/(^\s*)|(\s*$)/g, "");
				var alarm=items[2];
				if(alarm == 'none')
				{
					document.getElementById(item_id).innerHTML='';
				}
				else
				{
					document.getElementById(item_id).innerHTML=alarm;
				}
			}
		}
		
	}
}

</script>
<?php
	echo "\n<script language=\"JavaScript\">\n";
	echo "updateStatus('$sysTypeNo','$sysNo');\n";
	echo "</script>\n";
?>
