MINI MINI MANI MO
/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. */
/*
* This javascript is for generating menu HTML
*/
/*
* This function is used to set the menu bar in the em.html file
* Parameters:
* none
*/
function startMenuBar(emMode)
{
// other header information such as user_info, logout, status, etc.
var headerOtherInfo = '';
// headerHtml = framework menu + headerOtherInfo
var headerHtml = '';
// build page header
if (emMode != "active_report")
{
headerOtherInfo = '<!-- separator --> ' +
'<td> ' +
'<div class="headerMenuBox"> ' +
'<table> ' +
'<tr> ' +
'<td> ' +
'<table cellpadding="0" cellspacing="0" border="0" summary=""> ' +
'<tbody> ' +
'<tr> ' +
'<td class="toolbarSeparator"> </td> ' +
'</tr> ' +
'</tbody> ' +
'</table> ' +
'</td> ' +
'</tr> ' +
'</table> ' +
'</div> ' +
'</td> ' +
'<!-- user info --> ' +
'<td> ' +
'<div class="headerMenuBox"> ' +
'<table> ' +
'<tr> ' +
'<td> ' +
'<table cellpadding="0" cellspacing="0" border="0" summary=""> ' +
'<tbody> ' +
'<tr> ' +
'<td> ' +
'<img id="emxShell:unimg" alt="" src="image/em_loggedin.png"/> ' +
'</td> ' +
'<td> ' +
'<img id="emxShell:unspcr" src="image/t.gif" alt="" '+
' width="5" height="0px"/> ' +
'</td> ' +
'<td> ' +
'<span id="emxShell:userName" class="emFont4"></span> ' +
'</td> ' +
'</tr> ' +
'</tbody> ' +
'</table> ' +
'</td> ' +
'</tr> ' +
'</table> ' +
'</div> ' +
'</td> ' +
'<!-- separator --> ' +
'<td> ' +
'<div class="headerMenuBox"> ' +
'<table cellpadding="0" cellspacing="0" border="0"> ' +
'<tr> ' +
'<td> ' +
'<table cellpadding="0" cellspacing="0" border="0" summary=""> ' +
'<tbody> ' +
'<tr> ' +
'<td class="toolbarSeparator"> </td> ' +
'</tr> ' +
'</tbody> ' +
'</table> ' +
'</td> ' +
'</tr> ' +
'</table> ' +
'</div> ' +
'</td> ' +
'<!-- Log out --> ' +
'<td> ' +
'<div class="headerMenuBox"> ' +
'<table cellpadding="0" cellspacing="0"> ' +
'<tr> ' +
'<td onmouseover="mainMenuMouseOver(this)" onClick="mainMenuClick(this)" onmouseout="mainMenuMouseOut(this)"> ' +
'<table cellpadding="0" cellspacing="0" border="0" summary=""> ' +
'<tr> ' +
'<td style="padding-left:3; height:20px;"> ' +
'<a onclick="logout();" class="emFont6"> ' +
'<span class="emFont6" id="emxShell:logout"></span> ' +
'</a> ' +
'</td> ' +
'<td> ' +
'<img id="emxShell:unspcr" src="image/t.gif" alt="" ' +
' width="3" height="0px"/> ' +
'</td> ' +
'</tr> ' +
'</table> ' +
'</td> ' +
'</tr> ' +
'</table> ' +
'</div> ' +
'</td> ' +
'<!-- status --> ' +
'<td> ' +
'<div class="headerMenuBox"> ' +
'<table> ' +
'<tr> ' +
'<td> ' +
'<table cellpadding="0" cellspacing="0" border="0" summary=""> ' +
'<tbody> ' +
'<tr> ' +
'<td> ' +
'<img id="emxShell:loadingStatus" src="image/connected.png" ' +
' border="0" title="Idle" alt="Idle" ' +
' class="refreshIcon"/> ' +
'</td> ' +
'</tr> ' +
'</tbody> ' +
'</table> ' +
'</td> ' +
'</tr> ' +
'</table> ' +
'</div> ' +
'</td> ' ;
//
var text = '<!-- start menubar --> ' +
'<table cellpadding="0" cellspacing="0" border="0" summary="" style="padding-left:6px; padding-top:4px;"> ' +
'<tr> ' +
'<td> ' +
'<img id="emxShell:dbIcon" ' +
'style="padding-right:4;" ' +
'onclick="navigateToUrl(' + "'/em/shell#/dbhome/show_regions' " + ');"/> ' +
'</td> ' +
'<td> ' +
'<a href="/em/shell#/dbhome/show_regions" id="emxShell:dbName" class="dbName"> ' +
'</a> ' +
'</td> ' +
'<td class="dbName" style="padding-left:6;"> ' +
'</td> ' +
'<td id="emxShell:featureMenuBar" width="100%"> ' +
'</td> ' +
'<td> ' +
'<img title="Host" alt="Host" style="padding-right:4;" src="image/host_ena.png"/> ' +
'</td> ' +
'<td style="padding-right:8;"> ' +
'<a class="menuButton" id="emxShell:hostName" style="white-space:nowrap;" onclick="return false;" > ' +
'<span class="emFont6" ></span> ' +
'</a> ' +
'</td> ' +
'</tr> ' +
'</table> ';
// create header element
var menuBar = document.createElement("div");
menuBar.setAttribute("id", "startMenuBar");
menuBar.setAttribute(getAttributeClass(), "menuBarBackground");
menuBar.innerHTML = text;
// insert start Menu just after header
var _body = document.getElementsByTagName("body")[0];
document.body.appendChild(menuBar);
}
// add the header menu
headerHtml ='<!-- upper right: header menus and other context information --> ' +
'<div id="emHeader:menubar" ' +
'style="overflow-x: hidden; overflow-y: hidden; padding-right: 5px; padding-left: 5px; "> ' +
'<table cellpadding="0" cellspacing="0" border="0" summary=""> ' +
'<tbody> ' +
'<tr> ' +
'<!-- framework menu --> ' +
'<td id="emxShell:frameworkMenuBar" width="100%"></td> ' +
headerOtherInfo +
'</tr> ' +
'</tbody> ' +
'</table> ' +
'</div> ';
// create a new td element and add it to the header (table)
var headerTableTr = document.getElementById("emHeaderTbodyTr");
var td = document.createElement("td");
td.style.width = "100%";
td.style.align = "right";
td.innerHTML = headerHtml;
headerTableTr.appendChild(td);
}
/*
* This is called when generating feature menu HTML given the menu structure by shell swf
* Parameters:
* featureMenus - feature menu structure passed by shell swf
*/
function generateFeatureMenuBar(featureMenus, homeLabel)
{
var menuHtml = "<table id='emExpressMenu' class='emExpressMenu' border='0'>" +
" <tr>";
// add top level menu buttons
for (i=0; i < featureMenus.length; i++)
{
menuHtml += "<td>";
menuHtml += " <table border='0' cellpadding='0' cellspacing='0' >";
menuHtml += " <tr>";
menuHtml += " <td id='menuItem" + i + "' class='emExpressMainMenu' onmouseover='mainMenuMouseOver(this, \"subMenu" + i + "\")' onClick='mainMenuClick(this, \"subMenu" + i + "\")' onmouseout='mainMenuMouseOut(this)'>";
menuHtml += " <table id='menuItem" + i + ":table' cellpadding='0' cellspacing='0' border='0' style='padding-left:3; padding-right:3;'>";
menuHtml += " <tr id='menuItem" + i + ":table:row'>";
menuHtml += " <td id='menuItem" + i + ":table:row:cellImg1' style='padding-top:3; padding-right:6;'>";
menuHtml += " <img id='menuItem" + i + "Img1' src='image/" + featureMenus[i].icon + "' />";
menuHtml += " </td>";
menuHtml += " <td id='menuItem" + i + ":table:row:cellLink'>";
menuHtml += " <a id='menuItem" + i + "Link' class='emFont7 emExpressMainMenuItem'>" + featureMenus[i].label + " </a>";
menuHtml += " </td>";
menuHtml += " <td id='menuItem" + i + ":table:row:cellMenuImg'>";
menuHtml += " <div id='menuItemFmk" + i + "Img' class='menuImageWhite'/>";
menuHtml += " </td>";
menuHtml += " </tr>";
menuHtml += " </table>";
menuHtml += " </td>";
menuHtml += " </tr>";
menuHtml += " </table>";
// add sub menu for each top level menu button
menuHtml += " <div id='subMenu" + i + "' class='emExpressSubMenu'><table border='0' cellspacing='0' cellpadding='0'><tr><td class='emExpressSubMenuItemInnerTable'>";
// add each submenu item
var featureSubMenus = featureMenus[i].menuItems;
var j = 0;
for (j = 0; j < featureSubMenus.length; j++)
{
var featureSubMenu = featureSubMenus[j];
var type = featureSubMenu.type;
if (type != null && type == "separator")
{
menuHtml += "<div class='menuSeparator'></div>";
}
else
{
var action = "alert(\"not defined.\");";
if (type == "report")
{
if (featureSubMenu.component != null && featureSubMenu.report != null)
{
action = "navigateToUrl(\"/em/shell#/" + featureSubMenus[j].component + "/" + featureSubMenus[j].report + "\");";
}
else if (featureSubMenu.action != null)
{
action = featureSubMenu.action;
}
}
else if (type == "action")
{
if (featureSubMenu.action != null)
{
action = featureSubMenu.action;
}
else if (featureSubMenu.component != null && featureSubMenu.report != null)
{
action = "navigateToUrl(\"/em/shell#/" + featureSubMenus[j].component + "/" + featureSubMenus[j].report + "\");";
}
}
menuHtml += "<a id='subMenuItem" + i + j +
"' class='emExpressSubMenuItem'" +
"onmouseover='subMenuMouseOver(this);' onmouseout='subMenuMouseOut(this);' " +
"onClick='resetMenu();" + action + "'>" +
featureSubMenu.label + "</a>";
}
}
// add dropshadow
menuHtml += " </td>";
menuHtml += " <td width='3' valign='top' class='menuDropShadowColor'>";
menuHtml += " <table cellspacing='0' cellpadding='0' height='3' width='3' class='menuDropShadowNegativeColor'><tr><td><img src='image/t.gif'></td></tr></table>";
menuHtml += " </td>";
menuHtml += " </tr>";
menuHtml += " <tr>";
menuHtml += " <td colspan='2' style='padding-left:3px;'>";
menuHtml += " <table cellspacing='0' cellpadding='0' width='100%' style='height:3px;'><tr><td class='menuDropShadowColor'><img src='image/t.gif'></td></tr></table>";
menuHtml += " </td>"
menuHtml += " </tr>";
menuHtml += " </table>";
// close sub menu
menuHtml += " </div>";
// close top level menu
menuHtml += " </td>";
}
// close feature menu bar
menuHtml += " </tr>";
menuHtml += "</table>";
return menuHtml;
}
/*
* This is called when generating framework menu HTML given the menu structure by shell swf
* Parameters:
* frameworkMenus - framework menu structure passed by shell swf
*/
function generateFrameworkMenuBar(frameworkMenus)
{
var subMenuStyleClass = (emMode == "active_report" ? "emExpressActiveReportSubMenu" : "emExpressSubMenu");
var menuHtml = "<div class='headerMenuBox'>" +
" <table id='emExpressFrameworkMenus' border='0' cellpadding='0' cellspacing='0' >" +
" <tr>";
// add top level framework menu
var i=0;
for (i=0; i < frameworkMenus.length; i++)
{
var mainMenuLabel = frameworkMenus[i].label;
menuHtml += "<td id='menuItemFmk" + i + "' onmouseover='mainMenuMouseOver(this, \"subMenuFmk" + i + "\")' onClick='mainMenuClick(this, \"subMenuFmk" + i + "\")' onmouseout='mainMenuMouseOut(this)'>";
menuHtml += " <table id='menuItemFmk" + i + ":table' cellpadding='0' cellspacing='0' border='0' style='padding-left:0; padding-right:3;'>";
menuHtml += " <tbody id='menuItemFmk" + i + ":table:body'>";
menuHtml += " <tr id='menuItemFmk" + i + ":table:body:row'>";
menuHtml += " <td id='menuItemFmk" + i + ":table:body:row:cellImg1' style='height:20px;'>";
menuHtml += " <img id='menuItemFmk" + i + "Img1' src='image/t.gif' width='3' height='0px'/>";
menuHtml += " </td>";
menuHtml += " <td id='menuItemFmk" + i + ":table:body:row:cellLink'>";
// we do need access key and underlying the first char for active report
if (emMode == "active_report")
{
menuHtml += " <a id='menuItemFmk_current_language' class='emFont6 emExpressMainMenuItem'>" + mainMenuLabel;
}
else
{
menuHtml += " <a id='menuItemFmk" + i + "Link' class='emFont6 emExpressMainMenuItem' accesskey='" +
mainMenuLabel.charAt(0).toUpperCase() + "'>";
menuHtml += " <span id='menuItemFmk" + i + "Span' style='text-decoration: underline;'>" +
mainMenuLabel.charAt(0).toUpperCase() + "</span>" + mainMenuLabel.substr(1);
}
menuHtml += " </a>";
menuHtml += " </td>";
menuHtml += " <td id='menuItemFmk" + i + ":table:body:row:cellMenuImage' style='padding-top:2px;'>";
menuHtml += " <div id='menuItemFmk" + i + "Img' class='menuImage'/>";
menuHtml += " </td>";
menuHtml += " </tr>";
menuHtml += " </tbody>";
menuHtml += " </table>";
// add sub menu for each top level menu
menuHtml += " <div id='subMenuFmk" + i + "' class='" + subMenuStyleClass +"'><table border='0' cellspacing='0' cellpadding='0'><tr><td class='emExpressSubMenuItemInnerTable'>";
// add each submenu item
var frameworkSubMenus = frameworkMenus[i].menuItems;
var j = 0;
for (j = 0; j < frameworkSubMenus.length; j++)
{
var frameworkSubMenu = frameworkSubMenus[j];
var type = frameworkSubMenu.type;
if (type != null && type == "separator")
{
menuHtml += "<div class='menuSeparator'></div>";
}
else
{
var action = "alert(\"not defined.\");";
if (type == "report")
{
if (frameworkSubMenu.component != null && frameworkSubMenu.report != null)
{
action = "navigateToUrl(\"/em/shell#/" + frameworkSubMenus[j].component + "/" + frameworkSubMenus[j].report + "\");";
}
else if (frameworkSubMenu.action != null)
{
action = frameworkSubMenu.action;
}
}
else if (type == "action")
{
if (frameworkSubMenu.action != null)
{
action = frameworkSubMenu.action;
}
else if (frameworkSubMenu.component != null && frameworkSubMenu.report != null)
{
action = "navigateToUrl(\"/em/shell#/" + frameworkSubMenus[j].component + "/" + frameworkSubMenus[j].report + "\");";
}
}
menuHtml += "<a id='subMenuItem" + i + j + "' class='emFont7 emExpressSubMenuItem' onmouseover='subMenuMouseOver(this);' onmouseout='subMenuMouseOut(this);' onClick='resetMenu();" + action + "'>" + frameworkSubMenu.label + "</a>";
}
}
// add dropshadow
menuHtml += " </td>";
menuHtml += " <td width='3' valign='top' class='menuDropShadowColor'>";
menuHtml += " <table cellspacing='0' cellpadding='0' height='3' width='3' style='background-color:white'><tr><td><img src='image/t.gif'></td></tr></table>";
menuHtml += " </td>";
menuHtml += " </tr>";
menuHtml += " <tr>";
menuHtml += " <td colspan='2' style='padding-left:3px;'>";
menuHtml += " <table cellspacing='0' cellpadding='0' style='height:3px; width:100%'><tr><td class='menuDropShadowColor'><img src='image/t.gif'></td></tr></table>";
menuHtml += " </td>"
menuHtml += " </tr>";
menuHtml += " </table>";
// close sub menu
menuHtml += " </div>";
// close top level menu
menuHtml += " </td>";
}
// close framework menu bar
menuHtml += " </tr>";
menuHtml += " </table>";
menuHtml += "</div>";
return menuHtml;
}
/*
* Description:
* This function is used to manually switch the language/local of an active report
*
* Parameters:
* localeCode : code of the language to switch to
* localeLabel : translated label of the language to switch to
*/
function switchLanguage(localeCode, localeLabel)
{
// chenge the label of the local/language menue to be the current selected one
var languageMenuLabel = document.getElementById("menuItemFmk_current_language");
languageMenuLabel.innerHTML = localeLabel;
// get flashApp
var flashApp = getFlashApp();
try
{
// call Flex to change the language
flashApp.changeActiveReportLocale(localeCode);
}
catch (error)
{
// #13914689: errors can happen when switching swf, do not alert
// alert("switchLanguage() error: " + error);
}
// send a message to the parent html to refresh/reload itself
refreshParent();
// note: following lines were not in RDBMS txn, instead we had code block above
// refresh/reload the page. This will cause emxShell to reload again,
// reparse, durting which the nlsUserData is re-read, and the new locale
// re-loated.
// location.reload(true);
}
/*
* Description:
* Sends a message to the parent html to refresh/reload itself. We have to do
* it this way since the child iframe cannot refresh the parent directly due to
* cross domain issue. Upon receiver of this message, parent html will refresh
* itself, which will cause emxShell to reload again, reparse, durting which
* the nlsUserData is re-read, and the new locale re-loated.
*
*/
function refreshParent()
{
// send a message to the parent html to refresh/reload itself
window.parent.postMessage('refreshParent', '*');
}
/*
* Description:
* Simulates a click on the browser back button.
*
*/
function goBack()
{
// go to the last element in history
history.go(-1);
}
OHA YOOOO