851 lines
24 KiB
Plaintext
Executable File
851 lines
24 KiB
Plaintext
Executable File
<?php
|
||
/*************************************************
|
||
File name: openWenFunc.inc
|
||
Author: Cui Ticun
|
||
Version: 9.00.00
|
||
Date: 2007-7-11
|
||
Description:Show Parameters
|
||
Calls: header.inc
|
||
Called:
|
||
|
||
History:
|
||
No.1:
|
||
Author:
|
||
Date:
|
||
Version:
|
||
Description:
|
||
*************************************************/
|
||
//style
|
||
define(SHOW_HIDE, 0);
|
||
define(SHOW_SELECT, 1);
|
||
define(SHOW_TEXTBOX, 2);
|
||
define(SHOW_LABEL, 3);
|
||
define(SHOW_VISIBLE, 4);
|
||
define(SHOW_INVISIBLE, 5);
|
||
|
||
//access
|
||
define(ACCESS_TABLE_NAME, 0);
|
||
define(ACCESS_ENTRY, 21);
|
||
define(ACCESS_READ_WRITE, 19);
|
||
define(ACCESS_READ_ONLY, 18);
|
||
define(ACCESS_INDEX_CREATE_SPE, 48);
|
||
|
||
//value type
|
||
define(VALUE_NONE, 0);
|
||
define(VALUE_STRING, 2);
|
||
define(VALUE_INT, 3);
|
||
define(VALUE_IP, 5);
|
||
define(VALUE_TIMESTAMP, 8);
|
||
define(VALUE_OPAQUE, 9);
|
||
define(VALUE_COUNTER,6);
|
||
define(VALUE_GAUGE,7);
|
||
define(VALUE_COUNTER64,11);
|
||
define(VALUE_UINT,14);
|
||
define(VALUE_UNSIGNED32,15);
|
||
define(VALUE_INT32,16);
|
||
|
||
$settedColor ="blue";
|
||
$notSettedColor ="#008000";
|
||
$inputBkgrdColor = "#E7FEFD";
|
||
$saveBkgrdColor ="#F3F77D";
|
||
$waitingBkgrdColor = "red";
|
||
|
||
function showParameter($sysId,$oidStr,$instanceNo=0,$inputValueType='3',$doingOtherUlr='',$otherWhereStr='',$showStr='')
|
||
{
|
||
global $language,$notSettedColor,$settedColor;
|
||
$tmpStr = str_replace('.','_',$oidStr);
|
||
$id = 'ID_' . $sysId . '_' . $tmpStr . '_' . '_ist' . $instanceNo;
|
||
$newId = "New".$id;
|
||
$showValue = getParaValue($valueType,$operType,$initEquRead,$sysId,$oidStr,$instanceNo,$otherWhereStr);
|
||
|
||
if($initEquRead)
|
||
$color = $settedColor;
|
||
else
|
||
$color = $notSettedColor;
|
||
$doingOtherUlr=urlencode($doingOtherUlr);
|
||
if(strlen($showStr))
|
||
{
|
||
$color = $settedColor;
|
||
$showValue = $showStr;
|
||
}
|
||
if(strlen($showValue)<=0)
|
||
$showValue="--";
|
||
if($valueType==9){//TYPE_OPAQUE,It's defined in SNMP module
|
||
|
||
//discard the postfix E
|
||
$sysIdArr=explode('_',$sysId);
|
||
$sysTypeNo=$sysIdArr[0];
|
||
$oidwhere=getLevelWhere($oidStr);
|
||
$sql="select setTemplate_2 from OBJ_$sysTypeNo.paramConf where $oidwhere ";
|
||
$res=@mysqli_query($pubConn,$sql);
|
||
$row=@mysqli_fetch_array($res);
|
||
$split=explode("[unit]",$row[0]);
|
||
$tmplen=sizeof($split);
|
||
//only one unit
|
||
//if($tmplen == 2)
|
||
{
|
||
$split2=explode("keepHex-low-",$row[0]);
|
||
$repl=substr($split2[1],0,1);
|
||
$showValue=str_replace($repl," ",$showValue);
|
||
}
|
||
|
||
if(strlen(trim($showValue))<=0)
|
||
$showValue="--";
|
||
|
||
echo "<span id=\"$id\" style=\"cursor:pointer\" onclick=\"javascript:openSet('$sysId','$oidStr','$instanceNo','$id');\"><font color=\"$color\">$showValue </font></span>";
|
||
}else if($operType==3){//Label
|
||
echo "<span id=\"$id\" >$showValue</span>";
|
||
}else{
|
||
echo "<span id=\"$id\" style=\"cursor:pointer\" onclick=\"javascript:getPar('getVar','$language','$sysId','$oidStr','$instanceNo','0','$doingOtherUlr','$otherWhereStr','$showStr','$inputValueType');\"><font color=\"$color\">$showValue </font></span>";
|
||
echo "<span id=\"$newId\" style=\"display:none\" ></span>";
|
||
}
|
||
}
|
||
|
||
|
||
|
||
function showParameterAdv($sysId,$oidStr,$instanceNo)
|
||
{
|
||
$sysIdArr = explode('_',$sysId);
|
||
$sysTypeNo = $sysIdArr[0];
|
||
$sysNo = $sysIdArr[1];
|
||
$subSysNo = $sysIdArr[2];
|
||
$objDb = 'OBJ_'.$sysTypeNo;
|
||
$paraConfTable = $objDb.".paramConf";
|
||
if(checkIndependSystem($sysTypeNo))//Plat
|
||
$paraTable=$objDb.".param_".$sysNo;
|
||
else
|
||
$paraTable=$objDb.".param_99";
|
||
|
||
//get the id of the object
|
||
$OBJ_ID_SHOW="ADVID_SHOW_".$oidStr.".".$instanceNo;
|
||
$OBJ_ID_MODIFY="ADVID_MODIFY_".$oidStr.".".$instanceNo;
|
||
$OBJ_ID_CONTR="ADVID_CONTR_".$oidStr.".".$instanceNo;
|
||
$OBJ_ID_SAVE="ADVID_SAVE_".$oidStr.".".$instanceNo;
|
||
//get the value of the parameter
|
||
$tmp=explode("_",$sysId);
|
||
$database="OBJ_".$tmp[0];
|
||
$oidwhere=getLevelWhere($oidStr);
|
||
$selSql = "select initValue,readValue from $paraTable where ".$oidwhere." and instanceNo='".$instanceNo."' ";
|
||
|
||
//ISSUE-3
|
||
if(checkPlatWhoHaveSubSysNo($sysTypeNo,$sysNo))
|
||
{
|
||
$selSql.="and subSysNo='$subSysNo' ";
|
||
}
|
||
|
||
//echo "$selSql";
|
||
$selRes = @mysqli_query($pubConn,$selSql);
|
||
|
||
if(mysqli_num_rows($selRes)==0){//<2F>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD>$paramTable<6C>ﲻ<EFBFBD><EFB2BB><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ֵΪ<D6B5>յļ<D5B5>¼
|
||
$initValue = '';
|
||
$readValue = '';
|
||
$insertSql="INSERT INTO $paraTable SET initValue='',readValue='',instanceNo='$instanceNo'";
|
||
//ISSUE-3
|
||
if(checkPlatWhoHaveSubSysNo($sysTypeNo,$sysNo))
|
||
{
|
||
$selSql.=",subSysNo='$subSysNo'";
|
||
}
|
||
|
||
$oidStrArr=explode('.',$oidStr);
|
||
for($i=0;$i<sizeof($oidStrArr);$i++){
|
||
$insertSql=$insertSql.',level_'.($i+1).'='.$oidStrArr[$i];
|
||
}
|
||
//echo "insertSql=$insertSql";
|
||
mysqli_query($pubConn,$insertSql);
|
||
}else{
|
||
$selRow = @mysqli_fetch_array($selRes);
|
||
$initValue=$selRow[initValue];
|
||
$readValue=$selRow[readValue];
|
||
}
|
||
|
||
//get the operType,valueType,minValue,maxValue
|
||
$selSql="select * from $paraConfTable where ".$oidwhere;
|
||
//echo "selSql=$selSql<br>";
|
||
$selRes = @mysqli_query($pubConn,$selSql);
|
||
$selRow = @mysqli_fetch_array($selRes);
|
||
$operType=$selRow[operType];
|
||
if(strstr($selRow[desc_2],"PASSWORD:Invisible"))
|
||
$operType = SHOW_INVISIBLE;
|
||
else if(strstr($selRow[desc_2],"PASSWORD:Visible"))
|
||
$operType = SHOW_VISIBLE;
|
||
$valueType=$selRow[valueType];
|
||
$minValue=$selRow[minValue];
|
||
$maxValue=$selRow[maxValue];
|
||
$maxAccess=$selRow[maxAccess]+0;
|
||
$setTemplate=$selRow[setTemplate_1];
|
||
$note=$selRow[note_1];
|
||
$name=$selRow[name_1];
|
||
$isReadOnly=0;
|
||
//echo "initValue=$initValue";
|
||
|
||
//echo "$setTemplate";
|
||
//echo "initValue=$value,readValue={$selRow[readValue]}";
|
||
if(trim($initValue) == "")
|
||
{
|
||
$initValue="--";
|
||
}
|
||
if($initValue == $readValue)
|
||
{
|
||
$showcolor="blue";
|
||
}
|
||
else
|
||
{
|
||
$showcolor="#008000";
|
||
}
|
||
|
||
if($maxAccess == ACCESS_READ_ONLY || strstr($name,"Index") || strstr($name,"AdministrationState") || !checkWritePrivilege())
|
||
{
|
||
$showcolor="black";
|
||
$pointer="";
|
||
$isReadOnly=1;
|
||
}
|
||
else
|
||
{
|
||
$pointer=";cursor:pointer";
|
||
}
|
||
|
||
if($valueType == VALUE_INT && $maxAccess != 48)
|
||
{
|
||
//echo "initValue=$initValue";
|
||
$tmpp=explode(";",$setTemplate);
|
||
$isfind=0;
|
||
if(trim($setTemplate) != "")
|
||
{
|
||
for($i=0;$i< count($tmpp);$i++)
|
||
{
|
||
$tmpv=explode("=",$tmpp[$i]);
|
||
if($initValue==($tmpv[1]+0))
|
||
{
|
||
$initValue=$tmpv[0];
|
||
$isfind=1;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if($isfind==0)
|
||
{
|
||
$initValue=$initValue;
|
||
}
|
||
}
|
||
|
||
if($isReadOnly == 1)
|
||
echo "<span id=\"$OBJ_ID_SHOW\" style=\"color:$showcolor$pointer\" >";
|
||
else
|
||
echo "<span id=\"$OBJ_ID_SHOW\" style=\"color:$showcolor$pointer\" onClick=\"javascript:clickOnValue('$OBJ_ID_SHOW','$OBJ_ID_MODIFY','$OBJ_ID_CONTR','$OBJ_ID_SAVE','$initValue','$operType','$valueType','$minValue','$maxValue','$setTemplate','$name','$oidStr','$maxAccess')\">";
|
||
if($operType == SHOW_VISIBLE || $operType == SHOW_INVISIBLE)
|
||
echo "******";
|
||
else
|
||
echo "$initValue";
|
||
echo "</span>";
|
||
echo "<span id=\"$OBJ_ID_MODIFY\">";
|
||
echo "</span>";
|
||
echo " <span id=\"$OBJ_ID_SAVE\" style=\"cursor:pointer;font-family:Verdana, Arial, Helvetica;color:blue;background:#F3F77D;font-size:11px\" onClick=\"javascript:clickOnSave('$OBJ_ID_SHOW','$OBJ_ID_MODIFY','$OBJ_ID_CONTR','$OBJ_ID_SAVE','$sysId','$oidStr','$instanceNo','$initValue','$operType','$valueType','$minValue','$maxValue','$setTemplate')\">";
|
||
echo "</span>";
|
||
}
|
||
|
||
function getParaValue(&$valueType,&$operType,&$initEquRead,$sysId,$oidStr,$instanceNo=0,$otherWhereStr='')
|
||
{
|
||
global $language;
|
||
$sysIdArr = explode('_',$sysId);
|
||
$sysTypeNo = $sysIdArr[0];
|
||
$sysNo = $sysIdArr[1];
|
||
$subSysNo = $sysIdArr[2];
|
||
$objDb = 'OBJ_'.$sysTypeNo;
|
||
$paraConfTable = $objDb.".paramConf";
|
||
if(checkIndependSystem($sysTypeNo))//Plat
|
||
$paraTable=$objDb.".param_".$sysNo;
|
||
else
|
||
$paraTable=$objDb.".param_99";
|
||
|
||
if($language == 'eng'){
|
||
$objNameField=name_2;
|
||
$objSetField=setTemplate_2 ; //<2F><><EFBFBD><EFBFBD>2
|
||
}else{
|
||
$objNameField=name_1;
|
||
$objSetField=setTemplate_1 ; //<2F><><EFBFBD><EFBFBD>1(Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||
}
|
||
|
||
$objWhereStr = getLevelWhere($oidStr);
|
||
|
||
$objSql = "SELECT $objNameField,$objSetField,operType,valueType,minValue,maxValue FROM $paraConfTable WHERE $objWhereStr";
|
||
if($DEBUG)
|
||
echo "<br>objSql=$objSql";
|
||
$objResult = mysqli_query($pubConn ,$objSql);
|
||
$objRows = @mysqli_fetch_array($objResult);
|
||
$setTemplate = $objRows[$objSetField];
|
||
$operType = $objRows[operType];
|
||
$valueType = $objRows[valueType];
|
||
|
||
$paraSql = " SELECT initValue,readValue FROM $paraTable WHERE $objWhereStr $otherWhereStr AND instanceNo = '$instanceNo' ";
|
||
if($DEBUG)
|
||
echo "<br>paraSql=$paraSql";
|
||
|
||
$paraResult = mysqli_query($pubConn,$paraSql);
|
||
if(mysqli_num_rows($paraResult)==0){//<2F>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD>$paramTable<6C>ﲻ<EFBFBD><EFB2BB><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ֵΪ<D6B5>յļ<D5B5>¼
|
||
$initGetValue = '';
|
||
$readGetValue = '';
|
||
$insertSql="INSERT INTO $paraTable SET initValue='',readValue='',instanceNo='$instanceNo'";
|
||
$oidStrArr=explode('.',$oidStr);
|
||
for($i=0;$i<sizeof($oidStrArr);$i++){
|
||
$insertSql=$insertSql.',level_'.($i+1).'='.$oidStrArr[$i];
|
||
}
|
||
echo "insertSql=$insertSql";
|
||
mysqli_query($pubConn,$insertSql);
|
||
}else{
|
||
$paraRow = mysqli_fetch_array($paraResult);
|
||
$initGetValue = $paraRow[initValue];
|
||
$readGetValue = $paraRow[readValue];
|
||
}
|
||
if($DEBUG)
|
||
{
|
||
echo "<br>initGetValue=$initGetValue";
|
||
echo "<br>readGetValue=$readGetValue";
|
||
}
|
||
|
||
$initEquRead = false;
|
||
if($initGetValue == $readGetValue)
|
||
$initEquRead = true;
|
||
else
|
||
$initEquRead = false;
|
||
if($valueType==9)//TYPE_OPAQUE,It's defined in SNMP module
|
||
$returnValue=$initGetValue;
|
||
//else if($operType == SHOW_VISIBLE)
|
||
// $returnValue="******";
|
||
else
|
||
$returnValue=translate($initGetValue,$setTemplate);
|
||
|
||
if($DEBUG)
|
||
echo "<br>returnValue=$returnValue";
|
||
return $returnValue;
|
||
}//end getParamValue
|
||
?>
|
||
|
||
<script LANGUAGE="JavaScript">
|
||
var globalID;
|
||
|
||
//style
|
||
var SHOW_HIDE=0;
|
||
var SHOW_SELECT=1;
|
||
var SHOW_TEXTBOX=2;
|
||
var SHOW_LABEL=3;
|
||
var SHOW_VISIBLE=4;
|
||
var SHOW_INVISIBLE=5;
|
||
|
||
//access
|
||
var ACCESS_TABLE_NAME=0;
|
||
var ACCESS_ENTRY=21;
|
||
var ACCESS_READ_WRITE=19;
|
||
var ACCESS_READ_ONLY=18;
|
||
var ACCESS_INDEX_CREATE_SPE=48;
|
||
|
||
//value type
|
||
var VALUE_NONE=0;
|
||
var VALUE_STRING=2;
|
||
var VALUE_INT=3;
|
||
var VALUE_IP=5;
|
||
var VALUE_TIMESTAMP=8;
|
||
var VALUE_OPAQUE=9;
|
||
var VALUE_COUNTER=6;
|
||
var VALUE_GAUGE=7;
|
||
var VALUE_COUNTER64=11;
|
||
var VALUE_UINT=14;
|
||
var VALUE_UNSIGNED32=15;
|
||
var VALUE_INT32=16;
|
||
|
||
//hide some parameter
|
||
function hidesomeparam(value,table)
|
||
{
|
||
//Aif
|
||
if(table == "tgTable")
|
||
{
|
||
if(value == 0)
|
||
{
|
||
document.all.Backoff_Flag_id.style.display='none';
|
||
document.all.NFAS_id.style.display='none';
|
||
document.all.Primary_Link_id.style.display='none';
|
||
document.all.Backup_Link_id.style.display='none';
|
||
document.all.Opc_id.style.display='';
|
||
document.all.Dpc_id.style.display='';
|
||
document.all.Network_Indicator_id.style.display='';
|
||
}
|
||
//isup,bicc
|
||
else if(value == 1 || value == 2)
|
||
{
|
||
document.all.Backoff_Flag_id.style.display='';
|
||
document.all.NFAS_id.style.display='none';
|
||
document.all.Primary_Link_id.style.display='none';
|
||
document.all.Backup_Link_id.style.display='none';
|
||
document.all.Opc_id.style.display='';
|
||
document.all.Dpc_id.style.display='';
|
||
document.all.Network_Indicator_id.style.display='';
|
||
}
|
||
//isdn
|
||
else if(value == 3)
|
||
{
|
||
document.all.Backoff_Flag_id.style.display='';
|
||
document.all.NFAS_id.style.display='';
|
||
document.all.Primary_Link_id.style.display='';
|
||
document.all.Backup_Link_id.style.display='';
|
||
document.all.Opc_id.style.display='none';
|
||
document.all.Dpc_id.style.display='none';
|
||
document.all.Network_Indicator_id.style.display='none';
|
||
}
|
||
else
|
||
{
|
||
document.all.Backoff_Flag_id.style.display='';
|
||
document.all.NFAS_id.style.display='';
|
||
document.all.Primary_Link_id.style.display='';
|
||
document.all.Backup_Link_id.style.display='';
|
||
document.all.Opc_id.style.display='';
|
||
document.all.Dpc_id.style.display='';
|
||
document.all.Network_Indicator_id.style.display='';
|
||
}
|
||
}
|
||
else if(table == "trunkTable")
|
||
{
|
||
//aif isup
|
||
if(value == 0 || value == 1)
|
||
{
|
||
document.all.Link_ID_id.style.display='none';
|
||
document.all.User_Network_Interface_id.style.display='none';
|
||
document.all.Mg_ID_id.style.display='';
|
||
document.all.Port_ID_id.style.display='';
|
||
document.all.Supervision_Method_id.style.display='';
|
||
}
|
||
//bicc
|
||
else if(value == 2)
|
||
{
|
||
document.all.Link_ID_id.style.display='none';
|
||
document.all.User_Network_Interface_id.style.display='none';
|
||
document.all.Mg_ID_id.style.display='none';
|
||
document.all.Port_ID_id.style.display='none';
|
||
document.all.Supervision_Method_id.style.display='';
|
||
}
|
||
//isdn ,supervision method
|
||
else if(value == 3)
|
||
{
|
||
document.all.Link_ID_id.style.display='';
|
||
document.all.User_Network_Interface_id.style.display='';
|
||
document.all.Mg_ID_id.style.display='';
|
||
document.all.Port_ID_id.style.display='';
|
||
document.all.Supervision_Method_id.style.display='none';
|
||
}
|
||
else
|
||
{
|
||
document.all.Link_ID_id.style.display='';
|
||
document.all.User_Network_Interface_id.style.display='';
|
||
document.all.Mg_ID_id.style.display='';
|
||
document.all.Port_ID_id.style.display='';
|
||
document.all.Supervision_Method_id.style.display='';
|
||
}
|
||
}
|
||
}
|
||
|
||
function clickOnValue(showID,modifyID,contrlID,saveID,value,operType,valueType,minValue,maxValue,setTemplate,name,oid,maxAccess)
|
||
{
|
||
//add the check condition here
|
||
if(maxAccess == ACCESS_READ_ONLY)
|
||
return;
|
||
alert("aa"+document.getElementById(showID).innerHTML);
|
||
//if(operType == SHOW_VISIBLE)
|
||
//{
|
||
// document.getElementById(showID).innerHTML=value;
|
||
//}
|
||
//selection
|
||
if(operType == SHOW_SELECT)
|
||
{
|
||
var sel=setTemplate.split(";");
|
||
var hhtml="";
|
||
|
||
for(i=0;i<sel.length;i++)
|
||
{
|
||
var ssel=sel[i].split("=");
|
||
//alert("value="+value+","+ssel[0]+","+ssel[1]);
|
||
if(document.getElementById(showID).innerHTML==ssel[0])
|
||
hhtml+="<option value="+ssel[1]+" selected>"+ssel[0]+"</option>";
|
||
else
|
||
hhtml+="<option value="+ssel[1]+">"+ssel[0]+"</option>";
|
||
}
|
||
//hide some parameter
|
||
//if(oid == "2.4.1.1.10")
|
||
//hhtml="<select onChange=hidesomeparam(value,'tgTable'); id="+contrlID+">"+hhtml+"</select>";
|
||
//else
|
||
hhtml="<select id="+contrlID+">"+hhtml+"</select>";
|
||
//alert(hhtml);
|
||
document.getElementById(modifyID).innerHTML=hhtml;
|
||
document.getElementById(showID).innerHTML="";
|
||
|
||
|
||
var bro = navigator.appName;
|
||
if(bro == "Microsoft Internet Explorer")
|
||
{
|
||
document.getElementById(saveID).innerHTML="<b> SAVE </b>";
|
||
}
|
||
else
|
||
{
|
||
document.getElementById(saveID).innerHTML="<font size=2><b> SAVE </b></font>";
|
||
}
|
||
|
||
}
|
||
//input text
|
||
else if(operType == SHOW_TEXTBOX)
|
||
{
|
||
alert(document.getElementById(showID).innerHTML);
|
||
if(document.getElementById(showID).innerHTML=="--")
|
||
document.getElementById(modifyID).innerHTML="<input class=text type=input id="+contrlID+" maxlength="+maxValue+">";
|
||
else
|
||
document.getElementById(modifyID).innerHTML="<input class=text type=input value='"+document.getElementById(showID).innerHTML+"' id="+contrlID+" maxlength="+maxValue+">";
|
||
document.getElementById(showID).innerHTML="";
|
||
|
||
var bro = navigator.appName;
|
||
if(bro == "Microsoft Internet Explorer")
|
||
{
|
||
document.getElementById(saveID).innerHTML="<b> SAVE </b>";
|
||
}
|
||
else
|
||
{
|
||
document.getElementById(saveID).innerHTML="<font size=2><b> SAVE </b></font>";
|
||
}
|
||
}
|
||
|
||
/*
|
||
//input Invisible PASSWORD
|
||
else if(operType == SHOW_INVISIBLE)
|
||
{
|
||
if(document.getElementById(showID).innerHTML=="--")
|
||
document.getElementById(modifyID).innerHTML="<input class=text type=password id="+contrlID+" maxlength="+maxValue+">";
|
||
else
|
||
document.getElementById(modifyID).innerHTML="<input class=text type=password value='"+document.getElementById(showID).innerHTML+"' id="+contrlID+" maxlength="+maxValue+">";
|
||
document.getElementById(showID).innerHTML="";
|
||
|
||
var bro = navigator.appName;
|
||
if(bro == "Microsoft Internet Explorer")
|
||
{
|
||
document.getElementById(saveID).innerHTML="<b> SAVE </b>";
|
||
}
|
||
else
|
||
{
|
||
document.getElementById(saveID).innerHTML="<font size=2><b> SAVE </b></font>";
|
||
}
|
||
}
|
||
//input visible PASSWORD
|
||
else if(operType == SHOW_VISIBLE)
|
||
{
|
||
//if(!checkWritePrivilege())
|
||
//{
|
||
if(document.getElementById(showID).innerHTML=="--")
|
||
document.getElementById(modifyID).innerHTML="<input class=text type=input id="+contrlID+" maxlength="+maxValue+">";
|
||
else
|
||
{
|
||
//document.getElementById(showID).innerHTML=password_value;
|
||
document.getElementById(modifyID).innerHTML="<input class=text type=input value='"+document.getElementById(showID).innerHTML+"' id="+contrlID+" maxlength="+maxValue+">";
|
||
}
|
||
/*}
|
||
else
|
||
{
|
||
if(document.getElementById(showID).innerHTML=="--")
|
||
document.getElementById(modifyID).innerHTML="<input class=text type=password id="+contrlID+" maxlength="+maxValue+">";
|
||
else
|
||
document.getElementById(modifyID).innerHTML="<input class=text type=password value='"+document.getElementById(showID).innerHTML+"' id="+contrlID+" maxlength="+maxValue+">";
|
||
}
|
||
document.getElementById(showID).innerHTML="";
|
||
|
||
var bro = navigator.appName;
|
||
if(bro == "Microsoft Internet Explorer")
|
||
{
|
||
document.getElementById(saveID).innerHTML="<b> SAVE </b>";
|
||
}
|
||
else
|
||
{
|
||
document.getElementById(saveID).innerHTML="<font size=2><b> SAVE </b></font>";
|
||
}
|
||
}
|
||
*/
|
||
}
|
||
|
||
function clickOnSave(showID,modifyID,contrlID,saveID,sysId,oidStr,instanceNo,oldValue,operType,valueType,minValue,maxValue,setTemplate)
|
||
{
|
||
//add the check condition here
|
||
var message="";
|
||
var newValue=document.getElementById(contrlID).value;
|
||
var errorflag=0;
|
||
//number
|
||
if(operType == SHOW_TEXTBOX || operType == SHOW_VISIBLE &&
|
||
(valueType == VALUE_INT || valueType == VALUE_COUNTER || valueType == VALUE_GAUGE || valueType == VALUE_COUNTER64 || valueType == VALUE_UINT || valueType == VALUE_UNSIGNED32 || valueType == VALUE_INT32))
|
||
{
|
||
|
||
newValue=newValue-0;
|
||
minValue=minValue-0;
|
||
maxValue=maxValue-0;
|
||
//alert(newValue+",min="+minValue+",max="+maxValue+"errorflag="+errorflag);
|
||
if(newValue>maxValue)
|
||
errorflag=1;
|
||
else if(newValue < minValue)
|
||
errorflag=1;
|
||
else
|
||
errorflag=0;
|
||
message="The value must be between "+minValue+"-"+maxValue;
|
||
if(isNaN(newValue))
|
||
{
|
||
errorflag=1;
|
||
message="invalid digit";
|
||
}
|
||
else
|
||
{
|
||
var re=/^-?[0-9]+$/
|
||
if(!re.test(newValue))
|
||
{
|
||
errorflag=1;
|
||
message="invalid digit";
|
||
}
|
||
}
|
||
}
|
||
//string
|
||
else if(valueType == VALUE_STRING && operType == SHOW_TEXTBOX || operType == SHOW_VISIBLE)
|
||
{
|
||
if(newValue.length<minValue || newValue.length>maxValue)
|
||
{
|
||
errorflag=1;
|
||
if(minValue == maxValue)
|
||
message="The string length must be "+minValue;
|
||
else
|
||
message="The string length must be between "+minValue+"-"+maxValue;
|
||
}
|
||
}
|
||
//ip
|
||
else if(valueType == VALUE_IP && operType == SHOW_TEXTBOX)
|
||
{
|
||
if(checkIP(newValue))
|
||
{
|
||
errorflag=0;
|
||
}
|
||
else
|
||
{
|
||
errorflag=1;
|
||
}
|
||
message="The IP format is error";
|
||
}
|
||
|
||
//No error,send the operation request
|
||
if(errorflag==0)
|
||
{
|
||
document.getElementById(showID).style.color="#008000";
|
||
if(document.getElementById(contrlID).value=="")
|
||
document.getElementById(showID).innerHTML="--";
|
||
else
|
||
{
|
||
if(operType == SHOW_TEXTBOX)
|
||
{
|
||
document.getElementById(showID).innerHTML=document.getElementById(contrlID).value;
|
||
}
|
||
else if(operType == SHOW_SELECT)
|
||
{
|
||
var valS=document.getElementById(contrlID).value;
|
||
var sel=setTemplate.split(";");
|
||
|
||
for(i=0;i<sel.length;i++)
|
||
{
|
||
var ssel=sel[i].split("=");
|
||
if(valS==ssel[1])
|
||
{
|
||
document.getElementById(showID).innerHTML=ssel[0];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
else if(operType == SHOW_INVISIBLE)
|
||
{
|
||
document.getElementById(showID).innerHTML="******";
|
||
}
|
||
else if(operType == SHOW_VISIBLE)
|
||
{
|
||
document.getElementById(showID).innerHTML="******";
|
||
|
||
}
|
||
}
|
||
newValue=escape(newValue);
|
||
var fixurl="../sub_inc/saveParameter.php?sysId="+sysId+"&oidStr="+oidStr+"&instanceNo="+instanceNo+"&newValue="+newValue;
|
||
//var fixurl="../sub_inc/saveParameter.php?sysId="+sysId+"&oidStr="+oidStr+"&instanceNo="+instanceNo+"&newValue="+newValue;
|
||
|
||
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=checkStateAdv;
|
||
|
||
request_oo.onreadystatechange=function()
|
||
{
|
||
checkStateAdv(showID);
|
||
}
|
||
request_oo.send(null);
|
||
}
|
||
//Error,resume the old value
|
||
else if(errorflag==1)
|
||
{
|
||
/*
|
||
var browse = navigator.appName;
|
||
if(browse == "Microsoft Internet Explorer")
|
||
{
|
||
message="<font size=2> Tip<br> "+message+" </font>";
|
||
ShowTip_Static(message,'#F8F8F8');
|
||
setTimeout("ClearTip_Static()",2000);
|
||
}
|
||
else
|
||
{*/
|
||
alert(message);
|
||
//}
|
||
|
||
|
||
document.getElementById(showID).innerHTML=oldValue;
|
||
}
|
||
document.getElementById(modifyID).innerHTML="";
|
||
document.getElementById(saveID).innerHTML="";
|
||
|
||
|
||
|
||
}
|
||
function checkStateAdv(showID)
|
||
{
|
||
//not
|
||
if(request_oo.readyState == 3)
|
||
{
|
||
//alert("not finish");
|
||
}
|
||
if(request_oo.readyState == 4)
|
||
{
|
||
var saveResult = request_oo.responseText.replace(/(^\s*)|(\s*$)/g, "");
|
||
//alert(saveResult);
|
||
|
||
if(saveResult=="same")
|
||
document.getElementById(showID).style.color="blue";
|
||
else
|
||
document.getElementById(showID).style.color="#008000";
|
||
|
||
}
|
||
}
|
||
function checkIP(ip)
|
||
{
|
||
var re = /^((\d)|(([1-9])\d)|(1\d\d)|(2(([0-4]\d)|5([0-5]))))\.((\d)|(([1-9])\d)|(1\d\d)|(2(([0-4]\d)|5([0-5]))))\.((\d)|(([1-9])\d)|(1\d\d)|(2(([0-4]\d)|5([0-5]))))\.((\d)|(([1-9])\d)|(1\d\d)|(2(([0-4]\d)|5([0-5]))))$/;
|
||
|
||
if(re.test(ip))
|
||
return true;
|
||
else
|
||
return false;
|
||
|
||
}
|
||
|
||
|
||
|
||
function getPar(flag,lan,sysId,oidStr,instanceNo,inputID,doingOtherUlr,otherWhereStr,showStr,inputValueType)
|
||
{
|
||
|
||
var ulr="../sub_inc/getParameter.php?flag="+flag+"&lan="+lan+"&sysId="+sysId+"&oidStr="+oidStr+"&instanceNo="+instanceNo;
|
||
if(flag=='saveVar'){
|
||
var setValue = document.getElementById(inputID).value;
|
||
ulr = ulr + "&setValue=" + setValue;
|
||
}
|
||
ulr = ulr+"&doingOtherUlr="+doingOtherUlr+"&otherWhereStr="+otherWhereStr+"&showStr="+showStr+"&inputValueType="+inputValueType;
|
||
//alert(ulr)
|
||
var browser = navigator.appName;
|
||
if(browser == "Microsoft Internet Explorer"){
|
||
request_o = new ActiveXObject("Microsoft.XMLHTTP");
|
||
}else{
|
||
request_o = new XMLHttpRequest();
|
||
}
|
||
|
||
request_o.open("GET",ulr,"false");
|
||
request_o.onreadystatechange = updateID;
|
||
request_o.send(null);
|
||
}
|
||
|
||
function updateID()
|
||
{
|
||
if(request_o.readyState == 4)
|
||
{
|
||
var strResult = request_o.responseText;
|
||
var arrResult = strResult.split("###");
|
||
var flag = arrResult[0];
|
||
var idName = arrResult[1];
|
||
var innerStr = arrResult[2];
|
||
//alert(strResult);
|
||
if(flag=='getVar')
|
||
{
|
||
var getVarId = idName.substr(3);//ID...
|
||
var InputId = "Input"+getVarId;
|
||
var saveId = "Save" + getVarId;
|
||
document.getElementById(getVarId).style.display="none";
|
||
document.getElementById(idName).style.display="";
|
||
}
|
||
if(flag=='saveVar')
|
||
{
|
||
globalID = idName;
|
||
var saveVarId = "New"+idName;//NewID...
|
||
document.getElementById(saveVarId).style.display="none";
|
||
document.getElementById(idName).style.display="";
|
||
document.getElementById(idName).style.cursor="pointer";
|
||
var isEqual = arrResult[3];
|
||
if(isEqual == '1') color="<?php echo $settedColor;?>";
|
||
else color = "<?php echo $notSettedColor;?>";
|
||
document.getElementById(idName).style.color = color;
|
||
//alert(innerStr);
|
||
var doingOtherUlr = arrResult[4];
|
||
if(doingOtherUlr.length>0)
|
||
{
|
||
//alert(doingOtherUlr);
|
||
doingOther(doingOtherUlr);
|
||
}
|
||
}
|
||
document.getElementById(idName).innerHTML = innerStr;
|
||
if(flag == 'getVar')
|
||
{
|
||
document.getElementById(InputId).style.background="<?php echo $inputBkgrdColor;?>";
|
||
document.getElementById(saveId).style.background="<?php echo $saveBkgrdColor;?>";
|
||
//alert(document.getElementById(InputId).value);
|
||
}
|
||
}
|
||
}
|
||
|
||
function doingOther(ulr)
|
||
{
|
||
var browser = navigator.appName;
|
||
if(browser == "Microsoft Internet Explorer")
|
||
{
|
||
request_o = new ActiveXObject("Microsoft.XMLHTTP");
|
||
}
|
||
else
|
||
{
|
||
request_o = new XMLHttpRequest();
|
||
}
|
||
request_o.open("GET",ulr,"false");
|
||
request_o.onreadystatechange = otherReturn;
|
||
request_o.send(null);
|
||
}
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫΪwaitingBkgrdColor
|
||
function otherReturn()
|
||
{
|
||
if(request_o.readyState == 3)//û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
//var strResult = request_o.responseText;
|
||
document.getElementById(globalID).style.background="<?php echo $waitingBkgrdColor;?>";
|
||
}
|
||
if(request_o.readyState == 4)//<2F><><EFBFBD><EFBFBD>
|
||
{
|
||
document.getElementById(globalID).style.background="";
|
||
}
|
||
}
|
||
|
||
function openSet(sysId,oidStr,instanceNo,spanId){
|
||
URL="./handleOpaquePara.php?sysId="+sysId+"&oidStr="+oidStr+"&instanceNo="+instanceNo+"&spanId="+spanId;
|
||
//window.alert(URL);
|
||
var msgWindow = open(URL, 'newWin', 'toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,width=400,height=350');
|
||
msgWindow.focus();
|
||
}
|
||
</script>
|