/******************************************************************************************************************************** * 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 px or % //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();