/******************************************************************************************************************************** * Licensed Materials - Property of IBM * * * * IBM Cognos Products: AGS * * * * (C) Copyright IBM Corp. 2005, 2010 * * * * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. * *********************************************************************************************************************************/ var GET_SP_DETAILS_RESPONSE_ROOT = "getSpDetailsResponse"; var GET_SP_DETAILS_PACKAGE = "getSpPackage"; var GET_SP_DETAILS_CONTEXT = "getSpDetails_context"; var GET_SP_DETAILS_SP_NAME = "getSpDetails_sp_name"; var GET_SP_MARKUP = "markup"; var current_task_id; var current_sp_name; var doGetSpDetailsRequestURL; //called to initiate the asynch requests //this is a special method for the stored proc page //the sp page has to use asynch to get the select drop down //markup function startGetSpParametersRequest(sql_package, context, sp_name, taskId){ applicationActionManager.blockActions(); current_sp_name = sp_name; current_task_id = taskId; doGetSpDetailsRequest(getGetSpDetailsRequestString(sql_package, context, sp_name, taskId)); } function resendSpDetailsRequest() { getCommandStackManager().getCommandStack().push("doGetSpDetailsRequest()"); } function doGetSpDetailsRequest(request,isSecondary) { if (request == undefined || request.length ==0) { request = doGetSpDetailsRequestURL; } else if (!isSecondary) { doGetSpDetailsRequestURL = request; } // build up the URL var url = "b_action=xts.run"; url += URIEncode("m","/ags/async/asyncConv.xts"); url += URIEncode("buildResponseXTS","/ags/async/getSpDetailsResponse.xts"); // force SOAPFault for passport expire instead of getting a logon page url += URIEncode("forceSOAPFault","false"); url += request; if (cafContextId != "") { url += URIEncode("cafcontextid",cafContextId); //SEC_INFO url - The request is not parsed as a string so should not be subject to an injection attack } try{ // send off the resquest sendDispatcherRequestWithXMLTextResponse(url, getSpDetailsXMLTextResponse); }catch(ex){ applicationActionManager.allowActions(ex); } } // utility function function getGetSpDetailsRequestString(sql_package, context, sp_name, taskId) { current_task_id = taskId; var sURL = ""; var pl = "pl"; var cl = "cl"; var locales = getLocales(cl, pl); sURL += URIEncode(pl, locales[pl]); sURL += URIEncode(cl, locales[cl]); sURL += URIEncode("sql_package", sql_package); sURL += URIEncode("model", sql_package + "/model[last()]"); sURL += URIEncode("inlineSpecType", "reportServiceMetadataSpecification"); sURL += URIEncode("buildRequestXTS","/ags/async/spRequest.xts"); sURL += URIEncode("context", context); sURL += URIEncode("method", "runSpecification"); sURL += URIEncode("parameterValues", getConnectionParameterValues(sp_name + taskId)); sURL += URIEncode("displayedPage", "sql"); // always have to ask for credential parameters too sURL += URIEncode("credentialParameters", "true"); //SEC_INFO sUrl - The request is not parsed as a string so should not be subject to an injection attack return sURL; } function getSpDetailsXMLTextResponse(responseArray) { // get the values returned var responseXML = responseArray[0]; var responseText = responseArray[1]; var workingRoot = responseXML.getElementsByTagName(ASYNC_WORKING); var promptingRoot = responseXML.getElementsByTagName(ASYNC_PROMPTING); var getParametersResponseRoot = responseXML.getElementsByTagName(GET_SP_DETAILS_RESPONSE_ROOT); var httpStop = true; var parsedResponse = parseResponse(responseXML,responseText); // decide what we're going to do //This is a case when getContent in asyncConv faults with either session expiry or //external logon to a different name space fault. if (parsedResponse.isLogonFault()) { doPassportExpire(responseXML,resendSpDetailsRequest,parsedResponse); } else if (parsedResponse.isSoapFault()) { if (parsedResponse.isCancelledWait()) { //This was a server cancelled wait. We need to resubmit. This could happen //if we have a SSO on and we hit an password protected external datasource, //The dispacther will fire the same request again, in this wait fired twice //Will cancel conversation if first wait fails. WO1903, WO2338 resendSpDetailsRequest(); setTimeout("getCommandStackManager().processCommandStack()", 100); } else { // we have a fault which is a genuine fault fault doSOAPFault(responseXML,tidyParametersDiv,parsedResponse); } } else if (workingRoot.length == 1) { httpStop = false; // we have a working response doWorking(workingRoot[0], "doGetSpDetailsRequest"); } else if (promptingRoot.length == 1) { // are we prompting - promptGetSpDetailsResponse doPrompting(promptingRoot[0], 4); } else if (getParametersResponseRoot.length == 1) { httpStop = false; // we have the actually information useGetSpDetailsResponse(getParametersResponseRoot[0]); } else { tidyParametersDiv(); if (parsedResponse.isHTML() && !parsedResponse.isEmptyBody()) { // check the text response to see if we got a html page back in the response doHTMLResponse(responseText); } else { // send the alert alert(asyncGetParametersError_string); } } if(httpStop){ applicationActionManager.allowActions(); } } function promptGetSpDetailsResponse(parameters, response, conversation, clientContext, tracking) { if (response == "Cancel" || response == "Error") { // we don't want to close everything down - so just cancel the prompt and parameter load injectHTML(""); // hide the dialog frame hideDialogFrame(); } else { // we're passed the parameters - so save them for the task saveParameterValues(parameters, current_sp_name + current_task_id); // send the context and the final response from prompts back var request = getGetSpDetailsRequestString(null, clientContext, current_sp_name, current_task_id); //request += URIEncode("context", clientContext); request += URIEncode("promptResponse", response); request += URIEncode("disp_trackingInfo", tracking); // hide the dialog frame hideDialogFrame(); //SEC_INFO request - javascript encode the request prior to firing setTimeout. The //setTimeout function will un-encode the request before it is submitted request = jsStrEncode(request); // resubmit the request setTimeout("doGetSpDetailsRequest(\'" + request + "\');",100); } } function useGetSpDetailsResponse(responseRootNode) { // get the spDetails returned var getParamsPackage = responseRootNode.getElementsByTagName(GET_SP_DETAILS_PACKAGE); var getParamsContext = responseRootNode.getElementsByTagName(GET_SP_DETAILS_CONTEXT); var getParamsSpName = responseRootNode.getElementsByTagName(GET_SP_DETAILS_SP_NAME); var getParamsMarkup = responseRootNode.getElementsByTagName(GET_SP_MARKUP); var sp_package = getTextNodeValue(getParamsPackage[0]); var sp_name = getTextNodeValue(getParamsSpName[0]); var context = getTextNodeValue(getParamsContext[0]); var markup = getParamsMarkup ? getTextNodeValue(getParamsMarkup[0]) : ""; var taskId = sp_name + current_task_id; if(!sp_package || ! sp_name){ clearParametersValues(); injectHTML(markup ? markup : ""); }else{ var request = parent.getConfigFrame().getGetParametersQfSpecificationRequestString(sp_package, sp_name, context, taskId); var command = "parent.getConfigFrame().startGetParametersRequest('" + jsStrEncode(request) + "', parent.getConfigFrame().getGetParametersQfSpecificationRequestString)"; // do the request setTimeout(command, 100); } }