123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919 |
- /****************************************************************
- ** 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
- *
- * <link type="text/css" rel="stylesheet" href="/cognos8/skins/business/hal/hal_portal_skin_business.css"/>
- * <script language="javascript" src="/cognos8/hal/hal.js"/>
- * <script language="javascript" src="/cognos8/cchl/cchl.js"/>
- * <script src="/cognos8/camcrypto/base64.js"></script>
- * <script src="/cognos8/camcrypto/camcryptoutil.js"></script>
- * <script src="/cognos8/camcrypto/sha1.js"></script>
- * <script src="/cognos8/camcrypto/authtoken1.js"></script>
- * 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
- *
- * <script>
- * G_HAL.F_WriteHtml();
- * </script>
- *
- * @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 = " <rns1:addDrillPath xmlns:rns1=\"http://developer.cognos.com/schemas/reportService/1\">\r\n" +
- " <bus:parentPath xsi:type=\"bus:searchPathSingleObject\">"+g_sParentPath+"</bus:parentPath>\r\n" +
- " <bus:object xsi:type=\"bus:drillPath\">\r\n" +
- this.F_getDefaultName()+
- this.F_getDefaultDescription()+
- this.F_getDefaultScreenTip()+
- this.F_getAction()+
- this.F_getScope()+
- this.F_getParameterAssignments()+
- this.F_getDrillSpec()+
- " <bus:options xsi:type=\"bus:optionArrayProp\">\r\n" +
- " <bus:value xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"bus:option[3]\">\r\n" +
- this.F_getOutputFormat()+
- this.F_getPrompt()+
- this.F_getUseEditSpecification()+
- " </bus:value>\r\n" +
- " </bus:options>\r\n" +
- this.F_getBookMark()+
- " </bus:object>\r\n";
- // the drill path will be replaced
- if (v_sUpdateAction == 'replace')
- {
- v_sBusRequest = v_sBusRequest + "<bus:options xsi:type=\"bus:addOptions\">\r\n" +
- " <bus:faultIfObjectReferenced xsi:type=\"xs:boolean\">false</bus:faultIfObjectReferenced>\r\n" +
- " <bus:ignoreInvalidObjectReference xsi:type=\"xs:boolean\">false</bus:ignoreInvalidObjectReference>\r\n" +
- " <bus:returnProperties xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"bus:propEnum[0]\"/>\r\n" +
- " <bus:updateAction xsi:type=\"bus:updateActionEnum\">replace</bus:updateAction>\r\n" +
- " </bus:options>\r\n" +
- " </rns1:addDrillPath>" ;
- }
- else
- {
- v_sBusRequest = v_sBusRequest + "<bus:options xsi:type=\"bus:addOptions\">\r\n" +
- " <bus:faultIfObjectReferenced xsi:type=\"xs:boolean\">false</bus:faultIfObjectReferenced>\r\n" +
- " <bus:ignoreInvalidObjectReference xsi:type=\"xs:boolean\">false</bus:ignoreInvalidObjectReference>\r\n" +
- " <bus:returnProperties xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"bus:propEnum[0]\"/>\r\n" +
- " <bus:updateAction xsi:type=\"bus:updateActionEnum\">fail</bus:updateAction>\r\n" +
- " </bus:options>\r\n" +
- " </rns1:addDrillPath>" ;
- }
-
- 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+"<item xsi:type=\"bus:parameterAssignmentDataItem\">\r\n" +
- "<bus:parameterName xsi:type=\"xs:string\">"+document.getElementsByName("name_" + el_oForm.elements[i].name)[0].value.F_XMLEncode()+"</bus:parameterName>\r\n" +
- "<bus:dataItemName xsi:type=\"bus:metadataModelItemName\">"+el_oForm.elements[i].value.F_XMLEncode()+"</bus:dataItemName>\r\n" +
- "</item>\r\n";
- }
- }
- }
- parameterAssignmentsXML = "<bus:parameterAssignments xsi:type=\"bus:baseParameterAssignmentArrayProp\">\r\n" +
- " <bus:value xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"bus:baseParameterAssignment[1]\">\r\n"+
- items+
- " </bus:value>\r\n" +
- " </bus:parameterAssignments>\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 = " <bus:specification xsi:type=\"bus:reportServiceDrillThroughSpecificationProp\">\r\n" +
- " <bus:value xsi:type=\"bus:reportServiceDrillThroughSpecification\">\r\n" +
- " <bus:value xsi:type=\"bus:specification\">"+v_sDrillSpec+"</bus:value>\r\n" +
- " </bus:value>\r\n" +
- " </bus:specification>\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 = "<bookmarkItem xsi:type=\"bus:metadataModelItemNameProp\">\r\n" +
- "<value xsi:type=\"bus:metadataModelItemName\">"+g_sBookMarkItem+"</value>\r\n" +
- "</bookmarkItem>\r\n";
- }
- else if (g_sBookMarkText!='')
- {
- m_nBookmark = "<bookmarkText xsi:type=\"bus:stringProp\">\r\n" +
- "<value xsi:type=\"xs:string\">"+g_sBookMarkText+"</value>\r\n"+
- "</bookmarkText>\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 = " <item xsi:type=\"bus:runOptionBoolean\">\r\n" +
- " <name xsi:type=\"bus:runOptionEnum\">prompt</name>\r\n" +
- " <value xsi:type=\"xs:boolean\">\r\n" +
- g_bPromptOption+
- " </value>\r\n" +
- " </item>";
- }
-
- 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 = " <bus:scope xsi:type=\"bus:metadataModelItemNameArrayProp\">\r\n" +
- " <value xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"bus:metadataModelItemName[2]\">\r\n" +
- " <item xsi:type=\"bus:metadataModelItemName\">"+g_sScope+"</item>\r\n" +
- " </value>\r\n" +
- " </bus:scope>\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 = " <bus:action xsi:type=\"bus:baseReportActionEnumProp\">\r\n" +
- " <bus:value xsi:type=\"bus:baseReportActionEnum\">"+g_sAction+"</bus:value>\r\n" +
- " </bus:action>\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 = " <bus:defaultName xsi:type=\"bus:tokenProp\">\r\n" +
- " <bus:value xsi:type=\"xs:string\">"+g_sDefaultName+"</bus:value>\r\n" +
- " </bus:defaultName>\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 = "<bus:defaultScreenTip xsi:type=\"bus:stringProp\">\r\n" +
- " <bus:value xsi:type=\"xs:string\">"+g_sDefaultScreenTip+"</bus:value>\r\n" +
- "</bus:defaultScreenTip>\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 = "<bus:defaultDescription xsi:type=\"bus:stringProp\">\r\n" +
- " <bus:value xsi:type=\"xs:string\">"+g_sDefaultDescription+"</bus:value>\r\n" +
- "</bus:defaultDescription>\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 = "<bus:contact xsi:type=\"bus:baseClassArrayProp\">\r\n" +
- " <bus:value xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"bus:baseClass[1]\">\r\n" +
- " <item xsi:type=\"bus:account\">\r\n" +
- " <bus:defaultName xsi:type=\"bus:tokenProp\">\r\n" +
- " <bus:value xsi:type=\"xs:string\">Anonymous</bus:value>\r\n" +
- " </bus:defaultName>\r\n" +
- " <bus:searchPath xsi:type=\"bus:stringProp\">\r\n" +
- " <bus:value xsi:type=\"xs:string\">CAMID("::Anonymous")</bus:value>\r\n" +
- " </bus:searchPath>\r\n" +
- " </item>\r\n" +
- " </bus:value>\r\n" +
- "</bus:contact>\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 = "<item xsi:type=\"bus:drillThroughOptionBoolean\">\r\n" +
- " <name xsi:type=\"bus:drillThroughOptionEnum\">useEditSpecification</name>\r\n" +
- " <value xsi:type=\"xs:boolean\">\r\n" +
- g_bUseEditSpecification+
- " </value>\r\n" +
- "</item>\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 = "<item xsi:type=\"bus:runOptionStringArray\">\r\n" +
- " <name xsi:type=\"bus:runOptionEnum\">outputFormat</name>\r\n" +
- " <value xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:string[1]\">\r\n" +
- " <item xsi:type=\"xsd:string\">"+g_sOutputFormat+"</item>\r\n" +
- " </value>\r\n" +
- "</item>\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 =
- '<rns1:queryDrillPath xmlns:rns1="http://developer.cognos.com/schemas/reportService/1">' +
- '<bus:objectPath xsi:type="bus:searchPathSingleObject">' +
- '@OBJECTPATH@' +
- '</bus:objectPath>' +
- '<bus:parameterValues SOAP-ENC:arrayType="bus:parameterValue[]" xsi:type="SOAP-ENC:Array">' +
- '@PARAMETERVALUES@' +
- '</bus:parameterValues>' +
- '<bus:options xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:option[]">' +
- '<item xsi:type="bus:contentManagerQueryOptionPropEnumArray">' +
- '<bus:name xsi:type="bus:contentManagerQueryOptionEnum">properties</bus:name>' +
- '<bus:value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:propEnum[]">' +
- '<item xsi:type="bus:propEnum">defaultName</item>' +
- '<item xsi:type="bus:propEnum">searchPath</item>' +
- '<item xsi:type="bus:propEnum">specification</item>' +
- '</bus:value>' +
- '</item>' +
- '<item xsi:type="bus:asynchOptionInt">' +
- '<bus:name xsi:type="bus:asynchOptionEnum">primaryWaitThreshold</bus:name>' +
- '<bus:value xsi:type="xs:int">0</bus:value>' +
- '</item>' +
- '</bus:options>' +
- '</rns1:queryDrillPath>';
|