123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- /********************************************************************************************************************************
- * Licensed Materials - Property of IBM *
- * *
- * IBM Cognos Products: AGS *
- * *
- * (C) Copyright IBM Corp. 2005, 2014 *
- * *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *
- *********************************************************************************************************************************/
- //
- // Those functions are used to reload frames or to change their aspect.
- //
- //Frame ids
- var DIALOG_FRAME_ID = "dialogIFrame";
- var MESSAGE_FRAME_ID = "messageIFrame";
- var DISPLAY_NONE = "none";
- // define some parameters for this sort of thing
- var WIZARD_MENU_ALIAS='wizard';
- var TASK_MENU_ALIAS='task2';
- // define some variable for the tabs
- var TAB_MODEL = 'Model';
- var TAB_DATAITEMS = 'DataItems';
- var TAB_FUNCTIONS = 'Functions';
- var TAB_PARAMETERS = 'Parameters';
- var TAB_HISTORY = 'History';
- var TAB_MEMBERS = 'MemberSearch';
- var flag = null;
- var itemType = "";
- var itemLabel= "";
- //var popWin1;
- /*
- * switch the task menu depending on whether the new agent wizard is active
- * alias Can be 'wizard' or 'task2'. When null the default alias is task2
- * taskCount The number of tasks in the summary bar
- */
-
- function changeTaskMenu(alias)
- {
-
- var lastMenuDiv = null;
-
- //set the default alias if necessary
- if (alias==null) {
- alias=TASK_MENU_ALIAS;
- }
-
- //get the last menu
- if (alias == WIZARD_MENU_ALIAS) {
- lastMenuDiv = document.getElementById('div_taskmenu_task2');
- }
- else if (alias == TASK_MENU_ALIAS) {
- lastMenuDiv = document.getElementById('div_taskmenu_wizard');
- }
-
- if (lastMenuDiv != null) {
-
- //hide the old menu
- lastMenuDiv.style.display="none";
-
- //get the new menu div
- var newMenuDiv = document.getElementById('div_taskmenu_'+alias);
- //show the correct menu
- if(newMenuDiv != null){
-
- if (browserCheck.isIE5Up()) {
- newMenuDiv.style.display="block";
- }
- else {
- newMenuDiv.style.display="table";
- }
-
- var taskCount = cfgGet("TaskCount");
-
- //set a default task count if it has not been set
- if (taskCount == undefined || taskCount == null) {
- taskCount = 0;
- }
-
- //alert('changeTaskMenu:alias='+alias+', task count:'+taskCount);
-
- // now do the setSubmissionMenu
- doSetSubmissionMenu(taskCount);
- }
- }
- }
- function doSetSubmissionMenu(taskCount) {
-
- var menuItem = menuItemMap['sequenceTasks'];
-
- // hide the set submission of tasks item if there's no sequencing to be done
- if (taskCount < 2) {
- // hide it
- document.getElementById('set_submit_spacer').style.display="none";
- document.getElementById('set_submit').style.display="none";
- menuItem.hide();
- }
- // show it.
- else{
- if (browserCheck.isIE5Up() && document.documentMode < 10) { // IE7, IE8, IE9 Standards mode
- document.getElementById('set_submit').style.display="block";
- document.getElementById('set_submit_spacer').style.display="block";
- } else { // IE 10 or upper IE browser and other browsers.
- document.getElementById('set_submit').style.display="table-row";
- document.getElementById('set_submit_spacer').style.display="table-row";
- }
- menuItem.show();
- }
- }
- function getConfigFrame() {
- if (this.id == 'CR1_AgentStudio_TopFrame')
- return this;
- else if (parent != null && parent.id == 'CR1_AgentStudio_TopFrame')
- return parent;
- else if (opener != null && opener.id == 'CR1_AgentStudio_TopFrame')
- return opener;
- else if (top.id == 'CR1_AgentStudio_TopFrame')
- return top;
- else
- return null;
- }
- function getMessageIFrame() {
- return getFrame('messageIFrame');
- }
- function getPopUpFrame() {
- return getFrame('popUpFrame');
- }
- function getDialogFrame(frameId) {
- if(!frameId){
- frameId = DIALOG_FRAME_ID;
- }
-
- return getFrame(frameId);
- }
- function getFrameDocument(frame)
- {
- return frame.document;
- }
- function getFrame(name) {
- var cf = getConfigFrame();
- var f = null;
- if (cf)
- f = cf.window.frames[name];
- return f;
- }
- function redrawLayers() {
- // always change the menu to a new agent
- changeMenu(TAB_MODEL);
- changeTaskMenu('task2');
- doSetSubmissionMenu(); // ?
- showDialogFrame(0);
- }
- function hideDialogFrame(){
- saveChangesToDialogFrame=false;
- //only hide if the dialog is showing
- if (isDialogFrameShowing()) {
- showDialogFrame(0);
- //Make the call to reset the Task Menu selection
- //so that it is the select tab in summary bar.
- //Only do this if summarybar is currently displayed.
- if (getMessageIFrame() && getMessageIFrame().highlightSelectedMenuItem) {
- getMessageIFrame().highlightSelectedMenuItem();
- getMessageIFrame().focus();
- }
- }
- }
- //only hide if we can match to the current type
- function hideDialogFrameForType(dialogType){
- var currentType = agsDialogTypes.getCurrentType();
-
- if(currentType && currentType.equals(dialogType)){
- showDialogFrame(0);
- }
- }
- function closeErrorPage(){
-
- var popUpform = getPopUpFrame().document.forms[0];
- var isLogonShowing = (popUpform.h_CAM_action && popUpform.h_CAM_action.value.indexOf(K_logon) == 0) ? true : false;
- if (isLogonShowing) {
- if (history.startIndex >= 0){
- history.back();
- history.startIndex--;
- return;
- } else {
-
- if(cfgGet("CAN_CANCEL_LOGON") && cfgGet("AGS_initialized")){
- //empty the command stack and return if ags is up and running
- getCommandStackManager().getCommandStack().clear();
- //display a message : OK to close event studio, Cancel to leave logon dialog showing
- }else if(confirm(closeAgsWarningMessage_string)){
- //canceling a logon means warn and then close ags
- closeAGS();
- }
- else {
- //do not close ags, leave the logon dialog showing
- return;
- }
- }
- }
-
- cfgRemove("CAN_CANCEL_LOGON")
-
- var dialog = parent.agsFormUtils.getElementFromFrame(parent,parent.DIALOG_FRAME_ID);
- if (popUpIsOpen()) {
- doClosePopUp();
- }
- else if (dialog && dialog.style.display=='') {
- hideDialogFrame();
- }
- }
- /*
- * Set the dialog frame height and border style
- * percentage The height of the dialog frame (integer)
- */
- function setDialogFrameHeight(percentage) {
- //height expressed as <n>px or <n>%
- //there is a firefox issue when using percentages. If the message frame is set
- //to 100% and the dialog frame is set to 0%, space will still be allocated to
- //the dialog frame. This is fixed by always specifying the dialog frame size in
- //pixels when hiding it, when showing it we can still use percentages
- var dlgFrameHeight='100%';
- var heightStr='0px';
- var borderTop='0px';
- var dlgDisplay="";
- //collect the message and dialog frames
- var aMessageFrame = agsFormUtils.getElementFromFrame(getConfigFrame(), MESSAGE_FRAME_ID);
- var messageTD = agsFormUtils.getElementFromFrame(getConfigFrame(), getFrameBorderId(MESSAGE_FRAME_ID));
- var aDialogFrame = agsFormUtils.getElementFromFrame(getConfigFrame(), DIALOG_FRAME_ID);
- var dialogTD = agsFormUtils.getElementFromFrame(getConfigFrame(), getFrameBorderId(DIALOG_FRAME_ID));
- var windowHeight = aMessageFrame.contentWindow.document.body.clientHeight + aDialogFrame.contentWindow.document.body.clientHeight;
- //hidden dialog, showing message frame
- if(percentage == 0){
- //uncomment when bugzilla bug 100533 is fixed (firefox 1.6)
- //see https://bugzilla.mozilla.org/show_bug.cgi?id=100533
- //dlgDisplay=DISPLAY_NONE;
- dlgFrameHeight='0px';
- getConfigFrame().getAgentItemsListener().frameHidden(DIALOG_FRAME_ID);
- //showing dialog, hidden message frame
- }else if(percentage == 100){
- heightStr = '100%';
- //showing dialog frame, showing message frame
- }else{
- borderTop = "1px solid #999999";
- heightStr = percentage + '%';
- }
-
- //set the height
- dialogTD.style.height = heightStr;
- aDialogFrame.style.height=dlgFrameHeight;
- //set the top border style
- aDialogFrame.style.borderTop = borderTop;
- //set the display style
- aDialogFrame.style.display = dlgDisplay;
- dialogTD.style.display = dlgDisplay;
- //alert('aDialogFrame.style.height:'+aDialogFrame.style.height);
- }
- //if the frame is going to 100% we dont show the top border
- function showDialogFrame(size) {
-
- //for good measure.... the wait pop up may be expecting to be closed from
- //a page being run in the dialog fram
- getConfigFrame().doClosePopUp();
-
- //collect the message and dialog frames
- var aMessageFrame = agsFormUtils.getElementFromFrame(getConfigFrame(), MESSAGE_FRAME_ID);
- var messageTD = agsFormUtils.getElementFromFrame(getConfigFrame(), getFrameBorderId(MESSAGE_FRAME_ID));
-
- if(!aMessageFrame.contentWindow.document.body){
- //were in page transition.. hold on
- setTimeout("showDialogFrame("+size+")", 100);
- return;
- }
-
- var aDialogFrame = agsFormUtils.getElementFromFrame(getConfigFrame(), DIALOG_FRAME_ID);
- var dialogTD = agsFormUtils.getElementFromFrame(getConfigFrame(), getFrameBorderId(DIALOG_FRAME_ID));
-
- //the whole kaboudle
- var windowHeight = aMessageFrame.contentWindow.document.body.clientHeight + aDialogFrame.contentWindow.document.body.clientHeight;
-
- var msgDisplay="";
- var newDialogSize=0;
- var newMessageSize;
-
- //parse it
- if (typeof size != SizeParser) {
- size = new SizeParser(size);
- }
-
- //express the size as a percentage always
- if(size.isPercent()){
- newDialogSize = size.number;
- newMessageSize = 100 - size.number;
- }else{
-
- newMessageSize = ((windowHeight - size.number) * 100) / windowHeight;
-
- if(newMessageSize > 100) newMessageSize = 100;
- if(newMessageSize < 0) newMessageSize = 0;
-
- newDialogSize = 100 - newMessageSize;
- }
-
- setDialogFrameHeight(newDialogSize);
-
- //adjust the size unit for firefox
- // KM this code had strange behaviour in IE so added a condition to avoid it in IE, was working ok in Firefox
- // although setting size to 0 or display prop to none should effectively do the same
-
- if (newMessageSize==0) {
- // msgDisplay = DISPLAY_NONE; // causes cq 261144 in IE
- msgDisplay = "";
- messageTD.style.height = '0%';
-
- }
- else {
- msgDisplay = "";
- messageTD.style.height = newMessageSize + '%';
- }
- messageTD.style.display = msgDisplay;
- aMessageFrame.style.display = msgDisplay;
-
- if(getMessageIFrame().setBarSize) {
- getMessageIFrame().setBarSize();
- }
- }
- function isDialogFrameShowing(){
- //var aDialogFrame = agsFormUtils.getElementFromFrame(self, DIALOG_FRAME_ID);
- //return aDialogFrame.style.display == "";
- var isShowing=false;
- var aDialogFrame = agsFormUtils.getElementFromFrame(getConfigFrame(), DIALOG_FRAME_ID);
- var size = new SizeParser(aDialogFrame.style.height);
- return isShowing = size.number > 0;
- }
- function getFrameBorderId(frameId){
- return frameId + "_td";
- }
- function collapseMenu(url) {
- document.getElementById("menuFrame").style.width = "0%";
- document.getElementById("messageFrame").style.width = "100%";
- document.getElementById('menuTabs_and_Props').style.display="none";
- //As these statement is used for Quirks mode to Standards mode, so there is no judgement which is set for Quirks mode.
- if (browserCheck.isIE5Up() && document.documentMode < 10) { //IE7, IE8, IE9 Standards mode
- document.getElementById('menuExpand_button').style.display="block";
- }else { //IE10 or upper IE Standards mode and other browser.
- document.getElementById('menuExpand_button').style.display="table";
- }
- }
- function expandMenu() {
- var size = cfgGet("MenuSize");
- if (size == null || isNaN(size)) {
- size = 200;
- cfgSet("MenuSize");
- }
- //document.getElementById("menuFrame").style.width = size + "px";
- //document.getElementById("messageFrame").style.width = "";
- updateMenuFrameWidth(size);
- document.getElementById('menuExpand_button').style.display="none";
- //As these statement is used for Quirks mode to Standards mode, so there is no judgement which is set for Quirks mode.
- if (browserCheck.isIE5Up() && document.documentMode < 10) { //IE7, IE8, IE9 Standards mode
- document.getElementById('menuTabs_and_Props').style.display="block";
- }else { //IE10 or upper IE Standards mode and other browser.
- document.getElementById('menuTabs_and_Props').style.display="table";
- }
- }
- function showAgsMenu(alias){
- if (alias==null)
- alias=TAB_MODEL;
- if (alias != 'closed')
- cfgSet("lastMenu", alias);
- document.getElementById('div_menu_' + TAB_MODEL).style.display="none";
- document.getElementById('div_menu_' + TAB_DATAITEMS).style.display="none";
- document.getElementById('div_menu_' + TAB_FUNCTIONS).style.display="none";
- document.getElementById('div_menu_' + TAB_PARAMETERS).style.display="none";
- document.getElementById('div_menu_' + TAB_HISTORY).style.display="none";
- document.getElementById('div_menu_' + TAB_MEMBERS).style.display="none";
-
- if(null != document.getElementById('div_menu_'+alias) ){
- if (browserCheck.isIE5Up() && document.documentMode < 10) { // IE7, IE8, IE9 Standards mode
- document.getElementById('div_menu_'+alias).style.display="block";
- } else { //IE10 or upper IE Standards mode and other browser.
- document.getElementById('div_menu_'+alias).style.display="table";
- }
-
- var cf = getConfigFrame();
- setInsertableObjectsTabContainerHeight();
- }
- }
- // DO NOT USE THIS METHOD OTHER THAN IN HERE - USE THE ABOVE UTIL FUNCTIONS
- function changeMenu(alias) {
- showAgsMenu(alias);
-
- if (alias == TAB_MODEL && metadataTree == null) {
- refreshMetaDataTree();
- }
-
- if (alias == TAB_FUNCTIONS && functionsTree == null) {
- refreshFunctionsTree();
- }
- }
- // for click and enter key press action
- function changeTabMenu(alias) {
- showAgsMenu(alias);
-
- if (AccessibilityHandler.isEnabled()) {
- AccessibilityHandler.setTabMenuFocus(alias);
- }
- }
- // not sure
- function enableResize(bEnable, widthOrHight) {
- cfgSet('RESIZING_MENU_PANE', bEnable);
- if(widthOrHight == "width" || widthOrHight == "height"){
- flag = widthOrHight;
- }else{
- flag = null;
- }
- }
- // utility function too
- /*
- Event handler
- onmousemove on menu frame's body or report frame's body
- This function
- resizes the menu pane when the user is dragging the expand icon.
- */
- function resizeMenuPane(evt, bEventInReportFrame) {
- var buttondown;
- if (document.documentMode < 10)
- buttondown = (evt.button!= null && evt.button == 1);
- else if (browserCheck.isNav6Up() || document.documentMode >= 10)
- buttondown = (evt.button!= null && evt.button == 0);
-
- if (buttondown && flag == "width") {
- var m = document.getElementById("menuFrame");
- if (!m)
- return;
- var size = parseInt(m.style.width);
- if (size == null || isNaN(size))
- size = 200;
- if(!bEventInReportFrame)
- size = 0;
- if (browserCheck.isIE5Up())
- size += evt.x;
- else
- size += evt.pageX;
- if (size < 100)
- size = 100;
- cfgSet("MenuSize", size);
- //m.style.width = size + "px";
- updateMenuFrameWidth(size);
- }
- }
- /*
- * The two columns that hold the menu frame and message frame are specified
- * in terms of a percentage. This function will take a new menu frame width given
- * in pixels, convert it into two percentages and set the style widths for both menu
- * frame and message frame.
- */
- function updateMenuFrameWidth(menuFrameWidth) {
- var perc;
- var menuFrame = document.getElementById('menuFrame');
- var parent = document.getElementById('container_float');
- var messageFrame = document.getElementById('messageFrame');
- var parentWidth=parent.offsetWidth;
- perc = Math.round((menuFrameWidth/parentWidth)*100);
-
- //20% is the minimum size for the menu frame
- if (perc<=20) {
- perc=20;
- }
- var messageFramePerc = 100-perc;
-
- //set the percentages
- menuFrame.style.width=perc+'%';
- messageFrame.style.width=messageFramePerc+'%';
- }
- function moveHorizPane(evt, bEventInReportFrame) {
- var buttondown;
- if (document.documentMode < 10)
- buttondown = (evt.button!= null && evt.button == 1);
- else if (browserCheck.isNav6Up() || document.documentMode >= 10)
- buttondown = (evt.button!= null && evt.button == 0);
-
- if (buttondown && flag == "height") {
- var m = document.getElementById("taskDiv");
- if (!m)
- return;
- var height = parseInt(m.style.height);
- if (height == null || isNaN(height))
- height = 100;
- if(!bEventInReportFrame)
- height = 0;
-
- if (browserCheck.isIE5Up())
- height = evt.y-100;
- else
- height += evt.pageY;
-
- if (height > 120)
- height = 120;
- if (height < 98)
- height = 98;
- //cfgSet("MenuSize", size);
- window.status= "";
- m.style.height = height + "px";
- m.style.zIndex = -10;
- }
- }
- function AgsDialogTypes(){
- this.DIALOG_TYPE_KEY = "AgsDialogType_key"
-
- this.SAVE_SAVEAS = new AgsDialogType("save-saveas");
- this.VALIDATE = new AgsDialogType("validate");
- this.SCHEDULE = new AgsDialogType("schedule");
- this.OPEN_FILE = new AgsDialogType("file-open");
- this.SUPPRESSION = new AgsDialogType("suppression");
- this.DATAITEMS = new AgsDialogType("dataitems");
- this.PARAMETER = new AgsDialogType("paramter");
- this.PROMPT = new AgsDialogType("prompt");
- this.SEQUENCE_AGENT_TASKS = new AgsDialogType("sequenceagenttasks");
- this.NOTIFICATION_LIST = new AgsDialogType("notificationlist");
- this.DEFAULT_TASKS_OPTIONS = new AgsDialogType("defaulttasksoptions");
- }
- AgsDialogTypes.prototype.setCurrentType = function(agsDialogType){
- if(agsDialogType && agsDialogType instanceof AgsDialogType){
- cfgSet(this.DIALOG_TYPE_KEY, agsDialogType);
- }
- }
- AgsDialogTypes.prototype.getCurrentType = function(agsDialogType){
- return cfgGet(this.DIALOG_TYPE_KEY);
- }
- AgsDialogTypes.prototype.isCurrentType = function(){
- if(agsDialogType && agsDialogType instanceof AgsDialogType){
- var currentType = cfgGet(this.DIALOG_TYPE_KEY);
- return agsDialogType.equals(currentType);
- }
- return false;
- }
- function AgsDialogType(type){
- this.equals = equals;
- this.agsDialogType = type;
-
- function equals(another){
- var isEqual = false;
-
- if(another instanceof AgsDialogType){
- isEqual = another.agsDialogType == this.agsDialogType;
- }
- return isEqual;
- }
- }
- //use this as a one off
- var agsDialogTypes = new AgsDialogTypes();
|