123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454 |
- /********************************************************************************************************************************
- * 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 = "<table class=\"tooltip\" cellpadding=\"0\" cellspacing=\"1\"><tr> <td valign=\"middle\"> <img width=\"16\" height=\"16\" src=\"" + icon + "\"/> </td> <td id=\"taskActionName\" valign=\"middle\"> </td></tr></table>";
-
- // 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 = '<IMG alt="" src="../ags/images/summary/summary_scroll_left_dis.gif"/>' ;
- scrollLeft.onmousedown = null;
- }else{
- scrollLeft.innerHTML = '<IMG alt="" src="../ags/images/summary/summary_scroll_left.gif"/>' ;
- scrollLeft.onmousedown = scrollLeftDown;
- }
- var shoScrollRight = summaryBarScrollpane2.scrollWidth - (summaryBarScrollpane2.scrollLeft + summaryBarScrollpane2.clientWidth) ;
- var scrollRight = document.getElementById("scroll_right");
- if( shoScrollRight > 0){
- scrollRight.innerHTML = '<IMG alt="" src="../ags/images/summary/summary_scroll_right.gif"/>' ;
- scrollRight.onmousedown = scrollRightDown;
- }else{
- scrollRight.className = "button";
- scrollRight.innerHTML = '<IMG alt="" src="../ags/images/summary/summary_scroll_right_dis.gif"/>' ;
- 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);
- }
|