/**************************************************************** ** Licensed Materials - Property of IBM ** ** IBM Cognos Products: drill ** ** (C) Copyright IBM Corp. 2001, 2011 ** ** US Government Users Restricted Rights - Use, duplication or ** disclosure restricted by GSA ADP Schedule Contract with ** IBM Corp. *****************************************************************/ // Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved. // Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated). /** * * This application is used to generate the SOAP messages that are required to * send add, query, and update requests to the server and also handles the response * with proper action (e.g. error message) * * To use this javascript library following variable and resources should be initialize in hte html file * //HAL Options * G_HALOptions = { "isApplication" : false, "path" : "/cognos8/" }; * G_CCHLOptions = { "path" : "/cognos8/" }; * G_CCHL.M_sProductLocale ='en'; * G_CCHL.M_sContentLocale ='en-us'; * G_BusServer.F_SetRouterServerGroup() ; * G_BusServer.F_SetCafContextId(cafContextId); * * This file uses following HAL resources that need to be loaded in the html file * * * * * * * G_CCHL.M_sGatewayURL ='http://localhost/cognos8/cgi-bin/cognos.cgi'; * G_HAL.F_Include("hal/C_WebRequest.js"); * G_HAL.F_Include("cchl/C_BusRequest.js"); * G_HAL.F_Include("hal/D_Progress.js"); * G_HAL.F_Include( "hal/C_Dialog.js" ); * G_HAL.F_Include( "cchl/dialogs/D_DetailedMsgBox.js" ); * G_HAL.F_Include( "hal/G_ResManager.js" ); * G_HAL.F_Include( "hal/C_Error.js" ); * * This should be added to the end of HTML file * * * * @author Alireza Pourshahid */ // Defines the HAL var G_DrillPath = {}; // Global variables var el_oForm; // the HTML form that is passed and contains the inputs var g_sParentPath = ''; // the location that drillpath is saved var g_sDefaultName = ''; // drill path name var g_sDefaultDescription = ''; // drill path default description var g_sDefaultScreenTip = ''; // drill path default sceen tip var g_sAction = ''; // this is the run action can be either edit or run var g_bUseEditSpecification = ''; // specifies if dynamic filtering is used when we run the drill through var g_sScope = ''; // contains a model data item as the drill path scope var g_sTargetSearchPath = ''; // the search path of the target object var g_sOutputFormat = ''; // the out format of the target report (e.g. PDF, HTML, XML ...) var g_bPromptOption = ''; // Specifies whether wether we always promt the user or not var g_sBookMarkItem = ''; // contains a model data item as bookMarkItem in the target var g_sBookMarkText = ''; // contains a lable that is a bookmark in the target var g_sTargetClass = ''; // specifies the class of the target object (e.g. report, query, analysis, powerPlay8Report, package) var g_sRequestType = ''; // This is used to specify the type of the request. Can be AddDrillPath, QueryDrillPath, UpdateDrillPath // It is used by functions to act appropriatly based on the request type. var g_sDrillPathObjectSearchPath = ''; // This is the search path to the Drill path object that is used in the update method // Called during the window.onload event // This is used to load the required strings //This (G_DrillPath.F_HAL_OnLoad = function()) is the function that should be used for HAL applications // however since xts generate init() function that takes over the the load event we have renamed the function function init() { // Asynchronously load resources G_ResManager.F_SetLocale(G_CCHL.M_sProductLocale); // loads the string files that are require G_ResManager.F_LoadStrings( new Array( "cchl/res/cchl_strings",G_CCHLOptions.path+"drill/res/drill_strings"), G_DrillPath ); }; G_DrillPath.F_ResManager_OnStringsLoaded = function ( v_aFiles ) { G_ResManager.F_LoadResources( new Array( "cchl/res/cchl_resources.xml" ), this ); }; G_DrillPath.F_ResManager_OnResourcesLoaded = function( v_aFiles ) { }; G_DrillPath.F_HAL_OnUnLoad = function() { }; /** * Generates the add request and calls the adddrillPath method with a SOAP requesst * Uses C_BusRequest from CCHL * @el_oForm the HTML form object that contains the inputs * @v_sTargetClass the class of drill path target * @v_sUpdateAction This is the update action when the add request is sent if it is replace the drill path will be replaced * @author Alireza Pourshahid */ G_DrillPath.F_addDrillPath = function(v_oForm,v_sTargetClass, v_sUpdateAction){ // if we pass the update action it means user has been prompted to select the action (rename or replace) // this means this is the second request we are going to send after the first failure due to having an object // with the same name so we have already processed the form and // initialized the variables we need to build the request and don't need to do // the steps inside the if anymore if (v_sUpdateAction != 'rename' && v_sUpdateAction != 'replace') { // set the passed in form object into global object el_oForm = v_oForm; // set the target class g_sTargetClass = v_sTargetClass; // set the request type g_sRequestType = "addDrillPath"; // get the data from HTML page; this.F_getHTMLPageData(); } v_sBusRequest = " \r\n" + " "+g_sParentPath+"\r\n" + " \r\n" + this.F_getDefaultName()+ this.F_getDefaultDescription()+ this.F_getDefaultScreenTip()+ this.F_getAction()+ this.F_getScope()+ this.F_getParameterAssignments()+ this.F_getDrillSpec()+ " \r\n" + " \r\n" + this.F_getOutputFormat()+ this.F_getPrompt()+ this.F_getUseEditSpecification()+ " \r\n" + " \r\n" + this.F_getBookMark()+ " \r\n"; // the drill path will be replaced if (v_sUpdateAction == 'replace') { v_sBusRequest = v_sBusRequest + "\r\n" + " false\r\n" + " false\r\n" + " \r\n" + " replace\r\n" + " \r\n" + " " ; } else { v_sBusRequest = v_sBusRequest + "\r\n" + " false\r\n" + " false\r\n" + " \r\n" + " fail\r\n" + " \r\n" + " " ; } var v_oRequest = new C_BusRequest( this , C_BusRequest.K_sSOAPAction_reportService, v_sBusRequest ); // This is used for debuging to dump the request to a text (requestDump) // it only works if requestDump exist in the html page if (el_oForm.requestDump){ el_oForm.requestDump.value = v_sBusRequest; } this.F_sendRequest(v_oRequest); return false; }; /** * Gets form variables, generate the drill specification, and update the drill spec form variable * @See this.F_getDrillSpecString() * @el_oForm the HTML form object that contains the inputs * @v_sTargetClass the class of drill path target. This is used to generate appropriate drill spec based on the target. * @author Alireza Pourshahid */ G_DrillPath.F_updateDrillPath = function(v_oForm,v_sTargetClass){ // set the passed in form object into global object el_oForm = v_oForm; // set the target class g_sTargetClass = v_sTargetClass; // set the request type g_sRequestType = "updateDrillPath"; // get the data from HTML page; this.F_getHTMLPageData(); // get a new list of parameters (defined in Specs but not visible) G_DrillPath.F_getNewParameterList(); // make sure that we don't have any problem with non abacab targets if(el_oForm.m_p_target){el_oForm.removeChild(el_oForm.m_p_target);} el_oForm.m_p_specification.value = this.F_getDrillSpecString(); return true; } G_DrillPath.F_D_RenameReplace_OnOK = function(v_oDialog,v_sUpdateAction, v_sDrillNewName) { // This function is defined in the xts page // It enables the select controls and change their color // This has done as a part of work around for IE 6 bug for select z-index // without this work around select controls were popping over the dialog blocker F_selectUnblocker(); v_oDialog.F_Hide(); if (v_sUpdateAction == "rename") { g_sDefaultName = v_sDrillNewName; } this.F_addDrillPath(null,null,v_sUpdateAction); } //G_DrillPath.F_D_Choose_OnCancel= function(v_oDialog) G_DrillPath.F_D_RenameReplace_OnCancel= function(v_oDialog) { F_selectUnblocker(); v_oDialog.F_Hide(); } /** * sends the SOAP request to the server * @v_oRequest the request body * @author Alireza Pourshahid */ G_DrillPath.F_sendRequest = function (v_oRequest){ // Send the request via a progress bar switch (g_sRequestType) { case "addDrillPath": v_sRequestMessage = G_ResManager.F_GetString("IDS_WIZARD_SAVING"); break; case "updateDrillPath": v_sRequestMessage = G_ResManager.F_GetString("IDS_WIZARD_SAVING"); break; case "queryDrillPath": v_sRequestMessage = G_ResManager.F_GetString("IDS_WIZARD_PLEASE_WAIT"); break; } // This function is defined in the xts page // It disables the select controls and change their color to Gray // This has done as a part of work around for IE 6 bug for select z-index // without this work around select controls were popping over the dialog blocker F_selectBlocker(); // Set the Title of Adding Dialog to blank C_Dialog.F_SetDefaultTitle(" "); D_Progress.F_SendRequest( v_oRequest, el_oForm, v_sRequestMessage ); } G_DrillPath.F_OnCancel = function() { return false; }; /** * Handles the response of the SOAP request * In case of addDrillPath request submit the form and goes to cc_drillthrough.xts * @v_oRequest the SOAP request */ G_DrillPath.F_Request_OnComplete = function(v_oRequest){ var v_oError = v_oRequest.F_GetError(); if (v_oError) { //TODO: in IB9 the fix for HAL bug in this area is dropped // Add title and description to the message box var v_sMsg = "You Drill path cannot be saved!"; var v_sTitle = "Drill Path Save result"; var v_sDetails = v_oError.F_GetErrorSummary(); var v_sErrorCode = v_oError.F_GetErrorCode(); var v_oErrorMessage = new C_Error( v_sMsg, v_sDetails, v_sErrorCode ); // check for the error number which is due to existence of an object with the same name // show the replace or rename dialog if (v_sErrorCode=='CM-REQ-4024') { // This function is defined in the xts page // It disables the select controls and change their color to Gray // This has done as a part of work around for IE 6 bug for select z-index // without this work around select controls were popping over the dialog blocker F_selectBlocker(); D_RenameReplace.F_Show( el_oForm, "", this, g_sDefaultName); } else { F_ShowError(v_oError); } } else { switch (g_sRequestType) { case "addDrillPath": window.location = el_oForm.backURL.value; break; case "updateDrillPath": el_oForm.removeChild(el_oForm.m_p_target); el_oForm.ps_nav_op.value = 'submit'; el_oForm.m.value = 'portal/submit.xts'; el_oForm.submit(); break; case "queryDrillPath": var v_docSoapResponse = v_oRequest.F_GetResponse(); this.F_processQueryResponse(v_docSoapResponse); break; } } } /** Handles the response of queryDrillPath request. * Get a drill specs from the soap response and set Vars needed for property sheet. * @v_docSoapResponse : A Soap response. **/ G_DrillPath.F_processQueryResponse = function(v_docSoapResponse) { var v_docDrillSpecs = v_docSoapResponse.selectSingleNode( "/SOAP-ENV:Envelope/SOAP-ENV:Body/rns1:queryDrillPathResponse/bus:result/bus:details/item/bus:drillPath/bus:specification/bus:value"); if (v_docDrillSpecs){ var v_docDrillSpecsDecoded = U_XML.F_LoadString(null, v_docDrillSpecs.text, false, true); v_docDrillSpecsDecoded.setProperty( "SelectionNamespaces", "xmlns:dts='http://developer.cognos.com/schemas/drillThroughSpecification/1/'" ); /* comment out the call since the current RSVP queryDrillPath() function does not return the correct drill specs yet*/ //this.F_setPropertiesFromDrillSpecs(v_docDrillSpecsDecoded); } } /** Set drill path Properties from the drill specs. * @v_docDrillSpecs : drill specs from the soap response **/ G_DrillPath.F_setPropertiesFromDrillSpecs = function(v_docDrillSpecs) { if (v_docDrillSpecs) { /* set serach path*/ var v_docSearchPath = v_docDrillSpecs.selectSingleNode("//dts:searchPath"); if ( v_docSearchPath && el_oForm.m_path) { el_oForm.m_path.value = v_docSearchPath.text; } /* set target path */ var v_docTargetSearchPath = v_docDrillSpecs.selectSingleNode("//dts:targetSearchPath"); if (v_docTargetSearchPath && el_oForm.m_p_target) { el_oForm.m_p_target.value = v_docTargetSearchPath.text; } /* set action */ var v_docAction = v_docDrillSpecs.selectSingleNode("//dts:action"); if (v_docAction && el_oForm.m_p_action) { el_oForm.m_p_action.value = v_docAction.text; } } } /** * Generates the XML node required for adding parameter assignments * @return parameterAssignmentsXML XML node that contains the part of the request related to PromptOption * @author alireza pourshahid */ G_DrillPath.F_getParameterAssignments = function(){ var items = ""; for(i=0;i < el_oForm.elements.length; i++) { if(el_oForm.elements[i].name.indexOf('drillParam_')==0) { if(el_oForm.elements[i].value != "") { items = items+"\r\n" + ""+document.getElementsByName("name_" + el_oForm.elements[i].name)[0].value.F_XMLEncode()+"\r\n" + ""+el_oForm.elements[i].value.F_XMLEncode()+"\r\n" + "\r\n"; } } } parameterAssignmentsXML = "\r\n" + " \r\n"+ items+ " \r\n" + " \r\n"; return parameterAssignmentsXML; }; /** * Generates the XML node required for adding the drill spec to the SOAP request * @v_sDrillSpec the drill spec * @return m_nDrillSpecProp XML node that contains the part of drill spec * @author alireza pourshahid */ G_DrillPath.F_getDrillSpec = function(){ var v_sDrillSpec = ""; v_sDrillSpec = this.F_getDrillSpecString(); var m_nDrillSpecProp = " \r\n" + " \r\n" + " "+v_sDrillSpec+"\r\n" + " \r\n" + " \r\n"; return m_nDrillSpecProp; }; /** * Method F_GetDrillSpecString generates the drill spec * TODO : This part can be moved to a another class */ G_DrillPath.F_getDrillSpecString = function(){ var v_sDrillSpec = ""; //TODO: Add other target objects specific DrillSpec to here when we start using add method for all target objects if (g_sTargetClass == 'report' || g_sTargetClass == 'reportView' || g_sTargetClass == 'query' || g_sTargetClass == 'analysis'){ v_sDrillSpec = "<dts:drillThroughSpecification xmlns:dts="http://developer.cognos.com/schemas/drillThroughSpecification/1/">"+ "<dts:modelSearchPaths>"+ "<dts:searchPath>"+g_sParentPath.F_XMLEncode()+"/model[last()]"+ "</dts:searchPath>"+ "</dts:modelSearchPaths>"+ this.F_getDrillSpecParameterAssignments()+ "<dts:reportTarget>"+ "<dts:action>#"+g_sAction+"</dts:action>"+ "<dts:targetSearchPath>"+g_sTargetSearchPath.F_XMLEncode()+"</dts:targetSearchPath>"+ "</dts:reportTarget>"+ "</dts:drillThroughSpecification>"; } // if authored report if (g_sTargetClass == 'powerPlay8Report' || g_sTargetClass == 'powerPlay8ReportView') { v_sDrillSpec = "<dts:drillThroughSpecification xmlns:dts="http://developer.cognos.com/schemas/drillThroughSpecification/1/">"+ "<dts:modelSearchPaths>"+ "<dts:searchPath>"+g_sParentPath.F_XMLEncode()+"/model[last()]"+ "</dts:searchPath>"+ "</dts:modelSearchPaths>"+ "<dts:powerPlay8ReportTarget>"+ "<dts:action>#"+g_sAction+"</dts:action>"+ "<dts:targetSearchPath>"+g_sTargetSearchPath.F_XMLEncode()+"</dts:targetSearchPath>"+ "</dts:powerPlay8ReportTarget>"+ "</dts:drillThroughSpecification>"; } // if powerPlay8report if (g_sTargetClass == 'package') { v_sDrillSpec = "<dts:drillThroughSpecification xmlns:dts="http://developer.cognos.com/schemas/drillThroughSpecification/1/">"+ "<dts:modelSearchPaths>"+ "<dts:searchPath>"+g_sParentPath.F_XMLEncode()+"/model[last()]"+ "</dts:searchPath>"+ "</dts:modelSearchPaths>"+ "<dts:packageTarget>"+ "<dts:action>#"+g_sAction+"</dts:action>"+ "<dts:targetSearchPath>"+g_sTargetSearchPath.F_XMLEncode()+"</dts:targetSearchPath>"+ "</dts:packageTarget>"+ "</dts:drillThroughSpecification>"; } // if package return v_sDrillSpec; }; // Get parameters defined in the drill specs but not in visible list G_DrillPath.F_getNewParameterList = function(){ this.v_aVisibleList = new Array(); var v_aOriList = new Array(); this.v_aNewList = new Array(); var v_iVisibleIndex = 0; var v_iOriIndex = 0; var v_OriListString = new String(""); for (i = 0; i < el_oForm.elements.length; i++) { // set visible list for parameters. if(el_oForm.elements[i].name.indexOf('drillParam_')==0) { this.v_aVisibleList[v_iVisibleIndex++] = el_oForm.elements[i]; } // set original list stored in drill specs. else if(el_oForm.elements[i].name.indexOf('drillParamInSpecs_')==0) { var objKey = el_oForm.elements[i].name; if (v_OriListString.indexOf(el_oForm.elements[i].name)==-1) { v_OriListString = v_OriListString +el_oForm.elements[i].name + ' ' ; v_aOriList[v_iOriIndex++] = el_oForm.elements[i]; } } } delete v_OriListString; // Put the parameters that are in drill specs but not in visible list into a New list. if (v_aOriList.length > this.v_aVisibleList.length) { var k = 0; for (i = 0; i < v_aOriList.length; i++) { var v_bNew = true; for (j = 0; j < this.v_aVisibleList.length; j++) { if (v_aOriList[i].value == this.v_aVisibleList[j].value) v_bNew = false; } if (v_bNew) { this.v_aNewList[k++] = v_aOriList[i] } } } } /** * */ G_DrillPath.F_getDrillSpecParameterAssignments = function(){ var v_sDrillSpecParameterAssignment = "" // Finding all parameter assignments in the page and write them into the spec for(i=0;i < el_oForm.elements.length; i++) { if(el_oForm.elements[i].name.indexOf('drillParam_')==0) { if(el_oForm.elements[i].value != "") { var v_elSelect = document.getElementsByName("select_MappedMetaDataType_" + el_oForm.elements[i].name)[0]; var v_sOriItemValue = el_oForm.elements[i].value.F_XMLEncode(); if (v_sOriItemValue.match("roleValue") ){ v_iStart = v_sOriItemValue.indexOf(",") + 1; v_iEnd = v_sOriItemValue.length - 1; v_sOriItemValue = v_sOriItemValue.substring(v_iStart, v_iEnd ); } //if (v_elSelect) //bugfix 602394 { var v_bAddShowPropertiesExtension = false; v_sDrillSpecParameterAssignment = v_sDrillSpecParameterAssignment+ "<dts:parameterAssignment>"+ "<dts:parameterName>"+ document.getElementsByName("name_" + el_oForm.elements[i].name)[0].value.F_XMLEncode()+ "</dts:parameterName>"+ "<dts:item>"; if (v_elSelect && !v_elSelect.disabled && v_elSelect.value != 'default') { // A name of source parameter needs to be encoded twice. v_sDrillSpecParameterAssignment = v_sDrillSpecParameterAssignment + "roleValue('"+v_elSelect.value+"'," + v_sOriItemValue.F_XMLEncode() + ")"; v_bAddShowPropertiesExtension = true; } else if (v_elSelect && !v_elSelect.disabled && v_elSelect.value == 'default') { v_sDrillSpecParameterAssignment = v_sDrillSpecParameterAssignment + v_sOriItemValue.F_XMLEncode(); v_bAddShowPropertiesExtension = true; } else { v_sDrillSpecParameterAssignment = v_sDrillSpecParameterAssignment + v_sOriItemValue.F_XMLEncode(); } v_sDrillSpecParameterAssignment = v_sDrillSpecParameterAssignment + "</dts:item>"; if (v_bAddShowPropertiesExtension) { //This extension is used in the senario where users select default property for the parameter //when define the drill path so we don't have role value stored in the spec and //we cannot find out if we need to show the select control or not //This extension is used in target.xslt v_sDrillSpecParameterAssignment = v_sDrillSpecParameterAssignment + "<dts:extension>" + "<dts:showParameterProperties>" + "true" + "</dts:showParameterProperties>"+ "</dts:extension>"; } v_sDrillSpecParameterAssignment += "</dts:parameterAssignment>"; } } } } // Add parameters in the New list to the drill specs when updating a drill through definition. if (this.v_aNewList) { for(i=0;i < this.v_aNewList.length; i++) { if(this.v_aNewList[i].value != "") { var v_bAddShowPropertiesExtension = false; v_sDrillSpecParameterAssignment = v_sDrillSpecParameterAssignment+ "<dts:parameterAssignment>"+ "<dts:parameterName>"+ document.getElementsByName("name_" + this.v_aNewList[i].name)[0].value.F_XMLEncode()+ "</dts:parameterName>"+ "<dts:item>"+ document.getElementsByName("MappedMetaDataType_" + this.v_aNewList[i].name)[0].value.F_XMLEncode().F_XMLEncode() + "</dts:item>"; v_sDrillSpecParameterAssignment = v_sDrillSpecParameterAssignment + "<dts:extension>" + "<dts:showParameterProperties>" + "true" + "</dts:showParameterProperties>"+ "</dts:extension>"; v_sDrillSpecParameterAssignment += "</dts:parameterAssignment>"; } } } if (v_sDrillSpecParameterAssignment!="") { v_sDrillSpecParameterAssignment = "<dts:parameterAssignments>" + v_sDrillSpecParameterAssignment + "</dts:parameterAssignments>"; } return v_sDrillSpecParameterAssignment; } /** * Generates the XML node required for adding the bookmark the the request * @g_sBookMarkItem string that contains the model Item for the bookmark item @g_sBookMarkText string that contains the Label * @return m_nBookmark XML node that contains the part of the request related to bookmark * @author alireza pourshahid */ G_DrillPath.F_getBookMark = function(){ var m_nBookmark = ""; if (g_sBookMarkItem!='') { m_nBookmark = "\r\n" + ""+g_sBookMarkItem+"\r\n" + "\r\n"; } else if (g_sBookMarkText!='') { m_nBookmark = "\r\n" + ""+g_sBookMarkText+"\r\n"+ "\r\n"; } return m_nBookmark; }; /** * Generates the XML node required for adding the PromptOption the the request * @g_bPromptOption boolean that contains if user get prompted or not * @return m_nPromptOption XML node that contains the part of the request related to PromptOption * @author alireza pourshahid */ G_DrillPath.F_getPrompt = function (){ var m_nPromptOption = ''; if (g_bPromptOption != '') { m_nPromptOption = " \r\n" + " prompt\r\n" + " \r\n" + g_bPromptOption+ " \r\n" + " "; } return m_nPromptOption; }; /** Generates the XML node required for adding the scope the the request * @g_sScope string that contains the modelItem for the scope * @return m_nScope XML node that contains the part of the request related to scope * @author alireza pourshahid */ G_DrillPath.F_getScope = function(){ var m_nScope = ""; if (g_sScope!=''){ m_nScope = " \r\n" + " \r\n" + " "+g_sScope+"\r\n" + " \r\n" + " \r\n"; } return m_nScope; } /** Generates the XML node required for adding the action the the request * @v_sAction string that contains the action * @return m_nAction XML node that contains the part of the request related to action * @author alireza pourshahid */ G_DrillPath.F_getAction = function(){ var m_nAction = ""; if (g_sAction!=''){ m_nAction = " \r\n" + " "+g_sAction+"\r\n" + " \r\n"; } return m_nAction; } /** Generates the XML node required for adding the defaultName the the request * @v_sDefaultName string that contains the defaultName * @return m_nDefaultName XML node that contains the part of the request related to defaultName * @author alireza pourshahid */ G_DrillPath.F_getDefaultName = function(){ var m_nDefaultName = ""; if (g_sDefaultName!=''){ m_nDefaultName = " \r\n" + " "+g_sDefaultName+"\r\n" + " \r\n" } return m_nDefaultName; } /** Generates the XML node required for adding the DefaultScreenTip the the request * @v_sDefaultScreenTip string that contains the DefaultScreenTip * @return m_nDefaultScreenTip XML node that contains the part of the request related to DefaultScreenTip * @author alireza pourshahid */ G_DrillPath.F_getDefaultScreenTip = function(){ var m_nDefaultScreenTip = ""; if (g_sDefaultScreenTip!=''){ m_nDefaultScreenTip = "\r\n" + " "+g_sDefaultScreenTip+"\r\n" + "\r\n"; } return m_nDefaultScreenTip; } /** Generates the XML node required for adding the defaultDescription the the request * @v_sDefaultName string that contains the defaultDescription * @return m_nDefaultDescription XML node that contains the part of the request related to defaultDescription * @author alireza pourshahid */ G_DrillPath.F_getDefaultDescription = function(){ var m_nDefaultDescription = ""; if (g_sDefaultDescription!=''){ m_nDefaultDescription = "\r\n" + " "+g_sDefaultDescription+"\r\n" + "\r\n"; } return m_nDefaultDescription; } /** Generates the XML node required for adding the contact the the request * @g_sContactDefaultName string that contains the ContactDefaultName * @return m_nDefaultDescription XML node that contains the part of the request related to ContactDefaultName * @author alireza pourshahid */ G_DrillPath.F_getContact = function(){ var m_nContact = ""; if (g_sContactDefaultName!=''){ m_nContact = "\r\n" + " \r\n" + " \r\n" + " \r\n" + " Anonymous\r\n" + " \r\n" + " \r\n" + " CAMID("::Anonymous")\r\n" + " \r\n" + " \r\n" + " \r\n" + "\r\n"; } return m_nContact; } /** Generates the XML node required for adding the useEditSpecification the the request * @g_bUseEditSpecification boolean that contains the value (true or false) for useEditSpecification * @return m_nUseEditSpecification XML node that contains the part of the request related to useEditSpecification * @author alireza pourshahid */ G_DrillPath.F_getUseEditSpecification = function(){ var m_nUseEditSpecification = ""; if (g_bUseEditSpecification!='') { m_nUseEditSpecification = "\r\n" + " useEditSpecification\r\n" + " \r\n" + g_bUseEditSpecification+ " \r\n" + "\r\n"; } return m_nUseEditSpecification; } /** Generates the XML node required for adding the OutputFormat the the request * @g_bUseEditSpecification string that contains the OutputFormat value * @return m_nUseEditSpecification XML node that contains the part of the request related to OutputFormat * @author alireza pourshahid */ G_DrillPath.F_getOutputFormat = function(){ var m_nOutputFormat = ""; if (g_sOutputFormat!='' && g_sOutputFormat!='default') { m_nOutputFormat = "\r\n" + " outputFormat\r\n" + " \r\n" + " "+g_sOutputFormat+"\r\n" + " \r\n" + "\r\n"; } return m_nOutputFormat; } /** * Gets the variables that are required from the the page * @el_oForm the HTML form object that contains the form fields * @author Alireza Pourshahid */ G_DrillPath.F_getHTMLPageData = function(){ if (g_sRequestType=='addDrillPath'){ g_sParentPath = el_oForm.m_path.value.F_XMLEncode(); g_sDefaultName = el_oForm.m_p_defaultName.value.F_XMLEncode(); g_sDefaultDescription = el_oForm.m_p_defaultDescription.value.F_XMLEncode(); g_sDefaultScreenTip = el_oForm.m_p_defaultScreenTip.value.F_XMLEncode(); g_sAction = el_oForm.m_p_action.value; g_bUseEditSpecification = el_oForm.m_dt_useEditSpecification.value; g_sScope = el_oForm.m_p_scope.value.F_XMLEncode(); g_sTargetSearchPath = el_oForm.m_p_target.value.F_XMLEncode(); // if action is edit the format is HTML if(!el_oForm.m_ro_outputF_HTML_Type.value){ g_sOutputFormat = el_oForm.tg_fmtselect.options[el_oForm.tg_fmtselect.selectedIndex].value } else{ g_sOutputFormat = 'HTML'; } // We don't have the following elements in case of Abacab targets so we need gard if (el_oForm.m_ro_prompt){ g_bPromptOption = el_oForm.m_ro_prompt.value; } if (el_oForm.m_p_bookmarkText){ g_sBookMarkItem = el_oForm.m_p_bookmarkItem.value.F_XMLEncode(); g_sBookMarkText = el_oForm.m_p_bookmarkText.value.F_XMLEncode(); } } if (g_sRequestType=='updateDrillPath'){ g_sParentPath = el_oForm.m_path.value.F_XMLEncode(); g_sDefaultName = el_oForm.pty_name.value.F_XMLEncode(); g_sDefaultDescription = el_oForm.pty_desc.value.F_XMLEncode(); g_sDefaultScreenTip = el_oForm.pty_scrt.value.F_XMLEncode(); g_sAction = el_oForm.m_p_action.value; g_bUseEditSpecification = el_oForm.m_dt_useEditSpecification.value; g_sScope = el_oForm.m_p_scope.value.F_XMLEncode(); g_sTargetSearchPath = el_oForm.m_p_target.value.F_XMLEncode(); //g_sOutputFormat = el_oForm.tg_fmtselect.options[el_oForm.tg_fmtselect.selectedIndex].value g_sDrillPathObjectSearchPath = el_oForm.m_obj.value.F_XMLEncode(); if (el_oForm.m_ro_prompt){ g_bPromptOption = el_oForm.m_ro_prompt.value; } if (el_oForm.m_p_bookmarkText){ g_sBookMarkItem = el_oForm.m_p_bookmarkItem.value.F_XMLEncode(); g_sBookMarkText = el_oForm.m_p_bookmarkText.value.F_XMLEncode(); } } // used for debuggin: s all the information gathered from the form. //alert("parentPath:" + g_sParentPath + " --DefaultName: " + g_sDefaultName + " --DefaultDescription: " + g_sDefaultDescription + " --DefaultScreenTip: " + g_sDefaultScreenTip + " --Action: " + g_sAction + " --UsedEditSpecification: " + g_bUseEditSpecification + " --Scope: " + g_sScope + " --TargetSearchPath: " + g_sTargetSearchPath + " --OutputFormat: " + g_sOutputFormat + " --promptOption: " + g_bPromptOption + " --BookmarkItem: " + g_sBookMarkItem + " --BookMarkText: " +g_sBookMarkText); }; /** * Construct a SOAP request to call RSVP API queryDrillPath by using C_BusRequest from CCHL. * @sObjPath : string contains drill path for a drill through definition. * @parameterValues : XML node contains a list of parameter values. * @return boolean false * @author Paul Cai **/ G_DrillPath.queryDrillPath = function(v_oForm, sObjPath, parameterValues) { var sRequest = G_DrillPath.sQueryRequestTemplate; sRequest = sRequest.replace("@OBJECTPATH@", sObjPath); sRequest = sRequest.replace("@PARAMETERVALUES@",parameterValues); g_sRequestType = "queryDrillPath"; el_oForm = v_oForm; var v_oRequest = new C_BusRequest( this , C_BusRequest.K_sSOAPAction_reportService, sRequest ); this.F_sendRequest(v_oRequest); return false; } /** Used to construct a SOAP request for queryDrillPath **/ G_DrillPath.sQueryRequestTemplate = '' + '' + '@OBJECTPATH@' + '' + '' + '@PARAMETERVALUES@' + '' + '' + '' + 'properties' + '' + 'defaultName' + 'searchPath' + 'specification' + '' + '' + '' + 'primaryWaitThreshold' + '0' + '' + '' + '';