/******************************************************************************************************************************** * Licensed Materials - Property of IBM * * * * IBM Cognos Products: AGS * * * * (C) Copyright IBM Corp. 2005, 2008 * * * * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. * *********************************************************************************************************************************/ var dragapproved=false; var dragToolTip; var oldDropZone; var dragData; var selTab; var dragItem; var nextZoneId; parent.doAction = doAction; function drag_move(evt){ evt = (evt) ? evt : ((event) ? event : null); dragToolTip.style.display = ""; if (dragapproved==true){ dragToolTip.style.left = (evt.clientX+20) + "px"; dragToolTip.style.top = evt.clientY + "px"; return false; } } // select the tab function selectTab(tabId, type) { var cf = window.parent.getConfigFrame(); if(cf.applicationActionManager.isBlocked()){ return; } if(!cf.agsDialogTypes.VALIDATE.equals(cf.agsDialogTypes.getCurrentType())){ cf.hideDialogFrame(); } if(submitAndGo()){ //block until page is reloaded cf.applicationActionManager.blockActions(); // we're replacing the current selected tab - keep the old value selTab = document.getElementById('tabSelectedID'); //guard clause, scheduling is not available if (typeof parent.userCanUseSched != 'undefined' && parent.userCanUseSched==false && type=='schedule') { return; } selTab.value = tabId; // and call submit on the form to proceed - explicitly setting variables as we go. document.pform.m.value='/ags/dialogAdapter.xts'; document.pform.ps_nav_op.value=''; //reset the undo state cf.getRedoUndoManager().resetTreeAction(); //clear the tab as a delete candidate (will get set on load) cf.deletionCandidateManager.clearCandidate(); // submit the form document.pform.submit(); } } /* * Fired when the user clicks on a selected tab. In this case we set * the task as a valid deletion candidate */ function selectCurrentTab(tabId, type) { var cf = window.parent.getConfigFrame(); //set the tab as a delete candidate parent.deletionCandidateManager.setCandidate('tabSelectedID',cf.K_sControlCandidate); } // function used to create a task - so doAction is a bad name as it happens. // arguments: // taskType : the type of task that you want created. Either // "message", "report", "sql", "job", "agent" or "web" function doAction(taskType) { var cf = window.parent.getConfigFrame(); if(cf.applicationActionManager.isBlocked()){ return; } // hide save/save_as dialog if(cf.hideDialogFrame)cf.hideDialogFrame(); if(submitAndGo()){ // we're replacing the current tab - keep the old value document.pform.tabSelectedID.value=taskType; document.pform.newTaskType.value=taskType; // set agent state cf.agentHasChanged(true); //reset the undo state cf.getRedoUndoManager().resetTreeAction(); // if sql task then pass in the default package name if(taskType=='sql'){ var packRoot = document.createElement("input"); packRoot.setAttribute('type', 'hidden'); packRoot.setAttribute('name', 'packRoot'); packRoot.value= decodeURIComponent(cf.cfgGet('PackageRoot')); document.pform.appendChild(packRoot); } //block until page is reloaded parent.applicationActionManager.blockActions(); // document.pform.m.value='/ags/dialogAdapter.xts'; document.pform.ps_nav_op.value=''; document.pform.submit(); } } /* The function leavingDialog should exist in the page if it has some extra info to be submitted, currently email options page does that. */ function submitAndGo() { if(window.leavingDialog){ //if we have any more info to operate leavingDialog(); } return true; } // allows drop only if the item being dragged is different from drop area item function onDrop(evt, dropedOnItemName) { evt = (evt) ? evt : ((event) ? event : null); if(dragapproved && dropedOnItemName!=dragData) { dropOnItem = document.getElementById('itemNewLocation'); if(dropOnItem != null) { dropOnItem.value = dropedOnItemName; } // item being dragged, we save its id so that we know what // requires to be shuffled upon reloading of the page draggedItem = document.getElementById('itemSelected'); if(draggedItem != null) { draggedItem.value = dragData; } // now set the form action to shuffle setAgentItemOp('shuffle'); //the task ordering has changed, so update the agent change state cf.agentHasChanged(true); // and call submit on the form to proceed document.pform.submit(); } } // set the agent item operation - this should have values of // 'shuffle', 'move_up', 'move_way_up', 'move_down', 'move_way_down' function setAgentItemOp(operation) { agentOperation = document.getElementById('agentItemOp'); agentOperation.value = operation; } function initdragie(evt, label, icon, dragInfo, nextItemId) { var cf = window.parent.getConfigFrame(); // hide save/save_as dialog if(cf.hideDialogs)cf.hideDialogs(); evt = (evt) ? evt : ((event) ? event : null); dragapproved=true; dragData = dragInfo; dragToolTip = document.getElementById('dragTip'); // if we reach in this we might see flicker of scrollbars in browser if(dragToolTip == null){ dragToolTip = document.createElement("div"); dragToolTip.setAttribute("id", "dragTip"); dragToolTip.setAttribute("style", "z-index:100"); //dragToolTip.setAttribute("class", "tooltip"); document.body.appendChild(dragToolTip); } nextZoneId = nextItemId; var it = "
 
"; // we are ready with the dragtip but will show it when user moves the mouse //dragToolTip.style.visibility = "hidden"; if (dragToolTip) { dragToolTip.innerHTML = it; var taskActionName = document.getElementById('taskActionName'); taskActionName.firstChild.nodeValue=label; dragToolTip.style.zIndex = 100; dragToolTip.style.position = "absolute"; dragToolTip.style.left = (evt.clientX+20) + "px"; dragToolTip.style.top = evt.clientY + "px"; dragToolTip.style.display = "inline"; } tempx = dragToolTip.style.pixelLeft; tempy = dragToolTip.style.pixelTop; iex=evt.clientX; iey=evt.clientY; window.status = ''; if (document.all) { document.attachEvent("onmousemove", drag_move); document.attachEvent("onmouseup", stopdrag); } else { document.addEventListener("mousemove", drag_move, false); document.addEventListener("mouseup", stopdrag, false); } } function dropZoneActive(evt, zoneID){ evt = (evt) ? evt : ((event) ? event : null); var blinkCaret = "../ags/images/summary/drop_caret.gif"; // allows drop only if the item being dragged is different from drop area item if(dragapproved && zoneID!=dragData && zoneID!=nextZoneId) { var external_dropZone = document.getElementById(zoneID+"_external"); var internal_dropZone = document.getElementById(zoneID+"_internal"); // make the external one visible external_dropZone.className='external_div'; // set the image into the inner one internal_dropZone.src = blinkCaret; } // stop this going any further evt.cancelBubble=true; } function dropZoneInactive(evt, zoneID){ evt = (evt) ? evt : ((event) ? event : null); var emptyCaret = "../ags/images/spacer.gif"; var external_dropZone = document.getElementById(zoneID+"_external"); var internal_dropZone = document.getElementById(zoneID+"_internal"); // make the external one hidden again external_dropZone.className='external_div_hidden'; // set the image into the inner one internal_dropZone.src = emptyCaret; // stop this going any further evt.cancelBubble=true; } function stopdrag(evt){ evt = (evt) ? evt : ((event) ? event : null); dragapproved=false; dragToolTip.style.display = "none"; dragToolTip.onmousemove=null; if (document.all) { document.detachEvent("onmousemove",drag_move); document.detachEvent("onmouseup",stopdrag); } else { document.removeEventListener("mousemove",drag_move, false); document.removeEventListener("mouseup", stopdrag, false); } } var resizeCount = 0; // set scrollbar div view width function setBarSize(event) { // get the size of the two button area's var flyOut = document.getElementById("flyout_td"); if(!flyOut){ //not finished page drawing setTimeout("setBarSize()", 100); return; } var left_button_size = flyOut.offsetWidth; var scrollTd = document.getElementById("scroll_td"); var right_button_size = scrollTd.offsetWidth; // get the size for the both - and add an offset var size = left_button_size + right_button_size + 10; // alter the size of the body if we can if(document.body.offsetWidth > size){ document.getElementById("SummaryBarScrollpane").style.width=document.body.offsetWidth-size + "px"; document.getElementById("SummaryBarScrollpane2").style.width=document.body.offsetWidth-size + "px"; } //Now adjust horizontal and vertical scroll bars of the IFrame so that they //are moved to the Div d2. var newHeight = document.body.offsetHeight-(document.getElementById("d1").offsetHeight+15); // this can be negative if window is too small or save as dialog is shown if(newHeight>0){ document.getElementById("d2").style.height = newHeight; } else { document.getElementById("d2").style.height = 10; } var newWidth = document.body.offsetWidth - 15; if(newWidth>0){ document.getElementById("d2").style.width = newWidth; } else{ document.getElementById("d2").style.width = 10; } leftRightController(); //COGCQ00242304 - Unable to attach multiple reports to an email in Event Studio using IE7 //This should deal with email options attachment menu. //This is when Portal puts the code in. /*if (window.removeAttachmentMenuListener && window.showMenu) { if (window.attachmentMenu && window.attachmentMenu.isVisible()) { window.removeAttachmentMenuListener(); //This will toggle it. window.showMenu(); } }*/ } /* This function finds out if the content of summary bar is out of view area if it so then enables or disables the left/right scroll buttons */ function leftRightController(){ var summaryBarScrollpane2 = document.getElementById("SummaryBarScrollpane2"); var scrollLeft = document.getElementById("scroll_left"); if( summaryBarScrollpane2.scrollLeft <= 0 ){ scrollLeft.className = "button"; scrollLeft.innerHTML = '' ; scrollLeft.onmousedown = null; }else{ scrollLeft.innerHTML = '' ; scrollLeft.onmousedown = scrollLeftDown; } var shoScrollRight = summaryBarScrollpane2.scrollWidth - (summaryBarScrollpane2.scrollLeft + summaryBarScrollpane2.clientWidth) ; var scrollRight = document.getElementById("scroll_right"); if( shoScrollRight > 0){ scrollRight.innerHTML = '' ; scrollRight.onmousedown = scrollRightDown; }else{ scrollRight.className = "button"; scrollRight.innerHTML = '' ; scrollRight.onmousedown = null; } } // scroll left the view in the scrollbar div function goLeft(){ for(var i=0; i < 20; i++){ document.getElementById("SummaryBarScrollpane").scrollLeft -=2; document.getElementById("SummaryBarScrollpane2").scrollLeft -=2; } leftRightController(); } // scroll right the view in the scrollbar div function goRight(){ for(var i=0; i < 20; i++){ document.getElementById("SummaryBarScrollpane").scrollLeft +=2; document.getElementById("SummaryBarScrollpane2").scrollLeft +=2; } leftRightController(); } // scroll left down function scrollLeftDown(){ document.getElementById('scroll_left').className='button_pressed'; window.status=''; goLeft(); return true; } // scroll left down function scrollRightDown(){ document.getElementById('scroll_right').className='button_pressed'; window.status=''; goRight(); return true; } // move focus to the selected button function setFocusToSelectedTab(){ // item_selected is the name of the selected tab so we find // its co-ordinates and set focus to it var myObj = document.getElementById('item_selected') ; if(null!=myObj){ var summaryBarScrollpane = document.getElementById("SummaryBarScrollpane"); var summaryBarScrollpane2 = document.getElementById("SummaryBarScrollpane2"); var offx = myObj.offsetLeft ; if(offx > (summaryBarScrollpane.offsetWidth-myObj.offsetWidth-10)){ summaryBarScrollpane.scrollLeft = offx-summaryBarScrollpane.offsetWidth+myObj.offsetWidth+10; summaryBarScrollpane2.scrollLeft = offx-summaryBarScrollpane.offsetWidth+myObj.offsetWidth+10; //moveInSteps(offx-summaryBarScrollpane.offsetWidth+myObj.offsetWidth+10); } } // set the item in task menu active highlightSelectedMenuItem(); } function highlightSelectedMenuItem(){ //get the id of the selected tab var selType = document.getElementById('tabSelectedID').value; if (selType.match('AgentTask-condition')) { selType = parent.K_sCondition; } parent.makeSelection(selType); } function moveInSteps(x){ var summaryBarScrollpane = document.getElementById("SummaryBarScrollpane"); var summaryBarScrollpane2 = document.getElementById("SummaryBarScrollpane2"); var lx = x-60; summaryBarScrollpane.scrollLeft = lx; summaryBarScrollpane2.scrollLeft = lx; for(var i=0; i < 30; i++){ summaryBarScrollpane.scrollLeft +=2; summaryBarScrollpane2.scrollLeft +=2; } } function openTask(idAndType) { // Remarks: if anypage id has this %% in its id this code can misbehave if (idAndType == "" || idAndType == null) return; var sepX = idAndType.indexOf('%%'); if(sepX > -1){ id = idAndType.substring(0, sepX); type = idAndType.substring(sepX+2); selectTab(id, type); } } function doSelectObject(mode, selectedObject){ var cf = window.parent.getConfigFrame(); cf.doSelectObject(mode, selectedObject); }