
function checkBackPrev()
{
if(BackPrev)
{
_top.src = currTabPge;
}
else
{
BackPrev = true;
}
}
function importXML(funcOnLoad,xmlToLoad)
{
var xmlDoc;
var nextURL = '';
var nextFunct = '';
if (funcOnLoad=='getGeneralDB'){xmlToLoad='../device/generalDB.xml?[generalDataTable]Filter:(rlHostParamName="l2_num_of_out_of_band_ports")||(rlHostParamName="l2_first_out_of_band_ifIndex")||(rlHostParamName="l2_num_of_trunks")||(rlHostParamName="l2_first_trunk_ifIndex")||(rlHostParamName="l2_max_num_ports_in_trunk")||(rlHostParamName="cosParams_ingressRateLimitSupported")||(rlHostParamName="unit_max_number_of_units"||rlHostParamName="l2_first_tunnel_ifIndex"||rlHostParamName="l2_num_of_tunnel_interfaces")^[dot1qVlanCurrentTableVT]Filter:dot1qVlanStatus=1'; nextFunct='getGeneralDB2'; nextURL='';}
else if (funcOnLoad=='getGeneralDB2'){xmlToLoad='../device/generalDB.xml?[generalDataTable]Filter:(rlHostParamName="vlan_pve_supported"||(rlHostParamName="poe_supported"))^[dot1qVlanCurrentTableVT]Filter:dot1qVlanStatus=1'; nextFunct='getPortDB'; nextURL='../device/portDB.xml?Filter:(ifOperStatus!=6)';}
else if (funcOnLoad=='getPortDB'){nextFunct='getModuleDB'; nextURL='../device/moduleDB.xml';}
else if (funcOnLoad=='getModuleDB'){nextFunct='getLAGDB'; nextURL='../device/lagDB.xml?[portsToLAGsDataTable]Filter:(ifOperStatus!=6)[LAGsDataTable]Filter:(ifOperStatus!=6)';}
else if (funcOnLoad=='getLAGDB'){nextFunct='getExtraPortsDB';nextURL='../device/extraPortsDB.xml?Filter:((ifIndex>='+parseInt(_top.oobFirstIndex)+')&&(ifIndex<'+(parseInt(_top.oobFirstIndex + _top.oobNumOfPorts))+'))';}
else if (funcOnLoad=='getExtraPortsDB'){nextFunct='endOfFunc';nextURL=''}
else if (funcOnLoad=='endOfFunc')
{
_top.pollingState = setTimeout("importXML('getPortDB','../device/portDB.xml')",_top.pollingInterval);
_top.isFirstLoad = false;
if (window.frames['mainFrame_gw'].oPolling)window.frames['mainFrame_gw'].oPolling.init();
return;
}
else if(funcOnLoad == 'loadPeriodicAuth')
{
nextURL = null;
}
else if(funcOnLoad =='')
{
return;
}
try
{
if(window.XMLHttpRequest && navigator.userAgent.indexOf("MSIE 8.0")==-1)
{
xmlDoc = new XMLHttpRequest();
addEventReadyState(xmlDoc);
xmlDoc.onreadystatechange = function() { if (nextURL!=null && xmlDoc.readyState == 4) {eval( funcOnLoad+'(xmlDoc.responseXML)');importXML(nextFunct,nextURL); }};
xmlDoc.open("GET", xmlToLoad, true);
xmlDoc.send(null);
}
else if(document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("", "", null);
addEventReadyState(xmlDoc);
xmlDoc.async = true;
xmlDoc.onreadystatechange = function()
{
if(nextURL!=null && xmlDoc.readyState == 4)
{
eval( funcOnLoad+'(xmlDoc)');importXML(nextFunct,nextURL);
}
};
xmlDoc.load(xmlToLoad);
}
else if(window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function()
{
if(nextURL != null && xmlDoc.readyState == 4)
{
eval(funcOnLoad + '(xmlDoc)');
importXML(nextFunct,nextURL);
}
};
xmlDoc.load(xmlToLoad);
}
else
{
alert('Your browser can\'t handle this script');
}
}
catch(e)
{
if(funcOnLoad=='getGeneralDB'||funcOnLoad=='getGeneralDB2')
{
setTimeout("importXML('"+funcOnLoad+"','"+xmlToLoad+"')",20000);
}
else
{
setTimeout("importXML('getPortDB','../device/portDB.xml?Filter:(ifOperStatus!=6)')",_top.pollingInterval);
}
}
}
function addEventReadyState(xmlDocument)
{
try
{
if(xmlDocument.readyState == null)
{
xmlDocument.readyState = 1;
xmlDocument.addEventListener("load",
function()
{
xmlDocument.readyState = 4;
if(typeof xmlDocument.onreadystatechange == "function") xmlDocument.onreadystatechange();
}
,false);
}
}
catch(e){}
}
function initTopPortArr()
{
_top.existedPortsArr = new Array(_top.NumberOfPorts);
_top.portsNamesArr = new Array(_top.NumberOfPorts);
_top.moduleNumPerPortArr = new Array(_top.NumberOfPorts);
_top.portsChangesArr = new Array(_top.NumberOfPorts);
_top.isComboPort = new Array(_top.NumberOfPorts);
_top.isPortsChanged = false;
for(var i=0; i<=_top.NumberOfPorts; i++)
{
_top.existedPortsArr[i] = false;
_top.portsNamesArr[i] = "";
_top.moduleNumPerPortArr[i] = "";
_top.portsChangesArr[i] = false;
_top.isComboPort[i] = false;
}
}
function getPortDB(portDB)
{
var value,ifIndex,portName,relatedUnit,transceiverType,ifSpeed,OperStatus,suspendedStatus,portsArr;
try
{
_top.portsDataXml = portDB;
_top.NumberOfPorts = parseInt(portDB.getElementsByTagName('numberOfPorts')[0].firstChild.nodeValue);
initTopPortArr();
var tmpPortsStatusArr = new Array(_top.NumberOfPorts);
var tmpPortsTypeArr = new Array(_top.NumberOfPorts);
portsArr = portDB.getElementsByTagName('port');
for(var i=0; i<portsArr.length; i++)
{
ifIndex = getVal(portsArr[i],"ifIndex");
if(i == 0)
{
_top.firstPresentPort = ifIndex;
}
portName = getVal(portsArr[i],"portName");
relatedUnit = getVal(portsArr[i],"relUnit");
transceiverType = getVal(portsArr[i],"transType");
relatedUnit = getVal(portsArr[i],"relUnit");
value = getVal(portsArr[i],"ifSpeed");
ifSpeed = parseInt(value);
if (ifSpeed==10000000) ifSpeed = 1;
else if (ifSpeed==100000000) ifSpeed = 2;
else if (ifSpeed==1000000000) ifSpeed = 3;
else if (ifSpeed==10000000000) ifSpeed = 4;
else ifSpeed = 0;
OperStatus=getVal(portsArr[i],"OperStatus");
suspendedStatus=getVal(portsArr[i],"suspStatus");
tmpPortsTypeArr[ifIndex] = transceiverType*10+ifSpeed;
_top.existedPortsArr[ifIndex] = true;
_top.portsNamesArr[ifIndex] = portName;
_top.moduleNumPerPortArr[ifIndex] = relatedUnit;
if((transceiverType == 4) ||(transceiverType == 3))
{
isComboPort[ifIndex] = true;
}
tmpPortsStatusArr[ifIndex] = ( OperStatus == 1 ? "Up" : ( suspendedStatus == 1 ? "Suspended" : "Down"))
if(!_top.isFirstLoad)
{
if((tmpPortsTypeArr[ifIndex] != _top.portsTypeArr[ifIndex]) || (tmpPortsStatusArr[ifIndex] != _top.portsStatusArr[ifIndex]))
{
_top.portsChangesArr[ifIndex] = true;
if(!_top.isPortsChanged)
{
_top.isPortsChanged = true;
}
}
}
else
{
_top.portsTypeArr = new Array(_top.NumberOfPorts);
_top.portsStatusArr = new Array(_top.NumberOfPorts);
}
}
_top.portsStatusArr = tmpPortsStatusArr;
_top.portsTypeArr = tmpPortsTypeArr;
if((!_top.isFirstLoad)&&(_top.isPortsChanged))
{
_top.frames[0].location.reload();
}
}
catch(e)
{
return false;
}
return true;
}
function getVal(owner,name)
{
return owner.getElementsByTagName(name)[0].firstChild.nodeValue
}
function initTopModuleArr()
{
_top.RealModuleNameArr = new Array(_top.NumberOfModules);
_top.NumberOfPortPerModuleArr = new Array(_top.MaxNumberOfUnits);
_top.StartingPortPerModuleArr = new Array(_top.MaxNumberOfUnits);
for(i=0;i<=_top.MaxNumberOfUnits;i++)
{
_top.NumberOfPortPerModuleArr[i] = "-1";
_top.StartingPortPerModuleArr[i] = "-1";
}
}
function getModuleDB(moduleDB)
{
modulesDataXml=moduleDB;
var value,moduleNumber,moduleType,firstPortIndex,numberOfPorts,moduleRole,stackConnect1,stackConnect2,moduleArr,extraModuleArr;
var flagMaster = false;
var flagBackup = false;
try
{
_top.NumberOfModules = parseInt(moduleDB.getElementsByTagName('numberOfUnits')[0].firstChild.nodeValue);
initTopModuleArr();
var firstPoe=-1;
var tmpTypePerModuleArr = new Array(_top.MaxNumberOfUnits);
for(i=0;i<=_top.MaxNumberOfUnits;i++)tmpTypePerModuleArr[i]=-1;
moduleArr = moduleDB.getElementsByTagName('modulesDataBase')[0].getElementsByTagName('module');
if (moduleDB.getElementsByTagName('modulesDataBase')[1])
extraModuleArr = moduleDB.getElementsByTagName('modulesDataBase')[1].getElementsByTagName('module');
for (var i=0;i<moduleArr.length;i++)
{
moduleIndex=getVal(moduleArr[i],"moduleNumber");if (i == 0) _top.firstPresentModule = moduleIndex;
moduleType=getVal(moduleArr[i],"moduleType");
firstPortIndex=getVal(moduleArr[i],"firstPortIndex");
numberOfPorts=getVal(moduleArr[i],"numberOfPorts");
moduleRole=getVal(moduleArr[i],"moduleRole");
if ((moduleType=="54" || moduleType=="45" || moduleType=="55" || moduleType=="75") && (firstPoe== -1))
firstPoe= parseInt(moduleIndex);
_top.RealModuleNameArr[i] = parseInt(moduleIndex);
_top.NumberOfPortPerModuleArr[moduleIndex] = parseInt(numberOfPorts);
_top.StartingPortPerModuleArr[moduleIndex] = parseInt(firstPortIndex);
tmpTypePerModuleArr[moduleIndex] = moduleType;
if (!_top.isFirstLoad)
{ if (tmpTypePerModuleArr[moduleIndex] != _top.TypePerModuleArr[moduleIndex])_top.isModuleTypeChanged = true;}
else _top.TypePerModuleArr = new Array(_top.MaxNumberOfUnits);
if(moduleRole == "1")
{ _top.MasterUnit = 0;
flagMaster=true;
}
else if(moduleRole == "2")
{ _top.MasterUnit = moduleIndex;
flagMaster=true;
}
else if(moduleRole == "3")
{ _top.BackUpUnit = moduleIndex;
flagBackup=true;
}
}
if(!flagMaster)_top.MasterUnit="";
if(!flagBackup)_top.BackUpUnit="";
_top.firstPoeUnit= firstPoe;
_top.TypePerModuleArr = tmpTypePerModuleArr;
_top.Units = (NumberOfModules > 1 ? true : false);
saveStackOrder(moduleDB.getElementsByTagName('stackOrderPermutation')[0].firstChild.nodeValue);
}
catch(e)
{
return false;
}
_top.finishLoading = true;
if (_top.frames[0])
{
if(typeof(_top.numberOfUnits) != "undefined")
{
if(_top.NumberOfModules != _top.frames[0].numberOfUnits)
_top.frames[0].location.reload();
}
}
return true;
}
function saveStackOrder(stackOctetOrder)
{
if(_top.Units)
{
stackOctetOrder=stackOctetOrder.toUpperCase();
var temp;
var i=0,j=0;
while(i<stackOctetOrder.length)
{
temp=stackOctetOrder.slice(i,i+2);
temp=Hex2Ascii(temp);
_top.StackOrderArr[j] = temp;
i+=2;
j+=1;
}
}
else _top.StackOrderArr[0]= _top.firstPresentModule;
}
function adjustStringToFilter(theString)
{
var result="";
for (i=0;(i<theString.length);i++)
{
if ((theString.charAt(i)!='^')&&(theString.charAt(i)!='[')&&(theString.charAt(i)!='"')&&(theString.charAt(i)!='\'')&&(theString.charAt(i)!='\\'))
{
if (theString.charAt(i)=='#') result+="%23";
else if (theString.charAt(i)=='%') result+="%25";
else if (theString.charAt(i)=='?') result+="%3F";
else if (theString.charAt(i)==';') result+="%3B";
else if (theString.charAt(i)=='&') result+="%26";
else if (theString.charAt(i)=='+') result+="%2B";
else result+=theString.charAt(i);
}
else result+='\\'+theString.charAt(i);
}
return result;
}
function getGeneralDB(generalDB)
{
var generalArr,hostName,hostValue,routValue,menuArr;
menuArr = generalDB.getElementsByTagName('menuParam');
for (var x=0;x<menuArr.length;x++)
{
routValue = getVal(menuArr[x],"routerData");
if (routValue.charAt(0)==1)
_top.displayRouter = true;
else
_top.displayRouter = false;
}
generalArr = generalDB.getElementsByTagName('hostParam');
for (var i=0;i<generalArr.length;i++)
{
hostValue = getVal(generalArr[i],"hostParamValue");
switch (getVal(generalArr[i],"hostParamName"))
{
case "l2_first_out_of_band_ifIndex":
_top.oobFirstIndex = parseInt(hostValue);
break;
case "l2_num_of_out_of_band_ports":
_top.oobNumOfPorts = parseInt(hostValue);
break;
case "l2_first_trunk_ifIndex":
_top.trunkFirstIndex = parseInt(hostValue);
break;
case "l2_num_of_trunks":
_top.NumberOfTrunks = parseInt(hostValue);
break;
case "cosParams_ingressRateLimitSupported":
_top.rateLimit = parseInt(hostValue);
break;
case "l2_max_num_ports_in_trunk":
_top.maxPortsPerTrunk = parseInt(hostValue);
break;
case "unit_max_number_of_units" :
_top.MaxNumberOfUnits = parseInt(hostValue);
break;
case "l2_first_tunnel_ifIndex":
_top.tunnelFirstIndex = parseInt(hostValue);
break;
case "l2_num_of_tunnel_interfaces":
_top.maxNumberOfTunnels = parseInt(hostValue);
break;
}
}
}
function getGeneralDB2(generalDB)
{
var generalArr,hostValue;
generalArr = generalDB.getElementsByTagName('hostParam');
for (var i=0;i<generalArr.length;i++)
{
hostValue = getVal(generalArr[i],"hostParamValue");
switch (getVal(generalArr[i],"hostParamName"))
{
case "poe_supported":
_top.poeSupported = (hostValue == "1" ? true : false);
break;
case "vlan_pve_supported":
_top.pveSupported = (hostValue == "1" ? true : false);
break;
}
}
hostValue = getVal(generalDB.getElementsByTagName('dot1qVlanIndex')[0],"dot1qVlanIndexValue");
_top.defaultVlanId = parseInt(hostValue,10);
_top.IpHostManagementIndex = _top.defaultVlanId + 99999;
}
function initTopLAGArr()
{
_top.presentTrunkArr = new Array(_top.NumberOfTrunks);
for(var i=_top.trunkFirstIndex; i<(_top.trunkFirstIndex+_top.NumberOfTrunks); i++)
{
_top.presentTrunkArr[i] = _top.isDisplayAllTrunk;
}
}
function getLAGDB(LAGDB)
{
var LAGIfIndex,extraLAGArr;
try
{
initTopLAGArr();
if (!_top.isDisplayAllTrunk)
{
extraLAGArr = LAGDB.getElementsByTagName('LAGsDataBase')[0].getElementsByTagName('LAG');
for (i=0;i<extraLAGArr.length;i++)
{
for (x=0;x<extraLAGArr[i].childNodes.length;x++)
{
if ((extraLAGArr[i].childNodes[x].nodeType !=1)||(extraLAGArr[i].childNodes[x].nodeName == "INPUT")) continue;
if (extraLAGArr[i].childNodes[x].nodeName == "LAGIfIndex")
LAGIfIndex = extraLAGArr[i].childNodes[x].firstChild.nodeValue;
}
_top.presentTrunkArr[parseInt(LAGIfIndex)] = true;
}
}
}
catch(e)
{
return false;
}
}
function initTopOOBArr()
{
_top.oobPortsStatusArr=new Array(_top.oobNumOfPorts);
_top.oobPortsIndexArray=new Array(_top.oobNumOfPorts);
_top.oobExistedPortsArr=new Array(_top.oobNumOfPorts);
_top.oobPortsNamesArr=new Array(_top.oobNumOfPorts);
for(var i=0;i<=_top.oobNumOfPorts;i++)
{
_top.oobPortsStatusArr[i] = "notPresent";
_top.oobPortsIndexArray[i] = "-1";
_top.oobExistedPortsArr[i] = false;
_top.oobPortsNamesArr[i] = "";
}
}
function getExtraPortsDB(ExtraPortsDB)
{ try
{
var oobArr,oobOperStatus,oobIfIndex;
initTopOOBArr();
oobArr = ExtraPortsDB.getElementsByTagName('extraPortsDataBase')[0].getElementsByTagName('OOB');
for (var i=0;i<oobArr.length;i++)
{
oobOperStatus = getVal(oobArr[i],"oobOperStatus")
_top.oobExistedPortsArr[i] = ( oobOperStatus=="6" ? false : true);
_top.oobPortsIndexArray[i] = getVal(oobArr[i],"oobIfIndex");
_top.oobPortsNamesArr[i]=( _top.oobNumOfPorts>1 ? "OOB " + parseInt(i+1):"OOB");
_top.oobPortsStatusArr[i] = ( oobOperStatus=="1" ? "UP" : "Down");
}
}
catch(e)
{
return false;
}
}

