Files
web.ems/wxc2_omc/element/toElement/E1channelEdit.php
agtuser 16a3fd1e1b init
2024-11-11 17:56:00 +08:00

467 lines
13 KiB
PHP
Executable File

<?php
/********************************************************************
********************************************************************/
//require("../../inc/header.inc");
require("../sub_inc/commfunc.php");
$helpId = "6.2.3";
$DEBUG = 0;
//==========================================================
//变量定义
//==========================================================
$paramTable ='OBJ_322.param_99';
$objDb = 'OBJ_322';
//==========================================================
//数据处理
//==========================================================
/*
MSC time slot format: Timeslot, Flag, Circuit, LCCP E1, LCCP timeslot
*/
$E1ConfArr=array(
array('Timeslot', '00.0-00.0', 'Timeslot', 'timesl', '1'),
array('Enable', '00.0-00.0', 'FlagConfArr', 'E1flag', '1'),
array('Circuit type', '00.1-00.2', 'TypeConfArr', 'cType', '2'),
array('LCCP E1', '01.0-01.3', 'LCCPcardArr', 'LCCPcard', '4'),
array('LCCP E1', '02.5-02.7', 'LCCPE1Arr', 'LCCPCARD', '3'),
array('LCCP timeslot', '02.0-02.4', 'LCCPtimeslotArr', 'LCCPtimesl','5')
);
$FlagConfArr =array('Disable','Enable');
$TypeConfArr =array('incoming','outgoing','bi-direction','lease');
$LCCPcardArr =array('Card 0','Card 1','Card 2','Card 3','Card 4','Card 5','Card 6','Card 7','Card 8','Card 9',
'Card 10','Card 11','Card 12','Card 13','Card 14','Card 15');
$LCCPE1Arr =array('0','1','2','3','4','5','6','7');
$LCCPtimeslotArr =array( '0','1','2','3','4','5','6','7','8','9',
'10','11','12','13','14','15','16','17','18','19',
'20','21','22','23','24','25','26','27','28','29',
'30','31');
//==========================================================
//输出并显示数据
//==========================================================
?>
<body topmargin="0" leftmargin="12">
<?php
if(!isset($instanceNo) || !isset($Protocol))
{
if(!isset($instanceNo))
echo "<font><b>ERROR!!:instanceNo == NULL</b></font><br>";
if(!isset($Protocol))
echo "<font><b>ERROR!!:Protocol == NULL</b></font><br>";
exit(0);
}
?>
<?php
$tempnum = $instanceNo/8;
$cardno = Floor($tempnum);
$cardE1no = $instanceNo - $cardno*8;
$timeslotno = $cardE1no*32;
$tempno = $cardno+1;
if($tempno<=16)
{
$paramTable_status = 'param_0';
$statSysId ='322_0_0';
$level3 = $tempno;
}
else
{
$paramTable_status = 'param_1';
$statSysId ='322_1_0';
$level3 = $tempno-16;
}
$stat_oidstr = "3.5."."$level3";
$objWhereStr =" level_1 = '2' and level_2 = '5' and level_3 = '$tempno'";
$objWhereStr_status = " level_1 = '3' and level_2 = '5' and level_3 = '$level3'";
$stat_oidsysArr=array(
array('oid' => $stat_oidstr, 'sysid' => $statSysId, 'selectsysid' => '-1'),
);
//print_r($stat_oidsysArr);
if($_SERVER['REQUEST_METHOD'] == "POST"){
if(isset($setSys))
{//保存改动
for($i=0; $i< 32;$i++)
{
{
$selSql = "SELECT initValue
FROM $paramTable
WHERE $objWhereStr AND instanceNo='$timeslotno'
";
if($DEBUG) echo "<BR>selSql=$selSql";
$result=mysqli_query($pubConn,$selSql);
echo mysqli_error($pubConn);
$rows =mysqli_fetch_array($result);
$orgValue=$rows[0];
$old_Value=$rows[0];
//echo "$orgValue<br>";
echo mysqli_error($pubConn);
}
$newValue=$orgValue;
// echo "<br>orgValue=$orgValue";
for($j =1;$j< sizeof($E1ConfArr);$j++)
{
$tmpname = $E1ConfArr[$j][3]."_$i";
$tmpval = ${$tmpname};
if($j==1)
{
$tmpval = decbin($tmpval);
$tmpval = omc_keep_length($tmpval,0,$E1ConfArr[$j][4]);
$newValue=setBitValue($newValue,$E1ConfArr[$j][1],$tmpval);
}
if(isset($tmpval))
{
if($j==3)
{
$set1 = $tmpval/8;
$set1 = Floor($set1);
$set2 = $tmpval - $set1*8;
$tmpval = decbin($set1);
$tmpval = omc_keep_length($tmpval,0,$E1ConfArr[$j][4]);
$newValue= setBitValue($newValue,$E1ConfArr[$j][1],$tmpval);
$j++;
$tmpval = decbin($set2);
$tmpval = omc_keep_length($tmpval,0,$E1ConfArr[$j][4]);
$newValue= setBitValue($newValue,$E1ConfArr[$j][1],$tmpval);
continue;
}
$tmpval = decbin($tmpval);
$tmpval = omc_keep_length($tmpval,0,$E1ConfArr[$j][4]);
$newValue=setBitValue($newValue,$E1ConfArr[$j][1],$tmpval);
}
}
$newValue=strtoupper($newValue);
$updSql = "UPDATE $paramTable SET initValue = '$newValue'
WHERE $objWhereStr AND instanceNo='$timeslotno'
";
mysqli_query($pubConn,$updSql);
echo mysqli_error($pubConn);
//echo "<BR>updSql=$updSql";
// echo "<br>newValue=$newValue";
$timeslotno++;
}
//echo "<br>saveHref=$saveHref";
if($btn_back==$strBack){
checkSaveFunction($saveHref);
exit();
}
echo "<script language='javascript'>";
echo " location='$backurl';";
echo "</script>";
exit();
}
else if(isset($refresh))
{
GetParam($stat_oidsysArr,0,0,0);
}
}
echo "<form method=\"POST\" name=\"setForm\" action=\"$PHP_SELF?instanceNo=$instanceNo&Protocol=$Protocol\">";
echo "<table border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"50%\">";
echo "Configuration > <a href=\"../overview/overview.php\">Network</a> > ";
echo "<a href=\"$backurl\">$webname</a> > ";
echo "<a href=\"#\">Time slot</a>";
echo "</td>";
echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
//showHelp($helpId);
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo "<table width=\"100%\">";
echo "<tr><td>";
echo "<b>MSC timeslot:</b>&nbsp;&nbsp;</td><td>";
echo "E1 No. $instanceNo&nbsp;&nbsp;</td><td>";
echo "Protocol: $Protocol&nbsp;&nbsp;</td><td>";
echo "<input type=\"submit\" name=\"setSys\" value=\"Save\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
echo "&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<input type=\"submit\" name=\"refresh\" value=\"Refresh\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
echo "</td>";
echo "<td>";
//echo "$backurl<br>";
echo "<p align=\"right\"><a href=\"$backurl\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
//echo "<p align=\"right\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\"><input type=\"submit\" name=\"btn_back\" value=\"$strBack\" onmouseover=\"this.className='style4'\" onmouseout=\"this.className='style3'\" class=\"style3\">";
echo "</td></tr>";
echo "<input type=\"hidden\" name=\"instanceNo\" value=\"$instanceNo\">";
echo "<input type=\"hidden\" name=\"Protocol\" value=\"$Protocol\">";
echo "<input type=\"hidden\" name=\"linkset\" value=\"$linkset\">";
echo "<input type=\"hidden\" name=\"trunkgp\" value=\"$trunkgp\">";
echo "\n<input type=\"hidden\" name=\"sysId\" value=\"$sysId\">";
echo "\n<input type=\"hidden\" name=\"backurl\" value=\"$backurl\">";
//echo "<br>backurl=$backurl";
echo "</table>";
echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\">";
echo "<tr bgcolor=\"#E6E6E6\">";
for($j =0;$j< sizeof($E1ConfArr);$j++)
{
if($j==4) continue;
if($j==1)
{
echo "<td width=\"16%\"><b>{$E1ConfArr[$j][0]}</b>";
echo "<input type=\"checkbox\" name=\"slctAll\" value=\"1\" onClick=\"javascript:selectAll(this,0,31)\">";
echo "</td>";
}
else
echo "<td width=\"16%\"><b>{$E1ConfArr[$j][0]}</b></td>";
}
echo "<td width=\"20%\"><b>Channel Status</b></td>";
echo "</tr>";
$channelStatArr = array(0=>'Disable',1=>'Idle',2=>'Busy',3=>'Local blocked',4=>'Remote blocked');
//echo "$objWhereStr<br>";
$tmp = $timeslotno+32;
$selSql = "SELECT initValue,instanceNo
FROM $paramTable
WHERE $objWhereStr AND instanceNo>='$timeslotno' AND instanceNo<='$tmp'
";
if($DEBUG) echo "<BR>selSql=$selSql";
$result=mysqli_query($pubConn,$selSql);
echo mysqli_error($pubConn);
for($i=0; $i< 32;$i++)
{
{
$rows =mysqli_fetch_array($result);
$orgValue=$rows[0];
//echo "{$rows[1]}:$orgValue<br>";
echo mysqli_error($pubConn);
}
echo "<tr>";
{//显示
echo "<td>$i</td>";
{//show enable/Disable
echo "<td>";
$flag = bindec(getBitValue($orgValue,$E1ConfArr[1][1]));
$tmpname = $E1ConfArr[1][3]."_$i";
if($flag == 1)
{
echo "<input type=checkbox name=$tmpname value=\"1\" checked onClick=\"javascript:selectCheck(this,$i)\">";
$disableStr = '';
}
else
{
echo "<input type=checkbox value=\"0\" name=$tmpname onClick=\"javascript:selectCheck(this,$i)\">";
$disableStr = 'disabled';
}
echo "</td>";
}
for($j =2;$j< sizeof($E1ConfArr);$j++)
{
$getval = bindec(getBitValue($orgValue,$E1ConfArr[$j][1]));
$tmpname = $E1ConfArr[$j][3]."_$i";
if($j==2)
{
echo "<td><select name=\"$tmpname\" size=\"1\" onchange=\"slctDirection(this,$i)\" $disableStr>";
}
else
{
$tmpDirect = bindec(getBitValue($orgValue,$E1ConfArr[2][1]));
if($tmpDirect==3 && $flag==1)
$disableStr = '';
else
$disableStr = 'disabled';
echo "<td><select name=\"$tmpname\" size=\"1\" $disableStr>";
}
$temp =$E1ConfArr[$j][2];
if($j==3)
{
$j++;
$getval_1 = bindec(getBitValue($orgValue,$E1ConfArr[$j][1]));
$getval = $getval*8+$getval_1;
for($k=0;$k<128;$k++)
{
if($getval == $k)
{
echo "<option value=\"$k\" selected>$k</option>";
}
else
{
echo "<option value=\"$k\">$k</option>";
}
}
continue;
}
if($temp != 'LCCPtimeslotArr')
{
for($k=0;$k<sizeof(${$E1ConfArr[$j][2]});$k++)
{
if($getval == $k)
{
echo "<option value=\"$k\" selected>{${$E1ConfArr[$j][2]}[$k]}</option>";
}
else
{
echo "<option value=\"$k\">{${$E1ConfArr[$j][2]}[$k]}</option>";
}
}
}
else
{
for($k=0;$k<sizeof(${$E1ConfArr[$j][2]});$k++)
{
if($k == 0 || $k == 16)
continue;
if($getval == $k)
{
echo "<option value=\"$k\" selected>{${$E1ConfArr[$j][2]}[$k]}</option>";
}
else{
echo "<option value=\"$k\">{${$E1ConfArr[$j][2]}[$k]}</option>";
}
}
}
echo "</select></td>";
}
{
$tmpInsNo = $timeslotno + $i;
$selSql_stat = "SELECT initValue
FROM $paramTable_status
WHERE $objWhereStr_status AND instanceNo='$tmpInsNo'";
if($DEBUG) echo "<BR>$i:selSql_stat=$selSql_stat";
$result_stat=mysqli_query($pubConn,$selSql_stat);
$row_stat = mysqli_fetch_array($result_stat);
$status = hexdec($row_stat[initValue]);
}
echo "<td align=\"center\">{$channelStatArr[$status]}</td>";
}
echo "</tr>";
}
echo "<input type=\"hidden\" name=\"webname\" value=\"$webname\">";
echo "</table>&nbsp;";
?>
<script LANGUAGE="JavaScript">
// function selectAll(thisCheckBox,start,end)
// {
// var circuit,lccpCard, lccpTimeSlot;
// for(i=start; i<=end; i++)
// {
// circuit = eval("document.setForm.cType_" + i);
// lccpCard = eval("document.setForm.LCCPcard_" + i);
// lccpTimeSlot = eval("document.setForm.LCCPtimesl_" + i);
//
// if(thisCheckBox.checked == true)
// {
// direct = circuit.options[circuit.selectedIndex].value;
// thisCheckBox.value=1;
// circuit.disabled = false;
// if(direct==3)
// {
// lccpCard.disabled = false;
// lccpTimeSlot.disabled = false;
// }
// }
// else
// {
// thisCheckBox.value=0;
// circuit.disabled = true;
// lccpCard.disabled = true;
// lccpTimeSlot.disabled = true;
// }
// }
// }
function selectAll(thisCheckBox,start,end)
{
var E1flag;
if(thisCheckBox.checked == true)
{
for(i=start; i<=end; i++)
{
E1flag = eval("document.setForm.E1flag_" + i);
E1flag.checked = true;
selectCheck(E1flag, i);
}
}
else
{
for(i=start; i<=end; i++)
{
E1flag = eval("document.setForm.E1flag_" + i);
E1flag.checked = false;
selectCheck(E1flag, i);
}
}
}
function selectCheck(thisCheckBox, i)
{
var circuit,lccpCard, lccpTimeSlot;
circuit = eval("document.setForm.cType_" + i);
lccpCard = eval("document.setForm.LCCPcard_" + i);
lccpTimeSlot = eval("document.setForm.LCCPtimesl_" + i);
if(thisCheckBox.checked == true)
{
direct = circuit.options[circuit.selectedIndex].value;
thisCheckBox.value=1;
circuit.disabled = false;
if(direct==3)
{
lccpCard.disabled = false;
lccpTimeSlot.disabled = false;
}
}
else
{
thisCheckBox.value=0;
circuit.disabled = true;
lccpCard.disabled = true;
lccpTimeSlot.disabled = true;
}
}
function slctDirection(item,i)
{
var direct;
var lccpCard, lccpTimeSlot;
lccpCard = eval("document.setForm.LCCPcard_" + i);
lccpTimeSlot = eval("document.setForm.LCCPtimesl_" + i);
direct = item.options[item.selectedIndex].value;
//alert(direct);
if(direct==3)
{
lccpCard.disabled = false;
lccpTimeSlot.disabled = false;
}
else
{
lccpCard.disabled = true;
lccpTimeSlot.disabled = true;
}
}
</script>
</form>
</body>
</html>