init web ems all
This commit is contained in:
333
wxc2_omc/configuration/sub_inc/getParameter.php
Executable file
333
wxc2_omc/configuration/sub_inc/getParameter.php
Executable file
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
/*************************************************
|
||||
File name: getParameter.php
|
||||
Author: Cui Ticun
|
||||
Version: 9.00.00
|
||||
Date: 2007-7-1
|
||||
Description:<3A><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>operWebFunc.inc<6E><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺʹ洢
|
||||
Calls:
|
||||
Called:
|
||||
|
||||
History:
|
||||
No.1:
|
||||
Author:
|
||||
Date:
|
||||
Version:
|
||||
Description:
|
||||
*************************************************/
|
||||
require("../../inc/lib.inc");
|
||||
$DEBUG = 0;
|
||||
$sysId=$_REQUEST['sysId'];
|
||||
$tmpStr=$_REQUEST['tmpStr'];
|
||||
$instanceNo=$_REQUEST['instanceNo'];
|
||||
$language = $_REQUEST['lan'];
|
||||
$tmpStr = str_replace('.','_',$_REQUEST['oidStr']);
|
||||
$id = 'ID_' . $sysId . '_' . $tmpStr . '_' . '_ist' . $instanceNo;
|
||||
$newId = "New".$id;
|
||||
$inputID = 'Input'.$id;
|
||||
$saveId = 'Save'.$id;
|
||||
// Display_Type
|
||||
define("DO_NOT_DISPLAY",0);
|
||||
define("PULLDOWN_MENU",1);
|
||||
define("TEXTBOX",2);
|
||||
define("LABEL",3);
|
||||
define("RADIO_BUTTON",4);
|
||||
define("PUSH_BUTTON",5);
|
||||
define("CHECKBOX",6);
|
||||
define("TEXTAREA",7);
|
||||
define("CONFIRM_PUSH_BUTTON",8);
|
||||
|
||||
|
||||
function getLevelWhere($objIdStr)
|
||||
{
|
||||
$levelArr=explode('.',$objIdStr);
|
||||
for($j=0;$j<sizeof($levelArr);$j++){
|
||||
$levelNo=$j+1;
|
||||
${"level_$levelNo"}=$levelArr[$j];
|
||||
if($Debug) echo "<BR>levelArr[$j]={$levelArr[$j]}";
|
||||
if($j == 0){
|
||||
$levelWhere ="level_$levelNo='${"level_$levelNo"}'";
|
||||
}else{
|
||||
$levelWhere .=" AND level_$levelNo='${"level_$levelNo"}'";
|
||||
}
|
||||
}
|
||||
return($levelWhere);
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Function: // translate
|
||||
Description: // Transfer the value to string
|
||||
// e.g. AdminState=2 --> AdminState=Unlocked
|
||||
Calls: //
|
||||
Called By: //
|
||||
Table Accessed: //
|
||||
Table Updated: //
|
||||
Input: //
|
||||
Output: //
|
||||
Return: //
|
||||
Others: //
|
||||
*************************************************/
|
||||
function translate($input,$data)
|
||||
{
|
||||
$found=-1;
|
||||
if ($data)
|
||||
{
|
||||
$items=split("[;=]",$data);
|
||||
$no_of_items=count($items);
|
||||
|
||||
for ($i=0;$i<$no_of_items;$i+=2) {
|
||||
if ( $input == $items[$i+1] ) {
|
||||
$found=$i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($found != -1)
|
||||
return($items[$found]);
|
||||
else
|
||||
return('Undefined Value ('.$input.')');
|
||||
}
|
||||
return($input);
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Function: // getInnerValue
|
||||
Description: // <20><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
Calls: //
|
||||
Called By: //
|
||||
Table Accessed: //
|
||||
Table Updated: //
|
||||
Input: //
|
||||
Output: //
|
||||
Return: //
|
||||
Others: //
|
||||
*************************************************/
|
||||
|
||||
function getInnerValue($sysId,$oidStr,$instanceNo=0,$otherWhereStr='',$showStr,$inputValueType)
|
||||
{
|
||||
global $language,$Debug,$inputID;
|
||||
$sysIdArr = explode('_',$sysId);
|
||||
$sysTypeNo = $sysIdArr[0];
|
||||
$sysNo = $sysIdArr[1];
|
||||
$subSysNo = $sysIdArr[2];
|
||||
$objDb = 'OBJ_'.$sysTypeNo;
|
||||
$paraConfTable = $objDb.".paramConf";
|
||||
if($sysTypeNo[0]=='2')//Plat
|
||||
$paraTable=$objDb.".param_".$sysNo;
|
||||
else
|
||||
$paraTable=$objDb.".param_99";
|
||||
|
||||
if(strlen($showStr)>0){
|
||||
echo "<input id=\"$inputID\" type=\"text\" class=\"text\" value=\"\" onchange=\"$chechFnc\">";
|
||||
return "";
|
||||
}
|
||||
|
||||
if($Debug) echo "<br>$paramConfTable<br>";
|
||||
|
||||
//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD>汾
|
||||
if($language == 'eng'){
|
||||
$objNameField=name_2;
|
||||
$objSetField=setTemplate_2 ; //<2F><><EFBFBD><EFBFBD>2
|
||||
}else{
|
||||
$objNameField=name_1;
|
||||
$objSetField=setTemplate_1 ; //<2F><><EFBFBD><EFBFBD>1(Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
}
|
||||
|
||||
if($Debug) echo "<br>getValue = $getValue";
|
||||
|
||||
$objWhereStr = getLevelWhere($oidStr);
|
||||
|
||||
$objSql = "SELECT $objNameField,$objSetField,operType,valueType,minValue,maxValue FROM $paraConfTable WHERE $objWhereStr";
|
||||
$objResult = mysqli_query($pubConn ,$objSql);
|
||||
$objRows = @mysqli_fetch_array($objResult);
|
||||
$setTemplate = $objRows[$objSetField];
|
||||
$operType = $objRows[operType];
|
||||
|
||||
$paraSql = " SELECT initValue FROM $paraTable WHERE $objWhereStr $otherWhereStr AND instanceNo = '$instanceNo' ";
|
||||
$paraResult = mysqli_query($pubConn,$paraSql);
|
||||
$paraRow = mysqli_fetch_array($paraResult);
|
||||
$getValue = $paraRow[initValue];
|
||||
if($DEBUG)
|
||||
echo "<br>getValue=$getValue";
|
||||
|
||||
switch($operType){
|
||||
case 2://Text Box
|
||||
//=============input type=====================
|
||||
$inputValueType=$inputValueType+0;
|
||||
|
||||
if($inputValueType==1){//===only can input the dec num====
|
||||
$chechFnc = "checkInput(this,10)";
|
||||
}else if($inputValueType==2){//===only can input the hex num====
|
||||
$chechFnc = "checkInput(this,16)";
|
||||
}else if($inputValueType==3){//====can input all character
|
||||
$chechFnc = "";
|
||||
}else if($inputValueType==4){//=====can put only dec num but include blank
|
||||
$chechFnc = "checkInput_patch(this)";
|
||||
}
|
||||
|
||||
echo "<input id=\"$inputID\" type=\"text\" class=\"text\" value=\"$getValue\" onchange=\"$chechFnc\">";
|
||||
return $getValue;
|
||||
break;
|
||||
case 1://PULLDOWN_MENU
|
||||
$menu_items=split("[;=]", $setTemplate);
|
||||
$no_of_menu_items=count($menu_items);
|
||||
$isSelected = 0;
|
||||
echo "<select id=\"$inputID\" size=\"1\">";
|
||||
for($j=0;$j< $no_of_menu_items;$j+=2)
|
||||
{
|
||||
$tmpValue=$menu_items[$j+1];
|
||||
echo "<option value=$tmpValue";
|
||||
if ($getValue == $menu_items[$j+1])
|
||||
{
|
||||
echo " selected>";
|
||||
$isSelected = 1;
|
||||
$selectedValue=$getValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo ">";
|
||||
}
|
||||
echo "$menu_items[$j] </option>\n";
|
||||
}
|
||||
|
||||
if ($isSelected == 0){
|
||||
echo "<option value=\"$selectValue\" selected>Undefined Value</option>";
|
||||
$selectedValue = "Undefined Value";
|
||||
}
|
||||
echo "</select>";
|
||||
return $selectedValue;
|
||||
break;
|
||||
default: echo "<br>Error:operType =|$operType|";
|
||||
break;
|
||||
}//end of switch(..)
|
||||
}//end getInnerValue
|
||||
|
||||
function getParamValue(&$initEquRead,$sysId,$oidStr,$instanceNo=0,$otherWhereStr='',$inputValueType)
|
||||
{
|
||||
global $language;
|
||||
//$Debug=1;
|
||||
$sysIdArr = explode('_',$sysId);
|
||||
$sysTypeNo = $sysIdArr[0];
|
||||
$sysNo = $sysIdArr[1];
|
||||
$subSysNo = $sysIdArr[2];
|
||||
$objDb = 'OBJ_'.$sysTypeNo;
|
||||
$paraConfTable = $objDb.".paramConf";
|
||||
if($sysTypeNo[0]=='2')//Plat
|
||||
$paraTable=$objDb.".param_".$sysNo;
|
||||
else
|
||||
$paraTable=$objDb.".param_99";
|
||||
|
||||
if($language == 'eng'){
|
||||
$objNameField=name_2;
|
||||
$objSetField=setTemplate_2 ; //<2F><><EFBFBD><EFBFBD>2
|
||||
}else{
|
||||
$objNameField=name_1;
|
||||
$objSetField=setTemplate_1 ; //<2F><><EFBFBD><EFBFBD>1(Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
}
|
||||
|
||||
$objWhereStr = getLevelWhere($oidStr);
|
||||
|
||||
$objSql = "SELECT $objNameField,$objSetField,valueType,minValue,maxValue FROM $paraConfTable WHERE $objWhereStr";
|
||||
$objResult = mysqli_query($pubConn ,$objSql);
|
||||
$objRows = @mysqli_fetch_array($objResult);
|
||||
$setTemplate = $objRows[$objSetField];
|
||||
|
||||
$paraSql = " SELECT initValue,readValue FROM $paraTable WHERE $objWhereStr $otherWhereStr AND instanceNo = '$instanceNo' ";
|
||||
$paraResult = mysqli_query($pubConn,$paraSql);
|
||||
$paraRow = mysqli_fetch_array($paraResult);
|
||||
$initGetValue = $paraRow[initValue];
|
||||
$readGetValue = $paraRow[readValue];
|
||||
|
||||
$initEquRead = false;
|
||||
if($initGetValue == $readGetValue)
|
||||
$initEquRead = true;
|
||||
else
|
||||
$initEquRead = false;
|
||||
$returnValue=translate($initGetValue,$setTemplate);
|
||||
|
||||
if($DEBUG)
|
||||
echo "<br>returnValue=$returnValue";
|
||||
return $returnValue;
|
||||
}//end getParamValue
|
||||
|
||||
function setParamValue($setValue,$sysId,$oidStr,$instanceNo=0,$otherWhereStr='',$inputValueType)
|
||||
{
|
||||
$sysIdArr = explode('_',$sysId);
|
||||
$sysTypeNo = $sysIdArr[0];
|
||||
$sysNo = $sysIdArr[1];
|
||||
$subSysNo = $sysIdArr[2];
|
||||
$objDb = 'OBJ_'.$sysTypeNo;
|
||||
$paraConfTable = $objDb.".paramConf";
|
||||
if($sysTypeNo[0]=='2')//Plat
|
||||
$paraTable=$objDb.".param_".$sysNo;
|
||||
else
|
||||
$paraTable=$objDb.".param_99";
|
||||
|
||||
|
||||
$objWhereStr = getLevelWhere($oidStr);
|
||||
|
||||
//$setValue = strtoupper($setValue);
|
||||
$updSql = "UPDATE $paraTable SET initValue = '$setValue'
|
||||
WHERE $objWhereStr $otherWhereStr AND instanceNo = '$instanceNo'";
|
||||
if($DEBUG)
|
||||
echo "<br>updSql=$updSql";
|
||||
mysqli_query($pubConn,$updSql);
|
||||
echo mysqli_error($pubConn);
|
||||
}//end setParamValue
|
||||
|
||||
//0: flag
|
||||
echo $flag;
|
||||
echo "###";
|
||||
|
||||
if($flag=='getVar')//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD>
|
||||
{
|
||||
//1: idName
|
||||
echo $newId;
|
||||
echo "###";
|
||||
|
||||
//2:innerStr
|
||||
$oldValue=getInnerValue($sysId,$oidStr,$instanceNo,$otherWhereStr,$showStr,$inputValueType);
|
||||
if(strlen($doingOtherUlr)>0)
|
||||
{
|
||||
$doingOtherUlr .= "&oldValue=$oldValue";
|
||||
$doingOtherUlr=urlencode($doingOtherUlr);
|
||||
}
|
||||
echo " <span id=\"$saveId\" style=\"cursor:pointer\" onclick=\"javascript:getPar('saveVar','$language','$sysId','$oidStr','$instanceNo','$inputID','$doingOtherUlr','$otherWhereStr','$showStr','$inputValueType');\"><font color=\"blue\"><b> SAVE <b></font></span>";
|
||||
}
|
||||
|
||||
if($flag=='saveVar')//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұߵġ<DFB5>Save<76><65>
|
||||
{
|
||||
|
||||
//1: idName
|
||||
echo $id;
|
||||
echo "###";
|
||||
|
||||
//2: innerStr
|
||||
setParamValue($setValue,$sysId,$oidStr,$instanceNo,$otherWhereStr,$inputValueType);
|
||||
$newValue = getParamValue($initEquRead,$sysId,$oidStr,$instanceNo,$otherWhereStr,$inputValueType);
|
||||
if(strlen($showStr))
|
||||
echo $showStr;
|
||||
else{
|
||||
if(strlen($newValue)>0)
|
||||
echo $newValue;
|
||||
else
|
||||
echo "--";
|
||||
}
|
||||
echo "###";
|
||||
|
||||
//3: isEqual
|
||||
if($initEquRead||strlen($showStr)) //initValue == readValue
|
||||
echo "1";
|
||||
else
|
||||
echo "0";
|
||||
echo "###";
|
||||
|
||||
//4: doingOtherUlr
|
||||
if(strlen($doingOtherUlr)>0)
|
||||
{
|
||||
$doingOtherUlr .= "&newValue=$newValue";
|
||||
}
|
||||
echo $doingOtherUlr;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user