init web ems all

This commit is contained in:
agtuser
2024-09-27 17:13:36 +08:00
parent 81c97acbe9
commit 5cc56f8078
4263 changed files with 798779 additions and 0 deletions

View File

@@ -0,0 +1,473 @@
<?php
/*************************************************************************
* <20>ļ<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>:OMC״̬<D7B4><CCAC>ʾҳ<CABE>
* <20><><EFBFBD>ù<EFBFBD>ϵ<EFBFBD><CFB5>
*
*
* <20><><EFBFBD>ߣ<EFBFBD>Cui Ticun 2006-10-30
*
*<2A>޸<EFBFBD>ע<EFBFBD>ͣ<EFBFBD>
*NO.1
*Name<6D><65>
*Time<6D><65>
*Modify description<6F><6E>
*************************************************************************/
require("../sub_inc/header.inc");
$DEBUG = 0;
//==========================online help=======================
{
echo "<div style=\"position:absolute;top:20;left:815;\" id=\"helpId\">";
$helpId="1.1";
showHelp($helpId);
echo "</div>";
}
$tmpSql = "SELECT existFlag From elementExistConf WHERE elementName='BSS'";
global $pubConn;
if($DEBUG)
echo "<br>tmpSql=$tmpSql";
$tmpResult=mysqli_query($pubConn,$tmpSql);
echo mysqli_error($pubConn);
$tmpRows=mysqli_fetch_array('$tmpResult');
$bssExistFlag=$tmpRows['existFlag'];
if($bssExistFlag==1)
$showingTypeDefine=array(
array('needDragElement'=>'1','typeOffset'=>'20480','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'map.jpg','title'=>'MAP'),
array('needDragElement'=>'0','typeOffset'=>'20489','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'bg_shelf.jpg','title'=>'Central Office'),
array('needDragElement'=>'0','typeOffset'=>'20577','maxPageNum'=>'12','maxLedNum'=>'512','bg_img'=>'bss.jpg','title'=>'BSS')
);
else
$showingTypeDefine=array(
array('needDragElement'=>'1','typeOffset'=>'20480','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'map.jpg','title'=>'MAP'),
array('needDragElement'=>'0','typeOffset'=>'20489','maxPageNum'=>'1','maxLedNum'=>'512','bg_img'=>'bg_shelf_noBss.jpg','title'=>'Central Office'),
array('needDragElement'=>'0','typeOffset'=>'20577','maxPageNum'=>'12','maxLedNum'=>'512','bg_img'=>'bss.jpg','title'=>'BSS')
);
if(!isset($pageNum)||strlen($pageNum)<=0)
$pageNum=0;
if(!isset($showingPageType)||strlen($showingPageType)<=0)
$showingPageType=0;
if($bssExistFlag==0)
$showingPageType=1;
$needDragElement=$showingTypeDefine[$showingPageType]['needDragElement'];
$typeOffset =$showingTypeDefine[$showingPageType]['typeOffset'];
$maxPageNum =$showingTypeDefine[$showingPageType]['maxPageNum'];
$maxLedNum =$showingTypeDefine[$showingPageType]['maxLedNum'];
$bg_img =$showingTypeDefine[$showingPageType]['bg_img'];
if($DEBUG)
{
echo "<br>showingPageType=$showingPageType";
echo "<br>needDragElement=$needDragElement";
echo "<br>typeOffset=$typeOffset";
echo "<br>pageNum=$pageNum";
echo "<br>maxPageNum=$maxPageNum";
echo "<br>maxLedNum=$maxLedNum";
echo "<br>bg_img=$bg_img";
}
echo "<script language=\"JavaScript\">\n";
echo "var showingPageType=$showingPageType;\n";
echo "var needDragElement=$needDragElement;\n";
echo "var typeOffset=$typeOffset;\n";
echo "var pageNum=$pageNum;\n";
echo "var maxPageNum=$maxPageNum;\n";
echo "var maxLedNum=$maxLedNum;\n";
echo "var bg_img='$bg_img';\n";
echo "</script>";
if($needDragElement==1){
require("./dragElement.php");
require("./jsgraphics.php");
}
?>
<?php
if($language_version == 'eng'){
$language = 'eng';
}else{
$language = 'gb';
}
$dbName='OMC_PUB';
$ledConfTable='sysLedConf';
$ledStatTable='sysLedStat';
$nLedNoUsed ='00';
$nLedOk ='01';
$nLedWarn ='02';
$nLedError ='03';
$nLedAlarm ='04';
$NotShowLED ='15';
$shapeArr=array("circle","square","rectangle","triangle","rectangle_v","star");
$suffixArr=array(".gif","_f.gif");
$maxY=540;
$maxX=760;
$divideNumber='20489';
$routerURL = "./status_router.php?";
$htmlPageType=50;
?>
<script language="JavaScript">
function myDrawFunction(imageColor,x1,y1,x2,y2)
{
jg_doc.setStroke(1);
jg_doc.setColor(imageColor); // green
jg_doc.drawLine(x1,y1,x2,y2);
jg_doc.paint(); // draws, in this case, directly into the document
}
if(needDragElement==1)
var jg_doc = new jsGraphics(); // draw directly into document
var request_o=null; //declare the variable to hold the object.
var pageNum=0;
var totalLedNum=0;
/*
*--------------- GetResult() -----------------
* GetResult()
* <20><><EFBFBD><EFBFBD><><CDA8>XMLHTTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ؽ<EFBFBD><D8BD>.
* <20><><EFBFBD><EFBFBD>:str,<2C>ַ<EFBFBD><D6B7><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
* ʵ<><CAB5>:GetResult();
*--------------- GetResult() -----------------
*/
function GetResult()
{
var browser = navigator.appName; //find the browser name
if(browser == "Microsoft Internet Explorer"){
/* Create the object using MSIE's method */
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}else{
/* Create the object using other browser's method */
request_o = new XMLHttpRequest();
//new XMLHttpRequest()
}
//alert(request_o);
var url="mapStatusServer.php?showingPageType="+showingPageType+"&typeOffset="+typeOffset+"&pageNum="+pageNum;
//document.writeln(url);
request_o.open("GET",url,"false");
request_o.onreadystatechange = handleMsgs;
request_o.send(null);
}
function handleMsgs(){
//alert(totalLedNum);
/* Make sure that the transaction has finished. The XMLHttpRequest object
has a property called readyState with several states:
0: Uninitialized
1: Loading
2: Loaded
3: Interactive
4: Finished */
//alert(request_o.readyState);
if(request_o.readyState == 4){ //Finished loading the response
/* We have got the response from the server-side script,
let's see just what it was. using the responseText property of
the XMLHttpRequest object. */
//var strResult = unescape(request_o.responseText);
var strResult = request_o.responseText;
//alert(strResult);
var arrResult = strResult.split("@@@");
if(arrResult.length-1!=totalLedNum)
window.location.href="./mapStatus.php?showingPageType="+showingPageType+"&pageNum="+pageNum;
for(var i=0;i<arrResult.length-1;i++){
statusImg=document.getElementById(i);
//alert(arrResult[i]);
statusImg.src=arrResult[i];
}
}
}
function MyShow(ledNum)
{
//10<31><30><EFBFBD>Զ<EFBFBD>ˢ<EFBFBD><CBA2>һ<EFBFBD><D2BB>,10<31><30>ȡ<EFBFBD><C8A1>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
timer = window.setInterval("GetResult()",10000);
}
function ChangeImgId()
{
var idNumber = 0;
for (var i=0;i<document.images.length;i++)
{
if(document.images[i].id != 'helpId'){
document.images[i].id = idNumber;
idNumber++;
}
}
}
function openPage(newPage_showingPageType,newPage_pageNum,backurl)
{
//alert(newPage_showingPageType);
//alert(newPage_pageNum);
window.location.href=backurl+"showingPageType="+newPage_showingPageType+"&pageNum="+newPage_pageNum;
}
</script>
<?php
function getLedStatus($status_str,$led_num){
//echo "status_str:$status_str<br>";
//echo "led_num:$led_num<br>";
global $NotShowLED,$divideNumber;
$status_num = $NotShowLED;
$offset = 0;
if($led_num < $divideNumber){
$offset = ($led_num % 16)*2;
}else{
$offset = 0;
}
if($DEBUG)
echo "<br>led_num=$led_num,status_str=$status_str,offset=$offset";
$status_num = substr($status_str,$offset,2);
if($DEBUG)
echo "<br>status_num=$status_num";
if($status_num >=0 && $status_num <=$NotShowLED){
return($status_num&0x07);
}else{
return($NotShowLED);
}
}
?>
<?php
//save the result of dragging
if($command=='save'){
$tmpArr=explode("_",$drag_key_led_num);
$updateSql="UPDATE $ledConfTable SET point_x='$drag_x',point_y='$drag_y' WHERE key_led_num='$tmpArr[1]'";
if($DEBUG){
echo "<font size=\"2\">";
echo "<br>updateSql=$updateSql";
echo "</font>";
}
mysqli_query($pubConn,$updateSql);
}
?>
<?php
$pageIndex=$typeOffset+$pageNum;
if($bssExistFlag==1)
$selSql = "SELECT T1.key_led_num,T2.key_status,T1.point_x,T1.point_y,T1.shape,T1.remark,T1.dst_page_type,T1.dst_page_num
FROM $ledConfTable AS T1,$ledStatTable AS T2
WHERE (
if(T1.sync_from_led < 0 && T2.key_led_num < $divideNumber,floor(T1.key_led_num/16) = T2.key_led_num,T1.key_led_num = T2.key_led_num)
OR
if(T1.sync_from_led >= 0 && T2.key_led_num < $divideNumber,floor(T1.sync_from_led/16) = T2.key_led_num,T1.sync_from_led = T2.key_led_num)
)
AND T1.key_src_page_type ='$showingPageType'
AND T1.key_src_page_num = '$pageIndex'
AND T2.key_status != '15151515151515151515151515151515'
";
else
$selSql = "SELECT T1.key_led_num,T2.key_status,T1.point_x,T1.point_y,T1.shape,T1.remark,T1.dst_page_type,T1.dst_page_num
FROM $ledConfTable AS T1,$ledStatTable AS T2
WHERE (
if(T1.sync_from_led < 0 && T2.key_led_num < $divideNumber,floor(T1.key_led_num/16) = T2.key_led_num,T1.key_led_num = T2.key_led_num)
OR
if(T1.sync_from_led >= 0 && T2.key_led_num < $divideNumber,floor(T1.sync_from_led/16) = T2.key_led_num,T1.sync_from_led = T2.key_led_num)
)
AND T1.key_src_page_type ='$showingPageType'
AND T1.key_src_page_num = '$pageIndex'
AND T2.key_status != '15151515151515151515151515151515'
AND (T1.key_led_num <='20576' OR T1.key_led_num >='20589')
";
if($DEBUG)
echo "<br>selSql=$selSql";
$selResult=mysqli_query($pubConn,$selSql);
echo mysqli_error($pubConn);
$i = 0;
while($selRows=mysqli_fetch_array($selResult))
{
$key_led_num_Arr[$i] = $selRows['key_led_num'];
$X_Arr[$i] = $selRows['point_x'];
$Y_Arr[$i] = $selRows['point_y'];
$status[$i] = getLedStatus($selRows['key_status'],$selRows['key_led_num']);
if(strchr($selRows['remark'],":")){
$tmpRemarkArr = explode(":",$selRows['remark']);
$remark[$i] = $tmpRemarkArr[1];
}else
$remark[$i] = $selRows['remark'];
$dst_page_type[$i] = $selRows['dst_page_type'];
$dst_page_num[$i] = $selRows['dst_page_num'];
$shape[$i] = $selRows['shape'];
$type[$i] = $selRows['type'];
if($key_led_num_Arr[$i]==20489){
$cntrlLed_X=$X_Arr[$i];
$cntrlLed_Y=$Y_Arr[$i];
}
/*
$tmpX=$selRows[point_x]+10;
$tmpY=$selRows[point_y]+60;
$updateSql="UPDATE $ledConfTable SET point_x='$tmpX',point_Y='$tmpY' where key_led_num='$key_led_num_Arr[$i]'";
// echo "<br>updateSql=$updateSql";
mysqli_query($pubConn,$updateSql);
*/
if($DEBUG)
{
echo "<br><br>key_led_num_Arr[$i]=$key_led_num_Arr[$i]";
echo "<br>X_Arr[$i]=$X_Arr[$i]";
echo "<br>Y_Arr[$i]=$Y_Arr[$i]";
echo "<br>type[$i]=$type[$i]";
echo "<br>status[$i]=$status[$i]";
echo "<br>remark[$i]=$remark[$i]";
echo "<br>dst_page_num[$i]=$dst_page_num[$i]";
}
$i++;
}
$ledNum = $i;
?>
<BODY background="./images/<?php echo $bg_img;?>" style="background-repeat:no-repeat;background-position:10 60" onload="ChangeImgId();MyShow();">
<?php
echo "<table boder=\"0\" width=\"100%\" height=\"50\">";
echo "<tr>";
echo "<td width=\"50%\">";
echo "<font size=\"2\">";
echo "Status > ";
for($i=0;$i<sizeof($showingTypeDefine);$i++){
if($bssExistFlag==0&&($showingTypeDefine[$i]['title']=='BSS'||$showingTypeDefine[$i]['title']=='MAP'))
continue;
echo "<a href=\"JavaScript:openPage($i,0,'$PHP_SELF?')\">{$showingTypeDefine[$i]['title']}</a>";
if($showingTypeDefine[$i]['title']=='BSS'&&$showingTypeDefine[$showingPageType]['title']=='BSS'){
if($pageNum>0){
$tmpPageNum=$pageNum-1;
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\"><</a>";
}else{
echo "<";
}
echo "&nbsp;$pageNum&nbsp;";
if($pageNum<11){
$tmpPageNum=$pageNum+1;
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\">></a>";
}else{
echo ">";
}
}
echo "|";
}
echo "</font>";
echo "</td>";
echo "</tr>";
echo "</table>";
//display all led status
$totalImgY=0;
for($j=0;$j<sizeof($Y_Arr);$j++)
{
//echo "<font size=\"2\">status = $status[$j]<br>";
switch($status[$j]){
case $nLedOk:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_green";
break;
case $nLedWarn:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_yellow";
break;
case $nLedError:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_red";
break;
case $nLedNoUsed:
$tmpImage="./images/".$shapeArr[$shape[$j]]."_gray";
break;
default :
$continueFlag=1;
//$tmpImage="./images/".$shapeArr[$shape[$j]]."_gray";
break;
}
if($continueFlag==1){
$ledNum--;
$continueFlag=0;
continue;
}
$tmpImage = $tmpImage.$suffixArr[0];
$tmpId='statusLed_'.$key_led_num_Arr[$j];
echo "\n<div id=\"$tmpId\" style=\"position:absolute; top:{$Y_Arr[$j]}px; left:{$X_Arr[$j]}px;\">";
if($needDragElement){
echo "\n<div onmousedown=\"beginDrag(this.parentNode,event);\">";
echo "<img VSPACE=\"0\" align = \"top\" border=\"0\" src=\"$tmpImage\"></a>";
echo "\n</div>";
$tmpPageNum=$dst_page_num[$j]-$showingTypeDefine[$dst_page_type[$j]]['typeOffset'];
if($dst_page_type[$j] >= $htmlPageType){
$linkURL=$routerURL."page_type=$dst_page_type[$j]&page_num=$dst_page_num[$j]&src_page_type=$showingPageType&src_page_num=$pageNum";
if($DEBUG)
echo "<br>linkURL=$linkURL";
echo "<a href=\"$linkURL\">$remark[$j]</a>";
}else{
$i=$dst_page_type[$j];
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\">$remark[$j]</a>";
}
}else{
$tmpPageNum=$dst_page_num[$j]-$showingTypeDefine[$dst_page_type[$j]]['typeOffset'];
if($dst_page_type[$j] >= $htmlPageType){
$linkURL=$routerURL."page_type=$dst_page_type[$j]&page_num=$dst_page_num[$j]&src_page_type=$showingPageType&src_page_num=$pageNum";
if($DEBUG)
echo "<br>linkURL=$linkURL";
echo "<a href=\"$linkURL\"><img VSPACE=\"0\" align = \"top\" border=\"0\" src=\"$tmpImage\"></a>";
if($key_led_num_Arr[$j]>=20577)// BSC or BTS, need display the remark
echo "<br><FONT color==\"#0000FF\">$remark[$j]</FONT>";
}else{
//echo "<br>page_num[$j]=$dst_page_num[$j]";
//echo "<br>Define[$dst_page_type[$j]][tO]={$showingTypeDefine[$dst_page_type[$j]][typeOffset]}";
$i=$dst_page_type[$j];
echo "<a href=\"JavaScript:openPage($i,$tmpPageNum,'$PHP_SELF?')\"><img VSPACE=\"0\" align = \"top\" border=\"0\" src=\"$tmpImage\"></a>";
if($key_led_num_Arr[$j]>=20577)// BSC or BTS, need display the remark
echo "<br><FONT color==\"#0000FF\">$remark[$j]</FONT>";
}
}
echo "\n</div>";
if(0)//<2F><><EFBFBD>λ<EFBFBD><CEBB><EFBFBD>
if($key_led_num_Arr!=20489){
echo "\n<script type=\"text/javascript\">\n";
echo "<!--\n";
echo "myDrawFunction('#ff0000',$cntrlLed_X+5,$cntrlLed_Y+5,$X_Arr[$j]+5,$Y_Arr[$j]+5)\n";
echo "//-->\n";
echo "</script>\n";
}
}
echo "<script language=\"JavaScript\">";
echo "pageNum=$pageNum;";
echo "totalLedNum=$ledNum;";
echo "</script>";
?>
</body>
</html>