/******************************************************************************************************************************** * 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 = "
| |
' ;
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);
}