123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- /****************************************************************************************************************************
- Licensed Materials - Property of IBM
- BI and PM: QFW
- © Copyright IBM Corp. 2005, 2010
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- *****************************************************************************************************************************/
- var G_QanReportRequestor = {};
- G_QanReportRequestor.m_sReportSpec = "";
- G_QanReportRequestor.m_sSeverity = "information";
- G_QanReportRequestor.F_RequestReport = function( v_sPath )
- {
- this.m_sReportSpec = "";
-
- this.m_oRequest = new C_QanReportRequest(this, v_sPath);
- D_Progress.F_SendRequest( this.m_oRequest, null, "OBTAINING REPORT SPECIFICATION" );
- };
- G_QanReportRequestor.F_Abort = function()
- {
- if ( this.m_oRequest )
- {
- this.m_oRequest.F_Abort();
- }
- };
- G_QanReportRequestor.F_Request_OnComplete = function(v_oRequest)
- {
- delete this.m_oRequest;
-
- var v_oError = v_oRequest.F_GetError();
-
- if (v_oError)
- {
- alert( "Report Specification request return an error" );
- return;
- }
- //this.m_nDefects = v_oRequest.F_GetDefects();
-
- var v_nRequestResponse = v_oRequest.F_GetSpecificationValue();
- this.m_sReportSpec = v_nRequestResponse;
-
- G_QanApp.f_setReport(this.m_sReportSpec);
-
- if( this.m_sReportSpec )
- G_QanApp.F_GetLogging();
- else
- G_QanApp.F_GetSQLAnalyzer();
- };
- G_QanReportRequestor.F_GetQFSLogging = function( v_nQFSLogProperty )
- {
- this.f_showQFSFeedbackItem(v_oRequest, "ExecutionPlan");
- }
- G_QanReportRequestor.F_GetQFSFeedbackProperty = function( v_nQFSFeedbackProperties, v_sItemName )
- {
- var v_nQFSProperty = v_nQFSFeedbackProperties;
- var v_oFileRequest =
- new C_MultiFileRequest( new C_RequestListenerRedirect( this, "f_showQFSFeedbackItem" ),
- [ "QFLogFormatting.xsl" ] );
- v_oFileRequest.nQFSProperty = v_nQFSProperty;
- v_oFileRequest.sItemName = v_sItemName;
-
- D_Progress.F_SendRequest( v_oFileRequest, null, "Loading", 30 );
- };
- G_QanReportRequestor.f_loadQFSFeedbackItems = function(v_oRequest)
- {
- var nQFSProperty = v_oRequest.nQFSProperty;
- var v_sItemName = v_oRequest.sItemName;
-
- {
- var v_asXML = [];
- v_asXML[0] = "<QFSFeedbackList>";
-
- if (nQFSProperty.length == 0)
- {
- var v_oLogDoc = new C_QanLogDoc( '<?xml version="1.0" encoding="utf-8"?><XQELog name="Query1.0" />' );
- var v_iLogId = G_QanApp.F_AddLogDoc( v_oLogDoc );
- var v_sQueryNames = "Query1.0";
- v_asXML.push( "<QFSFeedbackItem type=\"QFSLog\" logId=\"" + v_iLogId + "\" queryNames=\""+ v_sQueryNames +"\">" );
- v_asXML.push( "</QFSFeedbackItem>" );
- }
-
- for( var iQuery = 0; iQuery < nQFSProperty.length; ++iQuery )
- {
- var v_nQFSPropertyItem = nQFSProperty.item(iQuery);
-
- if( v_sItemName == "ExecutionPlan" )
- {
- v_asXML.push( "<QFSFeedbackItem type=\"ExecutionPlan\">" );
- v_asXML.push( v_nQFSPropertyItem.childNodes[0].xml );
- }
- else
- {
- var v_oLogDoc = new C_QanLogDoc( v_nQFSPropertyItem.childNodes[0].text )
- var v_iLogId = G_QanApp.F_AddLogDoc( v_oLogDoc );
- var v_sQueryNames = v_oLogDoc.F_GetRootQRDNames();
- v_asXML.push( "<QFSFeedbackItem type=\"QFSLog\" logId=\"" + v_iLogId + "\" queryNames=\""+ v_sQueryNames +"\">" );
- }
-
- v_asXML.push( "</QFSFeedbackItem>" );
- }
- v_asXML.push( "</QFSFeedbackList>" );
-
- v_docXML = U_XML.F_LoadString( D_XmlError, v_asXML.join("\n\r") );
-
- if ( !v_docXML || !v_docXML.documentElement )
- return;
- }
-
- return v_docXML;
- }
- G_QanReportRequestor.f_showQFSFeedbackItem = function(v_oRequest)
- {
- var v_sText = v_oRequest.F_GetFileContents()[ "QFLogFormatting.xsl" ];
- var v_docXSL = U_XML.F_LoadString( D_XmlError, v_sText );
- if ( !v_docXSL || !v_docXSL.documentElement )
- return;
-
- G_QanApp.F_SetXslDoc( v_docXSL );
- v_docXML = G_QanReportRequestor.f_loadQFSFeedbackItems(v_oRequest);
-
- var v_frame = document.createElement( "iframe" );
- v_frame.name = "idLoggingView";
- v_frame.id = "idLoggingView";
- v_frame.width = "100%";
- v_frame.height = "100%";
- document.body.insertBefore( v_frame, document.body.firstChild );
-
- var v_oWin = v_frame.contentWindow;
-
-
- var v_sPlanHTML = v_docXML.transformNode( v_docXSL );
-
-
-
- var v_sEntryFunctionCall;
- if( v_sItemName == "ExecutionPlan" )
- v_sEntryFunctionCall = "openExecutionPlan( document.body )";
- else
- v_sEntryFunctionCall = "showExecutionTree( document.body )";
-
- v_sPlanHTML = v_sPlanHTML.replace( /\<BODY/, "<BODY client=\"CRN\" onload='loadANDapplyPreferences(document); " + v_sEntryFunctionCall + ";' " );
- v_sPlanHTML = v_sPlanHTML.replace( /\<script type="text\/javascript" src="[^\>]*\\\.\.\\templates\\qfw\\/g, "<script type=\"text/javascript\" src=\"" );
- v_sPlanHTML = v_sPlanHTML.replace( /\<link href="[^\>]*\\\.\.\\webcontent\\qfw\\/g, "<link href=\"" );
-
- v_oWin.document.write( v_sPlanHTML );
- v_oWin.document.close();
- v_oWin.document.title = "Validation Details";
- };
- G_QanReportRequestor.F_ClearErrors = function()
- {
- delete this.m_nDefect;
- delete this.m_aValidationProblems;
- };
- G_QanReportRequestor.f_showRequestErrors = function()
- {
- if ( !this.m_aRequestProblems )
- {
- return;
- }
- if ( this.m_aReuestProblems.length > 0 )
- {
- alert( "Report has request report specification errors" );
- return;
- }
- alert( "Report is valid" );
- };
- // ********************************************************************************************************
- // QAN Report Request: introduced to work around the obfuscation issue of C_BusRequest
- //
- function C_QanReportRequest( v_oListener, v_sPath)
- {
- this.m_bQIsPrompting = false;
- this.m_sQPromptReport = "";
-
- this.m_oQListener = v_oListener;
-
- this.m_bQServerPrompting = true;
- this.m_aQNamespaces = [];
- this.F_QAddNamespace( C_QanReportRequest.k_sBIBusNamespaceDecl );
- this.F_QAddNamespace( C_QanReportRequest.k_sBIBusRNSNamespaceDecl );
- this.F_ConstructBaseClass( v_oListener, v_sPath);
- };
- C_QanReportRequest.k_sBIBusNamespace = "http://developer.cognos.com/schemas/bibus/3";
- C_QanReportRequest.k_sBIBusNamespaceDecl = "xmlns:bus='" + C_QanReportRequest.k_sBIBusNamespace + "/'";
- C_QanReportRequest.k_sBIBusRNSNamespaceDecl = "xmlns:rns1='http://developer.cognos.com/schemas/reportService/1'";
- C_QanReportRequest.F_Extends( C_ReportRequest );
- C_QanReportRequest.prototype.F_SetNoServerPrompting = function()
- {
- this.m_bQServerPrompting = false;
- };
- C_QanReportRequest.prototype.F_QAddNamespace = function( v_sNamespace )
- {
- this.m_aQNamespaces.push( v_sNamespace );
- };
- C_QanReportRequest.prototype.F_IsReadyToProcess=function()
- {
- if(!C_QanReportRequest.superClass.F_IsReadyToProcess.call(this))
- {return false;}
-
- var v_sResponseText = this.F_GetResponseText();
- var v_docResponse = U_XML.F_LoadString( null, v_sResponseText, false, true );
- this.m_docQResponse = v_docResponse;
- this.m_docQResponse.setProperty( "SelectionNamespaces", "xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " + this.m_aQNamespaces.join( " " ) );
-
- if (this.m_bQServerPrompting && this.m_oQListener && G_BusServer.F_RequiresServerPrompting(v_docResponse))
- {
- this.m_bQIsPrompting = true;
- if (G_BusServer.F_DoPrompting(this, v_docResponse, this.m_sQPromptReport))
- {
- // Depending on what happens after prompting, either the request will be completed (failed)
- // or it will be re-executed
-
- delete this.m_docQResponse;
- return false;
- }
- this.m_bQIsPrompting = false;
- this.F_SetNewErrorRes( "IDS_CCHL_INITIATE_SERVERPROMTING_FAILED" );
- return true;
- }
-
- return true;
- }
|