init web ems all
This commit is contained in:
409
wxc2_omc/configuration/bssomc/objects.php
Executable file
409
wxc2_omc/configuration/bssomc/objects.php
Executable file
@@ -0,0 +1,409 @@
|
||||
<?php
|
||||
//
|
||||
// Created on: 22 Feb 2001
|
||||
// Usage : objects.php?language="eng|gb"&bssid=0&objectid=ALink.0.0.1
|
||||
// &tablename=OMCR_ALink
|
||||
// [&status="Save is Completed][&alarm=attr value rejected]
|
||||
// Function : Show the parameters and action button based on OMCR_Meta_Table
|
||||
// and displaytype.inc.
|
||||
// Remarks : If objectid=BssFunc, it will redirect to another php file.
|
||||
// If $status is defined, the status will show in the status bar of browser.
|
||||
// If $alarm is defined, the text in $alarm will show in popup box.
|
||||
// Attributes has HTML object name as the <attribute name>
|
||||
// Attributes has type as the t<attribute name>
|
||||
//
|
||||
// MySQL table: OMCR_Meta_Table and table specified by $tablename
|
||||
//
|
||||
// modifyBssParam.php ___ bsstree.php (contents)
|
||||
// \__ objects.php (main1)
|
||||
//
|
||||
?>
|
||||
<?php
|
||||
if (!isset($language))
|
||||
{
|
||||
$language = "eng";
|
||||
}
|
||||
|
||||
$parameter="${language}namearray";
|
||||
include("nocache.inc");
|
||||
include("objects.inc");
|
||||
?>
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<?php include("header.inc"); ?>
|
||||
|
||||
<STYLE type="text/ccs">
|
||||
td {height: 24}
|
||||
</STYLE>
|
||||
<SCRIPT language="JavaScript" type="text/javascript">
|
||||
<!--
|
||||
var alerting=false;
|
||||
var oldvalue=0;
|
||||
var no_of_refresh=0;
|
||||
var timeout_handle = null;
|
||||
var refresh_bsstree_string="<?=${$parameter}[actioniscompleted]?>";
|
||||
|
||||
function actions(obj,nmicmd,need_confirm)
|
||||
{
|
||||
if (need_confirm)
|
||||
{
|
||||
window.status = "<?=${$parameter}[confirmquestionbegin]?>"
|
||||
+ obj.value + "<?=${$parameter}[confirmquestionend]?>";
|
||||
answer = confirm("<?=${$parameter}[confirmquestionbegin]?>"
|
||||
+ obj.value + "<?=${$parameter}[confirmquestionend]?>");
|
||||
window.status = "";
|
||||
if (answer != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (nmicmd != '')
|
||||
{
|
||||
this.document.object_form.modified_data.value = '';
|
||||
this.document.object_form.nmicommand.value = nmicmd;
|
||||
}
|
||||
this.document.object_form.submit();
|
||||
}
|
||||
function show_status(status,alarm)
|
||||
{
|
||||
//
|
||||
// alarm and status display
|
||||
if ((typeof(alarm) != "undefined") && (alarm != ""))
|
||||
{
|
||||
window.status=alarm;
|
||||
alert(alarm);
|
||||
window.status="";
|
||||
}
|
||||
if ((typeof(status) != "undefined") && (status != ""))
|
||||
{
|
||||
window.status=status;
|
||||
if ((no_of_refresh < 5) && (status == refresh_bsstree_string))
|
||||
{
|
||||
if (no_of_refresh++ < 5)
|
||||
{
|
||||
//refresh every 2 seconds and repeat for 5 times
|
||||
timeout_handle = setTimeout(show_status,2);
|
||||
/*var newurl=parent.contents.location+"&sleep_seconds=5";
|
||||
parent.contents.location.href=newurl;*/
|
||||
parent.contents.location.href=parent.contents.location;
|
||||
}
|
||||
else
|
||||
{
|
||||
clearTimeout(timeout_handle);
|
||||
timeout_handle = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function submit_form(data)
|
||||
{
|
||||
if (( data.modified_data.value == '') && ( data.nmicommand.value == ''))
|
||||
{
|
||||
window.status="<?=${$parameter}[savenotneed]?>";
|
||||
return(false);
|
||||
}
|
||||
else
|
||||
return(true);
|
||||
}
|
||||
function b4_change(data)
|
||||
{
|
||||
if (alerting)
|
||||
return;
|
||||
|
||||
if ( data.value != '' )
|
||||
{
|
||||
oldvalue=data.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( oldvalue!=0 )
|
||||
data.value=oldvalue;
|
||||
}
|
||||
}
|
||||
function change_made(data)
|
||||
{
|
||||
var parm_string=this.document.object_form.modified_data.value;
|
||||
|
||||
if ( data.value == '')
|
||||
{
|
||||
if ( oldvalue!=0 )
|
||||
{
|
||||
alerting = true; // True if alert() dialogue box is displayed.
|
||||
alert("<?=${$parameter}[entervalidvalue]?>");
|
||||
data.value = oldvalue;
|
||||
data.focus();
|
||||
alerting = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (data.value == oldvalue) //no Change
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( parm_string == '' )
|
||||
{
|
||||
this.document.object_form.modified_data.value = data.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parm_string.search(data.name) == -1)
|
||||
this.document.object_form.modified_data.value += ","+data.name;
|
||||
}
|
||||
}
|
||||
|
||||
function create_object_onclick(data){
|
||||
URL=data+<?php echo "\"&language=$language&bssid=$bssid&objectid=$objectid\""; ?>;
|
||||
//var setWindow = open(URL, '', 'toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,width=400,height=350');
|
||||
//setWindow.focus();
|
||||
location.href=URL;
|
||||
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<TITLE>
|
||||
|
||||
BSS OMC -> <?=$objectid;?>
|
||||
</TITLE>
|
||||
</HEAD>
|
||||
<BODY onLoad='show_status("<?=$status?>","<?=$alarm?>");'>
|
||||
<?php
|
||||
|
||||
//echo "<br>saved=$saved";
|
||||
echo "<font color=red size=+1>$alarm</font>";
|
||||
echo "<HR SIZE=1>";
|
||||
|
||||
$status="";
|
||||
|
||||
if (!isset($bssid) || !isset($objectid) || !isset($tablename))
|
||||
{
|
||||
echo "The required information for this page is invalid.<br>\n";
|
||||
echo "</BODY>\n</HTML>";
|
||||
exit();
|
||||
}
|
||||
|
||||
include("meta_table_type.inc");
|
||||
include("login_parm.inc");
|
||||
|
||||
//
|
||||
// Translate the value to string
|
||||
// e.g. AdminState=2 --> AdminState=Unlocked
|
||||
//
|
||||
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]);
|
||||
}
|
||||
return($input);
|
||||
}
|
||||
|
||||
$db = mysql_connect($hostname, $username, $password);
|
||||
mysql_select_db($dbname,$db);
|
||||
|
||||
// LOOK UP OMCR_META_TABLE for display parameters and buttons
|
||||
//
|
||||
// Display different xxxDisplay_Name base on the language selected
|
||||
//
|
||||
//
|
||||
$sqlstring = "select Object_Name,Attribute_Name,Attribute_Id,Attribute_Type,Display_Type," .
|
||||
"${language}Display_Name,${language}Lookup,${language}Help_Text" .
|
||||
" from OMCR_Meta_Table " .
|
||||
"where Display_Type<> 0 AND Object_Name='" . substr($tablename,5) . "'";
|
||||
|
||||
//echo $sqlstring . "<BR>";exit();
|
||||
$result = mysql_query($sqlstring,$db) or
|
||||
die("Invalid query: $sqlstring\n" . mysqli_error($pubConn));
|
||||
while ( $row = mysqli_fetch_row($result) )
|
||||
{
|
||||
if (($row[4] == PUSH_BUTTON) || ($row[4] == CONFIRM_PUSH_BUTTON)) //For action item in NMI
|
||||
list($act_object_name[], $act_attribute_name[], $act_attribute_id[], $act_attribute_type[],
|
||||
$act_display_type[], $act_display_name[], $act_lookup[],
|
||||
$act_help_text[]) = $row;
|
||||
else
|
||||
list($object_name[],$attribute_name[],$attribute_id[],$attribute_type[],$display_type[],
|
||||
$display_name[],$lookup[],$help_text[]) = $row;
|
||||
}
|
||||
$no_of_parms = count($attribute_name);
|
||||
|
||||
echo "<U><FONT color=#00FF0F size=+3pt>=) " . strtoupper($objectid) . "</FONT></U><BR>\n";
|
||||
echo "<FORM action=modify.php name='object_form' method=post\n" .
|
||||
"onSubmit='return submit_form(this.document.object_form);'>";
|
||||
|
||||
if ($no_of_parms == 0)
|
||||
{
|
||||
echo "<BR>";
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// LOOK UP OMCR_<Object ID> getting real parameter
|
||||
//
|
||||
$sqlstring = "select " . join(",",$attribute_name) .
|
||||
",ObjectId from $tablename " .
|
||||
"where bssid=$bssid and ObjectId like '$objectid'";
|
||||
|
||||
//echo $sqlstring . "<BR>";
|
||||
//$result = mysql_query($sqlstring,$db) or
|
||||
// die("Invalid query: $sqlstring\n" . mysqli_error($pubConn));
|
||||
$result = mysql_query($sqlstring,$db);
|
||||
if(mysqli_error($pubConn)!='')
|
||||
exit();
|
||||
$no_of_instance = mysqli_num_rows($result);
|
||||
|
||||
while ( $row = mysqli_fetch_row($result) )
|
||||
{
|
||||
echo "<TABLE border=0 cellspacing=0 cellpadding=0 width=400>\n";
|
||||
for ($i=0; $i<$no_of_parms; $i++)
|
||||
{
|
||||
//printf("%s%s %s\n",$display_type[$i],$attribute_name[$i],$lookup[$i]);
|
||||
switch($display_type[$i])
|
||||
{
|
||||
case DO_NOT_DISPLAY: //do not display
|
||||
$widget="";
|
||||
continue;
|
||||
case PULLDOWN_MENU: //pulldown menu
|
||||
$widget="<SELECT size=1 name='" . $attribute_name[$i] .
|
||||
"' onFocus='b4_change(this.document.object_form." .
|
||||
$attribute_name[$i] .
|
||||
")' onBlur='change_made(this.document.object_form." .
|
||||
$attribute_name[$i] .
|
||||
")' style='font-size: 10pt; border: 1 solid #646464'>";
|
||||
$existed=0;
|
||||
|
||||
$menu_items=split("[;=]", $lookup[$i]);
|
||||
$no_of_menu_items=count($menu_items);
|
||||
for($j=0;$j<$no_of_menu_items;$j+=2)
|
||||
{
|
||||
$widget.="<option value=" . $menu_items[$j+1];
|
||||
if ($row[$i] == $menu_items[$j+1])
|
||||
{
|
||||
$widget.=" selected>";
|
||||
$existed=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$widget.=">";
|
||||
}
|
||||
$widget.=$menu_items[$j] . "</option>\n";
|
||||
}
|
||||
$widget.="</SELECT>";
|
||||
if (!$existed)
|
||||
$widget="* Unknown value ($row[$i]) *";
|
||||
break;
|
||||
case TEXTBOX: //text box
|
||||
$widget="<INPUT type=text name=" . $attribute_name[$i] .
|
||||
" size=20 value='" . rawurldecode($row[$i]) .
|
||||
"' onFocus='b4_change(this.document.object_form." .
|
||||
$attribute_name[$i] .
|
||||
")' onBlur='change_made(this.document.object_form." .
|
||||
$attribute_name[$i] .
|
||||
")' style='font-size: 10pt; border: 1 solid #646464'>";
|
||||
break;
|
||||
case LABEL: //label
|
||||
if (!strcasecmp($attribute_name[$i], "adminstate"))
|
||||
$adminstate = $row[$i];
|
||||
$widget=translate($row[$i],$lookup[$i]);
|
||||
$widget.="<INPUT type=hidden name='$attribute_name[$i]' value='$row[$i]'>\n";
|
||||
break;
|
||||
case RADIO_BUTTON: //radio button
|
||||
$widget="<INPUT type=radio name=" . $attribute_name .
|
||||
" value='" . translate($row[$i],$lookup[$i]) .
|
||||
"' onBlur='change_made(this.document.object_form." .
|
||||
$attribute_name[$i] . ")'>" .
|
||||
$row[$i] . "\n";
|
||||
break;
|
||||
case CHECKBOX: //check box
|
||||
$widget="<INPUT type=checkbox name=" . $attribute_name[$i] .
|
||||
" value=1" . ($row[$i]? " CHECKED ":" ") .
|
||||
"onBlur='change_made(this.document.object_form." .
|
||||
$attribute_name[$i] . ")'>";
|
||||
break;
|
||||
case TEXTAREA: //text area
|
||||
$widget="<TEXTAREA name=" . $attribute_name[$i] .
|
||||
" rows=4 cols=45" .
|
||||
" onFocus='b4_change(this.document.object_form." .
|
||||
$attribute_name[$i] .
|
||||
")' onBlur='change_made(this.document.object_form." .
|
||||
$attribute_name[$i] . ")'>" . rawurldecode($row[$i]) . "</TEXTAREA>";
|
||||
break;
|
||||
}
|
||||
|
||||
if (strstr($saved,$attribute_name[$i]) != false)
|
||||
$color="#00F0FF";
|
||||
else
|
||||
$color="#FFFFFF";
|
||||
|
||||
$widget_type = "<INPUT type=hidden name=t$attribute_name[$i] value=$attribute_type[$i]>";
|
||||
|
||||
printf(" <TR><TD bgcolor=%s title='%s'>%s%s</TD><TD>%s</TD></TR>\n",
|
||||
$color, $help_text[$i], $display_name[$i], $widget_type, $widget);
|
||||
}
|
||||
echo "</TABLE>\n";
|
||||
} /* End of while() */
|
||||
}
|
||||
|
||||
//
|
||||
// Display the action buttons & confirmed action buttons
|
||||
//
|
||||
//
|
||||
$no_of_actions = count($act_attribute_name);
|
||||
for ($i=0;$i<$no_of_actions;$i++)
|
||||
{
|
||||
if (!strncasecmp($act_lookup[$i],"javascript:",11)) // Direct to another webpage
|
||||
{
|
||||
echo "<INPUT type=button value='" . $act_display_name[$i] .
|
||||
"' name='" . $act_attribute_name[$i] .
|
||||
"' onClick=\"" . $act_lookup[$i] . "\">\n";
|
||||
}
|
||||
else if ($act_lookup[$i] != '') // NMI Actions
|
||||
{
|
||||
if ($act_display_type[$i] == CONFIRM_PUSH_BUTTON)
|
||||
$need_confirm = "true";
|
||||
else
|
||||
$need_confirm = "false";
|
||||
|
||||
echo "<INPUT type=button value='" . $act_display_name[$i] .
|
||||
"' name='" . $act_attribute_name[$i] .
|
||||
"' onClick='actions(this.document.object_form." .
|
||||
$act_attribute_name[$i] . ",\"" . $act_lookup[$i] . "\",$need_confirm)'>\n";
|
||||
}
|
||||
else if ($act_attribute_name[$i] == "Revert") // Reset Webpage input the original value
|
||||
{
|
||||
echo "<INPUT type=reset value='" . $act_display_name[$i] .
|
||||
"' name='Revert'>\n";
|
||||
}
|
||||
else // Simply Save the altered values
|
||||
{
|
||||
echo "<INPUT type=submit value='" . $act_display_name[$i] .
|
||||
"' name='" . $act_attribute_name[$i] . "'>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<INPUT type=hidden name='modified_data' value=''>\n";
|
||||
echo "<INPUT type=hidden name='nmicommand' value=''>\n";
|
||||
echo "<INPUT type=hidden name='bssid' value=$bssid>\n";
|
||||
echo "<INPUT type=hidden name='objectid' value=$objectid>\n";
|
||||
echo "<INPUT type=hidden name='parent_objectid' value=$parent_objectid>\n";
|
||||
echo "<INPUT type=hidden name='tablename' value=$tablename>\n";
|
||||
echo "<INPUT type=hidden name='language' value=$language>\n";
|
||||
echo "<INPUT type=hidden name='x' value=$x>\n";
|
||||
echo "<INPUT type=hidden name='y' value=$y>\n";
|
||||
echo "<HR size=1>\n";
|
||||
?>
|
||||
|
||||
</FORM>
|
||||
</BODY>
|
||||
</HTML>
|
||||
Reference in New Issue
Block a user