init web ems all

This commit is contained in:
agtuser committed 2024-09-27 17:13:36 +08:00
1 parent 81c97acbe9
commit 5cc56f8078
4263 files changed
+798779

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
<?php
require("../../inc/header.inc");
?>
<frameset rows="65,*" framespacing="0" border="0" frameborder="0">
<?php
echo "<frame name=\"header\" scrolling=\"auto\" noresize target=\"main\" src=\"commScan.php?$scanURL\" marginwidth=\"0\" marginheight=\"0\">";
echo "<frame name=\"main\" src=\"commDown.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&userType=$userType\" scrolling=\"auto\"target=\"_self\" marginwidth=\"0\" marginheight=\"0\">";
?>
</frameset>
</html>
+291
View File
@@ -0,0 +1,291 @@
<?php
/********************************************************************
程序说明:
功能说明:发送完参数命令后,通过定时扫描数据库,显示命令的操作的状态过程,每隔两秒自动刷新
输入变量:(由发送命令页面传来)$commIdStr,$okURL,$failURL
输出并输入变量:$usedTime,$waitTime,$isFinish,$okURL,$failURL,$commIdStr
作者:
********************************************************************/
require("../../inc/header.inc");
$DEBUG = 0;
global $pubConn;
$commIdStr=$_REQUEST['commIdStr'];
$okURL=$_REQUEST['okURL'];
$failURL=$_REQUEST['failURL'];
//commType 's value
$nReadComm = 1;
$nChangeComm = 2;
$nCreateComm = 3;
$nDeleteComm = 4;
$nLoadIndexComm = 5;
$nReplaceIndexComm=6;
//commState's value
$nProcFail = 0;
$nWaitProc = 1;
$nInProc = 2;
$nOutProc = 3;
$failURL = rawurldecode($failURL);
$okURL = rawurldecode($okURL);
$pubDb = 'OMC_PUB';
$commTable = 'subscriberComm';
$sysConfTable ='sysConf';
$commNum=$_REQUEST['commNum'];
$commType=$_REQUEST['commType'];
$lastTimeFinishNumStr=$_REQUEST['lastTimeFinishNumStr'];
if($commNum <= 0){
$commArr = explode('-',$commIdStr);
$commNum = sizeof($commArr);
}
$maxOverTime = $commNum * 5 + 10; //根据子系统个数和对每个子系统操作的最大延时(5秒)来决定
$maxWaitTime = $commNum * 2;
$maxStopTime = $commNum * 5 + 10;
$maxOfCommId = 50000; //设定命令表的最大值
$isFinish = $_REQUEST['isFinish'];
$waitTime = $_REQUEST['waitTime'];
$stopTime = $_REQUEST['stopTime'];
$usedTime = $_REQUEST['usedTime'];
$isBatchCreate = $_REQUEST['isBatchCreate'];
$batchDelete = $_REQUEST['batchDelete'];
$dataTypeNo = $_REQUEST['dataTypeNo'];
if($DEBUG) echo "<br>if(isFinish != 0 || (waitTime >= maxWaitTime) ||(stopTime > maxStopTime))<br>";
if($DEBUG) echo "<br>if($isFinish != 0 || ($waitTime >= $maxWaitTime) ||($stopTime > $maxStopTime))<br>";
//命令处理完毕
//----------------
if(($isFinish != 0) || ($waitTime >= $maxWaitTime) || ($stopTime > $maxStopTime)){
if($commId >= $maxOfCommId){ //初始化命令表
//先删除表
$dropSql = "DROP TABLE $commTable ";
mysqli_query($pubConn,$dropSql);
//再建一个结构相同的新表
$createSql="CREATE TABLE subscriberComm (
commId smallint(5) unsigned NOT NULL auto_increment,
commType tinyint(1) DEFAULT '0' NOT NULL,
dataTypeNo tinyint(4) DEFAULT '0' NOT NULL,
sysTypeNo smallint(5) unsigned DEFAULT '0' NOT NULL,
sysNo smallint(5) unsigned DEFAULT '0' NOT NULL,
subSysNo smallint(5) unsigned DEFAULT '0' NOT NULL,
indexValueList varchar(255) NOT NULL,
fieldNameList tinytext NOT NULL,
paramType tinyint(4) DEFAULT '0' NOT NULL,
commState tinyint(3) unsigned DEFAULT '0' NOT NULL,
totalNum smallint(5) unsigned DEFAULT '0' NOT NULL,
finishNum smallint(5) unsigned DEFAULT '0' NOT NULL,
sendTime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
bgnTime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
endTime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
remark varchar(200) binary NOT NULL,
PRIMARY KEY (commId),
KEY sysTypeNo (sysTypeNo),
KEY sysNo (sysNo),
KEY subSysNo (subSysNo),
KEY bufferKey (indexValueList)
)
";
mysqli_query($pubConn,$createSql);
}else{
//删除命令表的相关命令
$commArr = explode('-',$commIdStr);
for($i=0;$i<sizeof($commArr);$i++){
if(strlen($commArr[$i]) <=0){
continue;
}
$deleteSql = "DELETE FROM $commTable WHERE commId='$commArr[$i]'";
if($DEBUG) echo "<br>deleteSql = $deleteSql";
mysqli_query($pubConn,$deleteSql);
echo mysqli_error($pubConn);
}
}
// 重定向返回指定页
if($isFinish != 0){
if($isFinish > 0){
echo "<b><font size=3 color=blue>Finished!!</font></b>";
if($commType == $nLoadIndexComm){
sleep(8);//等8秒,这样数据库插入才能完全完成
}
if($DEBUG) echo "<br>okURL=$okURL";
if($DEBUG) exit();
echo " <meta http-equiv=\"refresh\" content=\"2; url=$okURL\"> ";
}elseif($isFinish == -1){
echo "<b><font size=3 color=black>Failed in some system!!</font></b>";
if($DEBUG) exit();
echo " <meta http-equiv=\"refresh\" content=\"2; url=$okURL\"> ";
}else{
echo "<b><font size=3 color=red>Failed!!</font></b>";
if($DEBUG) exit();
echo " <meta http-equiv=\"refresh\" content=\"2; url=$failURL\"> ";
}
}elseif($usedTime >= $maxOverTime && $stopTime == 1){
echo "<b><font size=3 color=red>Stoped!!</font></b>";
if($DEBUG) exit();
echo " <meta http-equiv=\"refresh\" content=\"2; url=$failURL\"> ";
}else{ //$usedTime >= $maxOverTime
echo "<b><font size=3 color=red>Timeout!!</font></b>";
if($DEBUG) exit();
echo " <meta http-equiv=\"refresh\" content=\"2; url=$failURL\"> ";
}
exit();
}//end of if($isFinish....)
//显示命令执行状态
//-----------------------------
$showTime = $usedTime*2;
echo "<font size=2>Time:$showTime s</font>";
$okNum = 0;
$failNum = 0;
$commNum = 0;
$commArr = explode('-',$commIdStr);
$thisTImeFinishNumstr='';
$lastTimeFinishNumArr = explode('-',$lastTimeFinishNumStr);
for($i=0;$i<sizeof($commArr);$i++){
if(strlen($commArr[$i]) <=0){ continue;}
$commNum++;
$commSql = "SELECT * FROM $commTable WHERE commId= $commArr[$i]";
if($DEBUG) echo "<br>get command = $commSql";
$commResult = mysqli_query($pubConn,$commSql);
if(mysqli_num_rows($commResult) <= 0){
echo "<br>Can not find this command's info in datebase";
exit();
}
$commRows = @mysqli_fetch_array($commResult);
$sysTypeNo = $commRows[sysTypeNo];
$sysNo = $commRows[sysNo];
$subSysNo = $commRows[subSysNo];
$commType = $commRows[commType];
$paramType = $commRows[paramType];
$objId = $commRows[objId];
$commState = $commRows[commState];
$indexValueList = $commRows[indexValueList];
$fieldNameList = $commRows[fieldNameList];
$remark = $commRows[remark];
if ($DEBUG)echo "commState=$commState, commRemakr=$remark<br>";
//获取该系统类型的snmp头和类型名称
if(!isset($sysTypeName)){
$sysConfSql = "SELECT snmpHead,sysTypeName FROM $sysConfTable WHERE sysTypeNo='$sysTypeNo'";
if($DEBUG) echo "<br>get conf = $sysConfSql";
$sysConfResult = mysqli_query($pubConn,$sysConfSql);
echo mysqli_error($pubConn);
$sysConfRows = @mysqli_fetch_array($sysConfResult);
$sysTypeName = $sysConfRows[sysTypeName];
$snmpHead = $sysConfRows[snmpHead];
}
$sysName = $sysTypeName.'_'.$sysNo.'_'.$subSysNo;
//echo "<br><font size=2> $sysName 's</font>";
$objIdStr=$snmpHead.'.'.$objId;
//echo "<font size=2 color=blue>$objIdStr</font>";
switch($commType){
case $nReadComm:
$showInfo="Read $indexValueList from $sysName";
break;
case $nChangeComm:
$showInfo="Change $indexValueList's field[$fieldNameList] in $sysName";
break;
case $nCreateComm:
$showInfo="Create $indexValueList to $sysName";
break;
case $nDeleteComm:
$showInfo="Delete $sysName's $indexValueList";
break;
case $nLoadIndexComm:
$showInfo="Load $sysName's subscriber Data ";
break;
case $nReplaceIndexComm:
$showInfo="Replace Index $indexValueList -> $remark in $sysName";
break;
default:
echo "<font size=2> Unknown Command Type</font>";
exit();
}
echo "<font size=2> $showInfo</font>";
switch($commState){
case 0: //process failed
$failNum++;
echo "<br><b><font size=2 color=red> $commRows[remark] </font></b>";
insertLog("$showInfo Failed:$remark");
sleep(1);
break;
case 1: //wait process
$waitTime++;
break;
case 2: //in process
$waitTime = 0;
//只要有一个命令的完成数在增长,就认为该组命令在运行,否则认为命令处理超时
if($DEBUG) echo "====> {$commRows[finishNum]} > {$lastTimeFinishNumArr[$i]}";
if($commRows[finishNum] > $lastTimeFinishNumArr[$i]){
$stopTime = 0;
}else{
$stopTime++;
}
omcProgressBar($commRows[totalNum],$commRows[finishNum]);
$thisTimeFinishNumStr .=$commRows[finishNum].'-';
break;
case 3: //process finished
$okNum++;
omcProgressBar(100,100);
insertLog("$showInfo OK");
break;
default:
echo "<font size=3>Unknown Command State</font>";
exit();
}
echo "<br><br>";
}//end of for($i=0;$i<sizeof($commArr);$i++)
if($DEBUG) echo"<br>$commNum =?= $finishNum";
if($commNum == $okNum){
$isFinish = 1;
}elseif($failNum > 0 && $okNum > 0){
$isFinish = -1;
}elseif($commNum == $failNum){
$isFinish = -2;
}else{
$isFinish = 0;
}
//当删除用户时,只要不是"回应超时",都删除OMC数据库的用户
if($commType == $nDeleteComm && $commState != $nWaitProc && $commState != $nInProc){
if($DEBUG) echo"<br>commType == DeleteComm ($commType == $nDeleteComm)";
if($DEBUG) echo"<br>remark={$commRows[remark]}";
if($DEBUG) sleep(5);
if( $commRows[remark] != "response timeout"){
if(!strstr($commRows[remark],"Can not delete an in used subscriber, please disable first"))
$isFinish = 1;
}
}
if($DEBUG) echo"<br>lastTimeFinishNumStr=$lastTimeFinishNumStr";
if($DEBUG) echo"<br>thisTimeFinishNumStr=$thisTimeFinishNumStr";
$lastTimeFinishNumStr = $thisTimeFinishNumStr;
//刷新返回
//--------------
$usedTime++; //总时间
$failURL= rawurlencode($failURL);
$okURL = rawurlencode($okURL);
//保留变量值,传到下次刷新
$keepStr= "usedTime=$usedTime&waitTime=$waitTime&isFinish=$isFinish&stopTime=$stopTime&failURL=$failURL&okURL=$okURL&commIdStr=$commIdStr&commNum=$commNum&lastTimeFinishNumStr=$lastTimeFinishNumStr&commType=$commType";
if($DEBUG) echo "<br>keepStr=$keepStr";
/*
if ( 1!=$searchInServer ) {
require("commDown.php");
}
*/
sleep(5);
$PHP_SELF = $_SERVER['PHP_SELF'];
?>
<script type="text/javascript">
window.location.href="<?php echo "$PHP_SELF?$keepStr"; ?>";
</script>
+499
View File
@@ -0,0 +1,499 @@
<?php
$DEBUG=0;
$sysTypeNo=$_REQUEST['sysTypeNo'];
$bufferNo=$_REQUEST['bufferNo'];
$keyValue=$_REQUEST['keyValue'];
$isTryCreate=$_REQUEST['isTryCreate'];
global $OMC_server,$pubConn;
if(isset($sysId)){
$sysIdArr = explode('_',$sysId);
$sysTypeNo = $sysIdArr[0];
$sysNo = $sysIdArr[1];
$subSysNo = $sysIdArr[2];
}elseif(isset($sysTypeNo)){
//����vlrû��heartbeat,��Ҫ����MSC��״̬��ȷ�������ĸ�ϵͳ
if($sysTypeNo == '325'){
$getSysIdSql = "SELECT sysNo,subSysNo FROM OMC_PUB.sysInfo
WHERE sysTypeNo='325'
ORDER BY baseStat DESC,updateTime DESC,sysNo,subSysNo";
}else{
$getSysIdSql = "SELECT sysNo,subSysNo FROM OMC_PUB.sysInfo
WHERE sysTypeNo='$sysTypeNo'
ORDER BY baseStat DESC,updateTime DESC,sysNo,subSysNo";
}
if($DEBUG) echo "<br>getSysIdSql=$getSysIdSql";
//debug_log("/tmp/debug.txt",$getSysIdSql);
$getSysIdResult=mysqli_query($pubConn,$getSysIdSql);
echo mysqli_error($pubConn);
if(mysql_errno())
debug_log("/tmp/debug.txt","remark-1");
if(mysqli_num_rows($getSysIdResult) > 0){
$getSysIdRows=mysqli_fetch_array($getSysIdResult);
$sysNo = $getSysIdRows[sysNo];
$subSysNo = $getSysIdRows[subSysNo];
$sysId = $sysTypeNo.'_'.$sysNo.'_'.$subSysNo;
}else{
echo "<br><font size=3 color=red>Can not find this system's IP in system List,";
echo "Please add it!</font>";
exit(0);
}
}else{
echo "Can not find sysTYpeNo!!";
exit(0);
}
if(($isBatchCreate>0&&$isCreate>0)&&(!isset($batchNum)||$batchNum>100||$batchNum<=0)){
echo "<SCRIPT LANGUAGE=\"JavaScript\">";
echo "alert(\"The batch amount should be >0 and <= 100. \")";
echo "</SCRIPT>";
echo " <meta http-equiv=\"refresh\" content=\"0; url=$PHP_SELF?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&isTryCreate=1&isBatchCreate=1\">";
exit();
}
$objDb='OBJ_'.$sysTypeNo;
$objConn = mysqli_connect($OMC_server[0]['host'],$OMC_server[0]['user'],$OMC_server[0]['password'], $objDb);
$dataTypeNo = (strlen($dataTypeNo) > 0)?$dataTypeNo:0;
$confTable = 'subsParamConf_'.$dataTypeNo;
if($sysTypeNo==390 || $sysTypeNo == 365 || $sysTypeNo == 366){
$getConfSql="SELECT sysTypeName,dataTypeNo,indexFieldName,subsDataTable,tmpDataTable
FROM $sysSubsConfTable,$systemConfTable
WHERE $sysSubsConfTable.sysTypeNo='$sysTypeNo'
AND $systemConfTable.sysTypeNo='$sysTypeNo'
AND $sysSubsConfTable.dataTypeNo='$dataTypeNo'
AND $sysSubsConfTable.sysNo='$sysNo'
";
}else{
$getConfSql="SELECT sysTypeName,dataTypeNo,indexFieldName,subsDataTable,tmpDataTable
FROM $sysSubsConfTable,$systemConfTable
WHERE $sysSubsConfTable.sysTypeNo='$sysTypeNo'
AND $systemConfTable.sysTypeNo='$sysTypeNo'
AND $sysSubsConfTable.dataTypeNo='$dataTypeNo'
";
}
//if($DEBUG)
//echo "<br>getConfSql=$getConfSql";
//exit();
$getConfResult=mysqli_query($pubConn,$getConfSql);
echo mysqli_error($pubConn);
if(mysql_errno())
debug_log("/tmp/debug.txt","remark-2");
$getConfRows=mysqli_fetch_array($getConfResult);
$sysTypeName =$getConfRows['sysTypeName'];
$indexFieldName =$getConfRows['indexFieldName'];
$srcDataTable =$getConfRows['subsDataTable'];
$tmpDataTable =$getConfRows['tmpDataTable'];
global $userName;
if($sysTypeName=="VSS") $sysTypeName="VMS";
$srcDataConn = mysqli_connect($OMC_server[0]['host'],$OMC_server[0]['user'],$OMC_server[0]['password'], $sysTypeName."_DB");
if($DEBUG)echo "<br>srcDataTable:$srcDataTable<br>tmpDataTable:$tmpDataTable";
//�����û��Ƿ������˲���
$editFlag = false;
if($editFlag < 0){
$chkFlagSql = "SELECT editFlag FROM $tmpDataTable WHERE $indexFieldName = '$keyValue'";
if($DEBUG) echo "<br>chkFlagSql=$chkFlagSql";
$result=mysqli_query($objConn,$chkFlagSql);
echo mysqli_error($objConn);
if(mysql_errno())
debug_log("/tmp/debug.txt","remark-3");
$flagRow=mysqli_fetch_array($result);
$editFlag = $flagRow[0];
if($editFlag > 0){
echo "This subscriber is be other one editing!!,please wait and try again";
}else{
$setFlagSql = "UPDATE $tmpDataTable SET editFlag = '1' WHERE $indexFieldName = '$keyValue'";
mysqli_query($objConn,$setFlagSql);
}
}
$needSaveEditValue = 0;
$needSendComm = 0;
$indexValueList = $keyValue;
//*********��ȡһ���û�***************************
if($isRead > 0){//$getFromSys
$commType = $nReadComm;
$needSendComm = 1;
}
//*********�޸�һ���û�*************************
if($isChange > 0){
$needSaveEditValue = 1;
$commType = $nChangeComm;
$needSendComm = 1;
}
//*********����һ���û�***************************
if($isCreate > 0){
if($isCreate == 2){//create in omc
$needSaveEditValue = 1;
}else{//$isCreate == 2,create in server
$commType = $nCreateComm;
$needSendComm = 1;
$needSaveEditValue = 1;
}
}
//*********ɾ��һ���û�***************************
if($isDelete > 0){
$commType = $nDeleteComm;
$needSendComm = 1;
}
//*********���������û�***************************
if($isLoadIndex > 0){
$commType = $nLoadIndexComm;
$needSendComm = 1;
}
//*********�滻�û�index����***************************
if($isReplaceIndex > 0){
$chkIndexPass = 0;
if($isConfirmed > 0){
$chkIndexPass=1;
if($DEBUG) echo "<br>newIndexValue=$newIndexValue";
//���newIndexValue������
switch($sysTypeNo){
case '330':
//���㳤��
for($i=strlen($newIndexValue);$i<16;$i++){
$imsi='0'.$newIndexValue;
}
$oldMccMnc=substr($keyValue,0,6);
$newMccMnc=substr($newIndexValue,0,6);
/*
if($oldMccMnc != $newMccMnc){
echo "<font color=red>Please Check new IMSI's MCC AND MNC!<font>";
$chkIndexPass=0;
}*/
if($newIndexValue == $keyValue){
echo "<font color=red>New IMSI Number same as old's!<font>";
$chkIndexPass=0;
}
break;
default:
echo "Unknown sysTypeNo($sysTypeNo)!";
exit();
}
if($chkIndexPass > 0){
$commType = $nReplaceIndexComm;
$needSendComm = 1;
}
}
if($chkIndexPass == 0){
if($DEBUG) echo "<br>";
echo "\n <form method=\"POST\" name=\"update\" action=\"$PHP_SELF\" >";
echo "\n <table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\"> ";
$showIndexName=strtoupper($indexFieldName);
echo "\n <tr bgcolor=\"#E6E6E6\"><th colspan=\"2\">Replace $showIndexName</th></tr>";
echo "\n <tr><td>Old $showIndexName:</td><td>$keyValue</td></tr>";
echo "\n <tr><td>New $showIndexName:</td><td>";
echo "\n <input type=\"text\" name=\"newIndexValue\" maxlength=\"16\" size=\"18\" value=\"$newIndexValue\" class=\"text\">";
echo "\n </td></tr></table>";
echo "<br> &nbsp;&nbsp;&nbsp;&nbsp; <input type=\"submit\" value=\"Replace\" class=\"button\">";
echo "\n <input type=\"hidden\" name=\"sysId\" value=\"$sysId\">";
echo "\n <input type=\"hidden\" name=\"dataTypeNo\" value=\"$dataTypeNo\">";
echo "\n <input type=\"hidden\" name=\"indexFieldName\" value=\"$indexFieldName\">";
echo "\n <input type=\"hidden\" name=\"keyValue\" value=\"$keyValue\">";
echo "\n <input type=\"hidden\" name=\"isReplaceIndex\" value=\"1\">";
echo "\n <input type=\"hidden\" name=\"isConfirmed\" value=\"1\">";
echo "</form>";
exit();
}
}
//---------�������------------------------------
if($needSaveEditValue == 1){
if($isBatchCreate>0&&$isCreate>0){
$stopFlag=0;
for($tmpNum=0;$tmpNum<$batchNum;$tmpNum++){
$counter=0;
for($i=$bgnNo;$i<$endNo;$i++){
if(${'checkBox_'.$i} > 0){
$editValue=${'editValue_'.$i};
$tmpFieldName = ${'fieldName_'.$i};
if($tmpFieldName == $indexFieldName){
if($tmpNum==0)
$indexValueList = $editValue;
$tmpLen=strlen($editValue);
$tmpEditValue=$editValue[$tmpLen-4].$editValue[$tmpLen-3].$editValue[$tmpLen-2].$editValue[$tmpLen-1];
$tmpEditValue = $tmpEditValue+$tmpNum;
if($tmpEditValue%10000==0 && $tmpNum!=0){
$batchNum=$tmpNum;
$stopFlag=1;
}
$tmpEditValue=''.$tmpEditValue;//ȷ��tmpEditValueΪ�ַ���
$tmpEditValue=omc_keep_length($tmpEditValue,'0',4);
$editValue[$tmpLen-4]= $tmpEditValue[0];
$editValue[$tmpLen-3]= $tmpEditValue[1];
$editValue[$tmpLen-2]= $tmpEditValue[2];
$editValue[$tmpLen-1]= $tmpEditValue[3];
//echo "<br>editValue=$editValue";
}
if($sysTypeNo==330&&$tmpFieldName == 'inter_msisdn'){
$tmpEditValueArr=explode("E",$editValue);
$editValue=$tmpEditValueArr[0];
$tmpLen=strlen($editValue);
$tmpEditValue=$editValue[$tmpLen-4].$editValue[$tmpLen-3].$editValue[$tmpLen-2].$editValue[$tmpLen-1];
$tmpEditValue = $tmpEditValue+$tmpNum;
if($tmpEditValue%10000==0 && $tmpNum!=0){
$batchNum=$tmpNum;
$stopFlag=1;
}
$tmpEditValue=''.$tmpEditValue;//ȷ��tmpEditValueΪ�ַ���
$tmpEditValue=omc_keep_length($tmpEditValue,'0',4);
$editValue[$tmpLen-4]=$tmpEditValue[0];
$editValue[$tmpLen-3]=$tmpEditValue[1];
$editValue[$tmpLen-2]=$tmpEditValue[2];
$editValue[$tmpLen-1]=$tmpEditValue[3];
$editValue=omc_keep_length($editValue,'E',18,0);
//echo "<br>editValue=$editValue";
}
if($counter == 0){
$setValueStr = "$tmpFieldName = '$editValue'";
$fieldNameList = "$tmpFieldName";
}else{
$setValueStr .= ", $tmpFieldName = '$editValue'";
$fieldNameList .= ",$tmpFieldName";
}
$counter++;
}
}
if($stopFlag==1)
break;
if($isCreate == 2){//��omc�ϴ���
$saveSql = "REPLACE $srcDataTable SET $setValueStr";
$saveResult = mysqli_query($srcDataConn,$saveSql);
}else{
$saveSql = "REPLACE $tmpDataTable SET $setValueStr";
$saveResult = mysqli_query($objConn,$saveSql);
echo mysqli_error($objConn);
}
if($DEBUG)
echo "<br>saveSql = $saveSql <br>objDb=$objDb";
echo mysqli_error($pubConn);
if(mysql_errno())
debug_log("/tmp/debug.txt","remark-4");
}
$keyValue=$indexValueList;
if($isCreate == 2){//��omc�ϴ���
echo "<script LANGUAGE=\"JavaScript\">";
echo "\n window.location.href=\"./subscriberListDown.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo\";";
echo "\n </script>";
exit();
}
}else{
$counter=0;
//echo "bgnNo=$endNo<br>";
for($i=$bgnNo;$i<$endNo;$i++){
//echo "checkBox_$i=".${'checkBox_'.$i}."<br>";
if(${'checkBox_'.$i} > 0){
$editValue=${'editValue_'.$i};
$tmpFieldName = ${'fieldName_'.$i};
if($isCreate > 0){
if($tmpFieldName == $indexFieldName){
$indexValueList = $editValue;
}
}else{
if($tmpFieldName == $indexFieldName){
continue;
}
}
if($counter == 0){
$setValueStr = "$tmpFieldName = '$editValue'";
$fieldNameList = "$tmpFieldName";
}else{
$setValueStr .= ", $tmpFieldName = '$editValue'";
$fieldNameList .= ",$tmpFieldName";
}
$counter++;
}
}
if($isCreate){
$keyValue=$indexValueList;
if($isCreate == 2){//��omc�ϴ���
$saveSql = "REPLACE $srcDataTable SET $setValueStr";
$saveResult = mysqli_query($srcDataConn,$saveSql);
}else{
$saveSql = "REPLACE $tmpDataTable SET $setValueStr";
$saveResult = mysqli_query($objConn,$saveSql);
echo mysqli_error($objConn);
}
}else{
$saveSql = "UPDATE $tmpDataTable SET $setValueStr
WHERE $indexFieldName = '$keyValue'
";
$saveResult = mysqli_query($objConn,$saveSql);
echo mysqli_error($objConn);
}
if($DEBUG) echo "<br>saveSql = $saveSql <br>objDb=$objDb";
//if(mysql_errno())
//debug_log("/tmp/debug.txt","remark-5:$saveSql,tmpFieldName=$tmpFieldName,editValue'=$editValue'");
echo mysqli_error($pubConn);
}
}
//if($DEBUG && $_SERVER['REQUEST_METHOD'] == "POST") exit();
//echo "$sysId";
//exit();
//---------���������תҳ��----------------------------
global $objConn, $srcDataConn;
if($needSendComm == 1 && isset($commType)){
if($commType == $nLoadIndexComm || $commType == $nDeleteComm){
if($commType == $nLoadIndexComm){
$okURL ="./subscriberListDown.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&sysNo=$sysNo&sysId=$sysId";
$failURL ="./subscriberListDown.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&sysNo=$sysNo&sysId=$sysId";
}else{
$okURL ="./subscriberListDown.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&sysNo=$sysNo&sysId=$sysId&commType=$nDeleteComm&keyValue=$keyValue";
$failURL = "$PHP_SELF?sysId=$sysId&bgnNo=$bgnNo&keyValue=$keyValue&canSetNum=$canSetNum&bufferNo=$bufferNo&dataTypeNo=$dataTypeNo";
}
}else{
if($commType == $nReplaceIndexComm){
$okURL = "$PHP_SELF?sysId=$sysId&bgnNo=$bgnNo&keyValue=$newIndexValue&canSetNum=$canSetNum&bufferNo=$bufferNo&dataTypeNo=$dataTypeNo&isRead=1";
}elseif($commType == $nCreateComm){
if($isBatchCreate==1)
$okURL = "$PHP_SELF?sysId=$sysId&bgnNo=$bgnNo&keyValue=$keyValue&canSetNum=$canSetNum&bufferNo=$bufferNo&dataTypeNo=$dataTypeNo&isBatchCreate=$isBatchCreate";
else
$okURL = "$PHP_SELF?sysId=$sysId&bgnNo=$bgnNo&keyValue=$keyValue&canSetNum=$canSetNum&bufferNo=$bufferNo&dataTypeNo=$dataTypeNo&isRead=1";
}else{
$okURL = "$PHP_SELF?sysId=$sysId&bgnNo=$bgnNo&keyValue=$keyValue&canSetNum=$canSetNum&bufferNo=$bufferNo&dataTypeNo=$dataTypeNo";
}
$failURL = "$PHP_SELF?sysId=$sysId&bgnNo=$bgnNo&keyValue=$keyValue&canSetNum=$canSetNum&bufferNo=$bufferNo&dataTypeNo=$dataTypeNo&isBatchCreate=$isBatchCreate";
}
if($DEBUG) echo "<br>okURL =$okURL ";
sleep(1);
if($commType == $nReplaceIndexComm){
if($DEBUG) echo "<br>subsCommSend(sysId,dataTypeNo,indexValueList,fieldNameList,commType,newIndexValue)";
if($DEBUG) echo "<br>subsCommSend($sysId,$dataTypeNo,$indexValueList,$fieldNameList,$commType,$newIndexValue)";
$commIdStr = subsCommSend($sysId,$dataTypeNo,"$indexValueList","$fieldNameList",$commType,$newIndexValue);
}else{
if($DEBUG) echo "<br>subsCommSend(sysId,dataTypeNo,indexValueList,fieldNameList,commType)";
if($DEBUG) echo "<br>subsCommSend($sysId,$dataTypeNo,$indexValueList,$fieldNameList,$commType)";
if($isBatchCreate==1){
for($tmpNum=0;$tmpNum<$batchNum;$tmpNum++){
$tmpCommIdStr = subsCommSend($sysId,$dataTypeNo,"$indexValueList","$fieldNameList",$commType);
$tmpLen=strlen($indexValueList);
$tmpIndexValueList=$indexValueList[$tmpLen-4].$indexValueList[$tmpLen-3].$indexValueList[$tmpLen-2].$indexValueList[$tmpLen-1];
$tmpIndexValueList = $tmpIndexValueList+1;
$tmpIndexValueList=''.$tmpIndexValueList;//ȷ��tmpIndexValueListΪ�ַ���
$tmpIndexValueList=omc_keep_length($tmpIndexValueList,'0',4);
$indexValueList[$tmpLen-4]=$tmpIndexValueList[0];
$indexValueList[$tmpLen-3]=$tmpIndexValueList[1];
$indexValueList[$tmpLen-2]=$tmpIndexValueList[2];
$indexValueList[$tmpLen-1]=$tmpIndexValueList[3];
//echo "<br>commIdStr=subsCommSend($sysId,$dataTypeNo,\"$indexValueList\",\"$fieldNameList\",$commType)";
$commIdStr=$commIdStr.$tmpCommIdStr;
}
}else
$commIdStr = subsCommSend($sysId,$dataTypeNo,"$indexValueList","$fieldNameList",$commType);
//exit();
}
if($DEBUG) {
echo "<br>commIdStr=subsCommSend($sysId,$dataTypeNo,\"$indexValueList\",\"$fieldNameList\",$commType)";
}
if(isset($commIdStr) && $commIdStr != -1){
if($commType == $nLoadIndexComm){
$srcDataTableArr=explode('.',$srcDataTable);
$srcDataDb=$srcDataTableArr[0];
$clearDataSql="DELETE FROM $srcDataTable";
mysqli_query($srcDataConn,$clearDataSql);
if($DEBUG)
echo "mysqli_query($srcDataConn,$clearDataSql);<br>";
$clearDataSql="DELETE FROM $tmpDataTable";
if($DEBUG)
echo "mysqli_query($srcDataConn,$clearDataSql);<br>";
mysqli_query($objConn,$clearDataSql);
mysqli_error($srcDataConn);
mysqli_error($objConn);
}
$failURL = urlencode($failURL);
$okURL = urlencode($okURL);
$scanURL = "commIdStr=$commIdStr&okURL=$okURL&failURL=$failURL";
if($DEBUG) echo "<br>scanURL = $scanURL";
if($DEBUG) exit();
echo " <meta http-equiv=\"refresh\" content=\"0; url=./commScan.php?$scanURL&sysId=$sysId&sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&userType=$userType&searchInServer=$searchInServer&isLoadIndex=$isLoadIndex&isBatchCreate=$isBatchCreate\"> ";
exit();
}else{
echo "<br><font size=3 color=red>SEND COMMAND ERROR!<br></font>";
}
}
//��Ҫ�༭�����ݵ�����ʱ��
$getDataSql="SELECT * FROM $srcDataTable WHERE $indexFieldName='$keyValue'";
if($DEBUG)
echo "<br>getDataSql=$getDataSql";
$result=mysqli_query($srcDataConn,$getDataSql);
$fieldNum=mysqli_num_fields($result);
if(mysql_errno())
debug_log("/tmp/debug.txt","remark-6");
echo mysqli_error($srcDataConn);
if($DEBUG)
echo "<br>fieldNum=$fieldNum";
$tmpRow=mysqli_fetch_array($result);
if($DEBUG) echo "<br>tmpRow[mo_expiration_date]=$tmpRow[mo_expiration_date]";
#if($DEBUG) echo "<br>valuestr=$valueStr,bufferNo=$bufferNo";
for($i=0;$i<$fieldNum;$i++){
$valueStr = "$valueStr ,'$tmpRow[$i]'";
# if($DEBUG) echo "<br>i:$i,tmpRow:$tmpRow[$i],valuestr=$valueStr";
}
$updateSql = "REPLACE $tmpDataTable VALUES('0' $valueStr)";
mysqli_query($objConn,$updateSql);
#if($DEBUG) echo "<br>bufferNo=$bufferNo";
if($DEBUG) echo "<br>updateSql=$updateSql";
//exit();
if(mysql_errno())
debug_log("/tmp/debug.txt","remark-7");
echo mysqli_error($objConn);
// echo"<br>objDb =$isTryCreate <br> ParamSql = $paramSql <br> ";
//����������û�������ȱʡֵ
if($isTryCreate > 0){
//�ڲ��������ȡ��˵��������ʱ������ȡ����ص�ֵ
$paramSql = " SELECT * FROM $confTable
WHERE $confTable.operType > '0'
ORDER BY level_1,level_2,level_3,level_4,level_5,level_6,level_7,level_8,level_9,level_10
";
if($DEBUG)
echo"<br>objDb =$objDb <br> ParamSql = $paramSql <br> ";
$paramResult = mysqli_query($objConn,$paramSql);
if(mysql_errno())
debug_log("/tmp/debug.txt","remark-8");
echo mysqli_error($objConn);
$i=0;
while($paramRows = @mysqli_fetch_array($paramResult)){
$tmpRow[$paramRows[fieldName]]=$paramRows[initValue];
}
if($DEBUG) echo "<br>tmpRow[mo_expiration_date]=$tmpRow[mo_expiration_date]";
}
?>
+585
View File
@@ -0,0 +1,585 @@
<?php
/*********************************************************
程序说明:(和paramEditPreview.php保持一致)
功能说明:本程序实现参数编辑模板代码的产生,保存,预览
调用关系:调用: connectdb.inc,inc/header.inc
被调用:
变量说明:
返回值:无
作者:
修改注释:
NO.1
姓名:
时间:
修改说明:
*********************************************************/
require("../../inc/header.inc");
global $OMC_server;
$DEBUG = 0;
$TEST=$_REQUEST['TEST'];
$sysTypeNo=$_REQUEST['sysTypeNo'];
$dataTypeNo=$_REQUEST['dataTypeNo'];
$keyId=$_REQUEST['keyId'];
$setValue=$_REQUEST['setValue'];
$set=$_REQUEST['set'];
$inputName=$_REQUEST['inputName'];
$TEST = ($TEST > 0)?$TEST:0;
$objConn = mysqli_connect($OMC_server[0]['host'],$OMC_server[0]['user'],$OMC_server[0]['password'], "OBJ_".$sysTypeNo);
//value Type
$nInteger = 2;
$nAscStr = 3;
$nOctStr = 4;
function omcGetObjDb($sysTypeNo){
$dbName = 'OBJ_'.$sysTypeNo;
return($dbName);
}
function omcGetObjTbl($sysTypeNo,$tableType,$dataTypeNo){
$dbName = 'OBJ_'.$sysTypeNo;
$tableName = $dbName.'.subsParamConf_'.$dataTypeNo;
return($tableName);
}
/*
function omcStrFill($string,$defLen,$fillWay='high',$fillChar='0'){
if(strlen($string) <= $defLen){
$fillLen=$defLen - strlen($string);
for($i=0;$i<$fillLen;$i++){
if($fillWay == 'low'){
$string = $string.$fillChar;
}else{
$string = $fillChar.$string;
}
}
return($string);
}else{
echo "<br>Error in omcStrFill:the defLen < lengh of string!!";
echo "<br>defLen=$defLen and string=$string!!";
exit();
}
}
*/
$sysConfTable = 'OMC_PUB.sysConf';
$sysTypeNo = (isset($sysTypeNo)?$sysTypeNo:0);
$pubDb ='OMC_PUB';
$objDb = omcGetObjDb($sysTypeNo);
$paramConfTable = omcGetObjTbl($sysTypeNo,paramConf,$dataTypeNo);
$maxLevelNum = 10;
if($DEBUG) echo "<br>A=$paramConfTable<br>";
//----------------------
//选择语言版本
if($language == 'eng'){
$objNameField=name_2;
$objSetField=setTemplate_2 ; //语种2
}else{
$objNameField=name_1;
$objSetField=setTemplate_1 ; //语种1(默认语种)
}
//-----------------------
//=======================Get value From submit===================
if($set == 'Set'){
//sort by offset
$unitNum=$_POST['unitNum'];
$inputName = $_POST['inputName'];
for($i=1;$i<=$_POST['unitNum'];$i++){
// $tmpDef = ${'unitDef_'.$i};
// $tmpValue = ${'unit_'.$i};
$tmpDef = 'unitDef_'.$i;
$tmpValue = 'unit_'.$i;
$tmpDef = $_POST[$tmpDef];
$tmpValue = $_POST[$tmpValue];
if($DEBUG) echo "<br>tmpDef = $tmpDef";
$defArr[$i] = $tmpDef;
$tmpDefArr=explode('-',$tmpDef);
$sortArr[$i] = $tmpDefArr[0];
$valueArr[$i] = $tmpValue;
}
$lastValue = '';
$k = 0;
asort($sortArr);
for(reset($sortArr); $key = key($sortArr); next($sortArr)){
if($DEBUG) echo "<br>sortArr[$key] = {$sortArr[$key]}";
if($DEBUG) echo "<br>unitValue = {$valueArr[$key]}";
$unitValue = $valueArr[$key];
if($DEBUG) echo "<br>defArr[$key] = {$defArr[$key]}";
$unitDefArr = explode('-',$defArr[$key]); //例:0.0-0.7-input -toDec-high-0
if(sizeof($unitDefArr) <= 1){
if($DEBUG) echo "<br>nothing,just a name";
continue;
}
$bgnOffset = $unitDefArr[0];
$endOffset = $unitDefArr[1];
$operType = $unitDefArr[2];
$valueType = $unitDefArr[3];
$fillWay = $unitDefArr[4];
$fillChar = $unitDefArr[5];
$bgnOffsetArr = explode('.',$bgnOffset);
$bgnByte = $bgnOffsetArr[0];
$bgnBit = $bgnOffsetArr[1];
$endOffsetArr = explode('.',$endOffset);
$endByte = $endOffsetArr[0];
$endBit = $endOffsetArr[1];
$byteLen = $endByte - $bgnByte + 1;
$byteValue = '';
if($DEBUG) echo "<br>valueType = $valueType";
switch($valueType){
case 'toDec':
if($bgnBit > 0 ||$endBit < 7){
$bitLen = $byteLen*8 - $bgnBit - (7 - $endBit) ; //1 BYTE = 8 bit
$bitValue = DecBin($unitValue);
if($DEBUG) echo "<br>bitValue = $bitValue ";
$bitValue = omcStrFill($bitValue,$bitLen,$fillWay,$fillChar);
if($DEBUG) echo "<br>omcStrFill($bitValue,$bitLen,$fillWay,$fillChar)";
$bitValueArr[$k] = $bitValue;
if($DEBUG) echo "<br>bitValueArr[$k] = {$bitValueArr[$k]}";
if($endBit == 7){//发现这个单元结束,并没有跨byte,这时需要组成一个byte值
$bitValue = '';
for($bitNo=0; $bitNo<=$k; $bitNo++){
if($DEBUG) echo "<br>bitValueArr[$bitNo] = {$bitValueArr[$bitNo]}";
$bitValue = $bitValueArr[$bitNo].$bitValue;
}
$k=0;
if($DEBUG) echo "<br>bitValue = $bitValue";
$byteLen = strlen($bitValue) / 8;
if($DEBUG) echo "<br>byteLen = $byteLen";
$byteValue = BinDec($bitValue);
$byteValue = DecHex($byteValue);
$strLen = $byteLen*2;
if($DEBUG) echo "<br>omcStrFill($byteValue,$strLen,$fillWay,$fillChar)";
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
}else{//否则,继续组合下一个bit组
$byteValue = '';
$k++;
}
}else{
$byteValue = DecHex($unitValue);
$strLen = $byteLen*2;
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
if($DEBUG) echo "<br>omcStrFill($byteValue,$strLen,$fillWay,$fillChar)";
}
if($DEBUG) echo "<br>byteValue = $byteValue";
break;
case 'keepDec':
//echo "<br>Error:keepDec";
$byteValue = $unitValue - 0;
break;
case 'toHex':
echo "<br>Error:toHex";
break;
case 'keepHex':
if($bgnBit > 0 || $endBit < 7){//这里的处理不够全面,没有对=7的进行收尾
$byteValue = $unitValue;
$strLen = $byteLen;
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
$bitValue = DecBin(HexDec($byteValue));
$byteValue='';
$bitLen = $byteLen*8 - $bgnBit - (7 - $endBit) ; //1 BYTE = 8 bit
$bitValue = omcStrFill($bitValue,$bitLen,'high','0');
if($DEBUG) echo "<br>bitValue = $bitValue";
$bitValueArr[$k] = $bitValue;
$k++;
}else{
$k=0;
$byteValue = $unitValue;
$strLen = $byteLen*2;
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
if($DEBUG) echo "<br>omcStrFill($byteValue,$strLen,$fillWay,$fillChar)";
}
break;
case 'toAsc':
if($bgnBit > 0 ||$endBit < 7){
echo "<br>Error:toAsc";
exit(1);
}else{
$tmpLen=strlen($unitValue);
for($i=0;$i<$tmpLen;$i++){
$unitChar = substr($unitValue,$i,1);
$decValue = ord($unitChar); //ascii -> dec
$byteValue .= DecHex($decValue);
if(strlen($byteValue) < 2){
$byteValue = '0'.$byteValue;
}
}
$strLen = $byteLen*2;
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
}
break;
case 'keepAsc':
$byteValue = $unitValue;
break;
default:
echo "Error:Unknown valueType";
break;
}
if($DEBUG) echo "<br>byteValue = $byteValue ";
//--><-//$lastValue = $byteValue.$lastValue;
$lastValue = $lastValue.$byteValue;
}
if($DEBUG) echo "<br>lastValue = $lastValue ";
$setValue = $lastValue;
if($TEST != 1){
//set back to input field
echo "<script LANGUAGE=\"JavaScript\">";
echo "\n var setValue='$setValue'; ";
//echo "\n window.opener.document.update.$inputName.value=setValue.toUpperCase();";
echo "\n window.opener.document.update.$inputName.value=setValue;";
echo "\n window.opener.document.update.$inputName.style.color=\"BLUE\";";
echo "\n window.opener.document.update.$inputName.style.background = \"Yellow\";";
if($DEBUG) exit();
echo "\n window.opener.document.update.$inputName.focus();";
echo "\n window.close();";
echo "\n </script>";
}else{
if($valueType != 'keepAsc' && $valueType != 'toAsc'){
$setValue = strtoupper($setValue);
}
}
}//end of if($set == 1)
//=======================Show GUI ========================
?>
<body>
<script LANGUAGE="JavaScript">
function checkInt(term){
var checkOK = "0123456789";
var checkStr = term.value;
var allValid = true;
var termName = term.name;
var minValue = eval("document.confForm."+termName+"_min.value");
var maxValue = eval("document.confForm."+termName+"_max.value");
var oldValue = eval("document.confForm."+termName+"_old.value");
//alert(minValue+'<'+term.value+'<'+maxValue);
for (i = 0; i < checkStr.length; i++){
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++){
if (ch == checkOK.charAt(j))
break;
}
if (j == checkOK.length){
allValid = false;
break;
}
}
if (!allValid){
var errAlert="parameter Must be a dec number!";
alert(errAlert);
term.value=oldValue;
term.focus();
return (false);
}
if((minValue - term.value) > 0){
var errAlert="Too little!";
alert(errAlert);
term.value=oldValue;
term.focus();
return (false);
}
if((term.value - maxValue) > 0){
var errAlert="Too Big!";
alert(errAlert);
term.value=oldValue;
term.focus();
return (false);
}
}
</script>
<form method="POST" name="confForm" action="<?php echo"$PHP_SELF";?>" >
<?php
if($DEBUG) echo "<br>setValue = $setValue ,inputName = $inputName";
if($keyId > 0){
$objSql = "SELECT $objNameField,$objSetField,valueType,length,minValue,`maxValue` FROM $paramConfTable WHERE keyId = '$keyId'";
$objResult = mysqli_query($objConn ,$objSql);
$objRows = @mysqli_fetch_array($objResult);
$totalLen = $objRows[length]*2;
$objName = $objRows[$objNameField];
$setTemplate = $objRows[$objSetField];
$valueType = $objRows[valueType];
$minValue = $objRows[minValue];
$maxValue = $objRows[maxValue];
}else{
echo "<font><b>ERROR!!:keyId == NULL</b></font>";
exit();
}
/**************************************
*objName
*[unit]name[u]xx.xx-yy.yy[u]input[v]toDec-fillHigh-fillChar
*[unit]name[u]xx.xx-yy.yy[u]select[v]value1[opt]desc1[v]value2[opt]desc2
*[remark]
***************************************/
//explode by '[remark]'
$remarkArr = explode('[remark]',$setTemplate);
$remark = $remarkArr[1];
//explode by '[unit]'
$unitArr = explode('[unit]',$remarkArr[0]);
//show instance's name
echo "<b>{$unitArr[0]}</b><br>";
if($DEBUG) echo "<br>$unitArr[1]";
//show every one unit
//--><-//$setValue = strrev($setValue);
if($DEBUG){
echo "<table border=\"1\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">";
}else{
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">";
}
for($i=1;$i<sizeof($unitArr);$i++){
echo "\n <tr><td width=\"10%\" valign=middle><nobr>";
//unit input name
$unitName = "unit_".$i;
//explode by '[u]'
$tlvArr = explode('[u]',$unitArr[$i]);
if(sizeof($tlvArr) <= 1 ){
echo "<u><b>{$unitArr[$i]}</b></u>";
continue;
}
//show Unit Name
echo "$tlvArr[0]&nbsp;";
echo "</nobr></td><td>";
if($DEBUG) echo "$tlvArr[1]";
//explode by '-'
$offsetArr = explode('-',$tlvArr[1]);
$bgnOffsetArr = explode('.',$offsetArr[0]);
$bgnByte = $bgnOffsetArr[0];
$bgnBit = $bgnOffsetArr[1];
$endOffsetArr = explode('.',$offsetArr[1]);
$endByte = $endOffsetArr[0];
$endBit = $endOffsetArr[1];
$byteLen = $endByte - $bgnByte + 1;
$byteValue = substr($setValue,$bgnByte*2,$byteLen*2);
//--><-//$byteValue = strrev($byteValue);
if($DEBUG) echo "<br>byteValue = $byteValue";
$bitValue = '';
if($bgnBit > 0 ||$endBit < 7){
if($DEBUG) echo "<br>$bgnBit > 0 ||$endBit < 7";
$bitValue = HexDec($byteValue);
$bitValue = DecBin($bitValue);
if($DEBUG) echo "<br>bitValue = $bitValue";
$bitLen = $byteLen*8;//1 byte = 8 bit
$bitValue = omcStrFill($bitValue,$bitLen,'high','0');
if($DEBUG) echo "<br>omcStrFill($bitValue,$bitLen,'high','0')";
$bitValue = strrev($bitValue);
$catBitLen = $endByte*8+$endBit - ($bgnByte*8+$bgnBit) + 1; //1 byte = 8 bit
if($DEBUG) echo "<br>bitValue = substr($bitValue,$bgnBit,$catBitLen)";
$bitValue = substr($bitValue,$bgnBit,$catBitLen);
$bitValue = strrev($bitValue);
if($DEBUG) echo "<br>bitValue = $bitValue";
}
//explode by '[v]'
$valueArr = explode('[v]',$tlvArr[2]);
$typeAddTitleArr = explode('[t]',$valueArr[0]);
$operType = chop($typeAddTitleArr[0]);
$titleStr = chop($typeAddTitleArr[1]);
$valueArr[1] = chop($valueArr[1]);
if($DEBUG) echo "<br>operType = $operType";
switch($operType){
case 'input'://
//explode by '-'
$defArr = explode('-',$valueArr[1]);
if($DEBUG) echo "<br>defArr = $defArr[0],$defArr[1],$defArr[2]";
switch($defArr[0]){
case 'toDec':
if(strlen($bitValue) > 0){
$inputValue = BinDec($bitValue);
}else{
$inputValue = HexDec($byteValue);
}
break;
case 'keepDec':
$inputValue = $byteValue;
break;
case 'toHex':
echo "<br>Error:toHex";
break;
case 'keepHex':
$inputValue = $byteValue;
break;
case 'toAsc':
if($bgnBit > 0 ||$endBit < 7){
echo "<br>toAsc Error:bgnBit > 0 ||endBit < 7";
exit(1);
}else{
$tmpLen=strlen($byteValue);
for($charCount=0;$charCount<$tmpLen;$charCount++){
$unitByte = substr($byteValue,$charCount,2);
$unitChar = chr(HexDec($unitByte)); // hex -> ascii
if($DEBUG) echo "<br>unitChar=$unitChar";
$charValue .= $unitChar;
$charCount++;
}
$inputValue = $charValue;
}
break;
case 'keepAsc':
$inputValue = $byteValue;
break;
default:
echo "<br>Error:valueType=$defArr[0]";
break;
}
if($DEBUG) echo "<br>inputValue = $inputValue";
switch($defArr[1]){
case 'high':
switch($defArr[2]){
case '0':
if($defArr[0] == 'toHex' || $defArr[0] == 'keepHex'){
//$inputValue = str_replace('0','',$inputValue);
}else{
$inputValue = $inputValue - 0;
}
break;
case 'E':
echo "Error:high fill E";
break;
default: break;
}
break;
case 'low':
switch($defArr[2]){
case '0':
//$inputValue = str_replace('00','',$inputValue);
break;
case 'E':
//$inputValue = str_replace('E','',$inputValue);
break;
default: break;
}
break;
default: break;
}
if($valueType == $nOctStr){
if($DEBUG) echo "<br>$valueType =$nOctStr= OctStr";
if($defArr[0] == 'toHex' || $defArr[0] == 'keepHex'){
$inputLen = $byteLen *2;
}else{
$inputLen = $byteLen *3;
}
echo "<input type=\"text\" size=\"$inputLen\" maxLength =\"$inputLen\" name=\"$unitName\" value=\"$inputValue\">";
}elseif($valueType == $nAscStr){
if($DEBUG) echo "<br>$valueType == AscStr";
//if($defArr[0] == 'keepAsc'){
$inputLen = $byteLen;
//}
echo "<input type=\"text\" size=\"$inputLen\" maxLength =\"$inputLen\" name=\"$unitName\" value=\"$inputValue\">";
}else{
if($DEBUG) echo "<br>$valueType == Integer";
echo "<input type=\"text\" size=\"8\" name=\"$unitName\" value=\"$inputValue\" onchange=\"checkInt(this)\">";
echo "<input type=\"hidden\" name=\"$unitName"."_min\" value=\"$minValue\">";
echo "<input type=\"hidden\" name=\"$unitName"."_max\" value=\"$maxValue\">";
echo "<input type=\"hidden\" name=\"$unitName"."_old\" value=\"$inputValue\">";
}
break;
case 'select':
if($bitValue != ''){
$selectValue = BinDec($bitValue);
}else{
$selectValue = HexDec($byteValue);
}
if($DEBUG) echo "<br>bitValue = $bitValue";
if($DEBUG) echo "<br>selectValue = $selectValue";
echo "<select size=\"1\" name=\"$unitName\">";
$isSelected = 0;
for($j=1;$j<sizeof($valueArr);$j++){
//explode by '[opt]'
$defArr = explode('[opt]',$valueArr[$j]);
if(sizeof($defArr) < 2){
echo "<option value=\"$selectValue\" selected>Reserved Value</option>";
break;
}elseif($defArr[0] == $selectValue){
echo "<option value=\"$defArr[0]\" selected>$defArr[1]</option>";
$isSelected = 1;
}else{
echo "<option value=\"$defArr[0]\">$defArr[1]</option>";
}
}
if($isSelected ==0 && $j == sizeof($valueArr)){
echo "<option value=\"$selectValue\" selected>Undefined Value</option>";
}
echo "</select>";
break;
default: echo "<br>Error:operType =|$operType|";
break;
}//end of switch(..)
//like:unitDef_1 = 1.0-2.0-select-keepHex-high-0 -->$tlvArr[1]-$operType-
if($operType == 'select'){ //select
if($valueType == $nOctStr){
$tempDef = $tlvArr[1].'-'.$operType.'-'.'toDec-high-0';
}else{
$tempDef = $tlvArr[1].'-'.$operType.'-'.'keepDec-high-0';
}
}else{
$tempDef = $tlvArr[1].'-'.$operType.'-'.$valueArr[1];
}
$tempDef = str_replace(" ", "", $tempDef);
$tempDef = chop($tempDef);
echo "\n <input type=\"hidden\" name=\"unitDef_$i\" value=\"$tempDef\">";
echo "</td></tr>";
}//end of for(..)
echo "</table>";
$remark=nl2br($remark);
echo "<br><b>Remarks:</b><br>$remark<br>";
$unitNum = $i-1;
echo "\n<input type=\"hidden\" name=\"unitNum\" value=\"$unitNum\">";
echo "\n<input type=\"hidden\" name=\"inputName\" value=\"$inputName\">";
echo "\n<input type=\"hidden\" name=\"keyId\" value=\"$keyId\">";
echo "\n<input type=\"hidden\" name=\"sysTypeNo\" value=\"$sysTypeNo\">";
echo "\n<input type=\"hidden\" name=\"dataTypeNo\" value=\"$dataTypeNo\">";
echo "\n<input type=\"hidden\" name=\"setValue\" value=\"$setValue\">";
echo "\n<input type=\"hidden\" name=\"TEST\" value=\"$TEST\">";
echo "\n<input type=\"submit\" name=\"set\" value = \"Set\">";
echo "\n<input type=\"reset\" name=\"Reset\" value =\"Reset\">";
echo "</Form>";
//=======================Test input field========================
if($TEST){
echo "<Form method=\"POST\" name=\"testForm\" action=\"$PHP_SELF\">";
echo "<hr>";
//--><--// $setValue = strrev($setValue);
echo "<u><b>Test Area</b></u><br>";
echo "Test Value:&nbsp;&nbsp;&nbsp;<input type=\"text\" name=\"setValue\" value=\"$setValue\">";
echo "<input type=\"submit\" name=\"setTest\" value=\"set..\">";
echo "\n<input type=\"hidden\" name=\"sysTypeNo\" value=\"$sysTypeNo\">";
echo "\n<input type=\"hidden\" name=\"dataTypeNo\" value=\"$dataTypeNo\">";
echo "\n<input type=\"hidden\" name=\"keyId\" value=\"$keyId\">";
echo "\n<input type=\"hidden\" name=\"inputName\" value=\"$inputName\">";
echo "\n<input type=\"hidden\" name=\"TEST\" value=\"$TEST\">";
echo "</Form>";
}
?>
</body>
</html>
+567
View File
@@ -0,0 +1,567 @@
<?php
/*********************************************************
程序说明:(和paramEditPreview.php保持一致)
功能说明:本程序实现参数编辑模板代码的产生,保存,预览
调用关系:调用: connectdb.inc,inc/header.inc
被调用:
变量说明:
返回值:无
作者:
修改注释:
NO.1
姓名:
时间:
修改说明:
*********************************************************/
require("../../inc/header.inc");
$DEBUG = 0;
$TEST = ($TEST > 0)?$TEST:0;
//value Type
$nInteger = 2;
$nAscStr = 3;
$nOctStr = 4;
function omcGetObjDb($sysTypeNo){
$dbName = 'OBJ_'.$sysTypeNo;
return($dbName);
}
function omcGetObjTbl($sysTypeNo,$tableType,$dataTypeNo){
$dbName = 'OBJ_'.$sysTypeNo;
$tableName = $dbName.'.subsParamConf_'.$dataTypeNo;
return($tableName);
}
/*
function omcStrFill($string,$defLen,$fillWay='high',$fillChar='0'){
if(strlen($string) <= $defLen){
$fillLen=$defLen - strlen($string);
for($i=0;$i<$fillLen;$i++){
if($fillWay == 'low'){
$string = $string.$fillChar;
}else{
$string = $fillChar.$string;
}
}
return($string);
}else{
echo "<br>Error in omcStrFill:the defLen < lengh of string!!";
echo "<br>defLen=$defLen and string=$string!!";
exit();
}
}
*/
$sysConfTable = 'OMC_PUB.sysConf';
$sysTypeNo = (isset($sysTypeNo)?$sysTypeNo:0);
$pubDb ='OMC_PUB';
$objDb = omcGetObjDb($sysTypeNo);
$paramConfTable = omcGetObjTbl($sysTypeNo,paramConf,$dataTypeNo);
$maxLevelNum = 10;
if($DEBUG) echo "<br>$paramConfTable<br>";
//----------------------
//选择语言版本
if($language == 'eng'){
$objNameField=name_2;
$objSetField=setTemplate_2 ; //语种2
}else{
$objNameField=name_1;
$objSetField=setTemplate_1 ; //语种1(默认语种)
}
//-----------------------
//=======================Get value From submit===================
if($set == 'Set'){
//sort by offset
for($i=1;$i<=$unitNum;$i++){
$tmpDef = ${'unitDef_'.$i};
$tmpValue = ${'unit_'.$i};
if($DEBUG) echo "<br>tmpDef = $tmpDef,unitNum=$unitNum";
$defArr[$i] = $tmpDef;
$tmpDefArr=explode('-',$tmpDef);
$sortArr[$i] = $tmpDefArr[0];
$valueArr[$i] = $tmpValue;
}
$lastValue = '';
$k = 0;
asort($sortArr);
for(reset($sortArr); $key = key($sortArr); next($sortArr)){
if($DEBUG) echo "<br>sortArr[$key] = {$sortArr[$key]}";
if($DEBUG) echo "<br>unitValue = {$valueArr[$key]}";
$unitValue = $valueArr[$key];
if($DEBUG) echo "<br>defArr[$key] = {$defArr[$key]}";
$unitDefArr = explode('-',$defArr[$key]); //例:0.0-0.7-input -toDec-high-0
if(sizeof($unitDefArr) <= 1){
if($DEBUG) echo "<br>nothing,just a name";
continue;
}
$bgnOffset = $unitDefArr[0];
$endOffset = $unitDefArr[1];
$operType = $unitDefArr[2];
$valueType = $unitDefArr[3];
$fillWay = $unitDefArr[4];
$fillChar = $unitDefArr[5];
$bgnOffsetArr = explode('.',$bgnOffset);
$bgnByte = $bgnOffsetArr[0];
$bgnBit = $bgnOffsetArr[1];
$endOffsetArr = explode('.',$endOffset);
$endByte = $endOffsetArr[0];
$endBit = $endOffsetArr[1];
$byteLen = $endByte - $bgnByte + 1;
$byteValue = '';
if($DEBUG) echo "<br>valueType = $valueType";
switch($valueType){
case 'toDec':
if($bgnBit > 0 ||$endBit < 7){
$bitLen = $byteLen*8 - $bgnBit - (7 - $endBit) ; //1 BYTE = 8 bit
$bitValue = DecBin($unitValue);
if($DEBUG) echo "<br>bitValue = $bitValue ";
$bitValue = omcStrFill($bitValue,$bitLen,$fillWay,$fillChar);
if($DEBUG) echo "<br>omcStrFill($bitValue,$bitLen,$fillWay,$fillChar)";
$bitValueArr[$k] = $bitValue;
if($DEBUG) echo "<br>bitValueArr[$k] = {$bitValueArr[$k]}";
if($endBit == 7){//发现这个单元结束,并没有跨byte,这时需要组成一个byte值
$bitValue = '';
for($bitNo=0; $bitNo<=$k; $bitNo++){
if($DEBUG) echo "<br>bitValueArr[$bitNo] = {$bitValueArr[$bitNo]}";
$bitValue = $bitValueArr[$bitNo].$bitValue;
}
$k=0;
if($DEBUG) echo "<br>bitValue = $bitValue";
$byteLen = strlen($bitValue) / 8;
if($DEBUG) echo "<br>byteLen = $byteLen";
$byteValue = BinDec($bitValue);
$byteValue = DecHex($byteValue);
$strLen = $byteLen*2;
if($DEBUG) echo "<br>omcStrFill($byteValue,$strLen,$fillWay,$fillChar)";
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
}else{//否则,继续组合下一个bit组
$byteValue = '';
$k++;
}
}else{
$byteValue = DecHex($unitValue);
$strLen = $byteLen*2;
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
if($DEBUG) echo "<br>omcStrFill($byteValue,$strLen,$fillWay,$fillChar)";
}
if($DEBUG) echo "<br>byteValue = $byteValue";
break;
case 'keepDec':
//echo "<br>Error:keepDec";
$byteValue = $unitValue - 0;
break;
case 'toHex':
echo "<br>Error:toHex";
break;
case 'keepHex':
if($bgnBit > 0 || $endBit < 7){//这里的处理不够全面,没有对=7的进行收尾
$byteValue = $unitValue;
$strLen = $byteLen;
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
$bitValue = DecBin(HexDec($byteValue));
$byteValue='';
$bitLen = $byteLen*8 - $bgnBit - (7 - $endBit) ; //1 BYTE = 8 bit
$bitValue = omcStrFill($bitValue,$bitLen,'high','0');
if($DEBUG) echo "<br>bitValue = $bitValue";
$bitValueArr[$k] = $bitValue;
$k++;
}else{
$k=0;
$byteValue = $unitValue;
$strLen = $byteLen*2;
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
if($DEBUG) echo "<br>omcStrFill($byteValue,$strLen,$fillWay,$fillChar)";
}
break;
case 'toAsc':
if($bgnBit > 0 ||$endBit < 7){
echo "<br>Error:toAsc";
exit(1);
}else{
$tmpLen=strlen($unitValue);
for($i=0;$i<$tmpLen;$i++){
$unitChar = substr($unitValue,$i,1);
$decValue = ord($unitChar); //ascii -> dec
$byteValue .= DecHex($decValue);
if(strlen($byteValue) < 2){
$byteValue = '0'.$byteValue;
}
}
$strLen = $byteLen*2;
$byteValue = omcStrFill($byteValue,$strLen,$fillWay,$fillChar);
}
break;
case 'keepAsc':
$byteValue = $unitValue;
break;
default:
echo "Error:Unknown valueType";
break;
}
if($DEBUG) echo "<br>byteValue = $byteValue ";
//--><-//$lastValue = $byteValue.$lastValue;
$lastValue = $lastValue.$byteValue;
}
if($DEBUG) echo "<br>lastValue = $lastValue ";
$setValue = $lastValue;
if($TEST != 1){
//set back to input field
echo "<script LANGUAGE=\"JavaScript\">";
echo "\n var setValue='$setValue'; ";
echo "\n window.opener.document.update.$inputName.value=setValue.toUpperCase();";
echo "\n window.opener.document.update.$inputName.style.color=\"BLUE\";";
echo "\n window.opener.document.update.$inputName.style.background = \"Yellow\";";
if($DEBUG) exit();
echo "\n window.opener.document.update.$inputName.focus();";
echo "\n window.close();";
echo "\n </script>";
}else{
if($valueType != 'keepAsc' && $valueType != 'toAsc'){
$setValue = strtoupper($setValue);
}
}
}//end of if($set == 1)
//=======================Show GUI ========================
?>
<body>
<script LANGUAGE="JavaScript">
function checkInt(term){
var checkOK = "0123456789";
var checkStr = term.value;
var allValid = true;
var termName = term.name;
var minValue = eval("document.confForm."+termName+"_min.value");
var maxValue = eval("document.confForm."+termName+"_max.value");
var oldValue = eval("document.confForm."+termName+"_old.value");
//alert(minValue+'<'+term.value+'<'+maxValue);
for (i = 0; i < checkStr.length; i++){
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++){
if (ch == checkOK.charAt(j))
break;
}
if (j == checkOK.length){
allValid = false;
break;
}
}
if (!allValid){
var errAlert="parameter Must be a dec number!";
alert(errAlert);
term.value=oldValue;
term.focus();
return (false);
}
if((minValue - term.value) > 0){
var errAlert="Too little!";
alert(errAlert);
term.value=oldValue;
term.focus();
return (false);
}
if((term.value - maxValue) > 0){
var errAlert="Too Big!";
alert(errAlert);
term.value=oldValue;
term.focus();
return (false);
}
}
</script>
<form method="POST" name="confForm" action="<?php echo"$PHP_SELF";?>" >
<?
if($DEBUG) echo "<br>setValue = $setValue ,inputName = $inputName";
if($keyId > 0){
$objSql = "SELECT $objNameField,$objSetField,valueType,length,minValue,maxValue FROM $paramConfTable WHERE keyId = '$keyId'";
$objResult = mysqli_query($pubConn ,$objSql);
$objRows = @mysqli_fetch_array($objResult);
$totalLen = $objRows[length]*2;
$objName = $objRows[$objNameField];
$setTemplate = $objRows[$objSetField];
$valueType = $objRows[valueType];
$minValue = $objRows[minValue];
$maxValue = $objRows[maxValue];
}else{
echo "<font><b>ERROR!!:keyId == NULL</b></font>";
exit();
}
/**************************************
*objName
*[unit]name[u]xx.xx-yy.yy[u]input[v]toDec-fillHigh-fillChar
*[unit]name[u]xx.xx-yy.yy[u]select[v]value1[opt]desc1[v]value2[opt]desc2
*[remark]
***************************************/
//explode by '[remark]'
$remarkArr = explode('[remark]',$setTemplate);
$remark = $remarkArr[1];
//explode by '[unit]'
$unitArr = explode('[unit]',$remarkArr[0]);
//show instance's name
echo "<b>{$unitArr[0]}</b><br>";
if($DEBUG) echo "<br>$unitArr[1]";
//show every one unit
//--><-//$setValue = strrev($setValue);
if($DEBUG){
echo "<table border=\"1\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">";
}else{
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">";
}
for($i=1;$i<sizeof($unitArr);$i++){
echo "\n <tr><td width=\"10%\" valign=middle><nobr>";
//unit input name
$unitName = "unit_".$i;
//explode by '[u]'
$tlvArr = explode('[u]',$unitArr[$i]);
if(sizeof($tlvArr) <= 1 ){
echo "<u><b>{$unitArr[$i]}</b></u>";
continue;
}
//show Unit Name
echo "$tlvArr[0]&nbsp;";
echo "</nobr></td><td>";
if($DEBUG) echo "$tlvArr[1]";
//explode by '-'
$offsetArr = explode('-',$tlvArr[1]);
$bgnOffsetArr = explode('.',$offsetArr[0]);
$bgnByte = $bgnOffsetArr[0];
$bgnBit = $bgnOffsetArr[1];
$endOffsetArr = explode('.',$offsetArr[1]);
$endByte = $endOffsetArr[0];
$endBit = $endOffsetArr[1];
$byteLen = $endByte - $bgnByte + 1;
$byteValue = substr($setValue,$bgnByte*2,$byteLen*2);
//--><-//$byteValue = strrev($byteValue);
if($DEBUG) echo "<br>byteValue = $byteValue";
$bitValue = '';
if($bgnBit > 0 ||$endBit < 7){
if($DEBUG) echo "<br>$bgnBit > 0 ||$endBit < 7";
$bitValue = HexDec($byteValue);
$bitValue = DecBin($bitValue);
if($DEBUG) echo "<br>bitValue = $bitValue";
$bitLen = $byteLen*8;//1 byte = 8 bit
$bitValue = omcStrFill($bitValue,$bitLen,'high','0');
if($DEBUG) echo "<br>omcStrFill($bitValue,$bitLen,'high','0')";
$bitValue = strrev($bitValue);
$catBitLen = $endByte*8+$endBit - ($bgnByte*8+$bgnBit) + 1; //1 byte = 8 bit
if($DEBUG) echo "<br>bitValue = substr($bitValue,$bgnBit,$catBitLen)";
$bitValue = substr($bitValue,$bgnBit,$catBitLen);
$bitValue = strrev($bitValue);
if($DEBUG) echo "<br>bitValue = $bitValue";
}
//explode by '[v]'
$valueArr = explode('[v]',$tlvArr[2]);
$typeAddTitleArr = explode('[t]',$valueArr[0]);
$operType = chop($typeAddTitleArr[0]);
$titleStr = chop($typeAddTitleArr[1]);
$valueArr[1] = chop($valueArr[1]);
if($DEBUG) echo "<br>operType = $operType";
switch($operType){
case 'input'://
//explode by '-'
$defArr = explode('-',$valueArr[1]);
if($DEBUG) echo "<br>defArr = $defArr[0],$defArr[1],$defArr[2]";
switch($defArr[0]){
case 'toDec':
if(strlen($bitValue) > 0){
$inputValue = BinDec($bitValue);
}else{
$inputValue = HexDec($byteValue);
}
break;
case 'keepDec':
$inputValue = $byteValue;
break;
case 'toHex':
echo "<br>Error:toHex";
break;
case 'keepHex':
$inputValue = $byteValue;
break;
case 'toAsc':
if($bgnBit > 0 ||$endBit < 7){
echo "<br>toAsc Error:bgnBit > 0 ||endBit < 7";
exit(1);
}else{
$tmpLen=strlen($byteValue);
for($charCount=0;$charCount<$tmpLen;$charCount++){
$unitByte = substr($byteValue,$charCount,2);
$unitChar = chr(HexDec($unitByte)); // hex -> ascii
if($DEBUG) echo "<br>unitChar=$unitChar";
$charValue .= $unitChar;
$charCount++;
}
$inputValue = $charValue;
}
break;
case 'keepAsc':
$inputValue = $byteValue;
break;
default:
echo "<br>Error:valueType=$defArr[0]";
break;
}
if($DEBUG) echo "<br>inputValue = $inputValue";
switch($defArr[1]){
case 'high':
switch($defArr[2]){
case '0':
if($defArr[0] == 'toHex' || $defArr[0] == 'keepHex'){
//$inputValue = str_replace('0','',$inputValue);
}else{
$inputValue = $inputValue - 0;
}
break;
case 'E':
echo "Error:high fill E";
break;
default: break;
}
break;
case 'low':
switch($defArr[2]){
case '0':
$inputValue = str_replace('00','',$inputValue);
break;
case 'E':
$inputValue = str_replace('E','',$inputValue);
break;
default: break;
}
break;
default: break;
}
if($valueType == $nOctStr){
if($DEBUG) echo "<br>$valueType =$nOctStr= OctStr";
if($defArr[0] == 'toHex' || $defArr[0] == 'keepHex'){
$inputLen = $byteLen *2;
}else{
$inputLen = $byteLen *3;
}
echo "<input type=\"text\" size=\"$inputLen\" maxLength =\"$inputLen\" name=\"$unitName\" value=\"$inputValue\">";
}elseif($valueType == $nAscStr){
if($DEBUG) echo "<br>$valueType == AscStr";
//if($defArr[0] == 'keepAsc'){
$inputLen = $byteLen;
//}
echo "<input type=\"text\" size=\"$inputLen\" maxLength =\"$inputLen\" name=\"$unitName\" value=\"$inputValue\">";
}else{
if($DEBUG) echo "<br>$valueType == Integer";
echo "<input type=\"text\" size=\"8\" name=\"$unitName\" value=\"$inputValue\" onchange=\"checkInt(this)\">";
echo "<input type=\"hidden\" name=\"$unitName"."_min\" value=\"$minValue\">";
echo "<input type=\"hidden\" name=\"$unitName"."_max\" value=\"$maxValue\">";
echo "<input type=\"hidden\" name=\"$unitName"."_old\" value=\"$inputValue\">";
}
break;
case 'select':
if($bitValue != ''){
$selectValue = BinDec($bitValue);
}else{
$selectValue = HexDec($byteValue);
}
if($DEBUG) echo "<br>bitValue = $bitValue";
if($DEBUG) echo "<br>selectValue = $selectValue";
echo "<select size=\"1\" name=\"$unitName\">";
$isSelected = 0;
for($j=1;$j<sizeof($valueArr);$j++){
//explode by '[opt]'
$defArr = explode('[opt]',$valueArr[$j]);
if(sizeof($defArr) < 2){
echo "<option value=\"$selectValue\" selected>Reserved Value</option>";
break;
}elseif($defArr[0] == $selectValue){
echo "<option value=\"$defArr[0]\" selected>$defArr[1]</option>";
$isSelected = 1;
}else{
echo "<option value=\"$defArr[0]\">$defArr[1]</option>";
}
}
if($isSelected ==0 && $j == sizeof($valueArr)){
echo "<option value=\"$selectValue\" selected>Undefined Value</option>";
}
echo "</select>";
break;
default: echo "<br>Error:operType =|$operType|";
break;
}//end of switch(..)
//like:unitDef_1 = 1.0-2.0-select-keepHex-high-0 -->$tlvArr[1]-$operType-
if($operType == 'select'){ //select
if($valueType == $nOctStr){
$tempDef = $tlvArr[1].'-'.$operType.'-'.'toDec-high-0';
}else{
$tempDef = $tlvArr[1].'-'.$operType.'-'.'keepDec-high-0';
}
}else{
$tempDef = $tlvArr[1].'-'.$operType.'-'.$valueArr[1];
}
$tempDef = str_replace(" ", "", $tempDef);
$tempDef = chop($tempDef);
echo "\n <input type=\"hidden\" name=\"unitDef_$i\" value=\"$tempDef\">";
echo "</td></tr>";
}//end of for(..)
echo "</table>";
$remark=nl2br($remark);
echo "<br><b>Remarks:</b><br>$remark<br>";
$unitNum = $i-1;
echo "\n<input type=\"hidden\" name=\"unitNum\" value=\"$unitNum\">";
echo "\n<input type=\"hidden\" name=\"inputName\" value=\"$inputName\">";
echo "\n<input type=\"hidden\" name=\"keyId\" value=\"$keyId\">";
echo "\n<input type=\"hidden\" name=\"sysTypeNo\" value=\"$sysTypeNo\">";
echo "\n<input type=\"hidden\" name=\"dataTypeNo\" value=\"$dataTypeNo\">";
echo "\n<input type=\"hidden\" name=\"setValue\" value=\"$setValue\">";
echo "\n<input type=\"hidden\" name=\"TEST\" value=\"$TEST\">";
echo "\n<input type=\"submit\" name=\"set\" value = \"Set\">";
echo "\n<input type=\"reset\" name=\"Reset\" value =\"Reset\">";
echo "</Form>";
//=======================Test input field========================
if($TEST){
echo "<Form method=\"POST\" name=\"testForm\" action=\"$PHP_SELF\">";
echo "<hr>";
//--><--// $setValue = strrev($setValue);
echo "<u><b>Test Area</b></u><br>";
echo "Test Value:&nbsp;&nbsp;&nbsp;<input type=\"text\" name=\"setValue\" value=\"$setValue\">";
echo "<input type=\"submit\" name=\"setTest\" value=\"set..\">";
echo "\n<input type=\"hidden\" name=\"sysTypeNo\" value=\"$sysTypeNo\">";
echo "\n<input type=\"hidden\" name=\"dataTypeNo\" value=\"$dataTypeNo\">";
echo "\n<input type=\"hidden\" name=\"keyId\" value=\"$keyId\">";
echo "\n<input type=\"hidden\" name=\"inputName\" value=\"$inputName\">";
echo "\n<input type=\"hidden\" name=\"TEST\" value=\"$TEST\">";
echo "</Form>";
}
?>
</body>
</html>
+101
View File
@@ -0,0 +1,101 @@
<?php
function subsCommSend($sysId,$dataTypeNo,$indexValueList,$fieldNameList,$commType,$newIndexValue=0){
//global $pubDb,$commTable;
$DEBUG = 0;
$pubDb = 'OMC_PUB';
$commTable = 'subscriberComm';
$ipTable = 'sysInfo';
global $pubConn;
$nReadComm = 1;
$nChangeComm = 2;
$nCreateComm = 3;
$nDeleteComm = 4;
$nLoadIndexComm = 5;
$nReplaceIndexComm=6;
$sysIdArr = explode('_',$sysId);
$sysTypeNo = $sysIdArr[0];
$sysNo = $sysIdArr[1];
$subSysNo = $sysIdArr[2];
//step 1: delete overtime and imcompetent command
$overTime = date("Y-m-d H:i:s", mktime(date("H"),date("i")-1,date("s"),date("m"),date("d"),date("Y")));
$delSql = "DELETE FROM $commTable WHERE (commState ='0' OR commState ='3') AND sendTime < '$overTime'";
if($DEBUG) echo"<br>delete command sql = $delSql";
mysqli_query($pubConn,$delSql);
echo mysqli_error($pubConn);
$overTime = date("Y-m-d H:i:s", mktime(date("H"),date("i")-30,date("s"),date("m"),date("d"),date("Y")));
$delSql = "DELETE FROM $commTable WHERE sendTime < '$overTime'";
if($DEBUG) echo"<br>delete command sql = $delSql";
mysqli_query($pubConn,$delSql);
echo mysqli_error($pubConn);
/*
//step 2: check the system's ip
$chkIpSql = "SELECT ip FROM $ipTable
WHERE sysTypeNo='$sysTypeNo' AND sysNo='$sysNo' AND subSysNo='$subSysNo'
";
if($DEBUG) echo"<br>chkIpSql = $chkIpSql";
$chkIpResult = mysqli_query($pubConn,$chkIpSql);
echo mysqli_error($pubConn);
$rowsNum = @mysqli_num_rows($chkIpResult);
if($rowsNum > 0){
echo "<script language=\"javascript\"> ";
echo "alert('Can not find this system's ip address in system infp list,\n Please add it first!'); ";
echo "</script>";
return(-1);
}
*/
//step 3: check the command(����ͬʱ����ϵͳ���ͣ��������ͱ�ţ������������ͬ�IJ���)
$chkSql = "SELECT commId FROM $commTable
WHERE sysTypeNo='$sysTypeNo' AND indexValueList='$indexValueList'
";
if($DEBUG) echo"<br>check command sql = $chkSql";
$chkResult = mysqli_query($pubConn,$chkSql);
echo mysqli_error($pubConn);
$rowsNum = @mysqli_num_rows($chkResult);
if($rowsNum <= 0){
//step 4:insert commands into command table
if($commType == $nReplaceIndexComm){
$sendSql="INSERT INTO $commTable
(commType,dataTypeNo,sysTypeNo,sysNo,subSysNo,indexValueList, fieldNameList,paramType,commState,sendTime,remark)
VALUES
('$commType','$dataTypeNo','$sysTypeNo','$sysNo','$subSysNo','$indexValueList',
'$fieldNameList','0','1',CURRENT_TIMESTAMP,'$newIndexValue')
";
}else{
$sendSql="INSERT INTO $commTable
(commType,dataTypeNo,sysTypeNo,sysNo,subSysNo,indexValueList,fieldNameList,paramType,commState,sendTime)
VALUES
('$commType','$dataTypeNo','$sysTypeNo','$sysNo','$subSysNo','$indexValueList',
'$fieldNameList','0','1',CURRENT_TIMESTAMP)
";
}
if($DEBUG)echo"<br>send command sql = $sendSql";
$sendResult=mysqli_query($pubConn,$sendSql);
echo mysqli_error($pubConn);
}
//step 5:Return commIdStr
$selSql = "SELECT commId FROM $commTable
WHERE sysTypeNo='$sysTypeNo' AND sysNo='$sysNo' AND subSysNo='$subSysNo'
AND indexValueList='$indexValueList'
";
if($DEBUG)
echo"<br>get command id sql = $selSql";
$selResult=mysqli_query($pubConn,$selSql);
echo mysqli_error($pubConn);
$commIdStr='';
while($selRows = mysqli_fetch_array($selResult)){
$commIdStr .= $selRows[commId].'-';
}
if($DEBUG)echo "<br>commIdStr = $commIdStr";
if($DEBUG) exit();
return($commIdStr);
}//end of function sendComm()
?>
+609
View File
@@ -0,0 +1,609 @@
<?php
/*********************************************************
程序说明:
功能说明:将用户数据表的数据导入到临时参数表。
调用关系:调用: header.inc,lib.inc
被调用:params_adm_down_left.php
变量说明:
输入变量:
$keyValue :由用户列表传来
$sysId :由用户列表传来或本页面指定
$language:语言种类
返回值:无
作者:
修改注释:
NO.1
姓名:
时间:
修改说明:
*********************************************************/
require("../../inc/header.inc");
?>
<base target="_self">
<body leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('down');" onresize="javascript:adjust_frame('down');" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<?php
adjust_head_frame("down");
adjust_title_head_frame("down");
adjust_title_tail_frame("down");
adjust_content_head_frame("down");
echo "<br>";
$DEBUG = 0;
global $pubConn;
if($DEBUG) echo "<br>正在调试中,给您的工作带来不便,请原谅!!:)";
//==========================================================
//变量定义
//==========================================================
$pubDb = 'OMC_PUB';
$sysSubsConfTable ='OMC_PUB.sysSubsConf';
$systemConfTable = 'OMC_PUB.sysConf';
$nReadComm = 1;
$nChangeComm = 2;
$nCreateComm = 3;
$nDeleteComm = 4;
$nLoadIndexComm = 5;
$nReplaceIndexComm = 6;
$maxLevelNum = 10;
$nInteger = 2;
$nAscStr = 3;
$nHexStr = 4;
$dataTypeNo = $_REQUEST['dataTypeNo'];
//------------选择语言版本----------
if($language == 'eng'){
$objNameField = 'name_2';
$objDescField = 'desc_2';
$objNoteField = 'note_2';
}else{
$objNameField = 'name_1';
$objDescField = 'desc_1';
$objNoteField = 'note_1';
}
//==========================================================
//输入变量
//==========================================================
$canSetNum = $_REQUEST['canSetNum'];
$keyValue=$_REQUEST['keyValue'];
$canSetNum = isset($canSetNum)?$canSetNum:'all';
$sysId=$_REQUEST['sysId'];
$dataTypeNo = $_REQUEST['dataTypeNo'];
$isLoadIndex=$_REQUEST['isLoadIndex'];
$isTryCreate=$_REQUEST['isTryCreate'];
$isBatchCreate = $_REQUEST['isBatchCreate'];
$isBatchDelete = $_REQUEST['isBatchDelete'];
$Delstartkey = $_REQUEST['Delstartkey'];
$batchDelNum = $_REQUEST['batchDelNum'];
$batchDelete = $_REQUEST['batchDelete'];
$batchNum=$_REQUEST['batchNum'];
$isCreate=$_REQUEST['isCreate'];
$isDelete=$_REQUEST['isDelete'];
$isChange=$_REQUEST['isChange'];
$isRead=$_REQUEST['isRead'];
$sysIdArr=explode('_',$sysId);
$sysTypeNo=$sysIdArr[0];
$sysNo=$sysIdArr[1];
$objConn = mysqli_connect($OMC_server[0]['host'],$OMC_server[0]['user'],$OMC_server[0]['password'], 'OBJ_'.$sysTypeNo);
//显示用户数据编辑页面,需要的变量
if($DEBUG) echo "<br>sysId=$sysId";
if($DEBUG) echo "<br>canSetNum=$canSetNum";
if($DEBUG) echo "<br>keyValue=$keyValue";
if($DEBUG) echo "<br>sysTypeNo=$sysTypeNo";
if($DEBUG) echo "<br>sysNo=$sysNo";
if($DEBUG) echo "<br>subSysNo=$subSysNo";
if($DEBUG) echo "<br>dataTypeNo=$dataTypeNo";
//例如:
//$canSetNum =1; // 或= 'all'
//$sysId='330_0_0';
//$keyValue= '0460022157127016';
$isRead=$_REQUEST['isRead'];
$isChange=$_REQUEST['isChange'];
$isCreate=$_REQUEST['isCreate'];
$isDelete=$_REQUEST['isDelete'];
$isTryCreate=$_REQUEST['isTryCreate'];
$isLoadIndex=$_REQUEST['isLoadIndex'];
//操作类型变量
if($DEBUG) echo "<br>isRead=$isRead";
if($DEBUG) echo "<br>isChange=$isChange";
if($DEBUG) echo "<br>isCreate=$isCreate";
if($DEBUG) echo "<br>isDelete=$isDelete";
if($DEBUG) echo "<br>isLoadIndex=$isLoadIndex";
$bgnNo=$_REQUEST['bgnNo'];
$endNo=$_REQUEST['endNo'];
if (!isset($keyValue)) $keyValue=$_POST['keyValue'];
//保存用户数据修改的数据
if($DEBUG) echo "<br>bgnNo=$bgnNo";
if($DEBUG) echo "<br>endNo=$endNo";
//显示每个需要保存的字段
for($i=$bgnNo;$i<$endNo;$i++){
${'checkBox_'.$i} = $_POST['checkBox_'.$i];
${'fieldName_'.$i} = $_POST['fieldName_'.$i];
${'editValue_'.$i} = $_POST['editValue_'.$i];
if($DEBUG) echo "<br>checkBox_$i = ${'checkBox_'.$i}";
if($DEBUG) echo "<br>fieldName_$i = ${'fieldName_'.$i}";
if($DEBUG) echo "<br>editValue_$i = ${'editValue_'.$i}";
if($isCreate > 0){
if($tmpFieldName == $indexFieldName){
$indexValueList = $editValue;
if($DEBUG) echo "<br> indexValueList($indexValueList) be change to $editValue";
}
}
}
//if($DEBUG && $endNo > 1) exit();
//==========================================================
//数据处理
//==========================================================
$fieldNameList = "ALL";
require("./sendComm.inc");
require("./dataProc.inc");
//==========================================================
//输出并显示数据
//==========================================================
?>
<?php
//**********************************编辑参数时所用javascript*****************************************
?>
<script LANGUAGE="JavaScript">
function changevalue(term)
{
term.style.color = "BLUE";
//term.value = term.value.toUpperCase();
/*
if(term.value.length != term.maxlength){
var LengthErrorWarning = "<?php echo $strLengthOfTheInputValueIsError; ?>";
var CorrectItWarning = "<?php echo $strPleaseCorrectIt; ?>";
alert(LengthErrorWarning + CorrectItWarning + "[= " + term.maxlength + "]");
term.focus();
return (false);
}
*/
var checkOK = "-0123456789ABCDEF";
var checkStr = term.value;
var allValid = true;
for (i = 0; i < checkStr.length; i++){
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++){
if (ch == checkOK.charAt(j))
break;
}
if (j == checkOK.length){
//allValid = false;
break;
}
}
if (!allValid){
var ParaHex="<?php echo $strParaMustBeAHexNumber; ?>";
var Capital="<?php echo $strCapitalCharacter; ?>";
alert(ParaHex+","+"("+Capital+")!");
term.focus();
return (false);
}
}
function selectToSet(thisCheckBox)
{
if(thisCheckBox.checked == true)
{
thisCheckBox.value=1;
document.update.setNum.value++;
if(document.update.setNum.value > (document.update.canSetNum.value - 0)){
alert("You can not change too much parameter["+document.update.setNum.value+" > "+document.update.canSetNum.value+"] in one times,please try it next time!");
thisCheckBox.checked = false;
document.update.setNum.value--;
return;
}
}else{
thisCheckBox.value=0;
document.update.setNum.value--;
}
}
function selectAllToSet(thisCheckBox)
{
var p;
var bgnNo=document.update.bgnNo.value;
var endNo=document.update.endNo.value;
var tmpCheckBox;
if(thisCheckBox.checked == true)
{
for(p=bgnNo; p < endNo; p++){
tmpCheckBox=eval("document.update.checkBox_"+p);
tmpCheckBox.checked = true;
tmpCheckBox.value=1;
}
}else{
for(p=bgnNo; p < endNo; p++){
tmpCheckBox=eval("document.update.checkBox_"+p);
tmpCheckBox.checked = false;
tmpCheckBox.value=0;
}
}
}
function checkSubmit()
{
var p;
var bgnNo=document.update.bgnNo.value;
var endNo=document.update.endNo.value;
var tmpCheckBox;
var selectedNum = 0;
var chgFlag = document.update.isChange.value;
var crtFlag = document.update.isCreate.value;
if(chgFlag == 0 && crtFlag == 0){
return (true);
}
for(p=bgnNo; p < endNo; p++){
tmpCheckBox=eval("document.update.checkBox_"+p);
if(tmpCheckBox.checked == true){
if(checkOneInput(p) == true){
selectedNum++;
}else{
return (false);
}
}
}
if(document.update.isRead.value != 1){
if(selectedNum > 0){
return (true);
}else{
alert("Please select the check box for edit parametr!");
return (false);
}
}
}
function openSet(sysTypeNo,objKeyId,inputName,dataTypeNo)
{
var inputValue,checkBoxValue;
//checkBoxValue = eval("document.update."+checkBoxName+".checked");
//if(checkBoxValue == false){
// alert("Please select the check box first!");
// return;
//}
inputValue = eval("document.update."+inputName+".value");
URL = "./paramEdit.php?sysTypeNo="+sysTypeNo;
URL += "&keyId="+objKeyId+"&setValue="+inputValue
URL += "&inputName="+inputName+"&dataTypeNo="+dataTypeNo;
var msgWindow = open(URL, 'newWin', 'toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,width=400,height=350');
msgWindow.focus();
}
function checkOneInput(p)
{
var valueType,nInt=2,nAsc=3,nHex=4;
var i,j;
var checkOK = "-0123456789ABCDEF";
var editValue,readValue;
var allValid = true;
var LengthErrorWarning="<?php echo "$strLengthOfTheInputValueIsError"; ?>";
var CorrectItWarning="<?php echo "$strPleaseCorrectIt"; ?>";
var ValueCannotEmpty="value cannot be empty!";
var ValueLengthError="value length error!";
editInput = eval("document.update.editValue_"+p);
editValue = eval("document.update.editValue_"+p+".value.toUpperCase()");
valueType = eval("document.update.valueType_"+p+".value");
editFlag = eval("document.update.checkBox_"+p+".checked");
maxLen = eval("document.update.maxLen_"+p+".value");
if((editValue.length < 1) && (editFlag == true)){
editInput.style.background = "RED";
alert(ValueCannotEmpty);
return (false);
}
switch(valueType){
case nInt:
<?php //检测输入值是否为0-f的16进制字符?>
for (i = 0; i < editValue.length; i++){
ch = editValue.charAt(i);
for (j = 0; j < checkOK.length; j++){
if (ch == checkOK.charAt(j))
break;
}
if (j == checkOK.length){
allValid = false;
break;
}
}
break;
case nAsc:
break;
case nHex:
<?php //检测输入值是否超长或超短?>
if( editFlag == true && (editValue.length < maxLen || editValue.length > maxLen)){
document.update.editInput.style.color = "RED";
alert(ValueLengthError);
return (false);
}
<?php //检测输入值是否为0-f的16进制字符?>
for (i = 0; i < editValue.length; i++){
ch = editValue.charAt(i);
for (j = 0; j < checkOK.length; j++){
if (ch == checkOK.charAt(j))
break;
}
if (j == checkOK.length){
allValid = false;
break;
}
}
break;
default:
break;
}
//当输入值有非法字符
if (!allValid){
var ParaHex="Input value error!";
alert(ParaHex);
return (false);
}
editInput.style.background = "Yellow";
return (true);
}
function askSureToDel(keyName,keyId)
{
var answer = confirm("Are you sure to delete this subscriber( "+keyName+"="
+ keyId + ") from <?php echo"$sysTypeName";?> server?");
if (answer == true){
window.location.href = "<?php echo "$PHP_SELF?sysId=$sysId&dataTypeNo=$dataTypeNo&bufferNo=$bufferNo&keyValue=$keyValue&isDelete=1";?>";
//alert('Try to send delete command');
}else{
return(false);
}
}
function askSureToReplace(keyName,keyId)
{
var answer = confirm("Are you sure to replace this subscriber's Index( "+keyName+"="
+ keyId + ")?");
if (answer == true){
window.location.href = "<?php echo "$PHP_SELF?sysId=$sysId&dataTypeNo=$dataTypeNo&bufferNo=$bufferNo&keyValue=$keyValue&isReplaceIndex=1";?>";
}else{
return(false);
}
}
</script>
<form method="POST" name="update" action="<?php echo"$PHP_SELF";?>" onSubmit="return checkSubmit() ">
<?php
//显示用户参数编辑页面
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><nobr>
<?php echo "Server ID "?>
<select name="sysId" size="1">
<?php
$selSysIdSql="SELECT sysNo,subSysNo,sysTypeName
FROM sysInfo,sysConf
WHERE sysInfo.sysTypeNo='$sysTypeNo' AND sysConf.sysTypeNo='$sysTypeNo'
ORDER BY baseStat DESC,updateTime DESC
";
if($DEBUG) echo "<br>11.$selSysIdSql";
$sysIdResult=mysqli_query($pubConn,$selSysIdSql);
echo mysqli_error($pubConn);
while($sysIdRows=mysqli_fetch_array($sysIdResult)){
echo "<option value=\"$sysTypeNo"."_$sysIdRows[sysNo]"."_$sysIdRows[subSysNo]\"";
if(($sysNo == $sysIdRows[sysNo]) && ($subSysNo == $sysIdRows[subSysNo]))
echo " selected";
echo " >$sysIdRows[sysTypeName]"."_$sysIdRows[sysNo]"."_$sysIdRows[subSysNo]";
echo "</option>";
}
?>
</select>
</nobr>
</td>
<td><nobr>
<?php
if($sysTypeNo == '360' ||$sysTypeNo == '395'|| $sysTypeNo == '350' || $sysTypeNo == '375'){ //pps or smsc
$keyValueName = 'MSISDN';
if($sysTypeNo == '360')
{
if($dataTypeNo == 0)
{
$keyValueName = "MSISDN";
}
elseif($dataTypeNo == 1)
{
$keyValueName = "Card No.";
}
}
if($sysTypeNo == '390')
{
if($dataTypeNo == 0)
{
$keyValueName = "MSISDN";
}
elseif($dataTypeNo == 1)
{
$keyValueName = "Card No.";
}
}
}
else if($sysTypeNo == '365')
{
$keyValueName = 'SUPI';
}
else
{//hlr or auc or sn
$keyValueName = 'IMSI';
}
if(substr($keyValue,0,1) == 0 && strlen($keyValue) > 15){
$showkeyValue= substr($keyValue,1,15);
}else{
$showkeyValue= $keyValue;
}
echo "&nbsp;&nbsp;$keyValueName:$showkeyValue";
?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</nobr></td>
<?php
if($isTryCreate > 0){
?>
<td >
<input type="submit" value="Create in <?php echo "$sysTypeName"?>" name="create" title="" class="button" onClick="javascript:document.update.isCreate.value=1;">
<input type="hidden" value="0" name="isCreate">
<input type="hidden" value="0" name="isChange">
</td>
<td>
&nbsp;&nbsp;&nbsp;
<input type="submit" value="Create in OMC" name="create" title="" class="button" onClick="javascript:document.update.isCreate.value=2;">
</td>
<?php
}else{
?>
<td>
<input type="submit" value="Get" name="read" title="" class="button" onClick="javascript:document.update.isRead.value=1;">
<input type="hidden" value="0" name="isRead">
</td>
<?php
if($sysTypeNo!='325')
{
?>
<td>
<input type="submit" value="Set" name="change" title="" class="button" onClick="javascript:document.update.isChange.value=1;">
<input type="hidden" value="0" name="isChange">
<input type="hidden" value="0" name="isCreate">
</td>
<td>
<input type="button" value="Delete" name="delete" title="Delete this subscriber" class="button" onClick="askSureToDel(<?php echo"'$keyValueName','$keyValue'";?>)">
<input type="hidden" value="0" name="isDelete">
</td>
<td>
<input type="button" value="Replace index value" name="replace" title="Replace this subscriber's Index Value" class="button" onClick="askSureToReplace(<?php echo"'$keyValueName','$keyValue'";?>)">
<input type="hidden" value="0" name="isReplaceIndex">
</td>
<?php
}
}
?>
<td width="100%">&nbsp;</td>
</tr>
</table>
<br>
<table border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF">
<tr bgcolor="#E6E6E6">
<td width="5%" align="center" >No.</td>
<td width="50%"><?php echo"Parameter"; ?></td>
<td width="5%" >
<?php
if($canSetNum == 'all'){
echo "<input type=\"checkbox\" name=\"seleceAll\" title=\"Select all to set\" value=\"1\" onClick=selectAllToSet(this)>";
}else{
echo "&nbsp;";
}
?>
</td>
<td width="20%" title="">Value</td>
</tr>
<?php
//************************顺序显示该页每条参数************************
//在参数定义表取出说明和在临时参数表取出相关的值
$paramSql = " SELECT * FROM $confTable
WHERE $confTable.operType > '0'
ORDER BY level_1,level_2,level_3,level_4,level_5,level_6,level_7,level_8,level_9,level_10
";
if($DEBUG) echo"<br>objDb =$objDb <br> ParamSql = $paramSql <br> ";
$paramResult = mysqli_query($objConn,$paramSql);
echo mysqli_error($objConn);
$i=0;
while($paramRows = @mysqli_fetch_array($paramResult)){
$editName='editValue_'.$i;
$checkBoxName='checkBox_'.$i;
$fieldNameName = 'fieldName_'.$i;
$valueTypeName='valueType_'.$i;
$maxLen=$paramRows[length]*2;
$maxLenName='maxLen_'.$i;
if($paramRows[length] > 4){
$inputSize = $paramRows[length] * 2;
}else{
$inputSize = 8;
}
$fieldName =$paramRows[fieldName];
echo "\n <tr>";
echo "<td width=\"5%\"> $i</td> ";
echo "<td width=\"50%\" title=\"$paramRows[$objDescField]\">$paramRows[$objNameField]</td>";
echo "<td width=\"5%\">";
echo "<input type=\"checkbox\" name=\"$checkBoxName\" value=\"0\" onClick=selectToSet(this)>";
echo "</td> ";
echo "<td width=\"40%\">";
if($inputSize > 32){
$rows=ceil($inputSize / 32) + 1;
$cols=32;
echo "<textarea rows=\"$rows\" cols=\"$cols\" name=\"$editName\" size=\"$inputSize\" onchange = changevalue(this)>$tmpRow[$fieldName]</textarea>";
}else{
echo "<input type=\"text\" name=\"$editName\" maxlength=\"$maxLen\" size=\"$inputSize\" value=\"$tmpRow[$fieldName]\" onchange = changevalue(this)>";
}
echo "<a href=javascript:onClick=openSet('$sysTypeNo','$paramRows[keyId]','$editName','$dataTypeNo')>set..</a>";
echo "<input type=\"hidden\" name=\"$fieldNameName\" value=\"$paramRows[fieldName]\">";
echo "<input type=\"hidden\" name=\"$valueTypeName\" value=\"$paramRows[valueType]\">";
echo "<input type=\"hidden\" name=\"$maxLenName\" value=\"$paramRows[length]\">";
echo "</td>";
echo "</tr>";
$i++;
}
$bgnNo = 0;
$endNo = $i;
?>
</table>
<?php
//*****************************************隐藏输入框,用于传递值****************************************
echo "\n<input type=\"hidden\" name=\"keyFieldName\" value=\"$indexFieldName\">";
echo "\n<input type=\"hidden\" name=\"keyValue\" value=\"$keyValue\">";
echo "\n<input type=\"hidden\" name=\"canSetNum\" value=\"$canSetNum\">";
echo "\n<input type=\"hidden\" name=\"setNum\" >";
echo "\n<input type=\"hidden\" name=\"bgnNo\" value=\"$bgnNo\">";
echo "\n<input type=\"hidden\" name=\"endNo\" value=\"$endNo\">";
echo "\n<input type=\"hidden\" name=\"dataTypeNo\" value=\"$dataTypeNo\">";
?>
</form>
&nbsp;
<?php
adjust_content_tail("down");
?>
</body>
</html>
<?php
flush();
?>
+505
View File
@@ -0,0 +1,505 @@
<?php
/*********************************************************
程序说明:
功能说明:列表显示账号信息,默认显示第一页用户资料
调用关系:调用: header.inc
被调用:
变量说明:
作者:
修改注释:
NO.1
姓名:Cui Ticun
时间:2004-8-29
修改说明:Support OMC8.0,Modify the PPS subscriber field********************************************/
require("../../inc/header.inc");
?>
<body leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('down');" onresize="javascript:adjust_frame('down');" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<?php
adjust_head_frame("down");
adjust_title_head_frame("down");
adjust_title_tail_frame("down");
adjust_content_head_frame("down");
echo "<br>";
//if($DEBUG) echo "<br>正在调试中!!";
//==========================================================
//变量定义
//==========================================================
$dbName = 'OMC_PUB';
$sysSubsConfTable = 'OMC_PUB.sysSubsConf';
$systemConfTable = 'OMC_PUB.sysConf';
$numberPerPage = 100; //每页纪录数
$nReadComm = 1;
$nChangeComm = 2;
$nCreateComm = 3;
$nDeleteComm = 4;
$nLoadIndexComm = 5;
//确定告警内容显示语言种类
if($selectedLanguage=='chn'){
$alarmDesc = alarmDesc_1;
}elseif($selectedLanguage=='eng'){
$alarmDesc = alarmDesc_2;
}
//==========================================================
//输入变量
//==========================================================
//列表所需基本变量
//fj
$DEBUG=0;
if($DEBUG) echo "<br>sysTypeNo=$sysTypeNo";
if($DEBUG) echo "<br>dataTypeNo=$dataTypeNo";
$dataTypeNo = $_REQUEST['dataTypeNo'];
if (strstr($userName, "student"))
{
$commType = $_REQUEST['commType'];
$keyValue = $_REQUEST['keyValue'];
}
if ($_REQUEST['sysTypeNo'])
{
$sysTypeNo = $_REQUEST['sysTypeNo'];
}
if ($_REQUEST['sysId'])
{
$sysId = $_REQUEST['sysId'];
if($DEBUG) echo "<br>sysId=$sysId";
$sysIdArr=explode('_',$sysId);
$sysTypeNo=$sysIdArr[0];
$sysNo=$sysIdArr[1];
// echo "sysTypeNo=$sysTypeNo,sysNo=$sysNo";
}
$bgnNo = $_REQUEST['bgnNo'];
//删除用户
if($DEBUG) echo "<br>commType =$commType";
//根据sysTypeNo,dataTypeNo获取数据表名,索引字段名
if($sysTypeNo==390 || $sysTypeNo==365 || $sysTypeNo==366){
if(!isset($sysNo)){
if(!isset($sysId))
$sysId='390_0_0';
$sysIdArr=explode('_',$sysId);
$sysNo=$sysIdArr[1];
}
$getConfSql="SELECT indexFieldName,subsDataTable,tmpDataTable
FROM $sysSubsConfTable
WHERE sysTypeNo='$sysTypeNo'
AND dataTypeNo='$dataTypeNo'
AND sysNo='$sysNo'
";
}else{
$getConfSql="SELECT indexFieldName,subsDataTable,tmpDataTable
FROM $sysSubsConfTable
WHERE sysTypeNo='$sysTypeNo'
AND dataTypeNo='$dataTypeNo'
";
}
if($DEBUG) echo "<br>getConfSql=$getConfSql";
$getConfResult=mysqli_query($pubConn,$getConfSql);
echo mysqli_error($pubConn);
$getConfRows=mysqli_fetch_array($getConfResult);
$tableName =$getConfRows[subsDataTable];
$keyFieldName =$getConfRows[indexFieldName];
if($DEBUG) echo "<br>tableName=$tableName";
if($DEBUG) echo "<br>keyFieldName=$keyFieldName";
//排序所依赖的字段名
if(!isset($orderByField)){
$orderByField = $keyFieldName;
}
if($DEBUG) echo "<br>orderByField=$orderByField";
//排序字符串
$orderByStr = " $orderByField";
if($DEBUG) echo "<br>orderByStr=$orderByStr";
//==========================================================
//数据处理
//==========================================================
//删除命令,且该命令被执行
if($commType == $nDeleteComm ){
$delSql="Delete FROM $tableName WHERE $keyFieldName='$keyValue'";
if($DEBUG) echo "<br>delSql=$delSql";
$result=mysqli_query($pubConn,$delSql);
echo mysqli_error($pubConn);
if($result){
echo "<br>Delete $keyValue OK!";
}
}
switch($sysTypeNo){
case '375':
if(!isset($sysId)){
$sysId='375_0_0';
}
$sysTypeName='OPPS';
$canSetNum='all';
$selectFieldList = "msisdn,imsi,imei,oprFlag,class,userType";
$showNameList="MSISDN,IMSI,IMEI,User Status,Class,User Type";
break;
case '378':
if(!isset($sysId)){
$sysId='378_0_0';
}
$sysTypeName='iPALIM';
$canSetNum='all';
$selectFieldList = 'imsi,msisdn,msisdn_extern,tmsi,lai,type';
$showNameList='IMSI,MSISDN Public,MSISDN Private,TMSI,MCC-MNC-LAC-CI,Type';
break;
case '330':
if(!isset($sysId)){
$sysId='330_0_0';
}
$sysTypeName='HLR';
$canSetNum='all';
$selectFieldList = "imsi,inter_msisdn,used_flag,nam,camel_flag";
$showNameList="IMSI,MSISDN,usedFlag,NetworkAccessMode,CamelFlag";
break;
case '361':
if(!isset($sysId)){
$sysId='361_0_0';
}
$sysTypeName='MME';
$canSetNum='all';
$selectFieldList = "imsi,msisdn,mm_state,ecm_state,tai";
$showNameList="IMSI,MSISDN,MMState,ECMState,TAI";
break;
case '362':
if(!isset($sysId)){
$sysId='362_0_0';
}
$sysTypeName='SPGW';
$canSetNum='all';
$selectFieldList = "imsi,s11_local_teid,s11_remote_teid,ue_ps_state,ue_ims_state,ps_ip,ims_ip,granted_bytes,used_bytes,ccr_update_threshold";
$showNameList="IMSI,s11LocalTEID,s11RemoteTEID,uePSState,ueIMSState,psIP,imsIP,grantedBytes,used_bytes,ccrUpdateThreshold";
break;
case '363':
if(!isset($sysId)){
$sysId='363_0_0';
}
$sysTypeName='IMS';
$canSetNum='all';
$selectFieldList="msisdn,impu,barring,reg_state";
$showNameList="MSISDN,IMPU,Barring,regState";
break;
case '364':
if(!isset($sysId)){
$sysId='364_0_0';
}
$sysTypeName='RCS';
$canSetNum='all';
$selectFieldList = "imsi,tmsi,ptmsi,context_id,hnb_index,active_time";
$showNameList="IMSI,TMSI,P-TMSI,CONTEXT-ID,HNB-Index,ACTIVE-Time";
break;
case '365':
if(!isset($sysId)){
$sysId='365_0_0';
}
$sysTypeName='UDM';
$canSetNum='all';
//$selectFieldList = "supi,gpsis,internal_group_ids,subscribed_ue_ambr_temp,subscribed_snssais_temp,ue_usage_type";
//$showNameList="SUPI,GPSIS,INTERNAL-GROUP-IDS,SUBSCRIBED-UE-AMBR-TEMP,SUBSCRIBED-SNSSAIS-TEMP,UE-USAGE-TYPE";
$selectFieldList = "supi,gpsis,internal_group_ids,subscribed_ue_ambr_temp,subscribed_snssais_temp,ue_usage_type,rat_restriction,forbidden_areas_templ,service_area_restriction_templ,core_network_type_restriction,rfsp_index,periodic_registration_timer,mps_priority,mcs_priority,odb_packet_services,mico_mode,active_time,download_packet_count,subscribed_slice_selection_data_temp,subscribed_smf_selection_data_temp,subscribed_data,purge_flag,pei,ims_vops,guami,pdu_session_ids,single_nssais_str,dnns";
$showNameList="SUPI,GPSIS,INTERNAL-GROUP-IDS,SUBSCRIBED-UE-AMBR-TEMP,SUBSCRIBED-SNSSAIS-TEMP,UE-USAGE-TYPE,RAT-RESTRICTION,FORBIDDEN-AREAS-TEMPL,SERVICE-AREA-ERSTRICTION-TEMPL,CORE-NETWORK-TYPE-RESTRICTION,RFSP-INDEX,PERIODIC-REGISTRATION-TIMER,MPS-PRIORITY,MCS-PRIORITY,ODB-PACKET-SERVICES,MICO-MODE,ACTIVE-TIME,DOWNLOADED-PACKET-COUNT,SUBSCRIBED-SLIC-SELECTION-DATA-TEMP,SUBCRIBED-SMF-SELECTION-DATA-TEMP,SUBCRIBED-DATA,PURGE-FLAG,PEI,IMS-VOPS,GUAMI,PDU-SESSION-IDS,SINGLE-NSAIS-STR,DNNS";
break;
case '325':
if(!isset($sysId)){
$sysId='325_0_0';
}
$sysTypeName='VLR';
$canSetNum='all';
$selectFieldList = "IMSI,MSISDN,TMSI,LMSI";
$showNameList = "IMSI,MSISDN,TMSI,LMSI";
break;
case '360':
if($dataTypeNo == 0){
$sysTypeName='PPS';
$canSetNum='all';
$selectFieldList = "msisdn,status,balance,mo_expiration_date,mt_expiration_date,cug_id,access_date";
$showNameList= "MSISDN,Status,Balance,Expiration(MO),Expiration(MT),CUG,Active since";
// $selectFieldList = "msisdn,overdraft,status,balance,expiration_date,first_used_date,user_type";
// $showNameList= "MSISDN,Overdraft,Status,Balance,Expiration Date,First used Date,User Type";
}else{
$sysTypeName='Prepaid Card';
$canSetNum='all';
$selectFieldList ="card_no,card_hrn,face_value,card_status,expiry_date,valid_time,updated_date";
$showNameList="Card No,Card_hrn,Face Value,Status,Expiry Date,Valid Time,Updated Date";
}
if(!isset($sysId)){
$sysId='360_0_0';
}
break;
case '395':
$sysTypeName='Recharge Card';
$canSetNum='all';
$selectFieldList ="card_no,card_hrn,face_value,card_status,expiry_date,valid_time,updated_date";
$showNameList="Card No,Card_hrn,Face Value,Status,Expiry Date,Valid Time,Updated Date";
if(!isset($sysId)){
$sysId='395_0_0';
}
break;
case '340':
if(!isset($sysId)){
$sysId='340_0_0';
}
$sysTypeName='AUC';
$canSetNum='all';
$selectFieldList = "key_imsi,a3a8_version,status";
$showNameList = "IMSI,A3A8 version,status";
break;
case '380':
if(!isset($sysId)){
$sysId='380_0_0';
}
$sysTypeName='EIR';
$canSetNum='all';
$selectFieldList = "imei,status";
$showNameList= "IMEI,Status";
break;
case '390':
if(!isset($sysId)){
$sysId='390_0_0';
}
$sysTypeName='VMS';
$canSetNum='all';
$selectFieldList = "msisdn,mailboxID,status,promo_language,greeting,optionFlag,pwdValue,acbTimeOut";
$showNameList= "MSISDN,Mailbox No(Hex),Status,Language,Greeting,Option flag,Password,Acb timeout";
break;
case '253':
if(!isset($sysId)){
$sysId='253_0_0';
}
$sysTypeName='SN-HLR';
$canSetNum='all';
$selectFieldList = "imsi,msisdn,used_flag,lac";
$showNameList= "imsi,msisdn,used_flag,lac";
break;
case '370':
if(!isset($sysId)){
$sysId='370_0_0';
}
$sysTypeName='MNP';
$canSetNum='all';
$selectFieldList = "msisdn,routing_number,status,donor,recipient,Date";
$showNameList = "MSISDN,RN,status,Donor,Recipient,Date";
break;
break;
default:
echo "Uknown sysTypeNo: $sysTypeNo";
exit(1);
}
$showFieldArr=explode(',',$selectFieldList);
$showNameArr=explode(',',$showNameList);
//根据上部页面传来的变量,生成查询条件
$selKeyFieldName = $_REQUEST['selKeyFieldName'];
$selKeyValue = $_REQUEST['selKeyValue'];
if(strlen($selKeyFieldName) > 0 && strlen($selKeyValue) > 0){
$whereStr = "WHERE $selKeyFieldName like '%$selKeyValue%'";
}
//查询基本条件
if(strlen($whereStr) > 10){
$bascWhereStr ="";
}else{
$bascWhereStr ="";
}
$numberOfRecords = $_REQUEST['numberOfRecords'];
//首次查询,查出符合条件的纪录条数,并在以后的页面跳转中传递。
if(!$numberOfRecords){
$bgnNo=0;
$countSql="SELECT count(*) as totalNum
FROM $tableName
$whereStr
$bascWhereStr
";
if($DEBUG) echo "<br>countSql=$countSql";
$result=mysqli_query($pubConn,$countSql);
echo mysqli_error($pubConn);
$record = @mysqli_fetch_array($result);
$numberOfRecords = $record[0];
if($DEBUG) echo "<br>numberOfRecords=$numberOfRecords";
if($numberOfRecords > 0){
//插入日志
insertLog("search $sysTypeName subscriber: $selKeyValue ");
}else{
//插入日志
insertLog("search $sysTypeName subscriber: $selKeyValue not found");
echo "<br>No Found";
exit();
}
}
//找到需要显示的纪录
if($numberOfRecords > 0){
$showSql=" SELECT $selectFieldList
FROM $tableName
$whereStr
$bascWhereStr
ORDER BY $orderByStr
LIMIT $bgnNo, $numberPerPage
";
if($DEBUG) echo "<br>showSql=$showSql";
$result=@mysqli_query($pubConn,$showSql);
echo mysqli_error($pubConn);
$rows=@mysqli_fetch_array($result);
//下面是控制分页显示需要传递的变量传递变量
if ($numberOfRecords >= 1) {
$nextBgnNo = $bgnNo + $numberPerPage; //本页的结束数目
if ($nextBgnNo > $numberOfRecords){
$nextBgnNo = $numberOfRecords;
}
$t1 = $bgnNo + 1;
$prevBgnNo = $bgnNo - $numberPerPage;
if ($prevBgnNo < 0) {
$prevBgnNo = 0;
}
$basePageLink ="sysTypeNo=$sysTypeNo&sysId=$sysId&dataTypeNo=$dataTypeNo&numberOfRecords=$numberOfRecords";
$basePageLink .="&selKeyFieldName=$selKeyFieldName&selKeyValue=$selKeyValue";
$prePageLink ="bgnNo=$prevBgnNo";
$nextPageLink ="bgnNo=$nextBgnNo";
}
$showBgnNo=$bgnNo+1;
}
//==========================================================
//输出并显示数据
//==========================================================
?>
<script LANGUAGE="JavaScript">
function gotoPage(){
var pageUrl,bgnNo,numberPerPage;
pageNo=document.selectform.pageNo.value;
numberPerPage='<?php echo "$numberPerPage";?>';
bgnNo=numberPerPage*(pageNo-1);
baseUrl='<?php echo "$PHP_SELF?$basePageLink";?>';
pageUrl="&bgnNo="+bgnNo;
window.location.href=baseUrl+pageUrl;
}
</script>
<form name="selectform">
<TABLE border="0" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF">
<TR >
<TD >
<?php
echo "$strDisplayRecords<FONT color=#0000ff>&nbsp;$showBgnNo - $nextBgnNo</FONT>, ";
echo "($strTotal:$numberOfRecords)";
?>
<TD>&nbsp;
<?php /*
// NEW: Display a link for the previous set of records.
if ($bgnNo != 0) {
echo "<a href=\"$PHP_SELF?$basePageLink&$prePageLink\">";
echo "<IMG alt=$strPreviousPage border=0 src=../../images/prePage.gif ></a>&nbsp;&nbsp;&nbsp;";
}else{
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
}
// NEW: Display a link for the next set of records.
if ($nextBgnNo != $numberOfRecords && $numberOfRecords >0) {
echo "<a href=\"$PHP_SELF?$basePageLink&$nextPageLink\">";
echo "<IMG alt=$strNextPage border=0 src=../../images/nextPage.gif ></a>&nbsp;";
}else{
echo "&nbsp;&nbsp;&nbsp;&nbsp;";
}
//根据纪录条数,算出页码数,本页页码
if($numberOfRecords > 0){
$totalPageNum = ceil($numberOfRecords / $numberPerPage );
$pageNo = $bgnNo / $numberPerPage + 1;
}*/
?>
</TD>
<TD align="right">
<?php
// NEW: Display a link for the previous set of records.
if ($bgnNo != 0) {
echo "<a href=\"$PHP_SELF?$basePageLink&$prePageLink\">";
echo "$strPrevious&nbsp;<IMG alt=$strPreviousPage align=absBottom border=0 src=../../images/left.gif ></a>&nbsp";
}else{
echo "<font color=\"#808080\">$strPrevious&nbsp;</font><IMG alt=$strPreviousPage align=absBottom border=0 src=../../images/left_1.gif ></a>&nbsp";
}
//根据纪录条数,算出页码数,本页页码
if($numberOfRecords > 0){
$totalPageNum = ceil($numberOfRecords / $numberPerPage );
$pageNo = $bgnNo / $numberPerPage + 1;
}
echo "<SELECT size=\"1\" name=\"pageNo\" onChange=\"javasript:gotoPage()\">";
for($i=1;$i<=$totalPageNum;$i++){
if($i== $pageNo){
echo "<option selected value=\"$i\" >$i</option>";
}else{
echo "<option value=\"$i\">$i</option>";
}
}
echo "</SELECT>";
// NEW: Display a link for the next set of records.
if ($nextBgnNo != $numberOfRecords && $numberOfRecords >0) {
echo "<a href=\"$PHP_SELF?$basePageLink&$nextPageLink\">";
echo "<IMG alt=$strNextPage align=absBottom border=0 src=../../images/right.gif >&nbsp;$strNext</a>";
}else{
echo "<IMG alt=$strNextPage align=absBottom border=0 src=../../images/right.gif ><font color=\"#808080\">&nbsp;$strNext</font>";
}
?>
</TD>
</TR>
</TABLE>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr bgcolor="#E6E6E6">
<?php
for($i=0;$i<sizeof($showFieldArr);$i++){
echo "<td align=\"center\">";
echo "<a href=\"$PHP_SELF?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&orderByField=$showFieldArr[$i]&selKeyFieldName=$selKeyFieldName&selKeyValue=$selKeyValue\">";
echo "$showNameArr[$i]</a>";
echo "</td>";
}
?>
</tr>
<?php
do{
echo "<tr>";
for($i=0;$i<sizeof($showFieldArr);$i++){
echo "<td align=\"center\">";
if ($i == "0"){
echo "<a href=\"./subscriberConf.php?sysId=$sysId&dataTypeNo=$dataTypeNo&sysNo=$sysNo&keyValue={$rows[$keyFieldName]}&canSetNum=$canSetNum&isRead=1\">&nbsp;$rows[$i]</a>";
}else{
echo "&nbsp;$rows[$i]";
}
echo "</td>";
}
/* echo "<td align=\"center\">";
echo "<a href=\"./subscriberConf.php?sysId=$sysId&dataTypeNo=$dataTypeNo&keyValue=$rows[$keyFieldName]&canSetNum=$canSetNum&isRead=1\">edit</a>";
echo "</td>";*/
echo "</tr>";
}while($rows=mysqli_fetch_array($result));
?>
</table>
</form>
&nbsp;
<?php
adjust_content_tail("down");
?>
</body>
</html>
+23
View File
@@ -0,0 +1,23 @@
<?php
require("../../inc/header.inc");
$sysTypeNo = $_REQUEST['sysTypeNo'];
$dataTypeNo = $_REQUEST['dataTypeNo'];
?>
<frameset rows="75,*" framespacing="0" border="0" frameborder="0">
<?php
echo "<frame name=\"header\" scrolling=\"auto\" noresize target=\"main\" src=\"subscriberListUp.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo\" marginwidth=\"0\" marginheight=\"0\">";
echo "<frame name=\"main\" src=\"subscriberListDown.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo\" scrolling=\"auto\"target=\"_self\" marginwidth=\"0\" marginheight=\"0\">";
?>
<noframes>
<body>
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body>
</noframes>
</frameset>
</html>
+405
View File
@@ -0,0 +1,405 @@
<?php
/*********************************************************
程序说明:
功能说明:用户信息显示上部页面
调用关系:调用: header.inc
被调用:
变量说明:
作者:
修改注释:
NO.1
姓名:
时间:
修改说明:
*********************************************************/
require("../../inc/header.inc");
$sysTypeNo=$_REQUEST['sysTypeNo'];
$dataTypeNo=$_REQUEST['dataTypeNo'];
//$helpId="6.4.1";
?>
<script LANGUAGE="JavaScript">
function ignoreSpaces(string) {
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}
function checkSubmit(actionType,transValue){
var baseURL,URL,selSysId;
switch(actionType){
case 3: //add
<?php
echo "baseURL = \"./subscriberConf.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&\"; \n";
?>
break;
case 4: //import
<?php
if($sysTypeNo==390)
echo "baseURL = \"../pubSubsImport/subscriberImportIndex.php?sysId=$sysId&dataTypeNo=$dataTypeNo&\"; \n";
else
echo "baseURL = \"../pubSubsImport/subscriberImportIndex.php?sysId=$sysTypeNo"."_99_99&dataTypeNo=$dataTypeNo&\"; \n";
?>
break;
case 5: //get all
<?php
echo "baseURL = \"./subscriberConf.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&\"; \n";
?>
break;
default:
alert("Unknown action!");
return(false);
}
selSysId = document.actionForm.sysId.options[document.actionForm.sysId.selectedIndex].value;
URL = baseURL+transValue+'&sysId='+selSysId;
window.parent.main.location = URL;
}
function selectSysId(sysTypeNo,dataTypeNo){
var URL,selSysId;
selSysId = document.actionForm.sysId.value;
URL = "./subscriberListDown.php?sysId="+selSysId+"&sysTypeNo="+sysTypeNo+"&dataTypeNo="+dataTypeNo;
//window.alert(URL);
window.parent.main.location = URL;
}
</script>
<base target="main">
<body topmargin=16 leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('up');" onresize="javascript:adjust_frame('up');" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<form name="actionForm" method="POST" action="./subscriberListDown.php" >
<?php
adjust_head_frame("up");
adjust_title_head_frame("up");
echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"50%\" align=\"left\">";
$pagetitle="Advanced > Subscriber ";
switch($sysTypeNo){
case '375':
$pagetitle.="> OPPS";
$helpId = "2.2.1.8";
break;
case '330':
$pagetitle.="> HLR";
$helpId = "2.2.1.2";
break;
case '361':
$pagetitle.="> MME";
$helpId = "2.2.1.2"; // ??
break;
case '362':
$pagetitle.="> SPGW";
$helpId = "2.2.1.2";
break;
case '363':
$pagetitle.="> IMS";
$helpId = "2.2.1.2";
break;
case '364':
$pagetitle.="> RCS";
$helpId = "2.2.1.2";
break;
case '365':
$pagetitle.="> UDM";
$helpId = "2.2.1.2";
break;
case '366':
$pagetitle.="> AUSF";
$helpId = "2.2.1.2";
break;
case '325':
$pagetitle.="> VLR";
$helpId = "2.2.1.1";
break;
case '360':
if($dataTypeNo == 0){
$pagetitle.="> PPS";
$helpId = "2.2.1.3";
}else{
$pagetitle="Advanced > Recharge Card > Fresh Card";
$helpId = "2.2.2";
}
break;
case '395':
$pagetitle="Advanced > Recharge Card > Fresh Card";
$helpId = "2.2.2";
break;
case '340':
$pagetitle.="> AUC";
$helpId = "2.2.1.4";
break;
case '380':
$pagetitle.="> EIR";
$helpId = "2.2.1.5";
break;
case '390':
$pagetitle.="> VSS";
$helpId = "2.2.1.6";
break;
case '253':
$helpId = "2.2.1.7";
break;
case '370':
$pagetitle.="> MNP";
$helpId = "2.2.1.7";
break;
case '378':
$pagetitle.="> iPALIM";
$helpId = "2.2.1.9";
break;
default:
echo "Unknown sysTypeNo:$sysTypeNo";
exit(1);
}
echo "$pagetitle";
echo "</td>";
echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
showHelp($helpId);
echo "</td>";
echo "</tr>";
echo "</table>";
?>
<table border="0" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF">
<tr>
<td>
<nobr>
<?php
switch($sysTypeNo){
case '375':
$sysTypeName='OPPS';
//echo "MSISDN";
//echo "<input type=\"hidden\" name=\"selKeyFieldName\" value=\"msisdn\">";
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"msisdn\" selected>MSISDN</option>";
echo "<option value=\"imsi\">IMSI</option>";
echo "<option value=\"imei\">IMEI</option>";
echo "</select>";
break;
case '330':
$sysTypeName='HLR';
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"inter_msisdn\" selected>MSISDN</option>";
echo "<option value=\"imsi\">IMSI</option>";
echo "</select>";
break;
case '361':
$sysTypeName='MME';
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"imsi\">IMSI</option>";
echo "</select>";
break;
case '362':
$sysTypeName='SPGW';
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"imsi\">IMSI</option>";
echo "</select>";
break;
case '363':
$sysTypeName='IMS';
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"MSISDN\">MSISDN</option>";
echo "</select>";
break;
case '364':
$sysTypeName='RCS';
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"imsi\">IMSI</option>";
echo "</select>";
break;
case '365':
$sysTypeName='UDM';
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"supi\">SUPI</option>";
echo "</select>";
break;
case '366':
$sysTypeName='AUSF';
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"imsi\">IMSI</option>";
echo "</select>";
break;
case '378':
$sysTypeName='iPALIM';
echo "IMSI";
echo "<input type=\"hidden\" name=\"selKeyFieldName\" value=\"imsi\">";
break;
case '325':
$sysTypeName='VLR';
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"MSISDN\" selected>MSISDN</option>";
echo "<option value=\"IMSI\">IMSI</option>";
echo "</select>";
break;
case '360':
$sysTypeName='PPS';
if($dataTypeNo == 0){
echo "MSISDN";
echo "<input type=\"hidden\" name=\"selKeyFieldName\" value=\"msisdn\">";
}else{
echo "Card no.";
echo "<input type=\"hidden\" name=\"selKeyFieldName\" value=\"card_no\">";
}
break;
case '395':
$sysTypeName='RCM';
echo "Card no.";
echo "<input type=\"hidden\" name=\"selKeyFieldName\" value=\"card_no\">";
break;
case '340':
$sysTypeName='AUC';
echo "IMSI";
echo "<input type=\"hidden\" name=\"selKeyFieldName\" value=\"key_imsi\">";
break;
case '380':
$sysTypeName='EIR';
echo "IMEI";
echo "<input type=\"hidden\" name=\"selKeyFieldName\" value=\"imei\">";
break;
case '390':
$sysTypeName=$strVMSOrVSS;
echo "MSISDN";
echo "<input type=\"hidden\" name=\"selKeyFieldName\" value=\"msisdn\">";
break;
case '253':
$sysTypeName='SN';
echo "<select size=\"1\" name=\"selKeyFieldName\" >";
echo "<option value=\"msisdn\" selected>MSISDN</option>";
echo "<option value=\"imsi\">IMSI</option>";
echo "</select> ";
break;
case '370':
$sysTypeName='MNP';
echo "MSISDN";
echo "<input type=\"hidden\" name=\"selKeyFieldName\" value=\"msisdn\">";
break;
default:
echo "Uknown sysTypeNo:$sysTypeNo";
exit(1);
}
?>
<input type="text" name="selKeyValue" class="text" size="20" onBlur="this.value=ignoreSpaces(this.value);" >&nbsp;&nbsp;
</nobr>
</td>
<td>
<nobr>
<div onClick="javascript:document.actionForm.submit();" style="cursor:hand">
<IMG align=absBottom border=0 src="../../images/search.gif" >&nbsp;<?php echo "$strSearch"; ?>
</div>
</nobr>
</td>
<td width="40%">
&nbsp;
</td>
<td width="10%"><nobr>
<?php
if($sysTypeNo==390){
echo "Select System:";
echo "<select name=\"sysId\" size=\"1\" onChange=\"javascript:selectSysId($sysTypeNo,$dataTypeNo)\">";
echo "<option value=\"{$sysTypeNo}_0_0\">{$sysTypeName}_0_0</option>";
echo "<option value=\"{$sysTypeNo}_1_0\">{$sysTypeName}_1_0</option>";
echo "<option value=\"{$sysTypeNo}_2_0\">{$sysTypeName}_2_0</option>";
echo "<option value=\"{$sysTypeNo}_3_0\">{$sysTypeName}_3_0</option>";
echo "<option value=\"{$sysTypeNo}_4_0\">{$sysTypeName}_4_0</option>";
echo "<option value=\"{$sysTypeNo}_5_0\">{$sysTypeName}_5_0</option>";
echo "<option value=\"{$sysTypeNo}_6_0\">{$sysTypeName}_6_0</option>";
echo "<option value=\"{$sysTypeNo}_7_0\">{$sysTypeName}_7_0</option>";
echo "<option value=\"{$sysTypeNo}_8_0\">{$sysTypeName}_8_0</option>";
echo "<option value=\"{$sysTypeNo}_9_0\">{$sysTypeName}_9_0</option>";
echo "</select>";
}
else if($sysTypeNo == 365 || $sysTypeNo == 366)
{
echo "Select System:";
echo "<select name=\"sysId\" size=\"1\" onChange=\"javascript:selectSysId($sysTypeNo,$dataTypeNo)\">";
echo "<option value=\"{$sysTypeNo}_0_0\">{$sysTypeName}_0_0</option>";
echo "<option value=\"{$sysTypeNo}_1_0\">{$sysTypeName}_1_0</option>";
echo "<option value=\"{$sysTypeNo}_2_0\">{$sysTypeName}_2_0</option>";
echo "<option value=\"{$sysTypeNo}_3_0\">{$sysTypeName}_3_0</option>";
echo "<option value=\"{$sysTypeNo}_4_0\">{$sysTypeName}_4_0</option>";
echo "<option value=\"{$sysTypeNo}_5_0\">{$sysTypeName}_5_0</option>";
echo "<option value=\"{$sysTypeNo}_6_0\">{$sysTypeName}_6_0</option>";
echo "<option value=\"{$sysTypeNo}_7_0\">{$sysTypeName}_7_0</option>";
echo "<option value=\"{$sysTypeNo}_8_0\">{$sysTypeName}_8_0</option>";
echo "<option value=\"{$sysTypeNo}_9_0\">{$sysTypeName}_9_0</option>";
echo "<option value=\"{$sysTypeNo}_10_0\">{$sysTypeName}_10_0</option>";
echo "<option value=\"{$sysTypeNo}_11_0\">{$sysTypeName}_11_0</option>";
echo "</select>";
}
else
{
echo "Select System:";
echo "<select name=\"sysId\" size=\"1\" onChange=\"javascript:selectSysId($sysTypeNo,$dataTypeNo)\">";
echo "<option value=\"{$sysTypeNo}_0_0\">{$sysTypeName}_0_0</option>";
echo "<option value=\"{$sysTypeNo}_1_0\">{$sysTypeName}_1_0</option>";
echo "</select>";
}
?>
<?php
if($sysTypeNo==390)
$strGetAll='Get';
?>
</nobr></td>
<td width="10%">
&nbsp;
</td>
<td align="right">
<div style="cursor:hand" onClick=checkSubmit(5,"isLoadIndex=1")>
<nobr>
<IMG align=absBottom border=0 src="../../images/reload.gif"><?php echo "$strGetAll" ?>
</nobr>
</div>
</td>
<?php
if ($sysTypeNo != 325){
if($dataTypeNo != 1){
echo "<td align=\"right\">";
echo "<div style=\"cursor:hand\" onClick=checkSubmit(3,\"isTryCreate=1\")><nobr>";
echo "<IMG align=absBottom border=0 src=\"../../images/add.gif\">$strAdd";
echo "&nbsp;&nbsp;</nobr></div></td>";
}
echo "<td align=\"right\">";
echo "<div style=\"cursor:hand\" onClick=checkSubmit(4,\"isTryImport=1\")><nobr>";
echo "<IMG align=absBottom border=0 src=\"../../images/import_1.gif\">$strImport";
echo "</nobr></div></td>";
}
?>
<!--
<td align="right">
<input Name="isShowStat" type="button" DISABLED value="Statistics" title="Show subscriber data's statistics">&nbsp;
<input Name="isLoadIndex" type="button" value="Reload" onClick=checkSubmit(5,"isLoadIndex=1") title="Load all subscriber's data from server" class="button">&nbsp;
<input Name="isCreate" type="button" value="Create" onClick=checkSubmit(3,"isTryCreate=1") title="Create a new subscriber" class="button">&nbsp;
<input Name="isImport" type="button" value="Import" onClick=checkSubmit(4,"isTryImport=1") title="Import subscriber file to server" class="button">
</td>
-->
</tr>
</table>
<?php
echo "<input Name=\"sysTypeNo\" type=\"hidden\" value=\"$sysTypeNo\">";
echo "<input Name=\"dataTypeNo\" type=\"hidden\" value=\"$dataTypeNo\">";
?>
</form>
<?php
adjust_title_tail_frame("up");
adjust_content_head_frame("up");
adjust_content_tail_frame("up");
?>
</body>
</html>