123456789101112131415 |
- /**
- * IBM Confidential OCO Source Materials IBM Business Platform: CA Reporting
- * (C) Copyright IBM Corp. 2018
- *
- * The source code for this program is not published or otherwise divested of
- * its trade secrets, irrespective of what has been deposited with the U.S.
- * Copyright Office
- */
- define("bi/authoring/nls/AuthoringMessages",{root:!0,cs:!0,cy:!0,da:!0,de:!0,es:!0,fi:!0,fr:!0,gl:!0,hr:!0,hu:!0,it:!0,ja:!0,kk:!0,ko:!0,nb:!0,nl:!0,no:!0,pl:!0,pt:!0,"pt-br":!0,ro:!0,ru:!0,sl:!0,sv:!0,th:!0,tr:!0,zh:!0,"zh-cn":!0,"zh-tw":!0}),define("bi/authoring/nls/root/AuthoringMessages",{no_output_format_capability:"The user does not have the assigned capability to generate %{outputFormat} output.",authoring_welcome:"Reporting",report_view_of:"Report view of %{reportName}",no_action_available:"You are currently not authorized to access this object.",viewer_welcome:"Reporting",dataset_welcome:"Data set",powerplay_view_of:"PowerPlay view of %{reportName}"}),define("bi/authoring/nls/StringResource",["i18n!bi/authoring/nls/AuthoringMessages","bi/glass/utils/Lexicon"],function(localeResources,Lexicon){"use strict";var lexicon=new Lexicon({data:localeResources,verbose:!0}),StringResources=function(){};return StringResources.prototype.get=function(key,interpolationOptions){return lexicon.translate(key,interpolationOptions)},new StringResources}),define("bi/authoring/utils/pat/rsPromptParameters",[],function(){"use strict";function xmlEncode(v_sString){return v_sString.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}function addClassicViewerPrompts(v_elForm,v_aPromptParameters){for(var i=0;i<v_aPromptParameters.length;i++){var v_oParameter=v_aPromptParameters[i];if(Array.isArray(v_oParameter.value))for(var j=0;j<v_oParameter.value.length;j++){var v_elInput=v_elForm.appendChild(document.createElement("input"));v_elInput.type="hidden",v_elInput.name=v_oParameter.name,v_elInput.value=v_oParameter.value[j]}else{var v_elInput=v_elForm.appendChild(document.createElement("input"));v_elInput.type="hidden",v_elInput.name=v_oParameter.name,v_elInput.value=v_oParameter.value}}}function buildSelectOptionXML(v_oValue){return'<selectOption useValue="'+xmlEncode(v_oValue.use.toString())+'"'+(v_oValue.hasOwnProperty("display")?' displayValue="'+xmlEncode(v_oValue.display.toString())+'"':"")+"/>"}function buildBoundRangeXML(v_oValue){return'<selectBoundRange><start useValue="'+xmlEncode(v_oValue.boundRange.start.use.toString())+'"'+(v_oValue.boundRange.start.hasOwnProperty("display")?' displayValue="'+xmlEncode(v_oValue.boundRange.start.display.toString())+'"':"")+'/><end useValue="'+xmlEncode(v_oValue.boundRange.end.use.toString())+'"'+(v_oValue.boundRange.end.hasOwnProperty("display")?' displayValue="'+xmlEncode(v_oValue.boundRange.end.display.toString())+'"':"")+"/></selectBoundRange>"}function buildUnboundedEndRangeXML(v_oValue){return'<selectUnboundedEndRange><start useValue="'+xmlEncode(v_oValue.unboundedEndRange.start.use.toString())+'"'+(v_oValue.unboundedEndRange.start.hasOwnProperty("display")?' displayValue="'+xmlEncode(v_oValue.unboundedEndRange.start.display.toString())+'"':"")+"/></selectUnboundedEndRange>"}function buildUnboundedStartRangeXML(v_oValue){return'<selectUnboundedStartRange><end useValue="'+xmlEncode(v_oValue.unboundedStartRange.end.use.toString())+'"'+(v_oValue.unboundedStartRange.end.hasOwnProperty("display")?' displayValue="'+xmlEncode(v_oValue.unboundedStartRange.end.display.toString())+'"':"")+"/></selectUnboundedStartRange>"}function convertPromptValuesToXML(v_aValues){for(var v_sXMLValues="",i=0;i<v_aValues.length;i++){var v_oValue=v_aValues[i];if(v_oValue.hasOwnProperty("use"))v_sXMLValues+=buildSelectOptionXML(v_oValue);else if(v_oValue.hasOwnProperty("boundRange")){if(!(v_oValue.boundRange.start&&v_oValue.boundRange.start.hasOwnProperty("use")&&v_oValue.boundRange.end&&v_oValue.boundRange.end.hasOwnProperty("use"))){console.log("rsPromptParameters.convertPromptValuesToXML ... unexpected boundRange format.");break}v_sXMLValues+=buildBoundRangeXML(v_oValue)}else if(v_oValue.hasOwnProperty("unboundedEndRange")){if(!v_oValue.unboundedEndRange.start||!v_oValue.unboundedEndRange.start.hasOwnProperty("use")){console.log("rsPromptParameters.convertPromptValuesToXML ... unexpected unboundedEndRange format.");break}v_sXMLValues+=buildUnboundedEndRangeXML(v_oValue)}else if(v_oValue.hasOwnProperty("unboundedStartRange")){if(!v_oValue.unboundedStartRange.end||!v_oValue.unboundedStartRange.end.hasOwnProperty("use")){console.log("rsPromptParameters.convertPromptValuesToXML ... unexpected unboundStartRange format.");break}v_sXMLValues+=buildUnboundedStartRangeXML(v_oValue)}}return v_sXMLValues}function convertComplexParameterToClassicViewerXML(v_oPromptParametersXML,v_aComplexParameterObject){for(var i=0;i<v_aComplexParameterObject.length;i++){var v_oPromptParameter=v_aComplexParameterObject[i],v_sName=v_oPromptParameter.name,v_aValues=v_oPromptParameter.value,v_sValues=convertPromptValuesToXML(Array.isArray(v_aValues)?v_aValues:[v_aValues]);v_sName&&v_sValues&&(v_oPromptParametersXML[v_sName]||(v_oPromptParametersXML[v_sName]=[]),v_oPromptParametersXML[v_sName].push(v_sValues))}}function addClassicViewerPromptsComplex(v_elForm,v_aPromptParametersComplex){for(var v_oPromptParametersXML={},i=0;i<v_aPromptParametersComplex.length;i++){var v_aComplexParameterObject;try{v_aComplexParameterObject=JSON.parse(v_aPromptParametersComplex[i]),Array.isArray(v_aComplexParameterObject)||(v_aComplexParameterObject=[v_aComplexParameterObject])}catch(e){return console.log("rsPromptParameters.addClassicViewerPromptsComplex ... invalid promptParameters input : "+v_aPromptParametersComplex[i]),v_aComplexParameterObject=void 0,""}convertComplexParameterToClassicViewerXML(v_oPromptParametersXML,v_aComplexParameterObject)}for(var v_sName in v_oPromptParametersXML)if(v_oPromptParametersXML.hasOwnProperty(v_sName)){for(var v_sXMLValues="",i=0;i<v_oPromptParametersXML[v_sName].length;i++)v_sXMLValues+=v_oPromptParametersXML[v_sName][i];v_sXMLValues="<selectChoices>"+v_sXMLValues+"</selectChoices>";var v_elInput=v_elForm.appendChild(document.createElement("input"));v_elInput.type="hidden",v_elInput.name="p_"+v_sName,v_elInput.value=v_sXMLValues}}function valueToSimpleJson(v_oValue){switch(v_oValue.type){case"simpleParmValueItem":delete v_oValue.type,delete v_oValue.inclusive;break;case"boundRangeParmValueItem":v_oValue={boundRange:{start:v_oValue.start,end:v_oValue.end}};break;case"unboundedStartRangeParmValueItem":v_oValue={unboundedStartRange:{end:v_oValue.end}};break;case"unboundedEndRangeParmValueItem":v_oValue={unboundedEndRange:{start:v_oValue.start}}}return v_oValue}function groupPromptParamters(v_oPromptParameters,v_oPromptParametersComplex){var v_aPromptParametersComplex;if("string"==typeof v_oPromptParametersComplex)try{v_oPromptParametersComplex=JSON.parse(v_oPromptParametersComplex)}catch(e){return void console.log("rsPromptParameters.groupPromptParamters ... invalid promptParameters input : "+v_oPromptParametersComplex)}v_oPromptParameters||(v_oPromptParameters={}),v_oPromptParametersComplex&&(Array.isArray(v_oPromptParametersComplex)?v_aPromptParametersComplex=v_oPromptParametersComplex:"string"==typeof v_oPromptParametersComplex.name?v_aPromptParametersComplex=[v_oPromptParametersComplex]:Object.keys(v_oPromptParametersComplex).forEach(function(key){v_oPromptParameters[key]=v_oPromptParametersComplex[key]}));for(var i=0;v_aPromptParametersComplex&&i<v_aPromptParametersComplex.length;++i){var v_aPromptParametersComplexObject;try{v_aPromptParametersComplexObject="string"==typeof v_aPromptParametersComplex[i]?JSON.parse(v_aPromptParametersComplex[i]):v_aPromptParametersComplex[i],Array.isArray(v_aPromptParametersComplexObject)||(v_aPromptParametersComplexObject=[v_aPromptParametersComplexObject])}catch(e){return void console.log("rsPromptParameters.groupPromptParamters ... invalid promptParameters input : "+v_aPromptParametersComplex[i])}for(var j=0;j<v_aPromptParametersComplexObject.length;j++){var v_oPromptParameter=v_aPromptParametersComplexObject[j],v_sName=v_oPromptParameter.name,v_aValues=[];if(v_oPromptParameter.value&&(v_aValues=Array.isArray(v_oPromptParameter.value)||"number"==typeof v_oPromptParameter.value.length?v_oPromptParameter.value:[v_oPromptParameter.value]),v_sName&&v_aValues){v_oPromptParameters[v_sName]||(v_oPromptParameters[v_sName]=[]);for(var k=0;k<v_aValues.length;++k){var v_oValue=valueToSimpleJson(v_aValues[k]);v_oValue.hasOwnProperty("use")&&v_oPromptParameters[v_sName].push({use:v_oValue.use,display:v_oValue.hasOwnProperty("display")?v_oValue.display:v_oValue.use}),v_oValue.hasOwnProperty("boundRange")?v_oValue.boundRange.start&&v_oValue.boundRange.start.hasOwnProperty("use")&&v_oValue.boundRange.end&&v_oValue.boundRange.end.hasOwnProperty("use")?v_oPromptParameters[v_sName].push({boundRange:{start:{use:v_oValue.boundRange.start.use,display:v_oValue.boundRange.start.hasOwnProperty("display")?v_oValue.boundRange.start.display:v_oValue.boundRange.start.use},end:{use:v_oValue.boundRange.end.use,display:v_oValue.boundRange.end.hasOwnProperty("display")?v_oValue.boundRange.end.display:v_oValue.boundRange.end.use}}}):console.log("rsPromptParameters.groupPromptParamters ... unexpected boundRange format"):v_oValue.hasOwnProperty("unboundedEndRange")?v_oValue.unboundedEndRange.start&&v_oValue.unboundedEndRange.start.hasOwnProperty("use")?v_oPromptParameters[v_sName].push({unboundedEndRange:{start:{use:v_oValue.unboundedEndRange.start.use,display:v_oValue.unboundedEndRange.start.hasOwnProperty("display")?v_oValue.unboundedEndRange.start.display:v_oValue.unboundedEndRange.start.use}}}):console.log("rsPromptParameters.groupPromptParamters ... unexpected unboundedEndRange format."):v_oValue.hasOwnProperty("unboundedStartRange")&&(v_oValue.unboundedStartRange.end&&v_oValue.unboundedStartRange.end.hasOwnProperty("use")?v_oPromptParameters[v_sName].push({unboundedStartRange:{end:{use:v_oValue.unboundedStartRange.end.use,display:v_oValue.unboundedStartRange.end.hasOwnProperty("display")?v_oValue.unboundedStartRange.end.display:v_oValue.unboundedStartRange.end.use}}}):console.log("rsPromptParameters.groupPromptParamters ... unexpected unboundedStartRange format."))}}}}return v_oPromptParameters}function emitValue(v_sTtype,v_oValue){var v_aValue=[];return void 0!==v_oValue&&(v_aValue.push("<bus:"),v_aValue.push(v_sTtype),v_aValue.push(' xsi:type="xsd:string"'),null===v_oValue?v_aValue.push(' xsi:nil="true"/>'):(v_aValue.push(">"),v_aValue.push(xmlEncode(v_oValue.toString())),v_aValue.push("</bus:"),v_aValue.push(v_sTtype),v_aValue.push(">"))),v_aValue.join("")}function emitUseDisplay(v_oValue){return emitValue("use",v_oValue.use)+emitValue("display",v_oValue.display)}function buildSimpleParmValue(v_oValue){return'<item xsi:type="bus:simpleParmValueItem"><bus:inclusive xsi:type="xsd:boolean">true</bus:inclusive>'+emitUseDisplay(v_oValue)+"</item>"}function buildBoundRangeParmValue(v_oValue){return'<item xsi:type="bus:boundRangeParmValueItem"><bus:inclusive xsi:type="xs:boolean">true</bus:inclusive><bus:start xsi:type="bus:simpleParmValueItem"><bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>'+emitUseDisplay(v_oValue.boundRange.start)+'</bus:start><bus:end xsi:type="bus:simpleParmValueItem"><bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>'+emitUseDisplay(v_oValue.boundRange.end)+"</bus:end></item>"}function buildUnboundedEndRangeParmValue(v_oValue){return'<item xsi:type="bus:unboundedEndRangeParmValueItem"><bus:inclusive xsi:type="xs:boolean">true</bus:inclusive><bus:start xsi:type="bus:simpleParmValueItem"><bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>'+emitUseDisplay(v_oValue.unboundedEndRange.start)+"</bus:start></item>"}function buildUnboundedStartRangeParmValue(v_oValue){return'<item xsi:type="bus:unboundedStartRangeParmValueItem"><bus:inclusive xsi:type="xs:boolean">true</bus:inclusive><bus:end xsi:type="bus:simpleParmValueItem"><bus:inclusive xsi:type="xs:boolean">true</bus:inclusive>'+emitUseDisplay(v_oValue.unboundedStartRange.end)+"</bus:end></item>"}function buildBusParameterValues(v_oPromptParameters,v_oPromptParametersComplex,v_sParamsTagName){var v_sParameterValues="<bus:"+(v_sParamsTagName||"parameterValues")+' xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENC:arrayType="bus:parameterValue[]" xsi:type="SOAP-ENC:Array">',v_oPromptParameters=groupPromptParamters(v_oPromptParameters,v_oPromptParametersComplex);for(var v_sName in v_oPromptParameters)if(v_oPromptParameters.hasOwnProperty(v_sName)){v_sParameterValues+='<item xsi:type="bus:parameterValue">',v_sParameterValues+='<bus:name xsi:type="xsd:string">'+xmlEncode(v_sName)+"</bus:name>",v_sParameterValues+='<bus:value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:parmValueItem[]">';for(var v_aCurParams=v_oPromptParameters[v_sName],v_iCurParamsLen=v_aCurParams.length,i=0;v_iCurParamsLen>i;i++){var v_oValue=v_aCurParams[i];v_oValue.hasOwnProperty("use")?v_sParameterValues+=buildSimpleParmValue(v_oValue):v_oValue.hasOwnProperty("boundRange")?v_sParameterValues+=buildBoundRangeParmValue(v_oValue):v_oValue.hasOwnProperty("unboundedEndRange")?v_sParameterValues+=buildUnboundedEndRangeParmValue(v_oValue):v_oValue.hasOwnProperty("unboundedStartRange")&&(v_sParameterValues+=buildUnboundedStartRangeParmValue(v_oValue))}v_sParameterValues+="</bus:value>",v_sParameterValues+="</item>"}return v_sParameterValues+="</bus:"+(v_sParamsTagName||"parameterValues")+">"}function convertValueToBoundedRangeFormat(v_oValue){v_oValue.boundRange={start:{use:v_oValue.start.use,display:v_oValue.start.display},end:{use:v_oValue.end.use,display:v_oValue.end.display}},delete v_oValue.start,delete v_oValue.end}function convertValueToUnboundedStartRangeFormat(v_oValue){v_oValue.unboundedStartRange={end:{use:v_oValue.end.use,display:v_oValue.end.display}},delete v_oValue.end}function convertValueToUnboundedEndRangeFormat(v_oValue){v_oValue.unboundedEndRange={start:{use:v_oValue.start.use,display:v_oValue.start.display}},delete v_oValue.start}return{cvAddPromptParameters:function(v_elForm,v_aPromptParameters,v_aPromptParametersComplex){console.log("rsPromptParameters.cvAddPromptParameters ..."),addClassicViewerPrompts(v_elForm,v_aPromptParameters),addClassicViewerPromptsComplex(v_elForm,v_aPromptParametersComplex)},rsBuildPromptParameters:function(v_oPromptParameters,v_oPromptParametersComplex,v_sParamsTagName){return v_oPromptParameters||v_oPromptParametersComplex?buildBusParameterValues(v_oPromptParameters,v_oPromptParametersComplex,v_sParamsTagName):""},rsBuildParameterUrl:function(v_oUrlMap,v_oPromptParameters){var v_aPromptParameters=Array.isArray(v_oPromptParameters)?v_oPromptParameters:[v_oPromptParameters];v_aPromptParameters.forEach(function(v_oPara){if("undefined"!=typeof v_oPara){var v_aValues=Array.isArray(v_oPara.value)?v_oPara.value:[v_oPara.value];v_aValues.forEach(function(v_oValue){switch(v_oValue.type){case"boundRangeParmValueItem":convertValueToBoundedRangeFormat(v_oValue);break;case"unboundedStartRangeParmValueItem":convertValueToUnboundedStartRangeFormat(v_oValue);break;case"unboundedEndRangeParmValueItem":convertValueToUnboundedEndRangeFormat(v_oValue)}delete v_oValue.type,delete v_oValue.inclusive})}}),v_oUrlMap.promptParameters=v_oPromptParameters?JSON.stringify(v_aPromptParameters):null},convertParameterArrayToObject:function(v_aParameters){var v_oParameters={};return v_aParameters&&v_aParameters.length>0&&v_aParameters.forEach(function(v_oParameter){v_oParameter&&v_oParameter.name&&(v_oParameters[v_oParameter.name]=v_oParameter.value)}),v_oParameters}}}),define("bi/authoring/utils/rsCommon",["jquery","q","doT","bi/commons/utils/Utils","bi/authoring/utils/pat/rsPromptParameters"],function($,Q,dot,Utils,rsPromptParameters){"use strict";function findPromptParameters(options){var v_oPromptParameters;for(var v_sKey in options)if(options.hasOwnProperty(v_sKey)&&v_sKey.length>2&&0==v_sKey.indexOf("p_")&&options[v_sKey]){var v_sName=v_sKey.substring(2);v_oPromptParameters||(v_oPromptParameters={}),v_oPromptParameters[v_sName]||(v_oPromptParameters[v_sName]=[]);for(var v_aOptions=Array.isArray(options[v_sKey])?options[v_sKey]:[options[v_sKey]],i=0;i<v_aOptions.length;i++)v_oPromptParameters[v_sName].push({use:v_aOptions[i],display:v_aOptions[i]})}return v_oPromptParameters}function findPromptParametersComplex(options){return options.promptParameters}function isOutputForDownload(v_sOutputFormat){return-1!==["spreadsheetML","xlsxData","CSV","XML"].indexOf(v_sOutputFormat)}function convertToArrayImpl(v_oParameterValues){var v_aParameterValues=[];if(null!=v_oParameterValues)for(var v_sKey in v_oParameterValues)v_oParameterValues.hasOwnProperty(v_sKey)&&v_oParameterValues[v_sKey]&&v_aParameterValues.push(v_oParameterValues[v_sKey]);return v_aParameterValues}function useViewer(options){var v_bIsViewer=!1;if("dataSet2"===options.type)v_bIsViewer=!1;else switch(options.action){case"edit":v_bIsViewer=!1;break;case"run":case"viewOutput":v_bIsViewer=!0;break;default:(options.isViewer||options.cmProperties&&"output"==options.cmProperties.type)&&(v_bIsViewer=!0)}return v_bIsViewer}return{reject:function(deferred,msg,tag){console.log((tag?tag+": ":"")+msg),deferred.reject(new Error(msg))},isObjectOfType:function(cmProperties,v_oType){if(cmProperties){if(Array.isArray(v_oType)){for(var idx=0;idx<v_oType.length;++idx)if(this.isObjectOfType(cmProperties,v_oType[idx]))return!0;return!1}if(cmProperties.base&&cmProperties.base[0].type===v_oType)return!0;switch(cmProperties.type){case v_oType:return!0;case"reportVersion":return cmProperties.parent&&(cmProperties.parent[0].type==v_oType||"reportView"==cmProperties.parent[0].type&&cmProperties.parent[0].base[0].type==v_oType);case"output":return cmProperties.parent&&(cmProperties.parent[0].parent[0].type==v_oType||"reportView"==cmProperties.parent[0].parent[0].type&&cmProperties.parent[0].parent[0].base[0].type==v_oType)}}return!1},createTemplateParameters:function(v_oRSParameters){var v_oTemplateParameters={};return v_oTemplateParameters.rsUrl="pat/rsapp.htm",v_oTemplateParameters.rsParameters=JSON.stringify(v_oRSParameters),v_oTemplateParameters},convertToArray:function(v_oParameterValues){return convertToArrayImpl(v_oParameterValues)},extractGlassSettings:function(options){var glassSettings;return("undefined"!=typeof options.ui_appbar||"undefined"!=typeof options.ui_navbar)&&(glassSettings={},"undefined"!=typeof options.ui_appbar&&options.ui_appbar!==!0&&(glassSettings.ui_appbar=!1),"undefined"!=typeof options.ui_navbar&&options.ui_navbar!==!0&&(glassSettings.ui_navbar=!1)),glassSettings},isOutputFormatAllowed:function(v_sOutputFormat,glassContext){switch(v_sOutputFormat){case"CSV":return glassContext.hasCapability("canGenerateCSVOutput");case"XML":return glassContext.hasCapability("canGenerateXMLOutput");case"PDF":return glassContext.hasCapability("canGeneratePDFOutput");case"spreadsheetML":case"xlsxData":return glassContext.hasCapability("canGenerateXLSOutput")}return!0},createRSParameters:function(options,glassContext){var v_sGatewayUrl="../v1/disp",v_sCafContextId=glassContext&&glassContext.cafContextId||"",v_sStoreId=options.cmProperties&&options.cmProperties.id,v_sReportStoreId="",v_sModuleStoreId=options.moduleId,v_sModuleSearchPath=options.moduleSearchPath,v_sPackageSearchPath="",v_sType=options.type||"";options.isNew?this.isObjectOfType(options.cmProperties,"package")?v_sPackageSearchPath=options.cmProperties.searchPath+"/model[last()]":v_sStoreId&&(v_sModuleStoreId=v_sStoreId,v_sModuleSearchPath=options.cmProperties.searchPath):v_sReportStoreId=v_sStoreId;var v_bIsViewer=useViewer(options),v_sFormat=options.format,v_bRunInAdvancedViewer=options.cmProperties&&"undefined"!=typeof options.cmProperties.runInAdvancedViewer?!!options.cmProperties.runInAdvancedViewer:!0;if(options.rsFinalRunOptions=options.rsFinalRunOptions||{},void 0===options.rsFinalRunOptions.prompt&&void 0!==options.prompt&&(options.rsFinalRunOptions.prompt=options.prompt),!options.rsFinalRunOptions.globalParameters){var v_oParameterValues=null;glassContext&&glassContext.services&&glassContext.services.userProfile&&glassContext.services.userProfile.userProfileSettings&&(v_oParameterValues=glassContext.services.userProfile.userProfileSettings.parameter_values);var v_aParameterValues=convertToArrayImpl(v_oParameterValues);options.rsFinalRunOptions.globalParameters=JSON.stringify(v_aParameterValues)}v_sFormat&&!options.rsFinalRunOptions.format&&(options.rsFinalRunOptions.format=v_sFormat),options.rsFinalRunOptions.format&&!options.rsFinalRunOptions.Download&&(options.rsFinalRunOptions.Download=isOutputForDownload(options.rsFinalRunOptions.format).toString()),options.editSpecification?options.rsFinalRunOptions.editSpecification=options.editSpecification:options.m_oLaunchParameters&&options.m_oLaunchParameters.editSpecification&&(options.rsFinalRunOptions.editSpecification=options.m_oLaunchParameters.editSpecification),options.rsFinalRunOptions.isApplication=options.isApplication;var v_oRSParameters={parentType:"RSFrame",rs_UIProfile:options.UIProfile,reportStoreID:v_sReportStoreId,gateway:v_sGatewayUrl,isViewer:v_bIsViewer,model:v_sPackageSearchPath,module:v_sModuleStoreId,moduleSearchPath:v_sModuleSearchPath,htmlContainerPath:document.location.pathname,productLocale:glassContext.services.userProfile.preferences.productLocale||"en",contentLocale:glassContext.services.userProfile.preferences.contentLocale||"en-us",runInAdvancedViewer:v_bRunInAdvancedViewer,cafcontextid:v_sCafContextId,type:v_sType,rsFinalRunOptions:options.objRef?{format:v_sFormat||"HTML",Download:isOutputForDownload(v_sFormat).toString(),bidi:void 0!=options.bidi?!!options.bidi:void 0,a11y:void 0!=options.a11y?!!options.a11y:void 0,prompt:void 0!=options.prompt?!!options.prompt:void 0,globalParameters:options.rsFinalRunOptions.globalParameters,editSpecification:options.rsFinalRunOptions.editSpecification,isApplication:!!options.rsFinalRunOptions.isApplication}:options.rsFinalRunOptions,parameterValuesXML:options.parameterValuesXML,cmProperties:options.cmProperties,outputSpec:options.outputSpec,glassSettings:this.extractGlassSettings(options)};options.contentLocale&&(v_oRSParameters.rsFinalRunOptions.contentLocale=options.contentLocale),"run"!=options.action||this.isOutputFormatAllowed(options.rsFinalRunOptions.format,glassContext)||(v_oRSParameters.closePerspective=!0),v_oRSParameters.startingTemplate=options.startingTemplate,v_oRSParameters.isSlideout=options.isSlideout,v_oRSParameters.promptResponse=options.promptResponse;var v_oPromptParameters=findPromptParameters(options),v_oPromptParametersComplex=findPromptParametersComplex(options),v_sParameterValues=rsPromptParameters.rsBuildPromptParameters(v_oPromptParameters,v_oPromptParametersComplex);return v_sParameterValues&&(v_oRSParameters.parameterValuesXML=v_sParameterValues),v_oRSParameters},_hackFindPlugin:function(appView,id){var plugin;return id&&appView&&(plugin=appView.registeredPlugins[id]),plugin},hackLockGlass:function(appView){appView&&(appView.$(".navbar").addClass("disabled"),appView.$(".appbar").addClass("disabled"))},hackUnlockGlass:function(appView){appView&&(appView.$(".navbar").removeClass("disabled"),appView.$(".appbar").removeClass("disabled"))},getAuthoringApplicationFromIFrame:function(iFrame){return iFrame&&iFrame.contentWindow&&iFrame.contentWindow.Application},F_XMLEncode:function(v_sString){return v_sString.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},decodeAndMoveCMProperties:function(options){if(options&&options.cmPropStr&&!options.cmProperties){var v_oCmProperties;try{v_oCmProperties=JSON.parse(options.cmPropStr)}catch(e){v_oCmProperties=null}v_oCmProperties&&(options.cmProperties=v_oCmProperties)}if(delete options.cmPropStr,options&&options.reportPropStr&&!options.reportProperties){var v_oReportProperties;try{v_oReportProperties=JSON.parse(options.reportPropStr)}catch(e){v_oReportProperties=null}v_oReportProperties&&(options.reportProperties=v_oReportProperties)}delete options.reportPropStr},decodeAndMoveRSOptions:function(options){if(options&&options.rsEncodedOptions){var v_oRsOptions=JSON.parse(options.rsEncodedOptions);Object.keys(v_oRsOptions).forEach(function(v_sKey){options[v_sKey]=v_oRsOptions[v_sKey]}),delete options.rsEncodedOptions}},M_aConvertList:["isViewer","isNew","isApplication","a11y","bidi","runInAdvancedViewer","prompt","rsFinalRunOptions","promptParameters","ui_appbar","ui_navbar"],convertStringQSToValues:function(options,glassContext,trimURLParameterValues){var v_bStringOnlyQS=glassContext.getCoreSvc(".FeatureChecker").checkValue("ba-glass","stringOnlyQS","enabled");if(v_bStringOnlyQS)for(var propertyName in options)if(options[propertyName])if(-1!=this.M_aConvertList.indexOf(propertyName)){if("object"==typeof options[propertyName])this.convertStringQSToValues(options[propertyName],glassContext);else if("string"==typeof options[propertyName])if("true"===options[propertyName])options[propertyName]=!0;else if("false"===options[propertyName])options[propertyName]=!1;else{var v_numberValue=Number(options[propertyName]);options[propertyName]=isNaN(v_numberValue)?options[propertyName]:v_numberValue}}else 0==propertyName.indexOf("p_")&&trimURLParameterValues===!0&&(options[propertyName]=options[propertyName].trim())},getAvailableOutputs:function(glassContext,v_oOutputProperties){return glassContext.getSvc(".Content").then(function(v_oContentSvc){var v_sCMQueryUrl=v_oContentSvc.getBaseObjectsURL()+"/"+v_oOutputProperties.parent[0].id+"/outputs?fields=dataDescriptor,parent,locale,format,permissions,ancestors,lastPage";return v_oContentSvc.get(v_sCMQueryUrl,{})})},getContent:function(options,v_oContentView,rsShareHelper){var v_oCmProperties,v_bOnlyBookmarkContent=options&&"bookmark"==options.mode,v_oReturn={};if(v_oContentView.cmProperties){if(v_oReturn=rsShareHelper.buildShareUrlMap(v_oContentView),v_oCmProperties={id:v_oContentView.cmProperties.id,type:v_oContentView.cmProperties.type,defaultName:v_oContentView.cmProperties.defaultName,permissions:v_oContentView.cmProperties.permissions},"output"==v_oContentView.cmProperties.type){if(v_oContentView.cmProperties.ancestors){var v_sReportName=v_oContentView.cmProperties.ancestors[v_oContentView.cmProperties.ancestors.length-2].defaultName;v_oCmProperties.defaultName=v_sReportName+" - "+v_oContentView.cmProperties.modificationTime.substring(0,10)+" - "+v_oContentView.cmProperties.format}v_oCmProperties.modificationTime=v_oContentView.cmProperties.modificationTime,v_oCmProperties.format=v_oContentView.cmProperties.format,v_oContentView.cmProperties.parent&&v_oContentView.cmProperties.parent.length>0&&(v_oCmProperties.parent=[{id:v_oContentView.cmProperties.parent[0].id,type:v_oContentView.cmProperties.parent[0].type}]),v_oContentView.reportProperties&&(v_oReturn.reportPropStr=JSON.stringify({id:v_oContentView.reportProperties.id,type:v_oContentView.reportProperties.type,defaultName:v_oContentView.reportProperties.defaultName})),v_oReturn.type="output",delete v_oReturn.objRef}v_oReturn.cmPropStr=JSON.stringify(v_oCmProperties)}return v_oContentView.id&&(v_oReturn.id=v_oContentView.id),v_bOnlyBookmarkContent?delete v_oReturn.promptParameters:v_oReturn.application=v_oContentView.getApplicationContent(v_oReturn,v_oCmProperties),v_oReturn}}}),define("bi/authoring/utils/rsIFrameManager",["jquery","q","bi/authoring/utils/rsCommon"],function($,Q,rsCommon){"use strict";function isMyParentTheTopWindow(w){try{return Boolean(w.parent==w.top)}catch(e){return!1}}var rsIFrameManager={};return rsIFrameManager.m_iNewFrameId=1,rsIFrameManager.F_LaunchRS=function(v_oParameters,v_oGlassContext,v_oLaunchParameters){console.info("rsperf: rsIFrameManager.F_LaunchRS ..."),this.m_oLaunchParameters=v_oLaunchParameters?v_oLaunchParameters:null;var v_bPrelaunchTest=!1;if(v_bPrelaunchTest&&this.F_PreLaunch(v_oGlassContext),this.m_oPrelaunchRSPromise&&"datasets"!==v_oGlassContext.currentAppView.currentContentView.perspective){console.time("rsIFrameManager.F_LaunchRS->f_relaunchRSIFrameInView");var v_oIFramePromise=this.m_oPrelaunchRSPromise;if(this.m_oPrelaunchRSPromise=null,console.time("rsperf: Waiting for RS relaunch"),v_oIFramePromise.isFulfilled())return this.f_relaunchRSIFrameInView(v_oParameters,v_oLaunchParameters,v_oIFramePromise.inspect().value);var v_oRelaunchDeferred=Q.defer();return v_oIFramePromise.then(this.f_relaunchRSIFrameInView.bind(this,v_oParameters,v_oLaunchParameters)).done(function(v_idIFrameAuthoring){v_oRelaunchDeferred.resolve(v_idIFrameAuthoring)}),v_oRelaunchDeferred.promise}console.time("rsperf: Launch RS->OnRSApplicationReadyForObservers");var v_oLaunchDeferred=Q.defer();return this.f_launchRS(v_oGlassContext,v_oParameters,this.f_onLaunchReadyForObservers.bind(this,v_oGlassContext,v_oLaunchDeferred),v_oLaunchDeferred.reject.bind(v_oLaunchDeferred,new Error("rsIFrameManager: error during f_launchRS"))),v_oLaunchDeferred.promise},rsIFrameManager.f_relaunchRSIFrameInView=function(v_oParameters,v_oLaunchParameters,v_iframeAuthoring){console.timeEnd("rsIFrameManager.F_LaunchRS->f_relaunchRSIFrameInView");var v_oIFrameLaunchedDeferred=Q.defer();console.timeEnd("rsperf: Waiting for RS relaunch"),console.time("rsperf: Launch from prelaunch RS->OnRSApplicationReadyForObservers"),v_iframeAuthoring.OnRSApplicationReadyForObservers=function(){v_oIFrameLaunchedDeferred.resolve(v_iframeAuthoring.id),console.timeEnd("rsperf: Launch from prelaunch RS->OnRSApplicationReadyForObservers")}.bind(this);var v_oRsParameters=JSON.parse(v_oParameters.rsParameters);return v_iframeAuthoring.contentWindow.Application.Relaunch(v_oRsParameters,v_oLaunchParameters),v_oIFrameLaunchedDeferred.promise},rsIFrameManager.f_getBodyRect=function(el){var v_elScrollable=document.documentElement,v_oRect=el.getBoundingClientRect(),v_oBodyRect=document.body.getBoundingClientRect();return{top:v_oRect.top-v_oBodyRect.top+(v_elScrollable.scrollTop?v_elScrollable.scrollTop:0),left:v_oRect.left-v_oBodyRect.left+(v_elScrollable.scrollLeft?v_elScrollable.scrollLeft:0),width:v_oRect.width,height:v_oRect.height}},rsIFrameManager.F_PositionAndSizeIFrame=function($elContainer,v_iframeAuthoring){function f_getZIndex(v_el){for(var v_elCur=v_el;v_elCur&&"#document"!=v_elCur.nodeName;){var v_oStyle=v_elCur.ownerDocument.defaultView.getComputedStyle(v_elCur,null),v_iValue=parseInt(v_oStyle.zIndex,10);if(!isNaN(v_iValue)&&0!==v_iValue)return v_iValue;v_elCur=v_elCur.parentNode}return 0}var v_oRect=this.f_getBodyRect($elContainer.get(0));v_iframeAuthoring.style.top=v_oRect.top+"px",v_iframeAuthoring.style.left=v_oRect.left+"px",v_iframeAuthoring.style.width=v_oRect.width+"px",v_iframeAuthoring.style.height=v_oRect.height+"px",v_iframeAuthoring.style.zIndex=f_getZIndex($elContainer.get(0))+1,v_iframeAuthoring.style.visibility="visible"},rsIFrameManager.F_HideIFrame=function(v_iframeAuthoring){v_iframeAuthoring.style.top="-5000px",v_iframeAuthoring.style.left="-5000px",v_iframeAuthoring.style.zIndex=-1,v_iframeAuthoring.style.visibility="hidden"},rsIFrameManager.F_DetachIFrame=function(v_iframeAuthoring){var v_oApplication=v_iframeAuthoring.contentWindow.Application;v_oApplication&&v_oApplication.DetachFromGlass(),this.m_divRSFrameHolder.removeChild(v_iframeAuthoring)},rsIFrameManager.f_createRSIFrame=function(v_oParameters){var v_aHTML=[];return v_aHTML.push('<iframe title="RSIframe" src="'),isMyParentTheTopWindow(window)?v_aHTML.push(v_oParameters.rsUrl):v_aHTML.push(v_oParameters.rsUrl+"?v="+Math.random()),v_aHTML.push('" style="border:none;top:-5000px;left:-5000px;width:1024px;height:768px;position:absolute;visibility:hidden" data-rsparameters="'),v_aHTML.push(this.f_HTMLAttributeEncode(v_oParameters.rsParameters)),v_aHTML.push('" allowfullscreen="true"/>'),v_aHTML.join("")},rsIFrameManager.f_onLaunchReadyForObservers=function(v_oGlassContext,v_oDeferred,v_iframeAuthoring){console.timeEnd("rsperf: Launch RS->OnRSApplicationReadyForObservers");var v_oApplication=v_iframeAuthoring.contentWindow.Application;v_oApplication.GlassContext=v_oGlassContext,
- v_oApplication.LaunchParameters=this.m_oLaunchParameters,v_oDeferred.resolve(v_iframeAuthoring.id)},rsIFrameManager.f_HTMLEncode=function(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},rsIFrameManager.f_HTMLAttributeEncode=function(s){return this.f_HTMLEncode(s).replace(/'/g,"'").replace(/"/g,""")},rsIFrameManager.f_prelaunchRS=function(v_oGlassContext,v_fnOnLaunched,v_fnOnLaunchError){console.time("rsperf: prelaunch RS");var v_oRsParameters=rsCommon.createRSParameters({},v_oGlassContext);v_oRsParameters.prelaunchRS=!0,this.f_launchRS(v_oGlassContext,rsCommon.createTemplateParameters(v_oRsParameters),this.f_onPrelaunchRSReadyForObservers.bind(this,v_oGlassContext,v_fnOnLaunched),v_fnOnLaunchError)},rsIFrameManager.f_launchRS=function(v_oGlassContext,v_oParameters,v_fnOnLaunched,v_fnOnLaunchError){this.m_divRSFrameHolder||($("body").prepend('<div style="position:absolute;top:0px;left:0px;visibility:hidden"></div>'),this.m_divRSFrameHolder=$("body").find("div").get(0));var $divRSFrameHolder=$(this.m_divRSFrameHolder);$divRSFrameHolder.prepend(this.f_createRSIFrame(v_oParameters));var v_iframeAuthoring=$divRSFrameHolder.find("iframe").get(0);v_iframeAuthoring.id="rsIFrameManager_"+this.m_iNewFrameId++,v_iframeAuthoring.OnRSApplicationReadyForObservers=v_fnOnLaunched.bind(null,v_iframeAuthoring),v_iframeAuthoring.onerror=v_fnOnLaunchError},rsIFrameManager.f_onPrelaunchRSReadyForObservers=function(v_oGlassContext,v_fnOnLaunched,v_iframeAuthoring){var v_oApplication=v_iframeAuthoring.contentWindow.Application;v_oApplication.GlassContext=v_oGlassContext,v_oApplication.LaunchParameters=this.m_oLaunchParameters,v_oApplication.SharedState.Get("isAppLoaded")?this.f_onPrelaunchAppLoaded(v_iframeAuthoring,v_fnOnLaunched):v_oApplication.SharedState.AddObserver("rsIFrameManager","isAppLoaded",this.f_onPrelaunchAppLoaded.bind(this,v_iframeAuthoring,v_fnOnLaunched,!0))},rsIFrameManager.f_onPrelaunchAppLoaded=function(v_iframeAuthoring,v_fnOnLaunched,v_bRemoveObserver){if(console.timeEnd("rsperf: prelaunch RS"),v_bRemoveObserver){var v_oApplication=v_iframeAuthoring.contentWindow.Application;v_oApplication.SharedState.RemoveObserver("rsIFrameManager","isAppLoaded")}setTimeout(v_fnOnLaunched.bind(null,v_iframeAuthoring),0)},rsIFrameManager.F_PreLaunch=function(v_oGlassContext){if(!this.m_oPrelaunchRSPromise){var v_oDefer=Q.defer();this.m_oPrelaunchRSPromise=v_oDefer.promise,this.f_prelaunchRS(v_oGlassContext,function(v_idIFrameAuthoring){v_oDefer.resolve(v_idIFrameAuthoring)}.bind(this),v_oDefer.resolve.bind(v_oDefer,null))}},rsIFrameManager}),define("text!bi/authoring/res/DatasetList.xml",[],function(){return'<!--\n IBM Confidential \n OCO Source Materials\n IBM Cognos Products: rs\n (C) Copyright IBM Corp. 2020\n The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has been deposited with the U.S. Copyright Office.\n-->\n<report useStyleVersion="11.5" expressionLocale="en-us">\n <modelPath/>\n <drillBehavior modelBasedDrillThru="false"/>\n <queries>\n <query name="">\n <source>\n <model/>\n </source>\n <selection/>\n </query>\n </queries>\n <layouts>\n <layout>\n <reportPages>\n <page name="Page1">\n <style>\n <defaultStyles>\n <defaultStyle refStyle="pg"/>\n </defaultStyles>\n </style>\n <pageBody>\n <style>\n <defaultStyles>\n <defaultStyle refStyle="pb"/>\n </defaultStyles>\n </style>\n <contents>\n <list refQuery="" horizontalPagination="true" rowsPerPage="100">\n <style>\n <defaultStyles>\n <defaultStyle refStyle="ls"/>\n </defaultStyles>\n <CSS value="border-collapse:collapse;height: 100%"/>\n </style>\n </list>\n </contents>\n </pageBody>\n </page>\n </reportPages>\n </layout>\n </layouts>\n <XMLAttributes>\n <XMLAttribute output="no" name="RS_openInPageDesign" value="default"/>\n </XMLAttributes>\n</report>\n'}),define("bi/authoring/utils/pat/rsLaunchParameters",["jquery","text!bi/authoring/res/DatasetList.xml"],function($,datasetList){var getOpenerLaunchParameters=function(v_bParent){var v_oOpenerLaunchParameters;try{v_oOpenerLaunchParameters=v_bParent?window.opener.parent.require("bi/authoring/utils/pat/rsLaunchParameters"):window.opener.require("bi/authoring/utils/pat/rsLaunchParameters")}catch(e){}return v_oOpenerLaunchParameters},rsLaunchParameters={m_oParameterMap:{},m_oTemplates:{DatasetList:datasetList}};return rsLaunchParameters.GetTemplate=function(v_sTemplate){return this.m_oTemplates[v_sTemplate]},rsLaunchParameters.Store=function(v_oData,v_bJSONEncode,v_bUseParent){var v_sKey=(v_bUseParent?"-":"")+Date.now().toString();if(v_bJSONEncode){var v_oAdd=new Map,v_aRemove=[];Object.keys(v_oData).forEach(function(key){"object"!=typeof v_oData[key]||void 0==v_oData[key]||"function"==typeof v_oData[key].toString&&v_oData[key].toString().indexOf("Window")>=0||(v_oAdd.set("JSON_"+key,JSON.stringify(v_oData[key])),v_aRemove.push(key))});for(var idx=0;idx<v_aRemove.length;++idx)delete v_oData[v_aRemove[idx]];v_oAdd.forEach(function(value,key){v_oData[key]=value})}return this.m_oParameterMap[v_sKey]=v_oData,v_sKey},rsLaunchParameters.UseParent=function(){return{Store:function(v_oData,v_bJSONEncode){return this.Store(v_oData,v_bJSONEncode,!0)}.bind(this),GetTemplate:this.GetTemplate.bind(this)}},rsLaunchParameters.Retrieve=function(v_sKey){var v_oReturn;if(v_sKey){var v_oOpenerLaunchParameters=getOpenerLaunchParameters(0==v_sKey.indexOf("-"));if(v_oOpenerLaunchParameters){if(v_oReturn=v_oOpenerLaunchParameters.m_oParameterMap[v_sKey]){var v_oNonExtendable={};for(var p in v_oReturn)v_oReturn.hasOwnProperty(p)&&v_oReturn[p]&&"function"==typeof v_oReturn[p].toString&&v_oReturn[p].toString().indexOf("Window")>=0&&(v_oNonExtendable[p]=v_oReturn[p],delete v_oReturn[p]);try{v_oReturn=$.extend(!0,{},v_oReturn)}catch(e){console.log("rsLaunchParameters.Retrieve failed to extend launch parameters")}for(var p in v_oNonExtendable)v_oReturn[p]=v_oNonExtendable[p];var v_oParsed={};for(var p in v_oReturn)if(0==p.indexOf("JSON_")&&v_oReturn.hasOwnProperty(p)){var v_sP=p.slice(5);v_oParsed[v_sP]=JSON.parse(v_oReturn[p])}for(var p in v_oParsed)v_oParsed.hasOwnProperty(p)&&(v_oReturn[p]=v_oParsed[p],delete v_oReturn["JSON_"+p])}delete v_oOpenerLaunchParameters.m_oParameterMap[v_sKey]}}return v_oReturn},rsLaunchParameters}),define("bi/authoring/utils/rsOpenHelper",["jquery","q","bi/authoring/utils/rsIFrameManager","bi/authoring/utils/rsCommon","bi/authoring/nls/StringResource","bi/commons/utils/LegacyUtils","bi/authoring/utils/pat/rsLaunchParameters","bi/authoring/utils/pat/rsPromptParameters"],function($,Q,rsIFrameManager,rsCommon,StringResource,LegacyUtils,rsLaunchParameters,rsPromptParameters){"use strict";function getLegacyUtils(){return legacyUtils||(legacyUtils=LegacyUtils,legacyUtils.getLegacyLaunchUrl||(legacyUtils.getLegacyLaunchUrl=function(glassContext,tool,object,action){var qParms=this._getLaunchParms(glassContext,tool,object);return qParms["ui.action"]=action,this._getUrl(qParms)}.bind(LegacyUtils))),legacyUtils}function getLegacyLaunchUrl(oOpenSpec){var tool="query"==oOpenSpec.cmProperties.type?"QueryStudio":"AnalysisStudio",searchPath='storeID("'+oOpenSpec.cmProperties.id+'")',v_sLaunchURL=getLegacyUtils().getLegacyLaunchUrl(oOpenSpec.glassContext,tool,searchPath,"edit");void 0!=oOpenSpec.urlMap.prompt&&(v_sLaunchURL=v_sLaunchURL+"&prompt="+(oOpenSpec.urlMap.prompt?"true":"false"));var v_sParameterValuesXML=oOpenSpec.urlMap.parameterValuesXML;return!v_sParameterValuesXML&&oOpenSpec.urlMap.parameterValuesJSON&&(v_sParameterValuesXML=rsPromptParameters.rsBuildPromptParameters(null,oOpenSpec.urlMap.parameterValuesJSON,"parameters")),v_sParameterValuesXML&&(v_sLaunchURL=v_sLaunchURL+"&ui.drillThroughTargetParameterValues="+encodeURIComponent(v_sParameterValuesXML)),v_sLaunchURL}function runActiveReportInNewWindow(urlMap){var deferred=Q.defer(),v_sCmPath='storeID("'+urlMap.id+'")',v_sA11y=urlMap.a11y?"&"+encodeURIComponent("system.http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures")+"=true":"",v_sBidi=urlMap.bidi?"&"+encodeURIComponent("biDirectional.http://developer.cognos.com/ceba/constants/biDirectionalOptionEnum#biDirectionalFeaturesEnabled")+"=true":"",v_sPrompt=void 0!=urlMap.prompt?"&run.prompt="+urlMap.prompt:"",v_sUri="v1/disp?b_action=cognosViewer&ui.action=run&ui.object="+v_sCmPath+v_sPrompt+v_sA11y+v_sBidi;try{var v_oWin=window.open(v_sUri,"","");v_oWin.focus(),deferred.resolve(v_oWin)}catch(e){rsCommon.reject(deferred,"Failed to opend window: "+e.toString(),"rsOpenHelper.runActiveReportInNewWindow")}finally{return deferred.promise}}function isActiveReport(cmProperties){return rsCommon.isObjectOfType(cmProperties,"interactiveReport")}function isDataSet2(cmProperties){return rsCommon.isObjectOfType(cmProperties,"dataSet2")}function isReport_ish(cmProperties){return rsCommon.isObjectOfType(cmProperties,["report","reportView","reportTemplate","interactiveReport","dataSet2","query","analysis"])}function loadCmProperties(v_oUrlMap,v_oCmProperties){v_oCmProperties&&(v_oUrlMap.cmProperties=v_oCmProperties,v_oUrlMap.id=v_oCmProperties.id,v_oUrlMap.type=v_oCmProperties.type)}function getType(v_sId,glassContext){var v_sSearchPathUrl="v1/search_path?searchPath="+encodeURIComponent("storeID('"+v_sId+"')")+"&fields=type";return glassContext.services.fetch.get(v_sSearchPathUrl).then(function(v_oCmInfoResponse){return v_oCmInfoResponse.data.data[0].type})}function determineDefaultAction(v_sActionId,v_oCmProperties,glassContext,urlMap){if(urlMap&&(urlMap.m_oPromptContext||urlMap.m_oLaunchParameters&&urlMap.m_oLaunchParameters.promptContext))return glassContext.hasCapability("canUseCognosViewer")?"run":"none";var v_sAction;if(v_oCmProperties&&v_oCmProperties.defaultPortalAction){var v_bDefault=!0;v_sAction=v_oCmProperties.defaultPortalAction;var v_sType=v_oCmProperties.type;switch(v_sActionId){case"com.ibm.bi.authoring.run":case"com.ibm.bi.contentApps.action.runAs":case"com.ibm.bi.authoringContrib.runBtn":v_sAction="run",v_bDefault=!1;break;default:v_sActionId&&-1==v_sActionId.indexOf("com.ibm.bi.contentApps.defaultAction.")&&(v_sAction="edit",v_bDefault=!1)}switch(v_sType){case"dataSet2":v_sAction=-1!=v_oCmProperties.permissions.indexOf("read")&&glassContext.hasCapability("canUseMyDataSets")?"edit":null;break;case"reportTemplate":v_sAction=-1!=v_oCmProperties.permissions.indexOf("read")&&glassContext.hasCapability("canUseReportStudio")?"edit":null;break;case"reportView":"edit"==v_sAction&&(v_sAction=v_bDefault?"run":null);default:var v_sStudioCapability,v_bIsLegacy=!1;switch(v_sType){case"query":v_sStudioCapability="canUseQueryStudio",v_bIsLegacy=!0;break;case"analysis":v_sStudioCapability="canUseAnalysisStudio",v_bIsLegacy=!0;break;default:v_sStudioCapability="canUseReportStudio"}if(v_bIsLegacy&&"edit"==v_sAction){var v_bTool=LegacyUtils.canUseLegacyTool(glassContext,"query"==v_sType?"QueryStudio":"AnalysisStudio");v_sAction=v_bTool?"legacy":"run"}switch(v_sAction){case"edit":case"legacy":-1!=v_oCmProperties.permissions.indexOf("read")&&glassContext.hasCapability(v_sStudioCapability)||(v_sAction=-1!=v_oCmProperties.permissions.indexOf("execute")&&v_bDefault?"run":null);break;case"run":-1==v_oCmProperties.permissions.indexOf("execute")&&(v_sAction=-1!=v_oCmProperties.permissions.indexOf("read")&&v_bDefault?"viewOutput":null);break;case"viewOutput":-1==v_oCmProperties.permissions.indexOf("read")&&(v_sAction=-1!=v_oCmProperties.permissions.indexOf("execute")&&v_bDefault?"run":null);break;default:v_sAction=null}"run"!=v_sAction&&"viewOutput"!=v_sAction||glassContext.hasCapability("canUseCognosViewer")||(v_sAction=null)}}else urlMap&&urlMap.isNew&&(v_sAction=urlMap.isViewer?glassContext.hasCapability("canUseCognosViewer")?"run":"none":"authoring"==urlMap.perspective?glassContext.hasCapability("canUseReportStudio")?"edit":"none":"datasets"==urlMap.perspective&&glassContext.hasCapability("canUseMyDataSets")?"edit":"none");return v_sAction}function determineAction(v_oOpenSpec){var v_sAction,v_sCreateType,v_bAllowLegacy=!0;switch(v_oOpenSpec.actionId){case"com.ibm.bi.authoring.run":case"com.ibm.bi.contentApps.action.runAs":v_sAction="run";break;case"com.ibm.bi.authoring.createReportFromModule":case"com.ibm.bi.authoring.createReportFromPackage":v_sCreateType="report",v_sAction="edit";break;case"com.ibm.bi.datasets.createDataSetFromModule":case"com.ibm.bi.datasets.createDataSetFromPackage":v_sCreateType="dataSet2",v_sAction="edit";break;case"com.ibm.bi.authoring.convertToReport":v_sAction="edit",v_bAllowLegacy=!1;break;default:v_sAction=v_oOpenSpec.urlMap.action}var sObjectType=v_oOpenSpec.urlMap.cmProperties?v_oOpenSpec.urlMap.cmProperties.type:void 0;switch(sObjectType){case"reportVersion":case"output":v_sAction=v_oOpenSpec.glassContext.hasCapability("canUseCognosViewer")?"viewOutput":"none";break;default:switch(v_sAction){case"run":case"edit":case"viewOutput":(v_oOpenSpec.urlMap.isNew||!isReport_ish(v_oOpenSpec.urlMap.cmProperties))&&(v_sAction=v_oOpenSpec.glassContext.hasCapability("dataSet2"==v_sCreateType?"canUseMyDataSets":"canUseReportStudio")?"edit":"none"),"edit"!=v_sAction||"query"!=sObjectType&&"analysis"!=sObjectType||!v_bAllowLegacy||(v_sAction=LegacyUtils.canUseLegacyTool(v_oOpenSpec.glassContext,"query"==sObjectType?"QueryStudio":"AnalysisStudio")?"legacy":"run");break;case"default":case void 0:v_sAction=determineDefaultAction(v_oOpenSpec.actionId,v_oOpenSpec.urlMap.cmProperties,v_oOpenSpec.glassContext,v_oOpenSpec.urlMap),v_oOpenSpec.defaultAction=!0;break;default:v_sAction=null}}v_oOpenSpec.urlMap.action=v_sAction}function prepareUrlMap(v_oOpenSpec,v_oCmProperties){var urlMap=v_oOpenSpec.urlMap||{};rsCommon.convertStringQSToValues(urlMap,v_oOpenSpec.glassContext,v_oOpenSpec.trimURLParameterValues);var dataset=!1;switch(v_oOpenSpec.actionId){case"com.ibm.bi.datasets.createDataSetFromModule":case"com.ibm.bi.datasets.createDataSetFromPackage":urlMap.startingTemplate="DatasetList",dataset=!0,urlMap.isNew=!0;break;case"com.ibm.bi.contentApps.defaultAction.dataSet2":case"com.ibm.bi.datasets.editDataset":dataset=!0;break;case"com.ibm.bi.authoring.createReportFromModule":case"com.ibm.bi.authoring.createReportFromPackage":urlMap.isNew=!0;break;default:dataset=isDataSet2(v_oCmProperties)||!v_oCmProperties&&"datasets"==urlMap.perspective,urlMap.isNew=!isReport_ish(v_oCmProperties)}return loadCmProperties(urlMap,v_oCmProperties),urlMap.isApplication=isActiveReport(v_oCmProperties),!urlMap.perspective&&dataset&&(urlMap.perspective="datasets"),urlMap.UIProfile="datasets"==urlMap.perspective?"TitanDataset":"Titan",rsCommon.decodeAndMoveRSOptions(urlMap),v_oOpenSpec.urlMap=urlMap,determineAction(v_oOpenSpec),v_oOpenSpec}function convertToObjectFromCmOptionsArray(aCmOptions){if(!aCmOptions||!Array.isArray(aCmOptions))return aCmOptions;var oReturn={};return aCmOptions.forEach(function(oOption){"undefined"==typeof oReturn[oOption.name]?oReturn[oOption.name]=oOption.value:Array.isArray(oReturn[oOption.name])?oReturn[oOption.name].push(oOption.value):oReturn[oOption.name]=[oReturn[oOption.name],oOption.value]}),oReturn}function convertCmOptionsToSimpleArray(cmProperties){cmProperties.options=convertToObjectFromCmOptionsArray(cmProperties.options),cmProperties.base&&cmProperties.base.length>0&&cmProperties.base[0]&&(cmProperties.base[0].options=convertToObjectFromCmOptionsArray(cmProperties.base[0].options))}function getCMInfoForOpen(cmProperties,v_aProperties,glassContext){var deferred=Q.defer(),v_sReportViewUrl="v1/objects/"+cmProperties.id,v_aFields=[];v_aProperties.forEach(function(v_sField){v_aFields.push(v_sField)}),v_aFields.join(",");var v_sReportViewPropsUrl=v_sReportViewUrl.concat("?fields=",v_aFields.join(","));return glassContext.services.ajax.ajax({url:v_sReportViewPropsUrl,type:"GET",dataType:"json"}).fail(function(err){console.log("rsOpenHelper.getCMInfo ... FAILED"),deferred.reject(err)}).done(function(resp){if(!resp||!resp.data||resp.data.length<=0)return void rsCommon.reject(deferred,"unexpected response","rsOpenHelper.getCMInfoForOpen");var v_oData=resp.data[0];convertCmOptionsToSimpleArray(v_oData),convertCmOptionsToSimpleArray(cmProperties);var v_oCurrentCmProperties=cmProperties;for(var v_sProperty in v_oCurrentCmProperties)v_oCurrentCmProperties.hasOwnProperty(v_sProperty)&&void 0==v_oData[v_sProperty]&&(v_oData[v_sProperty]=v_oCurrentCmProperties[v_sProperty]);deferred.resolve(v_oData)}),deferred.promise}function f_determineMissingProperties(v_aProperties,v_oCmProperties){for(var v_aMissingProperties=[],len=v_aProperties.length,i=0;len>i;++i){var v_sProperty=v_aProperties[i];"undefined"==typeof v_oCmProperties[v_sProperty]&&v_aMissingProperties.push(v_sProperty)}return v_aMissingProperties}function extractProperties(v_aPropertiesSpec,type){var v_aProperties;if(v_aPropertiesSpec){v_aProperties=[];for(var idx=0;idx<v_aPropertiesSpec.length;++idx)type&&v_aPropertiesSpec[idx].type&&!v_aPropertiesSpec[idx].type.includes(type)||v_aProperties.push(v_aPropertiesSpec[idx].property)}return v_aProperties}function retreiveCMInfo(v_oCmProperties,glassContext,v_aPropertiesSpec){var deferred=Q.defer();if(v_oCmProperties&&v_oCmProperties.id&&!v_oCmProperties.type)return getType(v_oCmProperties.id,glassContext).then(function(v_sType){return v_oCmProperties.type=v_sType,retreiveCMInfo(v_oCmProperties,glassContext,v_aPropertiesSpec)});switch(v_oCmProperties?v_oCmProperties.type:"none"){case void 0:rsCommon.reject(deferred,"Missing properties or id","rsOpenHelper.retreiveCMInfo");break;case"none":deferred.resolve(void 0);break;case"output":var v_aRequestProperties=f_determineMissingProperties(extractProperties(v_aPropertiesSpec,"output")||m_aOutputProperties,v_oCmProperties);getCMInfoForOpen(v_oCmProperties,v_aRequestProperties,glassContext).then(function(v_oOutput){if(v_aPropertiesSpec)deferred.resolve(v_oOutput);else{var v_oCmProperties={id:v_oOutput.parent[0].id};getCMInfoForOpen(v_oCmProperties,m_aReportVersionProperties,glassContext).then(function(v_oVersion){v_oOutput.parent[0]=v_oVersion;var v_oCmProperties={id:v_oVersion.parent[0].id};getCMInfoForOpen(v_oCmProperties,["id","defaultName","type","base.type"],glassContext).then(function(v_oReport){v_oVersion.parent[0]=v_oReport,deferred.resolve(v_oOutput)})})}})["catch"](function(err){console.log("rsOpenHelper.retreiveCMInfo ... FAILED"),deferred.reject(err)});break;case"reportVersion":var v_aRequestProperties=f_determineMissingProperties(extractProperties(v_aPropertiesSpec,"reportVersion")||m_aReportVersionProperties,v_oCmProperties);getCMInfoForOpen(v_oCmProperties,v_aRequestProperties,glassContext).then(function(v_oVersion){if(v_aPropertiesSpec)deferred.resolve(v_oVersion);else{var v_oCmProperties={id:v_oVersion.parent[0].id};getCMInfoForOpen(v_oCmProperties,["id","defaultName","type","base.type"],glassContext).then(function(v_oReport){v_oVersion.parent[0]=v_oReport,deferred.resolve(v_oVersion)})}})["catch"](function(err){console.log("rsOpenHelper.retreiveCMInfo ... FAILED"),deferred.reject(err)});break;case"report":case"reportView":case"reportTemplate":case"interactiveReport":case"dataSet2":case"query":case"analysis":var v_aRequestProperties=f_determineMissingProperties(extractProperties(v_aPropertiesSpec,"report")||m_aProperties,v_oCmProperties),v_bNeedBase=!v_aPropertiesSpec&&"reportView"==v_oCmProperties.type;if(v_bNeedBase)for(var l=v_aRequestProperties.length,i=0;l>i;++i)v_aRequestProperties.push("base."+v_aRequestProperties[i]);else"report"!=v_oCmProperties.type||v_oCmProperties.metadataModelPackage&&v_oCmProperties.metadataModelPackage[0]&&v_oCmProperties.metadataModelPackage[0].effectiveUserCapabilities||v_aRequestProperties.push("metadataModelPackage.effectiveUserCapabilities");v_aRequestProperties.length>0?getCMInfoForOpen(v_oCmProperties,v_aRequestProperties,glassContext)["catch"](function(err){console.log("rsOpenHelper.retreiveCMInfo ... FAILED"),deferred.reject(err)}).then(function(v_oUpdatedCmProperties){deferred.resolve(v_oUpdatedCmProperties)}):deferred.resolve(v_oCmProperties);break;default:var v_aRequestProperties=f_determineMissingProperties(extractProperties(v_aPropertiesSpec,null)||["type","searchPath"],v_oCmProperties);v_aRequestProperties.length>0?getCMInfoForOpen(v_oCmProperties,v_aRequestProperties,glassContext)["catch"](function(err){console.log("rsOpenHelper.retreiveCMInfo ... FAILED"),deferred.reject(err)}).then(function(v_oUpdatedCmProperties){deferred.resolve(v_oUpdatedCmProperties)}):deferred.resolve(v_oCmProperties)}return deferred.promise}function isOutputFormatSupportedInAdvancedViewer(v_sOutputFormat){return-1!==["HTML","PDF","spreadsheetML","xlsxData","CSV","XML"].indexOf(v_sOutputFormat)}function isOutputForDownload(v_sOutputFormat){return-1!==["spreadsheetML","xlsxData","CSV","XML"].indexOf(v_sOutputFormat)}function getValueFromFieldIfDefined(v_o,v_sField){return v_o&&"undefined"!=typeof v_o[v_sField]&&null!==v_o[v_sField]?{value:v_o[v_sField]}:void 0}function getFirstValueFromArrayFieldIfDefined(v_o,v_sField){var o=getValueFromFieldIfDefined(v_o,v_sField);if(o){var a=o.value;if(!(a.length<1))return{value:Array.isArray(a)?a[0]:a}}}function determineRunInAdvancedViewer(v_oProperties){var o=getValueFromFieldIfDefined(v_oProperties,"runInAdvancedViewer");return o?o.value:!1}function isRunInAdvancedViewer(v_oOpenSpec,v_sFormat){var v_bRunInAdvancedViewer=!1,v_oCmProperties=v_oOpenSpec.urlMap.cmProperties;return determineRunInAdvancedViewer(v_oCmProperties&&v_oCmProperties.base?v_oCmProperties.base[0]:v_oCmProperties)&&(v_bRunInAdvancedViewer=!0),v_bRunInAdvancedViewer&&v_sFormat&&!isOutputFormatSupportedInAdvancedViewer(v_sFormat)&&(v_bRunInAdvancedViewer=!1),v_bRunInAdvancedViewer}function consolidateAndReconcileRunOptions(v_oOpenSpec){var urlMap=v_oOpenSpec.urlMap,v_oCmBaseProperties=urlMap.cmProperties&&urlMap.cmProperties.base?urlMap.cmProperties.base[0]:null,v_oCmProperties=urlMap.cmProperties||{},v_oPreferences=v_oOpenSpec.glassContext.services.userProfile.preferences;if(void 0==urlMap.format){var v_sFormat=v_oPreferences.format,o=getFirstValueFromArrayFieldIfDefined(v_oCmBaseProperties&&v_oCmBaseProperties.options,"outputFormat");o&&(v_sFormat=o.value||v_sFormat),o=getFirstValueFromArrayFieldIfDefined(v_oCmProperties.options,"outputFormat"),o&&(v_sFormat=o.value||v_sFormat),(isActiveReport(v_oCmProperties)||!rsCommon.isOutputFormatAllowed(v_sFormat,v_oOpenSpec.glassContext))&&(v_sFormat="HTML"),o=getValueFromFieldIfDefined(v_oOpenSpec.runOptions,"format"),o&&(v_sFormat=o.value||v_sFormat),urlMap.format=v_sFormat}if(void 0==urlMap.a11y){var v_bA11y=v_oPreferences.accessibilityFeatures,o=getValueFromFieldIfDefined(v_oCmBaseProperties&&v_oCmBaseProperties.options,"http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures");o&&(v_bA11y=o.value||v_bA11y),o=getValueFromFieldIfDefined(v_oCmProperties.options,"http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures"),o&&(v_bA11y=o.value||v_bA11y),urlMap.a11y=v_bA11y}if(void 0==urlMap.bidi&&(urlMap.bidi=v_oPreferences.biDirectionalFeaturesEnabled),urlMap.Download=isOutputForDownload(urlMap.format)?"true":"false",void 0==urlMap.prompt){var v_bPrompt;o=getValueFromFieldIfDefined(v_oCmBaseProperties&&v_oCmBaseProperties.options,"prompt"),o&&(v_bPrompt=o.value),o=getValueFromFieldIfDefined(v_oCmProperties.options,"prompt"),o&&(v_bPrompt=o.value),o=urlMap.m_oLaunchParameters&&urlMap.m_oLaunchParameters.RunOptions?getValueFromFieldIfDefined(urlMap.m_oLaunchParameters.RunOptions,"Prompt"):getValueFromFieldIfDefined(urlMap,"Prompt"),o&&(v_bPrompt="string"==typeof o.value?"true"===o.value:!!o.value),o=getValueFromFieldIfDefined(v_oOpenSpec.runOptions,"prompt"),o&&(v_bPrompt=o.value),urlMap.prompt=v_bPrompt}}function getActiveReportOutputURL(v_oCMProperties,v_oOutputProperties){var v_sReportId,v_sOutputId;return v_oOutputProperties?(v_sReportId=v_oCMProperties.id,v_sOutputId=v_oOutputProperties.id):"output"==v_oCMProperties.type?(v_sReportId=v_oCMProperties.parent[0].parent[0].id,v_sOutputId=v_oCMProperties.id):(v_sReportId=v_oCMProperties.id,v_sOutputId="default"),"v1/disp/repository/sid/cm/rid/"+v_sReportId+"/oid/"+v_sOutputId+"/content/mht/content"}function openUrlViaForm(sHref,bNewWindow){var v_nDrillForm;try{var v_sTarget="_self";if(bNewWindow&&(v_sTarget="rsTarget"+Date.now(),!window.open("",v_sTarget)))return!1;var v_aUrlParts=sHref.split("?");if(v_nDrillForm=document.body.appendChild(document.createElement("form")),v_nDrillForm.setAttribute("name","drillForm"),v_nDrillForm.setAttribute("method","post"),v_nDrillForm.setAttribute("action",decodeURIComponent(v_aUrlParts[0])),v_nDrillForm.setAttribute("target",v_sTarget),v_nDrillForm.style.display="none",2==v_aUrlParts.length)for(var v_aParams=v_aUrlParts[1].split("&"),i=0;i<v_aParams.length;i++){var v_aPair=v_aParams[i].split("="),v_nFormField=v_nDrillForm.appendChild(document.createElement("input"));v_nFormField.setAttribute("type","hidden"),v_nFormField.setAttribute("name",decodeURIComponent(v_aPair[0])),v_nFormField.setAttribute("value",decodeURIComponent(v_aPair[1]))}v_nDrillForm.submit()}catch(e){return v_nDrillForm&&document.body.removeChild(v_nDrillForm),!1}return document.body.removeChild(v_nDrillForm),!0}function launchViewSavedOutputApp(v_oOpenSpec,deferred){v_oOpenSpec.href?(openUrlViaForm(v_oOpenSpec.href,!0),deferred.resolve()):v_oOpenSpec.glassContext.openAppView(v_oOpenSpec.urlMap.perspective,{content:v_oOpenSpec.urlMap}).then(function(){deferred.resolve()})}function launchEditOrRunApp(v_oOpenSpec,deferred){var urlMap=v_oOpenSpec.urlMap;if("run"==urlMap.action&&urlMap.isApplication&&"classicviewer"==urlMap.perspective)return runActiveReportInNewWindow(urlMap).then(function(v_activeReportResult){deferred.resolve(v_activeReportResult)})["catch"](function(err){console.log("launchEditOrRunApp rejected"),deferred.reject(err)}),deferred.promise;if("authoring"==urlMap.perspective){var v_oRSParameters=rsCommon.createRSParameters(urlMap,v_oOpenSpec.glassContext),v_oIFrameTemplateParameters=rsCommon.createTemplateParameters(v_oRSParameters);urlMap.launchPromise=rsIFrameManager.F_LaunchRS(v_oIFrameTemplateParameters,v_oOpenSpec.glassContext),urlMap.m_oRSParameters=v_oRSParameters}v_oOpenSpec.glassContext.openAppView(urlMap.perspective,{content:urlMap}).fail(function(err){console.log(" rsOpenHelper.launchEditOrRunApp - openingAppView ... FAILED"),deferred.reject(err)}).done(function(v_oResult){deferred.resolve(v_oResult)})}function launchApp(v_oOpenSpec){var deferred=Q.defer();switch(v_oOpenSpec.urlMap.action){case"none":v_oOpenSpec.glassContext.showToast(StringResource.get("no_action_available"),{type:"warning",btnLabel:"OK"}),deferred.resolve();break;case"viewOutput":launchViewSavedOutputApp(v_oOpenSpec,deferred);break;case"run":case"edit":launchEditOrRunApp(v_oOpenSpec,deferred);break;case"legacy":var v_sLaunchUrl=getLegacyLaunchUrl(v_oOpenSpec);openUrlViaForm(v_sLaunchUrl,!0)?deferred.resolve():rsCommon.reject(deferred,"Could not launch a new tab.","rsOpenHelper.launchApp");break;default:rsCommon.reject(deferred,"Unexpected action "+v_oOpenSpec.urlMap.action+".","rsOpenHelper.launchApp")}return deferred.promise}function getSavedOutput(v_oGlassContext,v_oCmProperties,format,contentLocale){return"output"==v_oCmProperties.type?Q.resolve(v_oCmProperties):v_oGlassContext.getSvc(".Content").then(function(v_oContentSvc){var v_sFormatHint='"'+(format||"")+'"',v_sLocaleHint='"'+(contentLocale||"")+'"',v_sSearchPath='defaultOutput(storeID("'+v_oCmProperties.id+'"),'+v_sFormatHint+","+v_sLocaleHint+")",v_sCMQueryUrl=v_oContentSvc.getSearchPathUrl(v_sSearchPath)+"&fields=dataDescriptor,parent,locale,format,permissions,ancestors,lastPage";return v_oContentSvc.get(v_sCMQueryUrl,{}).then(function(v_oSavedOutputResp){if(v_oSavedOutputResp&&v_oSavedOutputResp.data&&v_oSavedOutputResp.data.length>0){var v_oOutput=v_oSavedOutputResp.data[0];if("reportVersion"==v_oCmProperties.type)return v_oOutput.parent[0]=v_oCmProperties,v_oOutput;var v_sCMQueryUrl=v_oContentSvc.getBaseObjectsURL()+"/"+v_oOutput.parent[0].id+"?fields=decoratedSpecification,id,parent";return v_oContentSvc.get(v_sCMQueryUrl,{}).then(function(v_oVersionResponse){var v_oVersion=v_oVersionResponse.data[0];return v_oVersion.parent[0]=v_oCmProperties,v_oOutput.parent[0]=v_oVersion,v_oOutput})}return null})})}function resolveUrlMapForSavedOutput(v_oOpenSpec){return v_oOpenSpec.urlMap.action?"viewOutput"!=v_oOpenSpec.urlMap.action?Q.resolve(v_oOpenSpec):getSavedOutput(v_oOpenSpec.glassContext,v_oOpenSpec.urlMap.cmProperties,v_oOpenSpec.urlMap.format,v_oOpenSpec.urlMap.contentLocale).fail(function(err){return Q.resolve(null)}).then(function(v_oOutput){if(v_oOutput&&"output"==v_oOutput.type&&"dataSet"!=v_oOutput.format){var v_bActiveReport=isActiveReport(v_oOutput),v_sActiveReportOutputHref=v_bActiveReport?getActiveReportOutputURL(v_oOutput):null;if(v_sActiveReportOutputHref&&(!v_oOutput.dataDescriptor||"interactive"!=v_oOutput.dataDescriptor.type))return v_oOpenSpec.href=v_sActiveReportOutputHref,Q.resolve(v_oOpenSpec);var v_oUrlMap=v_oOpenSpec.urlMap;return rsCommon.getAvailableOutputs(v_oOpenSpec.glassContext,v_oOutput).then(function(v_oSavedOutputFormats){if(!v_oSavedOutputFormats||!v_oSavedOutputFormats.data||v_oSavedOutputFormats.data.length<=0)return Q.reject(new Error("unexpected response for rsCommon.getAvailableOutputs"));v_oUrlMap.perspective="classicviewer",(v_oOutput.dataDescriptor&&"interactive"==v_oOutput.dataDescriptor.type||"PDF"==v_oOutput.format)&&(v_oUrlMap.perspective="authoring",v_oUrlMap.outputSpec=v_oOutput.parent[0].decoratedSpecification),v_oOpenSpec.glassContext.isEmbedded()&&(v_oUrlMap.perspective+="_embedded"),v_bActiveReport?delete v_oUrlMap.format:v_oUrlMap.format=v_oOutput.format||v_oUrlMap.format;for(var v_oOutputLookup={},i=0;i<v_oSavedOutputFormats.data.length;++i){var v_oAltOutput=v_oSavedOutputFormats.data[i];v_oAltOutput.locale==v_oOutput.locale&&(v_oOutputLookup[v_oAltOutput.format]=v_oAltOutput)}return v_oUrlMap.outputFormatLookup=v_oOutputLookup,v_oUrlMap.reportProperties={id:v_oOutput.parent[0].parent[0].id,type:v_oOutput.parent[0].parent[0].type},loadCmProperties(v_oUrlMap,v_oOutput),v_oUrlMap.objRef=v_oOutput.id,delete v_oUrlMap.pathRef,Q.resolve(v_oOpenSpec)})}var v_aPermissions=v_oOpenSpec.urlMap.cmProperties.permissions,v_sCmType=v_oOpenSpec.urlMap.cmProperties.type;switch(v_sCmType){case"query":case"analysis":if(-1!=v_aPermissions.indexOf("execute")){var v_bRead=-1!=v_aPermissions.indexOf("read"),v_bCapability=v_oOpenSpec.glassContext.hasCapability("query"==v_sCmType?"canUseQueryStudio":"canUseAnalysisStudio"),v_bTool=LegacyUtils.canUseLegacyTool(v_oOpenSpec.glassContext,"query"==v_sCmType?"QueryStudio":"AnalysisStudio");v_oOpenSpec.urlMap.action=v_bRead&&v_bCapability&&v_bTool?"legacy":"run"}else v_oOpenSpec.urlMap.action="none";break;default:v_oOpenSpec.urlMap.action="none",-1!=v_aPermissions.indexOf("execute")&&v_oOpenSpec.glassContext.hasCapability("canUseCognosViewer")&&(v_oOpenSpec.urlMap.action="run"),"none"==v_oOpenSpec.urlMap.action&&v_oOpenSpec.defaultAction&&-1!=v_aPermissions.indexOf("read")&&v_oOpenSpec.glassContext.hasCapability("canUseReportStudio")&&(v_oOpenSpec.urlMap.action="edit")}return Q.resolve(v_oOpenSpec)}):Q.reject()}function resolveUrlMapForEditRun(v_oOpenSpec){if("viewOutput"==v_oOpenSpec.urlMap.action)return Q.resolve(v_oOpenSpec);if(!v_oOpenSpec.urlMap.perspective)if(isDataSet2(v_oOpenSpec.urlMap.cmProperties))v_oOpenSpec.urlMap.perspective="datasets";else{var v_bRunInAdvancedViewer=isRunInAdvancedViewer(v_oOpenSpec,v_oOpenSpec.urlMap.format);v_oOpenSpec.urlMap.perspective=v_bRunInAdvancedViewer||"edit"==v_oOpenSpec.urlMap.action?"authoring":"classicviewer"}return v_oOpenSpec.glassContext.isEmbedded()&&(v_oOpenSpec.urlMap.perspective+="_embedded"),consolidateAndReconcileRunOptions(v_oOpenSpec),
- Q.resolve(v_oOpenSpec)}function resolveUrlMap(v_oOpenSpec){return retreiveCMInfo(v_oOpenSpec.cmProperties,v_oOpenSpec.glassContext).then(prepareUrlMap.bind(null,v_oOpenSpec)).then(resolveUrlMapForSavedOutput).then(resolveUrlMapForEditRun).then(function(v_oResolvedSpec){return v_oResolvedSpec.urlMap.rsResolved=!0,v_oResolvedSpec})}function processHref(sHref,deferred,glassContext){var v_oPerspective,v_oCurrentContentView=glassContext&&glassContext.currentAppView?glassContext.currentAppView.currentContentView:null;if(v_oCurrentContentView){if(v_oPerspective={perspective:v_oCurrentContentView.perspective,id:v_oCurrentContentView.id},!openUrlViaForm(sHref,!0))return void rsCommon.reject(deferred,"Could not launch a new tab.","rsOpenHelper.processHref")}else v_oPerspective={perspective:"home"},openUrlViaForm(sHref,!1);deferred.resolve(v_oPerspective)}var legacyUtils=null,m_aProperties=["ancestors","defaultDescription","defaultName","defaultPortalAction","id","modificationTime","options","owner","parent","permissions","routingServerGroup","runInAdvancedViewer","searchPath","format","type"],m_aOutputProperties=["ancestors","dataDescriptor","defaultName","burstKey","id","modificationTime","owner","parent","permissions","searchPath","type","format","locale","lastPage"],m_aReportVersionProperties=["decoratedSpecification","id","parent"];return{isReport_ish:isReport_ish,openView:function(v_oOpenSpec){var deferred=Q.defer();return resolveUrlMap(v_oOpenSpec).then(launchApp)["catch"](function(err){console.log("rsOpenHelper.openView ... FAILED"),deferred.reject(err)}).done(function(v_oLaunchResult){deferred.resolve(v_oLaunchResult)}),deferred.promise},retrieveCmProperties:function(v_oGlassContext,v_oCmProperties,v_sStoreId){var deferred=Q.defer();return v_sStoreId?(v_oCmProperties||(v_oCmProperties={}),v_oCmProperties.id||(v_oCmProperties.id=v_sStoreId),v_oCmProperties.id!=v_sStoreId&&(v_oCmProperties.id=v_sStoreId),retreiveCMInfo(v_oCmProperties,v_oGlassContext).done(function(cmProperties){deferred.resolve(cmProperties)})):deferred.resolve(v_oCmProperties),deferred.promise},getPerspective:function(v_oOpenSpec){var deferred=Q.defer();return v_oOpenSpec.urlMap?v_oOpenSpec.glassContext.getCoreSvc(".Config").getConfigValue("RS.TrimURLParameterValues").done(function(result){v_oOpenSpec.trimURLParameterValues="true"===result,resolveUrlMap(v_oOpenSpec)["catch"](function(err){console.log("rsOpenHelper.getPerspective ... FAILED"),deferred.reject(err)}).done(function(v_oOpenSpecResolved){if(v_oOpenSpecResolved)if(v_oOpenSpecResolved.urlMap&&"legacy"==v_oOpenSpecResolved.urlMap.action){if(v_oOpenSpec.urlMap.launchParametersKey){var v_oLaunchParameters=rsLaunchParameters.Retrieve(v_oOpenSpec.urlMap.launchParametersKey);delete v_oOpenSpec.urlMap.launchParametersKey,$.extend(!0,v_oOpenSpec.urlMap,v_oLaunchParameters)}processHref(getLegacyLaunchUrl(v_oOpenSpec),deferred,v_oOpenSpec.glassContext)}else v_oOpenSpecResolved.href?processHref(v_oOpenSpecResolved.href,deferred):deferred.resolve(v_oOpenSpecResolved.urlMap);else deferred.reject()})}.bind(this)):rsCommon.reject(deferred,"urlMap is missing","rsOpenHelper.getPerspective"),deferred.promise},determineDefaultAction:determineDefaultAction,resolveUrlMap:resolveUrlMap,updateCmProperties:function(v_oView,v_sStoreId){return delete v_oView.cmProperties,delete v_oView.reportProperties,this.retrieveCmProperties(v_oView.glassContext,null,v_sStoreId).then(function(v_oCmProperties){v_oView.cmProperties=v_oCmProperties,v_oView.id=v_oCmProperties.id,v_oView.type=v_oCmProperties.type;var v_oBaseReport;switch(v_oCmProperties.type){case"output":v_oBaseReport=v_oCmProperties.parent[0].parent[0];break;case"reportVersion":v_oBaseReport=v_oCmProperties.parent[0]}v_oBaseReport&&(v_oView.reportProperties={id:v_oBaseReport.id,type:v_oBaseReport.type})}.bind(this))},retreiveCMInfo:retreiveCMInfo}}),define("bi/authoring/utils/rsPerformance",["q"],function(Q){"use strict";var v_oRsPerformance={M_sPerformanceLogServerHost:void 0,M_sKitVersion:"no kit version",M_bKitVersionIsCached:!1,summarizeInteractiveViewerRun:function(v_oView){this._commonSummarize(v_oView,[{start:"rsContextMenuActions.onSelectItem",end:"rsContentView.render"},{start:"rsContentView.render",end:"rsContentView._onRSApplicationReady"},{start:"rsContentView._onRSApplicationReady",end:"rsContentView.onViewBeforeDraw"},{start:"rsContentView.onViewBeforeDraw",end:"rsContentView.onViewAfterDraw"},{start:"rsContextMenuActions.onSelectItem",end:"rsContentView.onViewAfterDraw"},{start:"authoring-selectItemAndDraw-start",end:"authoring-selectItemAndDraw-stop"}])},summarizeClassicViewerRun:function(v_oView){this._commonSummarize(v_oView,[{start:"rsContextMenuActions.onSelectItem",end:"cvContentView.render"},{start:"cvContentView.render",end:"cvContentView.getViewerConfiguration"},{start:"cvContentView.getViewerConfiguration",end:"cvContentView.onReportStatusComplete"},{start:"cvContentView.onReportStatusComplete",end:"cvContentView._onClassicViewerLoaded"},{start:"rsContextMenuActions.onSelectItem",end:"cvContentView._onClassicViewerLoaded"},{start:"authoring-selectItemAndDraw-start",end:"authoring-selectItemAndDraw-stop"}])},_commonSummarize:function(v_oView,v_aStartEndNames){try{if(this.getEntriesByName("rsContextMenuActions.onSelectItem","mark").length<1)return;v_aStartEndNames.forEach(function(v_o){var v_sName=v_o.start+"->"+v_o.end;try{this.measure(v_sName,v_o.start,v_o.end)}catch(e){}},this);for(var v_aPerformanceFields=["navigationStart","unloadEventStart","unloadEventEnd","redirectStart","redirectEnd","fetchStart","domainLookupStart","domainLookupEnd","connectStart","connectEnd","requestStart","responseStart","responseEnd","domLoading","domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","loadEventStart","loadEventEnd"],v_oPerformanceOut={timing:{}},iframe=v_oView.m_iframeAuthoring||v_oView.m_iframeClassicViewer,v_oPerformanceIn=iframe.contentWindow.performance,iPField=0;iPField<v_aPerformanceFields.length;++iPField){var v_sField=v_aPerformanceFields[iPField];void 0!==v_oPerformanceIn.timing[v_sField]&&(v_oPerformanceOut.timing[v_sField]=v_oPerformanceIn.timing[v_sField])}var v_oPerformanceSummary={userAgent:window.navigator.userAgent,urlPath:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")+window.location.pathname,reportName:v_oView.cmProperties.defaultName,date:Date.now(),measures:[],rsWindowPerformance:v_oPerformanceOut};if(this.getEntriesByType("measure").forEach(function(v_oEntry){console.info("rsperf: performance.measure %s %s ms",v_oEntry.name,v_oEntry.duration),v_oPerformanceSummary.measures.push({name:v_oEntry.name,duration:v_oEntry.duration})}),this.clearMeasures(),this.clearMarks(),this.M_sPerformanceLogServerHost){var qPromiseFromValueForLint=Q;Q.all([this.getKitVersion(v_oView.glassContext),this.getPerformanceUUID(v_oView.glassContext),qPromiseFromValueForLint(v_oPerformanceSummary),qPromiseFromValueForLint(v_oView.glassContext)]).then(function(v_aResults){this.sendPerformanceRecordToHost.apply(this,v_aResults)}.bind(this))["catch"](function(){console.info("rsperf: failed to get kit and uuid for logging")}).done(function(v_oResult){console.info("rsperf: _commonSummarized finished")})}else this.getKitVersion(v_oView.glassContext)["catch"](function(err){console.info("rsperf: error while getting kit version")}).done(function(version){console.info("rsperf: kit version %s (cached: %s)",version,this.M_bKitVersionIsCached.toString())}.bind(this))}catch(err){console.warn("_commonSummarize failed with an exception:\n%s",err&&err.toString()||"unknown err"),this.clearMeasures(),this.clearMarks()}},getKitVersion:function(v_oGlassContext){var deferred=Q.defer();return this.M_sKitVersion?(this.M_bKitVersionIsCached=!0,deferred.resolve(this.M_sKitVersion),deferred.promise):(v_oGlassContext.services.ajax.ajax({url:window.location.pathname+"cmplst.txt",type:"GET",dataType:"text"}).fail(function(err){console.warn("getKitVersion() failed "),this.M_sKitVersion="error cannot get kit version",deferred.reject(this.M_sKitVersion)}.bind(this)).done(function(resp){var v_aMatches=resp.match(/^kit_version=\s*((?:\d+.)+\d+)\s*$/m);v_aMatches?this.M_sKitVersion=v_aMatches[1]:this.M_sKitVersion="could not find kit version",deferred.resolve(this.M_sKitVersion)}.bind(this)),deferred.promise)},getPerformanceUUID:function(v_oGlassContext){var deferred=Q.defer();return v_oGlassContext.services.ajax.ajax({url:this.M_sPerformanceLogServerHost+"/_uuids",type:"GET",dataType:"json"}).fail(function(jqXHR,err){deferred.reject("uuid_failed")}).done(function(resp){deferred.resolve(resp.uuids[0])}),deferred.promise},sendPerformanceRecordToHost:function(v_sKit,v_sUuid,v_oRecord,v_oGlassContext){var deferred=Q.defer();return v_oRecord.kitVersion=v_sKit,v_oRecord.kitVersionCached=this.M_bKitVersionIsCached,v_oGlassContext.services.ajax.ajax({headers:{Accept:"application/json","Content-Type":"application/json"},url:this.M_sPerformanceLogServerHost+"/toddtest/"+v_sUuid,type:"PUT",data:JSON.stringify(v_oRecord)}).fail(function(err){console.log("error sendPerformanceRecordToHost: %s",err),deferred.reject(err)}).done(function(result){console.log("succeed sendPerformanceRecordToHost: %s",result),deferred.resolve(result)}),deferred.promise}};return["mark","measure","getEntriesByName","getEntriesByType","clearMeasures","clearMarks"].forEach(function(fname){window.performance[fname]?this[fname]=window.performance[fname].bind(window.performance):-1!=["getEntriesByName","getEntriesByType"].indexOf(fname)?this[fname]=function(){return[]}:this[fname]=function(){}},v_oRsPerformance),v_oRsPerformance}),define("bi/authoring/utils/rsShareHelper",["bi/authoring/utils/pat/rsPromptParameters","bi/authoring/utils/rsOpenHelper","bi/authoring/utils/rsCommon","jquery","q"],function(rsPromptParameters,OpenHelper,rsCommon,$,Q){"use strict";function createShareUrl(v_oOpenSpec,v_oCmProperties){var v_oUrlMap={};v_oOpenSpec&&v_oOpenSpec.contentView&&(v_oUrlMap=$.extend(v_oUrlMap,rsCommon.extractGlassSettings(v_oOpenSpec.contentView)));var v_sObjRef=v_oCmProperties.id;switch(v_oCmProperties.type){case"dataSet2":v_oUrlMap.objRef=v_sObjRef;break;case"output":v_oUrlMap.objRef=v_oCmProperties.burstKey?v_sObjRef:v_oCmProperties.parent[0].id;break;default:if(v_oUrlMap.objRef=v_sObjRef,"current"===v_oOpenSpec.mode&&v_oOpenSpec.glassContext.currentAppView){var v_oCurrentContentView=v_oOpenSpec.glassContext.currentAppView.currentContentView;if(v_oCurrentContentView)switch(v_oCurrentContentView.perspective){case"authoring":var v_oApplication=v_oCurrentContentView.getAuthoringApplication&&v_oCurrentContentView.getAuthoringApplication();if(v_oApplication)if(v_oApplication.SharedState.Get("isViewer")){v_oUrlMap.action="run";var v_sObjectType=v_oApplication.SharedState.Get("objectType");if("interactiveReport"!=v_sObjectType){var v_sViewer=v_oApplication.SharedState.Get("viewer");switch(v_sViewer.toUpperCase()){case"HTML":v_oUrlMap.format="HTML";break;case"PDF":v_oUrlMap.format="PDF"}}}else v_oUrlMap.action="edit";else v_oUrlMap.action=v_oCurrentContentView.action||(v_oCurrentContentView.isViewer?"run":"edit"),"edit"!=v_oUrlMap.action&&(v_oUrlMap.format=v_oCurrentContentView.format);break;case"classicviewer":v_oUrlMap.action="run";var v_sOutputFormat;v_sOutputFormat=v_oCurrentContentView.m_oRVFormParameters&&v_oCurrentContentView.m_oRVFormParameters["run.outputFormat"]?v_oCurrentContentView.m_oRVFormParameters["run.outputFormat"]:v_oCurrentContentView.format,v_oUrlMap.format=v_sOutputFormat||"HTML"}}}return v_oUrlMap}function retrievePromptParameters(v_oOpenSpec,v_oUrlMap){if("current"==v_oOpenSpec.mode&&v_oOpenSpec.glassContext.currentAppView){var v_oCurrentContentView=v_oOpenSpec.glassContext.currentAppView.currentContentView;if(v_oCurrentContentView){var v_oApplication=v_oCurrentContentView.getAuthoringApplication&&v_oCurrentContentView.getAuthoringApplication();if("classicviewer"==v_oCurrentContentView.perspective||v_oApplication&&v_oApplication.SharedState.Get("isViewer")){var v_aParameters=v_oCurrentContentView.getParameterValues(!0);v_aParameters&&v_aParameters.length>0&&(v_oUrlMap.prompt=!1,rsPromptParameters.rsBuildParameterUrl(v_oUrlMap,v_aParameters))}}}return v_oUrlMap}function buildShareUrl(v_oOpenSpec,v_oCmProperties){var v_oUrlMap=createShareUrl(v_oOpenSpec,v_oCmProperties);return retrievePromptParameters(v_oOpenSpec,v_oUrlMap)}function prepareShareUrlMap(v_oOpenSpec){var deferred=Q.defer();return OpenHelper.retreiveCMInfo(v_oOpenSpec.cmProperties,v_oOpenSpec.glassContext,M_aShareProperties).then(buildShareUrl.bind(null,v_oOpenSpec)).fail(function(err){console.log("OpenHelper.prepareShareUrlMap ... FAILED"),deferred.reject(err)}).done(function(v_oUrlMap){deferred.resolve(v_oUrlMap)}),deferred.promise}var M_aShareProperties=[{property:"id",type:null},{property:"type",type:null},{property:"burstKey",type:["output"]},{property:"parent",type:null}];return{getShareUrlMap:function(v_oOpenSpec){var deferred=Q.defer();return prepareShareUrlMap(v_oOpenSpec)["catch"](function(err){console.log("rsShareHelper.getShareUrlMap ... FAILED"),deferred.reject(err)}).done(function(v_oUrlMap){deferred.resolve(v_oUrlMap)}),deferred.promise},buildShareUrlMap:function(v_oContentView){var v_oCmProperties=v_oContentView.cmProperties,glassContext=v_oContentView.glassContext,v_oOpenSpec={mode:"current",glassContext:glassContext,contentView:v_oContentView};return buildShareUrl(v_oOpenSpec,v_oCmProperties)},isShareable:function(v_oCurrentContentView,v_bEmbed){var v_bShareable=!1;if(v_oCurrentContentView&&v_oCurrentContentView.canRun()){var v_oAuthoringApp=v_oCurrentContentView.getAuthoringApplication();"datasets"==v_oCurrentContentView.perspective?v_bShareable=!v_bEmbed:("classicviewer"==v_oCurrentContentView.perspective||v_oAuthoringApp&&v_oAuthoringApp.SharedState.Get("isViewer"))&&v_oAuthoringApp&&v_oAuthoringApp.SharedState.Get("storeID")&&(v_bShareable=!0)}return v_bShareable}}}),define("bi/authoring/rsContentView",["bi/glass/app/ContentView","jquery","q","bi/authoring/nls/StringResource","bi/commons/utils/Utils","bi/authoring/utils/rsCommon","bi/authoring/utils/rsOpenHelper","bi/authoring/utils/rsPerformance","bi/authoring/utils/rsIFrameManager","bi/authoring/utils/pat/rsLaunchParameters","bi/authoring/utils/pat/rsPromptParameters","bi/authoring/utils/rsShareHelper","bi/admin/common/utils/parameters/ParameterValues"],function(ContentView,$,Q,StringResource,Utils,rsCommon,rsOpenHelper,rsPerformance,rsIFrameManager,rsLaunchParameters,rsPromptParameters,rsShareHelper,ParameterValues){"use strict";function handleTruthyValueAlreadySetOrAddObserver(v_oApplication,v_sPropertyName,v_fnOnChangeCallback){v_oApplication.SharedState.Get(v_sPropertyName)?v_fnOnChangeCallback():v_oApplication.SharedState.AddObserver(v_sObserverId,v_sPropertyName,v_fnOnChangeCallback)}function handleTruthyValueAlreadySetAndAddObserver(v_oApplication,v_sPropertyName,v_fnOnChangeCallback){v_oApplication.SharedState.Get(v_sPropertyName)&&v_fnOnChangeCallback(),v_oApplication.SharedState.AddObserver(v_sObserverId,v_sPropertyName,v_fnOnChangeCallback)}var v_sObserverId="/authoring/js/rsContentView",v_aSpecModificationPluginIds=["com.ibm.bi.authoring.saveAsBtn","com.ibm.bi.authoring.undoBtn","com.ibm.bi.authoring.redoBtn","com.ibm.bi.authoring.toggleEditViewer"],rsContentView=ContentView.extend({init:function(options,appView){this.m_oLaunchPromise=options.launchPromise,delete options.launchPromise,rsCommon.decodeAndMoveCMProperties(options),rsCommon.convertStringQSToValues(options,options.glassContext),rsCommon.decodeAndMoveRSOptions(options),rsContentView.inherited("init",this,arguments),this.m_fOnWindowResize=this.syncIFrameSizeToView.bind(this),window.addEventListener("resize",this.m_fOnWindowResize,!1),this.m_oAppView=appView;var v_oAppViewFirstLoadedDeferred=Q.defer();this.m_oRemoveAppViewLoadedHandler=this.glassContext.getCoreSvc(".Events").on("appView:loaded",this._handleFirstAppViewOnLoaded.bind(this,v_oAppViewFirstLoadedDeferred),this),this.m_oAppViewFirstLoadedPromise=v_oAppViewFirstLoadedDeferred.promise,this.m_oRSParameters=this.m_oRSParameters||{};try{var v_oLaunchParameters=rsLaunchParameters.Retrieve(this.launchParametersKey);if(v_oLaunchParameters?this.m_oLaunchParameters=v_oLaunchParameters:window.parent&&this.launchParametersRef&&(this.m_oLaunchParameters=window.parent[options.launchParametersRef]),window.opener&&!window.opener.closed&&window.opener.RSParameters)if(this.isNemesis){var o=window.opener.RSParameters;for(var v_sAttrName in o)"reportXML"==v_sAttrName?(this.m_oRSParameters.useGlassReportXML=!0,this.m_sReportSpecFromOpener=o[v_sAttrName]):this.m_oRSParameters[v_sAttrName]=o[v_sAttrName];this.m_oRSParameters.useGlassReportXML&&(this.m_oRSParameters.model=""),o.AppOnLoad&&(this.AppOnLoad=window.opener[o.AppOnLoad])}else if(!this.m_oLaunchParameters&&!this.isHomepage){var v_oSrcParameters=window.opener.RSParameters;window.opener.RSParameters=void 0,this.startingTemplate=v_oSrcParameters.startingTemplate,this.moduleId=v_oSrcParameters.module,this.isViewer=v_oSrcParameters.isViewer,this.m_oLaunchParameters=rsLaunchParameters.Retrieve(v_oSrcParameters.launchParametersKey),this.moduleId&&!this.moduleSearchPath&&this.startingTemplate&&(this.m_bIsTryIt=!0,this.moduleSearchPath='storeID("'+this.moduleId+'")',this.action="run",console.log("rsContentView.init() - launched from try it setting module search path "+this.m_oRSParameters.moduleSearchPath))}}catch(e){console.log("rsContentView.init() - Call to window.opener failed, assume it doesn't exist")}this.m_bDisableRsLockUnlock=!1,this.m_bFullyInitialized=!1},_postInit:function(){if(!this.m_bFullyInitialized){this.m_bFullyInitialized=!0;var options=this;options.parameterValuesJSON&&(options.parameterValuesXML=rsPromptParameters.rsBuildPromptParameters(void 0,options.parameterValuesJSON),delete options.parameterValuesJSON),this.m_oLaunchPromise||$.extend(this.m_oRSParameters,rsCommon.createRSParameters(options,this.glassContext)),this.m_bNewlyCreatedReport=this.m_oRSParameters.reportStoreID?!1:!0,options.isSlideout&&(this.m_bDisableRsLockUnlock=!0),this.m_oLaunchParameters&&this.m_oLaunchParameters.RunOptions&&(this.m_oRSParameters.rsFinalRunOptions||(this.m_oRSParameters.rsFinalRunOptions={}),this.m_oLaunchParameters.RunOptions.OutputFormat&&(this.m_oRSParameters.rsFinalRunOptions.format=this.m_oLaunchParameters.RunOptions.OutputFormat),this.m_oLaunchParameters.RunOptions.isApplication&&(this.m_oRSParameters.rsFinalRunOptions.isApplication=this.m_oLaunchParameters.RunOptions.isApplication),this.m_oLaunchParameters.RunOptions.globalParameters&&(this.m_oRSParameters.rsFinalRunOptions.globalParameters=this.m_oLaunchParameters.RunOptions.globalParameters)),this.m_bInitialIsViewerState=this.m_oRSParameters.isViewer,this.m_oLaunchParameters&&this.m_oLaunchParameters.parameterValuesJSON&&(this.m_oLaunchParameters.parameterValuesXML=rsPromptParameters.rsBuildPromptParameters(void 0,this.m_oLaunchParameters.parameterValuesJSON),delete this.m_oLaunchParameters.parameterValuesJSON)}},render:function(){if(this.rsResolved)return this._render();!this.cmProperties&&this.objRef&&(this.cmProperties={id:this.objRef,type:this.type});var v_oOpenSpec={cmProperties:this.cmProperties,glassContext:this.glassContext,urlMap:this};return rsOpenHelper.resolveUrlMap(v_oOpenSpec).then(function(v_oResolvedOpenSpec){return $.extend(this,v_oResolvedOpenSpec.urlMap),this._render()}.bind(this))},_render:function(){this._postInit();var $renderDeferred=$.Deferred();if(this.m_oRSParameters.closePerspective||"none"==this.action){var v_oState={isViewer:!0,objectType:"",runInAdvancedViewer:!0};if(this._updatePlugins(v_oState),this.m_oRSParameters.closePerspective){var v_sError=StringResource.get("no_output_format_capability",{outputFormat:this.m_oRSParameters.rsFinalRunOptions.format});$renderDeferred.reject({message:v_sError})}else{var v_sError=StringResource.get("no_action_available");this.glassContext.showToast(v_sError,{type:"warning",btnLabel:"OK",callback:function(){this.glassContext.closeAppView("authoring",this.id)}.bind(this)}),$renderDeferred.resolve()}return $renderDeferred.promise()}if(rsPerformance.mark("rsContentView.render"),console.timeEnd("rsperf: onSelectItem->render"),console.time("rsperf: render->OnRSApplicationReadyForObservers"),$renderDeferred.resolve(this),this.m_oAppView.$(".navbar").addClass("narrow"),!this.m_oLaunchPromise){var v_oTemplateParameters=rsCommon.createTemplateParameters(this.m_oRSParameters);this.m_oLaunchPromise=rsIFrameManager.F_LaunchRS(v_oTemplateParameters,this.glassContext,this.m_oLaunchParameters)}this.m_oLaunchPromise["catch"](function(err){console.log(err),this.hackUnlockGlass(),$renderDeferred.reject(err)}.bind(this)).done(this._onRSApplicationReady.bind(this,$renderDeferred));var v_oState={isViewer:this.m_bInitialIsViewerState,objectType:"",runInAdvancedViewer:this.m_bNewlyCreatedReport};this.cmProperties&&(v_oState.objectType=this.cmProperties.type,this.cmProperties.runInAdvancedViewer&&(v_oState.runInAdvancedViewer=!0)),this._updatePlugins(v_oState);var v_oGlassActionToInstrumentationEventType={run:"Ran Process",viewOutput:"Read Object",edit:"Read Object",create:"Created Object"},v_sInstrumentationType=v_oGlassActionToInstrumentationEventType[this.action];if(v_sInstrumentationType&&this.glassContext){var v_oInstrumentationService=this.glassContext.getCoreSvc(".Instrumentation");if(v_oInstrumentationService&&v_oInstrumentationService.enabled){var v_sType,v_sId;if("output"==this.type&&this.cmProperties){var v_oVersionedAncestor=this.cmProperties.parent[0].parent[0];v_oVersionedAncestor=v_oVersionedAncestor.base||v_oVersionedAncestor,v_sType=v_oVersionedAncestor.type,v_sId=v_oVersionedAncestor.id}else v_sType=this.type,v_sId=this.id;v_sInstrumentationType===v_oGlassActionToInstrumentationEventType.edit&&this.isNew&&(v_sInstrumentationType=v_oGlassActionToInstrumentationEventType.create,v_sId="null",v_sType||(v_sType="report"));var v_oEvent={type:v_sInstrumentationType,objectType:v_sType,object:v_sId,milestoneName:v_sInstrumentationType+"_"+v_sType};v_sInstrumentationType===v_oGlassActionToInstrumentationEventType.run&&(v_oEvent.processType="Run a Report"),-1!==[v_oGlassActionToInstrumentationEventType.run,v_oGlassActionToInstrumentationEventType.viewOutput].indexOf(v_sInstrumentationType)&&(v_oEvent["custom.viewer"]="interactive",v_oEvent["custom.outputFormat"]=this.format),v_oInstrumentationService.track(v_oEvent)}}return this.hackLockGlass(),$renderDeferred.promise()},getTitle:function(){return this.isApplicationLoaded()?this.getAuthoringApplication().SharedState.Get("reportName"):StringResource.get("datasets"==this.perspective?"dataset_welcome":"authoring_welcome")},getIcon:function(){var v_sIcon;if("datasets"==this.perspective)v_sIcon="common-dataset";else{var v_sReportType=this.getAuthoringApplication()&&this.getAuthoringApplication().SharedState.Get("objectType");switch(v_sReportType){case"interactiveReport":v_sIcon="common-interactiveReport";break;case"reportView":v_sIcon="common-report_view";break;default:v_sIcon="common-report"}}return v_sIcon},getIconTooltip:function(){return StringResource.get("datasets"==this.perspective?"dataset_welcome":"authoring_welcome")},getType:function(){var v_sObjectType;return this.isApplicationLoaded()&&(v_sObjectType=this.getAuthoringApplication().SharedState.Get("objectType")),v_sObjectType},isDirty:function(){var v_oSharedState=this.getAuthoringApplication()?this.getAuthoringApplication().SharedState:null,v_sObjectType=v_oSharedState?v_oSharedState.Get("objectType"):"";if("reportView"==v_sObjectType||this.isNemesis||!this.isApplicationLoaded()||this.m_bIsTryIt)return!1;var v_bIsModified=v_oSharedState&&v_oSharedState.Get("isModified"),v_bIsViewer=v_oSharedState&&v_oSharedState.Get("isViewer");if(v_bIsModified&&v_bIsViewer){var v_bRead=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("read"),v_bWrite=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("write"),v_bSaveAsCapabilities=this.glassContext.hasCapability("canUseReportStudio")&&this.glassContext.hasCapability("canUseReportStudioFileManagement");v_bRead&&(v_bWrite||v_bSaveAsCapabilities)||(v_bIsModified=!1)}return v_bIsModified},getAuthoringApplication:function(){return rsCommon.getAuthoringApplicationFromIFrame(this.m_iframeAuthoring)},isApplicationLoaded:function(){var v_Application=this.getAuthoringApplication();return!(!v_Application||!v_Application.SharedState.Get("isAppLoaded"))},canRun:function(){var v_oAuthoringApp=this.getAuthoringApplication();return v_oAuthoringApp.SharedState.Get("canRun")},getContent:function(options){return rsCommon.getContent(options,this,rsShareHelper)},getApplicationContent:function(v_oContent,v_oCmProperties){var application={};if(this.isApplicationLoaded()){var v_oAuthoringApp=this.getAuthoringApplication(),v_sStoreID=v_oAuthoringApp.SharedState.Get("storeID");application.storeID=v_sStoreID,application.isModified=v_oAuthoringApp.SharedState.Get("isModified"),application.cmSearchPath=v_oAuthoringApp.SharedState.Get("cmSearchPath"),application.reportName=this.getTitle(),v_oCmProperties||(console.log("rsContentView.getContent no .cmProperties"),v_oCmProperties={type:void 0});var v_sType=v_oContent.objRef&&v_oContent.type||v_oCmProperties&&v_oCmProperties.type;"reportTemplate"===v_sType||"dataSet2"===v_sType?application.type=v_sType:v_oAuthoringApp.SharedState.Get("isActiveReport")?application.type="interactiveReport":application.type="report"}return application},onAppLoaded:function(){var v_Application=this.getAuthoringApplication();this.m_oAppViewFirstLoadedPromise.done(function(){rsIFrameManager.F_PositionAndSizeIFrame(this.$el,this.m_iframeAuthoring),this.hackUnlockGlass(),handleTruthyValueAlreadySetAndAddObserver(v_Application,"reportName",this.updateTitle.bind(this)),handleTruthyValueAlreadySetOrAddObserver(v_Application,"isReportLoaded",this._on_isReportLoaded.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"isViewer",this._on_isViewer.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"isActiveReport",this._on_isActiveReport.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"runInAdvancedViewer",this._on_runInAdvancedViewer.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"viewer",this._on_viewer.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"isModified",this._on_isModified.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"storeID",this._on_storeID.bind(this)),this.onSavedCallback&&(v_Application.SharedState.AddObserver(null,"onDatasetSaved",this.onSavedCallback),delete this.onSavedCallback),this.onCancelCallback&&(v_Application.SharedState.AddObserver(null,"onDatasetCancelled",this.onCancelCallback),delete this.onCancelCallback),handleTruthyValueAlreadySetOrAddObserver(v_Application,"firstBeforeDraw",this.onViewBeforeFirstDraw.bind(this)),handleTruthyValueAlreadySetOrAddObserver(v_Application,"firstAfterDraw",this.onViewAfterFirstDraw.bind(this)),this.isNew&&!rsOpenHelper.isReport_ish(this.cmProperties)&&delete this.cmProperties}.bind(this))},onViewBeforeFirstDraw:function(){console.time("rsperf: ViewBeforeDraw->ViewAfterDraw"),rsPerformance.mark("rsContentView.onViewBeforeDraw")},onViewAfterFirstDraw:function(){rsPerformance.mark("rsContentView.onViewAfterDraw"),rsPerformance.mark("authoring-selectItemAndDraw-stop"),console.timeEnd("rsperf: ViewBeforeDraw->ViewAfterDraw"),console.timeEnd("rsperf: total_RunReport"),this.glassContext&&this.glassContext.isDevInstall&&this.glassContext.isDevInstall()&&rsPerformance.summarizeInteractiveViewerRun(this);var v_Application=this.getAuthoringApplication();this.m_oLaunchParameters&&this.m_oLaunchParameters.promptContext||!v_Application.GetUserDataSetting("PreLaunchRS")||rsIFrameManager.F_PreLaunch(this.glassContext)},enablePluginForApplicationState:function(v_oOption){var v_oState=this.getAuthoringApplication().SharedState.Get(v_oOption.state);this._setEnableForPlugins(v_oState,[v_oOption.plugin])},highlightPluginForApplicationState:function(v_oOption){var v_oState=this.getAuthoringApplication().SharedState.Get(v_oOption.state),v_oPlugin=this.glassContext.findPlugin(v_oOption.plugin);v_oPlugin?v_oState?(console.log("rsContentView press %s",v_oOption.plugin),v_oPlugin.setPressed()):(console.log("rsContentView unpress %s",v_oOption.plugin),v_oPlugin.setUnpressed()):console.log("rsContentView highlightPluginForApplicationState - could not find plugin: %s",v_oOption.plugin)},showPluginForApplicationState:function(v_oOption){var v_oPlugin=this.glassContext.findPlugin(v_oOption.plugin);if(v_oPlugin){var v_oState=this.getAuthoringApplication().SharedState.Get(v_oOption.state);v_oState?v_oPlugin.show():v_oPlugin.hide()}else console.log("rsContentView showPluginForApplicationState - could not find plugin: %s",v_oOption.plugin)},_setDisplayForPlugins:function(v_bShow,v_aPluginIds){v_aPluginIds.forEach(function(v_sPluginId){var v_oPlugin=this._hackFindPlugin(v_sPluginId);v_oPlugin?v_bShow?v_oPlugin.show():v_oPlugin.hide():console.log("could not find plugin: %s",v_sPluginId)},this)},_setEnableForPlugins:function(v_bEnable,v_aPluginIds){v_aPluginIds.forEach(function(v_sPluginId){var v_oPlugin=this._hackFindPlugin(v_sPluginId);v_oPlugin?v_bEnable?v_oPlugin.enable():v_oPlugin.disable():console.log("could not find plugin: %s",v_sPluginId)},this)},_updatePlugins:function(v_oState){var v_aEditIds=["com.ibm.bi.authoring.runMenu","com.ibm.bi.authoring.insertableObjectsBtn"],v_aViewerIds=["com.ibm.bi.authoring.runBtn","com.ibm.bi.authoring.refreshBtn","com.ibm.bi.authoring.consumptionFilter","com.ibm.bi.contentApps.teamFoldersSlideout","com.ibm.bi.contentApps.myContentFoldersSlideout","com.ibm.bi.search.search","com.ibm.bi.contentApps.mruSlideout"];if(this.m_bIsTryIt)this._setDisplayForPlugins(!1,v_aViewerIds),this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.saveAsBtn","com.ibm.bi.authoring.outputBtn","com.ibm.bi.authoring.runMenu"]);else if("output"==v_oState.objectType){var v_bRun=-1!=this.cmProperties.permissions.indexOf("execute");this._setDisplayForPlugins(v_bRun,["com.ibm.bi.authoring.outputBtn"]),this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.runBtn","com.ibm.bi.authoring.insertableObjectsBtn","com.ibm.bi.authoring.runMenu","com.ibm.bi.authoring.refreshBtn","com.ibm.bi.authoring.consumptionFilter","com.ibm.bi.authoring.saveAsBtn","com.ibm.bi.authoring.undoBtn","com.ibm.bi.authoring.redoBtn"])}else"reportView"==v_oState.objectType&&this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.saveAsBtn"]),this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.outputBtn"]),this._setDisplayForPlugins(!v_oState.isViewer,v_aEditIds),this._setDisplayForPlugins(v_oState.isViewer,v_aViewerIds),v_oState.isViewer||this._setDisplayForPlugins(!1,["com.ibm.bi.contentApps.customFoldersSlideout"]),v_oState.isViewer&&"PDF"==this.m_oRSParameters.rsFinalRunOptions.format&&this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.consumptionFilter"]),this._setDisplayForPlugins(!(v_oState.isViewer&&v_oState.isFromRS),["com.ibm.bi.glass.common.operations"]);var v_bRead=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("read"),v_bCanToggleEditView=this.glassContext.hasCapability("canUseReportStudio")&&"report"==v_oState.objectType&&v_oState.runInAdvancedViewer&&!v_oState.useReadOnlyViewer&&!this.m_bIsTryIt&&!(v_oState.isViewer&&v_oState.isFromRS)&&(!v_oState.isViewer||v_bRead);"interactiveReport"==v_oState.objectType&&this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.consumptionFilter","com.ibm.bi.authoring.refreshBtn","com.ibm.bi.authoring.outputBtn"]),this.getAuthoringApplication()?(v_oState.isViewer||this.getAuthoringApplication().SharedState.Set(null,"showFilters",!1),this.getAuthoringApplication().SharedState.Set(null,"canToggleEditView",v_bCanToggleEditView)):this._setDisplayForPlugins(!1,["com.ibm.bi.authoring.toggleEditViewer"]);
- },_updatePluginsForNewState:function(){var v_oState={isViewer:this.getAuthoringApplication().SharedState.Get("isViewer"),objectType:this.getAuthoringApplication().SharedState.Get("objectType"),runInAdvancedViewer:this.getAuthoringApplication().SharedState.Get("runInAdvancedViewer"),useReadOnlyViewer:this.getAuthoringApplication().SharedState.Get("useReadOnlyViewer")};this.m_oLaunchParameters&&this.m_oLaunchParameters.RunOptions&&1==this.m_oLaunchParameters.RunOptions.isFromRS&&(v_oState.isFromRS=!0),this._updatePlugins(v_oState)},_on_isViewer:function(){this._updatePluginsForNewState()},_on_isActiveReport:function(){this._updatePluginsForNewState()},_on_runInAdvancedViewer:function(){this._updatePluginsForNewState()},_on_viewer:function(){var v_Application=this.getAuthoringApplication();this._setDisplayForPlugins("HTML"==v_Application.SharedState.Get("viewer").toUpperCase(),v_aSpecModificationPluginIds),this._updatePluginsForNewState(),this._updateButtonState()},_on_storeID:function(){var v_Application=this.getAuthoringApplication(),v_sStoreId=v_Application.SharedState.Get("storeID");!v_sStoreId||this.cmProperties&&v_sStoreId==this.cmProperties.id||rsOpenHelper.updateCmProperties(this,v_sStoreId).then(function(){this._updatePluginsForNewState(),this.glassContext.updateCurrentCachedAppView()}.bind(this))},_updateButtonState:function(){var v_Application=this.getAuthoringApplication(),v_aStateAndPlugin=[{state:"canUndo",plugin:"com.ibm.bi.authoring.undoBtn"},{state:"canRedo",plugin:"com.ibm.bi.authoring.redoBtn"},{state:"canRun",plugin:"com.ibm.bi.authoring.runBtn"},{state:"canRun",plugin:"com.ibm.bi.authoring.runMenu"},{state:"canRun",plugin:"com.ibm.bi.authoring.refreshBtn"}];v_aStateAndPlugin.forEach(function(v_o){this.enablePluginForApplicationState(v_o),v_Application.SharedState.AddObserver(v_sObserverId,v_o.state,this.enablePluginForApplicationState.bind(this,v_o))},this)},_on_isReportLoaded:function(){var v_Application=this.getAuthoringApplication();if(v_Application.SharedState.Get("useReadOnlyViewer")){this._setDisplayForPlugins(!1,v_aSpecModificationPluginIds);var v_oStateAndPlugin={state:"canRun",plugin:"com.ibm.bi.authoring.runBtn"};this.enablePluginForApplicationState(v_oStateAndPlugin),v_Application.SharedState.AddObserver(v_sObserverId,v_oStateAndPlugin.state,this.enablePluginForApplicationState.bind(this,v_oStateAndPlugin))}else{this._updateButtonState();var v_aLeftSideStateAndPlugin=[{state:"showInsertableObjects",plugin:"com.ibm.bi.authoring.insertableObjectsBtn"}];v_aLeftSideStateAndPlugin.forEach(function(v_o){this.highlightPluginForApplicationState(v_o),v_Application.SharedState.AddObserver(v_sObserverId,v_o.state,this.highlightPluginForApplicationState.bind(this,v_o))},this);var v_sToggleEditPluginId="com.ibm.bi.authoring.toggleEditViewer",v_oToggleEditButtonPlugin=this._hackFindPlugin(v_sToggleEditPluginId);if(v_oToggleEditButtonPlugin){var v_bIsViewer=v_Application.SharedState.Get("isViewer");v_bIsViewer?v_oToggleEditButtonPlugin.setUnpressed():v_oToggleEditButtonPlugin.setPressed(),this._updateToggleEditView(),v_Application.SharedState.AddObserver(v_sObserverId,"canToggleEditView",this._updateToggleEditView.bind(this)),v_Application.SharedState.AddObserver(v_sObserverId,"canEditReport",this._updateToggleEditView.bind(this))}else console.log("could not find plugin: %s",v_sToggleEditPluginId)}this._updatePluginsForNewState();var v_oMRU,v_oDummyCmProperties={type:this.type};rsOpenHelper.isReport_ish(v_oDummyCmProperties)?this.objRef?(v_oMRU={},v_oMRU.id=this.objRef,v_oMRU.type=this.getAuthoringApplication().SharedState.Get("objectType"),v_oMRU.defaultName=this.getAuthoringApplication().SharedState.Get("reportName")):this.cmProperties&&(v_oMRU=$.extend(!0,{},this.cmProperties)):this.reportProperties&&(v_oMRU=$.extend(!0,{},this.reportProperties)),v_oMRU&&this._addToMRU(v_oMRU),this.updateTitle()},_addToMRU:function(mruEntry){return this.glassContext.getSvc(".Content").then(function(contentSvc){return contentSvc.addToMRU(mruEntry)})},_updateToggleEditView:function(){var v_Application=this.getAuthoringApplication();if(v_Application.SharedState.Get("canToggleEditView")&&v_Application.SharedState.Get("canEditReport")){var v_oPlugin=this.glassContext.findPlugin("com.ibm.bi.authoring.toggleEditViewer");v_oPlugin&&v_oPlugin.show()}},_on_isModified:function(){var v_oSharedState=this.getAuthoringApplication().SharedState,v_bCantSaveModified=!1,v_bIsModified=v_oSharedState.Get("isModified");if(v_bIsModified&&v_oSharedState.Get("isViewer")){var v_bRead=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("read"),v_bWrite=!this.cmProperties||!this.cmProperties.permissions||-1!=this.cmProperties.permissions.indexOf("write"),v_bSaveAsCapabilities=this.glassContext.hasCapability("canUseReportStudio")&&this.glassContext.hasCapability("canUseReportStudioFileManagement");v_bCantSaveModified=!v_bRead||!v_bWrite&&!v_bSaveAsCapabilities}v_bCantSaveModified?(this.glassContext.showToast(this.getAuthoringApplication().GetString("IDS_MSG_EDITS_LOST"),{type:"info"}),this._setEnableForPlugins(!1,["com.ibm.bi.authoring.saveAsBtn"])):this._setEnableForPlugins(!0,["com.ibm.bi.authoring.saveAsBtn"]),this.trigger("change:dirty",{value:v_bIsModified})},updateTitle:function(){var v_sReportName=this.getAuthoringApplication().SharedState.Get("reportName");this.trigger("change:title",{value:v_sReportName})},_addGlassBodyObserver:function(){void 0===this.m_bIsIE&&(this.m_bIsIE=(-1!=navigator.userAgent.toLowerCase().search(/trident\/([0-9]+\.[0-9]+)/)?parseFloat(RegExp.$1):0)>=7),this.m_bIsIE&&(this.m_oBodyObserver=new MutationObserver(function(){var v_aClasses=["openedMenu","openedSlideout","openedAppViewSlideout","openedDialog"];v_aClasses.some(function(s){return this.contains(s)},document.body.classList)?this.m_iframeAuthoring.contentDocument.body.classList.add("clsGlassUiDisplayed"):this.m_iframeAuthoring.contentDocument.body.classList.remove("clsGlassUiDisplayed")}.bind(this)),this.m_oBodyObserver.observe(document.body,{attributes:!0,attributeFilter:["class"]}))},_removeGlassBodyObserver:function(){this.m_oBodyObserver&&(this.m_oBodyObserver.disconnect(),this.m_oBodyObserver=null)},show:function(){rsContentView.inherited("show",this,arguments),this.m_iframeAuthoring&&(setTimeout(rsIFrameManager.F_PositionAndSizeIFrame.bind(rsIFrameManager,this.$el,this.m_iframeAuthoring),0),this.getAuthoringApplication().Activate()),this._addGlassBodyObserver()},deactivate:function(){this._removeGlassBodyObserver(),this.m_iframeAuthoring&&(this.getAuthoringApplication().Deactivate(),rsIFrameManager.F_HideIFrame(this.m_iframeAuthoring))},remove:function(){var v_oApplication=this.getAuthoringApplication();return this.m_bIsTryIt&&v_oApplication.DeleteTempModule(this.moduleId),this.m_fOnWindowResize&&(window.removeEventListener("resize",this.m_fOnWindowResize,!1),this.m_fOnWindowResize=null),this.m_oRemoveAppViewLoadedHandler&&(this.m_oRemoveAppViewLoadedHandler.remove(),this.m_oRemoveAppViewLoadedHandler=void 0),this.m_iframeAuthoring&&(rsIFrameManager.F_DetachIFrame(this.m_iframeAuthoring),this.m_iframeAuthoring=null),this.m_oLaunchPromise=null,this.m_oAppView=null,!0},isMenuItemVisible:function(context){if(!this.getAuthoringApplication())return!0;var v_sMenuItem=context.target.itemId;if(v_sMenuItem){var v_oCurrentContentView=context.glassContext.currentAppView.currentContentView,v_bIsViewer=this.getAuthoringApplication().SharedState.Get("isViewer");switch(v_sMenuItem){case"com.ibm.bi.share.subscribe":if(!v_bIsViewer||!rsShareHelper.isShareable(v_oCurrentContentView,!1))return!1;break;case"com.ibm.bi.glass.common.setHome":if(!v_bIsViewer||!rsShareHelper.isShareable(v_oCurrentContentView,!1)||this.getAuthoringApplication().SharedState.Get("isActiveReport"))return!1}}return!0},addPdfCssPositionStyling:function(v_sPositionStyle){this.$el[0].style.position=v_sPositionStyle},removePdfCssPositionStyling:function(){this.$el[0].style.position=""},_onRSApplicationReady:function(v_oContentViewDeferred,v_idIFrameAuthoring){this.m_iframeAuthoring=document.getElementById(v_idIFrameAuthoring),console.timeEnd("rsperf: render->OnRSApplicationReadyForObservers"),rsPerformance.mark("rsContentView._onRSApplicationReady");var v_oApplication=this.getAuthoringApplication();this.glassContext.getCoreSvc(".UserProfile").getCapabilities().then(function(v_aCapabilities){v_oApplication.SetGlassInfo({glassView:this,glassContext:this.glassContext,launchParameters:this.m_oLaunchParameters,capabilities:v_aCapabilities}),handleTruthyValueAlreadySetOrAddObserver(v_oApplication,"isAppLoaded",this.onAppLoaded.bind(this)),v_oContentViewDeferred.resolve(this)}.bind(this))},_onRsLaunchError:function(v_oDeferred){console.log("rsContentView._onRsLaunchError(). "),this.hackUnlockGlass(),v_oDeferred.reject(new Error("rsContentView: error during iframe load"))},_hackFindPlugin:function(id){return rsCommon._hackFindPlugin(this.m_oAppView,id)},hackLockGlass:function(){this.m_bDisableRsLockUnlock||rsCommon.hackLockGlass(this.m_oAppView)},hackUnlockGlass:function(){this.m_bDisableRsLockUnlock||rsCommon.hackUnlockGlass(this.m_oAppView)},getReportSpec:function(){return this.m_sReportSpecFromOpener},launchInExploration:function(v_nReport,v_aSelectionIids,v_sReportSpec,v_sExploreStoreID){return require(["bi/authoring/utils/V5ToDashboard"],function(V5ToDashboard){var v_oAuthoringApp=this.getAuthoringApplication();return V5ToDashboard.LaunchInExploration(v_nReport,v_oAuthoringApp,v_aSelectionIids,v_sReportSpec,v_sExploreStoreID,this.glassContext).then(function(){})}.bind(this))},syncIFrameSizeToView:function(){this.m_iframeAuthoring&&"visible"==this.m_iframeAuthoring.style.visibility&&rsIFrameManager.F_PositionAndSizeIFrame(this.$el,this.m_iframeAuthoring)},getParameterValues:function(bStripCredentials){var v_oAuthoringApp=this.getAuthoringApplication(),v_aParameters=null,v_aAppParameters=v_oAuthoringApp.GetParameterValues();return v_aAppParameters&&(v_aParameters=[],v_aAppParameters.length>0&&v_aAppParameters.forEach(function(v_oParameter){bStripCredentials&&v_oParameter&&v_oParameter.name&&0==v_oParameter.name.indexOf("credential:")||v_aParameters.push(v_oParameter)})),v_aParameters},getParameters:function(){var v_oAuthoringApp=this.getAuthoringApplication();if(v_oAuthoringApp&&v_oAuthoringApp.SharedState.Get("isViewer")){if(v_oAuthoringApp.SharedState.Get("isActiveReport"))return{};var v_aParameters=this.getParameterValues(!0);return rsPromptParameters.convertParameterArrayToObject(v_aParameters)}return null},updateGlobalParameters:function(v_oNewGlobalParameters,v_oGlassContext){var v_Application=this.getAuthoringApplication();if(v_Application&&v_oNewGlobalParameters&&!v_Application.SharedState.Get("isActiveReport")){var v_aGlobalParameters=rsCommon.convertToArray(v_oGlassContext?v_oGlassContext.services.userProfile.userProfileSettings.parameter_values:null),v_sGlobalParameters=v_aGlobalParameters.length?JSON.stringify(v_aGlobalParameters):null,v_aGlobalParametersDelta=rsCommon.convertToArray(v_oNewGlobalParameters),v_sGlobalParametersDelta=v_aGlobalParametersDelta.length?JSON.stringify(v_aGlobalParametersDelta):null,v_oParameters={globalParameters:v_sGlobalParameters,globalParametersDelta:v_sGlobalParametersDelta};v_Application.SharedState.Call(null,"updateGlobalParameters",v_oParameters)}},getShareableItemsForCollaboration:function(){if(this.isApplicationLoaded()&&this.m_iframeAuthoring){var v_oAuthoringApp=this.getAuthoringApplication();if(v_oAuthoringApp){var doc=this.m_iframeAuthoring.contentDocument,body=doc.body;if(v_oAuthoringApp.SharedState.Get("isActiveReport")){var iframes=doc.querySelectorAll("iframe");iframes&&1===iframes.length&&(body=iframes[0].contentDocument.body)}return[{el:body,label:v_oAuthoringApp.SharedState.Get("reportName")}]}}return[]},_handleFirstAppViewOnLoaded:function(v_oDeferred,v_oEvent,v_sEventName){"appView:loaded"==v_sEventName&&v_oEvent&&v_oEvent.appView&&v_oEvent.appView==this.m_oAppView&&(console.info("rsContentView._handleFirstAppViewOnLoaded"),v_oDeferred.resolve(!0),this.m_oRemoveAppViewLoadedHandler.remove(),this.m_oRemoveAppViewLoadedHandler=void 0)},setFocus:function(){if(this.isApplicationLoaded()){var v_oApplication=this.getAuthoringApplication();v_oApplication&&v_oApplication.SharedState&&v_oApplication.SharedState.Get("isReportLoaded")&&v_oApplication.SetFocusToWorkarea()}else rsContentView.inherited("setFocus",this,arguments)}});return rsContentView}),define("bi/authoring/plugins/rsAppButtonActions",["bi/glass/app/plugins/ButtonActionInterface"],function(ButtonActionInterface){"use strict";var AuthoringButtonActionInterface=ButtonActionInterface.extend({onPress:function(context){var v_sObserverId="rsAppButtonActions";console.log("rsAppButtonActions pressed"),console.log("context.target.plugin.itemSpec.id: %s",context.target.plugin.itemSpec.id);var v_sId=context.target.plugin.itemSpec.id,v_oContentView=context.glassContext.currentAppView.currentContentView,v_Application=v_oContentView.getAuthoringApplication();if(v_Application){switch(v_sId){case"com.ibm.bi.authoring.undoBtn":v_Application.SharedState.Call(v_sObserverId,"undo");break;case"com.ibm.bi.authoring.redoBtn":v_Application.SharedState.Call(v_sObserverId,"redo");break;case"com.ibm.bi.authoring.insertableObjectsBtn":v_Application.SharedState.Toggle(v_sObserverId,"showInsertableObjects");break;case"com.ibm.bi.authoring.toggleEditViewer":v_Application.ToggleBetweenEditViewModes(v_sObserverId);break;case"com.ibm.bi.authoring.refreshBtn":var v_oParameters={Prompt:!1};v_Application.SharedState.Call(null,"refresh",v_oParameters);break;case"com.ibm.bi.authoring.consumptionFilter":v_Application.SharedState.Toggle(v_sObserverId,"showFilters");break;default:return void console.log("Unhandled label: "+v_sId)}v_Application.GlassButton_onPress(v_sId)}}});return AuthoringButtonActionInterface}),define("bi/authoring/plugins/rsAppMenuActions",["bi/glass/app/plugins/MenuActionInterface"],function(MenuActionInterface){"use strict";var AuthoringMenu=MenuActionInterface.extend({onSelectItem:function(context){var v_sMenuItem=context.target.itemId;console.log("rsAppMenu.onSelectItem selected item %s",v_sMenuItem);var v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(v_Application){switch(v_sMenuItem){case"com.ibm.bi.authoring.editOverflow_resetParameters":case"com.ibm.bi.authoring.editOverflow_clearParameters":var v_oParameters={Prompt:!1};v_Application.SharedState.Call(null,v_sMenuItem.substring(v_sMenuItem.lastIndexOf("_")+1),v_oParameters);break;case"com.ibm.bi.datasets.editOverflow_setParameters":v_Application.SharedState.Call(null,v_sMenuItem.substring(v_sMenuItem.lastIndexOf("_")+1));break;default:return void console.log("unhandled menu item")}var v_targetId=context.target.plugin&&context.target.plugin.id;v_targetId&&v_Application.GlassButton_onPress(v_targetId),v_Application.GlassMenu_onSelectItem(v_sMenuItem)}},isItemVisible:function(context){var v_sMenuItem=context.target.itemId;console.log("rsAppMenu.isItemVisible item %s",v_sMenuItem);var v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(!v_Application)return!1;switch(v_sMenuItem){case"com.ibm.bi.datasets.editOverflow_setParameters":return"datasets"==context.glassContext.currentAppView.currentContentView.perspective;case"com.ibm.bi.authoring.editOverflow_conditionalStyles":case"com.ibm.bi.authoring.editOverflow_clearParameters":if(v_Application.SharedState.Get("isViewer"))return!1}return!0}});return AuthoringMenu}),define("bi/authoring/plugins/rsAppRunMenuActions",["bi/glass/app/plugins/MenuActionInterface"],function(MenuActionInterface){"use strict";var AuthoringMenu=MenuActionInterface.extend({onSelectItem:function(context){var v_sMenuItem=context.target.itemId;console.log("rsAppRunMenu.onSelectItem selected item "+v_sMenuItem);var v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(v_Application){switch(v_sMenuItem){case"com.ibm.bi.authoring.run_show_run_options":return void window.setTimeout(v_Application.ShowRunOptions.bind(v_Application),0);case"com.ibm.bi.viewer.run":case"com.ibm.bi.viewer.runHtml":case"com.ibm.bi.viewer.run_html_ar":case"com.ibm.bi.viewer.runPdf":var v_oParameters={Prompt:"com.ibm.bi.viewer.run"==v_sMenuItem};switch(v_sMenuItem){case"com.ibm.bi.viewer.runHtml":case"com.ibm.bi.viewer.run_html_ar":v_oParameters.OutputFormat="HTML";break;case"com.ibm.bi.viewer.runPdf":v_oParameters.OutputFormat="PDF"}v_Application.SharedState.Call(null,v_sMenuItem.substring(v_sMenuItem.lastIndexOf(".")+1),v_oParameters);break;case"com.ibm.bi.authoring.run_html":case"com.ibm.bi.authoring.run_pdf":case"com.ibm.bi.authoring.run_excel2007":case"com.ibm.bi.authoring.run_excel2007data":case"com.ibm.bi.authoring.run_csv":case"com.ibm.bi.authoring.run_html_ar":case"com.ibm.bi.authoring.run_html_ar_download":case"com.ibm.bi.authoring.run_xml":case"com.ibm.bi.viewer.run_excel2007":case"com.ibm.bi.viewer.run_excel2007data":case"com.ibm.bi.viewer.run_csv":case"com.ibm.bi.viewer.run_html_ar_download":case"com.ibm.bi.viewer.run_xml":var v_oParameters={OutputFormat:null},v_bViewerAction=v_sMenuItem.indexOf(".viewer.")>0;v_bViewerAction&&(v_oParameters.Prompt=!1);var v_bRunInNewViewer=v_bViewerAction||v_Application.SharedState.Get("runInAdvancedViewer");switch(v_sMenuItem){case"com.ibm.bi.authoring.run_html_ar":v_oParameters.OutputFormat="HTML",v_oParameters.Download="false",v_oParameters.isApplication=v_Application.SharedState.Get("isActiveReport");break;case"com.ibm.bi.authoring.run_html_ar_download":case"com.ibm.bi.viewer.run_html_ar_download":v_oParameters.OutputFormat="HTML",v_oParameters.Download="true",v_oParameters.isApplication=v_Application.SharedState.Get("isActiveReport");break;case"com.ibm.bi.authoring.run_html":v_oParameters.OutputFormat="HTML",v_bRunInNewViewer&&(v_oParameters.isViewer=!0);break;case"com.ibm.bi.authoring.run_pdf":v_oParameters.OutputFormat="PDF",v_bRunInNewViewer&&(v_oParameters.isViewer=!0);break;case"com.ibm.bi.authoring.run_excel2007":case"com.ibm.bi.viewer.run_excel2007":v_oParameters.OutputFormat="spreadsheetML",v_bRunInNewViewer&&(v_oParameters.Download="true");break;case"com.ibm.bi.authoring.run_excel2007data":case"com.ibm.bi.viewer.run_excel2007data":v_oParameters.OutputFormat="xlsxData",v_bRunInNewViewer&&(v_oParameters.Download="true");break;case"com.ibm.bi.authoring.run_csv":case"com.ibm.bi.viewer.run_csv":v_oParameters.OutputFormat="CSV",v_bRunInNewViewer&&(v_oParameters.Download="true");break;case"com.ibm.bi.authoring.run_xml":case"com.ibm.bi.viewer.run_xml":v_oParameters.OutputFormat="XML",v_bRunInNewViewer&&(v_oParameters.Download="true");break;default:var v_sIdxValue=v_sMenuItem.indexOf("_"),v_sValue=v_sMenuItem.slice(v_sIdxValue+1);console.warn("using implicit output format: %s",v_sValue)}v_bViewerAction||(v_oParameters.isFromRS=!0),v_Application.SharedState.Call(null,"runInNewWindow",v_oParameters);break;default:return void console.warn("Unhandled item: "+v_sMenuItem)}v_Application.GlassMenu_onSelectItem(v_sMenuItem)}},isItemVisible:function(context){console.log("rsAppRunMenu.isItemVisible");var v_sMenuItem=context.target.itemId;console.log("v_sMenuItem: "+v_sMenuItem);var v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(!v_Application)return!1;var v_bCanRun=v_Application.SharedState.Get("canRun"),v_bActiveReport=v_Application.SharedState.Get("isActiveReport"),v_bIsViewer=v_Application.SharedState.Get("isViewer");switch(v_sMenuItem){case"com.ibm.bi.viewer.run":case"com.ibm.bi.authoring.refresh":return!1;case"com.ibm.bi.authoring.run_html_ar":return v_bActiveReport&&v_bCanRun;case"com.ibm.bi.authoring.run_html_ar_download":case"com.ibm.bi.viewer.run_html_ar_download":return v_bActiveReport&&v_bCanRun;case"com.ibm.bi.authoring.run_show_run_options":case"com.ibm.bi.viewer.run_html_ar":return v_bCanRun&&!v_bIsViewer;case"com.ibm.bi.authoring.run_csv":case"com.ibm.bi.viewer.run_csv":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGenerateCSVOutput");case"com.ibm.bi.viewer.runPdf":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGeneratePDFOutput");case"com.ibm.bi.authoring.run_pdf":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGeneratePDFOutput");case"com.ibm.bi.authoring.run_html":return!v_bActiveReport&&v_bCanRun;case"com.ibm.bi.viewer.runHtml":return!v_bActiveReport&&v_bCanRun;case"com.ibm.bi.authoring.run_xml":case"com.ibm.bi.viewer.run_xml":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGenerateXMLOutput");case"com.ibm.bi.authoring.run_excel2007":case"com.ibm.bi.authoring.run_excel2007data":case"com.ibm.bi.viewer.run_excel2007":case"com.ibm.bi.viewer.run_excel2007data":return!v_bActiveReport&&v_bCanRun&&context.glassContext.hasCapability("canGenerateXLSOutput");default:return!v_bActiveReport&&v_bCanRun}}});return AuthoringMenu}),define("bi/authoring/plugins/rsAppSaveAsMenuActions",["bi/glass/app/plugins/MenuActionInterface"],function(MenuActionInterface){"use strict";var AuthoringMenu=MenuActionInterface.extend({onSelectItem:function(context){var v_sMenuItem=context.target.itemId,v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(v_Application){switch(v_sMenuItem){case"com.ibm.bi.authoring.save_as":v_Application.SaveAsReport();break;case"com.ibm.bi.authoring.convert_to_active_report":v_Application.ConvertToActiveReport();break;case"com.ibm.bi.authoring.convert_to_template":v_Application.ConvertToTemplate();break;case"com.ibm.bi.authoring.save_as_report_view":v_Application.SaveAsReportView();break;case"com.ibm.bi.authoring.save":case"com.ibm.bi.datasets.dataset_save":var v_oCmProperties=context.glassContext.currentAppView.currentContentView.cmProperties;if("com.ibm.bi.authoring.save"==v_sMenuItem&&v_Application.SharedState.Get("isViewer")&&v_oCmProperties&&-1==v_oCmProperties.permissions.indexOf("read")){context.glassContext.showToast(v_Application.GetString("IDS_MSG_NO_PERMISSIONS_TO_SAVE"),{type:"error"});break}v_oCmProperties&&-1==v_oCmProperties.permissions.indexOf("write")?"com.ibm.bi.authoring.save"==v_sMenuItem&&v_Application.SharedState.Get("isViewer")&&context.glassContext.hasCapability("canUseReportStudio")&&context.glassContext.hasCapability("canUseReportStudioFileManagement")?v_Application.SaveAsReport():context.glassContext.showToast(v_Application.GetString("IDS_MSG_NO_PERMISSIONS_TO_SAVE"),{type:"error"}):v_Application.Save();break;case"com.ibm.bi.datasets.refresh":v_Application.SaveDataSet(function(v_sFileName,v_sStoreID){var options={id:v_sStoreID,name:v_sFileName,showToastWhenDone:!0,glassContext:context.glassContext};context.glassContext.getSvc(".DatasetExecutionService").then(function(DatasetExecutionService){DatasetExecutionService.execute(options)})});break;default:return void console.warn("Unhandled item: "+v_sMenuItem)}v_Application.GlassMenu_onSelectItem(v_sMenuItem)}},isItemVisible:function(context){var v_sMenuItem=context.target.itemId,v_Application=context.glassContext.currentAppView.currentContentView.getAuthoringApplication();if(v_Application){var v_bResult,v_oCmProperties=context.glassContext.currentAppView.currentContentView.cmProperties,v_bRead=!v_oCmProperties||-1!=v_oCmProperties.permissions.indexOf("read");switch(v_sMenuItem){case"com.ibm.bi.authoring.save_as_report_view":v_bResult=v_Application.SharedState.Get("isViewer")&&v_Application.SharedState.Get("cmSearchPath")&&!v_Application.SharedState.Get("isModified");break;case"com.ibm.bi.datasets.dataset_save":v_bResult=v_Application.SharedState.Get("isModified");break;case"com.ibm.bi.authoring.save":v_bResult=!1;break;case"com.ibm.bi.authoring.save_as":v_bResult=context.glassContext.hasCapability("canUseReportStudio")&&context.glassContext.hasCapability("canUseReportStudioFileManagement")?v_Application.SharedState.Get("isViewer")?v_bRead:!0:!1;break;case"com.ibm.bi.datasets.refresh":v_bResult=v_Application.SharedState.Get("isModified");break;case"com.ibm.bi.authoring.convert_to_active_report":v_bResult=!v_Application.SharedState.Get("isViewer")&&!v_Application.SharedState.Get("isActiveReport");break;case"com.ibm.bi.authoring.convert_to_template":v_bResult=!v_Application.SharedState.Get("isViewer");break;default:v_bResult=!0}return v_bResult}}});return AuthoringMenu}),define("bi/authoring/utils/rsSaveReportView",["q","bi/authoring/nls/StringResource"],function(Q,StringResource){"use strict";return{saveReportView:function(v_oCmProperties,v_oContext){var v_oSaveDeferred=Q.defer();return require(["bi/commons/ui/content/dialog/SaveAsDialog"],function(SaveAsDialog){var v_oDialog=new SaveAsDialog({glassContext:v_oContext.glassContext,defaultFileName:StringResource.get("powerPlay8Report"===v_oCmProperties.type?"powerplay_view_of":"report_view_of",{reportName:v_oCmProperties.defaultName}),ancestors:v_oCmProperties.ancestors,service:{context:v_oContext,inheritBaseProperties:function(oData){var deferred=Q.defer();if("reportView"===oData.type){var sUrl;sUrl=v_oCmProperties._meta?v_oCmProperties._meta.links.self.url:v_oCmProperties.selfUrl,v_oContext.glassContext.services.ajax.ajax({url:sUrl+"?fields=executionFormat,executionLocale,options,parameters",dataType:"json",type:"GET"}).then(function(response){var data=response.data[0];oData.executionFormat=data.executionFormat,oData.executionLocale=data.executionLocale,oData.options=data.options,oData.parameters=data.parameters,deferred.resolve()},function(error){deferred.reject(error)})}else deferred.resolve();return deferred.promise},save:function(v_oService,v_oSelection,v_sName,v_bOverwrite){v_oDialog.hide();var v_oData={type:"powerPlay8Report"===v_oCmProperties.type?"powerPlay8ReportView":"reportView",defaultName:v_sName,base:[{searchPath:'storeID("'+v_oCmProperties.id+'")',type:"baseClass"}]},v_oDeferred=Q.defer();return this.inheritBaseProperties(v_oData).then(function(){var v_sUrl=v_oSelection.url+"?updateAction="+(v_bOverwrite?"replace":"fail");v_oService.context.glassContext.services.ajax.post(v_sUrl,{contentType:"application/json",processData:!1,dataType:"text",data:JSON.stringify(v_oData)}).fail(function(d,request){var v_oResponse=request.responseJSON;!v_oResponse&&request.responseText&&(v_oResponse=JSON.parse(request.responseText)),"cmDuplicateName"===v_oResponse.errorCode?v_oDeferred.reject({isDuplicate:!0}):(v_oDeferred.reject(),v_oSaveDeferred.reject())}).done(function(v_oResult){try{v_oContext.target.plugin.activeObject.oListControl.contentView.refresh()}catch(e){}v_oDeferred.resolve(v_oResult),v_oSaveDeferred.resolve(v_oResult)})},function(){v_oDeferred.reject(),v_oSaveDeferred.reject()}),v_oDeferred.promise}}});v_oDialog.open()}),v_oSaveDeferred.promise}}}),define("bi/authoring/plugins/rsContextMenuActions",["bi/glass/app/plugins/MenuActionInterface","jquery","q","bi/authoring/utils/rsOpenHelper","bi/authoring/utils/rsShareHelper","bi/authoring/utils/rsPerformance","bi/authoring/utils/rsSaveReportView"],function(MenuActionInterface,$,Q,OpenHelper,ShareHelper,rsPerformance,rsSaveReportView){"use strict";var rsContextMenuActions=MenuActionInterface.extend({isItemVisible:function(context){if(!context.target)return!1;if(!context.target.activeObject&&!context.target.objectInformation)return!1;var v_oCMInfo;if(context.target.activeObject){var v_aSelectedContext=context.target.activeObject.aSelectedContext;if(1!==v_aSelectedContext.length)return!1;v_oCMInfo=v_aSelectedContext[0]}else context.target.objectInformation&&(v_oCMInfo=context.target.objectInformation);"string"==typeof v_oCMInfo.disabled&&(v_oCMInfo.disabled="true"==v_oCMInfo.disabled?!0:"false"==v_oCMInfo.disabled?!1:v_oCMInfo.disabled);var v_sCapabilityToCheck="canUseReportStudio",v_sPermission="read";switch(context.target.itemId){case"com.ibm.bi.authoring.convertToReport":if(-1===["analysis","query"].indexOf(v_oCMInfo.type))return!1;break;case"com.ibm.bi.authoring.createReportFromModule":if("module"!==v_oCMInfo.type)return!1;if(v_oCMInfo.disabled)return!1;break;case"com.ibm.bi.authoring.createReportFromPackage":if("package"!==v_oCMInfo.type)return!1;if(v_oCMInfo.disabled)return!1;if(!v_oCMInfo.effectiveUserCapabilities||-1===v_oCMInfo.effectiveUserCapabilities.indexOf(v_sCapabilityToCheck))return!1;break;case"com.ibm.bi.datasets.editDataset":if("dataSet2"!==v_oCMInfo.type)return!1;v_sCapabilityToCheck="canUseMyDataSets";break;case"com.ibm.bi.authoring.editReport":if(-1===["interactiveReport","report","reportTemplate"].indexOf(v_oCMInfo.type))return!1;if("report"===v_oCMInfo.type&&v_oCMInfo.metadataModelPackage&&v_oCMInfo.metadataModelPackage[0]&&v_oCMInfo.metadataModelPackage[0].effectiveUserCapabilities&&-1===v_oCMInfo.metadataModelPackage[0].effectiveUserCapabilities.indexOf(v_sCapabilityToCheck))return!1;break;case"com.ibm.bi.authoring.saveAsReportView":if(-1===["interactiveReport","report","query","analysis"].indexOf(v_oCMInfo.type))return!1;v_sCapabilityToCheck=void 0,v_sPermission=void 0;break;case"com.ibm.bi.authoring.saveAsPowerPlayView":if("powerPlay8Report"!==v_oCMInfo.type)return!1;v_sCapabilityToCheck=void 0,v_sPermission=void 0;break;case"com.ibm.bi.contentApps.action.runAs":if(-1===["interactiveReport","report","reportView","query","analysis","powerPlay8Report","powerPlay8ReportView"].indexOf(v_oCMInfo.type))return!1;if(v_sCapabilityToCheck="canUseCognosViewerRunWithOptions",v_sPermission="execute","reportView"===v_oCMInfo.type){if(null===v_oCMInfo.base)return!1;if(v_oCMInfo.base[0]&&v_oCMInfo.base[0].permissions&&-1===v_oCMInfo.base[0].permissions.indexOf(v_sPermission))return!1}break;case"com.ibm.bi.contentApps.defaultAction.interactiveReport":case"com.ibm.bi.contentApps.defaultAction.report":case"com.ibm.bi.contentApps.defaultAction.dataSet2":case"com.ibm.bi.contentApps.defaultAction.reportTemplate":case"com.ibm.bi.contentApps.defaultAction.reportView":case"com.ibm.bi.contentApps.defaultAction.query":case"com.ibm.bi.contentApps.defaultAction.analysis":return context.target.itemId.indexOf(v_oCMInfo.type)>0&&null!==OpenHelper.determineDefaultAction(context.target.itemId,v_oCMInfo,context.glassContext);case"com.ibm.bi.datasets.createDataSetFromModule":if("module"!==v_oCMInfo.type)return!1;if(v_oCMInfo.disabled)return!1;v_sCapabilityToCheck="canUseMyDataSets";break;case"com.ibm.bi.datasets.createDataSetFromPackage":if("package"!==v_oCMInfo.type)return!1;if(v_oCMInfo.disabled)return!1;v_sCapabilityToCheck="canUseMyDataSets";break;case"com.ibm.bi.datasets.datasets-divider-top":case"com.ibm.bi.datasets.datasets-divider-bottom":return!0;default:return!1}if(v_sCapabilityToCheck&&!context.glassContext.hasCapability(v_sCapabilityToCheck))return!1;var v_aPermissions=v_oCMInfo.permissions;return v_aPermissions?v_sPermission&&-1==v_aPermissions.indexOf(v_sPermission)?!1:!0:!1},isVisible:function(context){var v_bShareable=!1;if(context&&context.target&&context.target.itemId&&context.glassContext)switch(context.target.itemId){case"com.ibm.bi.glass.common.shareContextual":v_bShareable=!0;break;case"com.ibm.bi.glass.common.embedContextual":if(context.target.activeObject){var v_oCmProperties=context.target.activeObject.aSelectedContext[0];v_oCmProperties&&"dataSet2"!==v_oCmProperties.type&&(v_bShareable=!0)}break;case"com.ibm.bi.glass.common.operations.shareCurrent":case"com.ibm.bi.glass.common.operations.embedCurrent":var v_oCurrentContentView=context.glassContext.currentAppView.currentContentView;v_bShareable=ShareHelper.isShareable(v_oCurrentContentView,"com.ibm.bi.glass.common.operations.embedCurrent"===context.target.itemId);break;default:console.log("Unsupported isVisible menu action item : "+context.target.itemId)}return v_bShareable},execute:function(context){var v_oCmProperties,deferred=Q.defer();context.target&&context.target.activeObject?v_oCmProperties=context.target.activeObject.aSelectedContext[0]:context.target&&context.target.objectInformation&&(v_oCmProperties=context.target.objectInformation);
- var v_fExecute,v_oCurrentContentView=context.glassContext&&context.glassContext.currentAppView&&context.glassContext.currentAppView.currentContentView,v_oOpenSpec={cmProperties:v_oCmProperties,mode:context.mode,glassContext:context.glassContext,contentView:v_oCurrentContentView};return"defaultAction"==context.mode?(v_oOpenSpec.cmProperties=v_oOpenSpec.cmProperties||{id:context.urlMap.id,type:context.urlMap.type},v_oOpenSpec.urlMap=context.urlMap,v_fExecute=OpenHelper.getPerspective):(v_oOpenSpec.cmProperties=v_oOpenSpec.cmProperties||v_oCurrentContentView.cmProperties,v_fExecute=ShareHelper.getShareUrlMap),v_fExecute(v_oOpenSpec)["catch"](function(err){console.log("rsContextMenuActions.execte ... FAILED."),deferred.reject(err)}).done(function(v_oUrlMap){deferred.resolve(v_oUrlMap)}),deferred.promise},doAction:function(context){var $dfd=$.Deferred();return this.onSelectItem(context)["catch"](function(err){console.log("rsContextMenuActions.doAction ... FAILED"),$dfd.reject(err)}).done(function(result){$dfd.resolve(result)}),$dfd.promise()},canExecute:function(context){return this.isItemVisible(context)},onSelectItem:function(context){rsPerformance.clearMeasures(),rsPerformance.clearMarks(),rsPerformance.mark("authoring-selectItemAndDraw-start"),rsPerformance.mark("rsContextMenuActions.onSelectItem"),console.time("rsperf: total_RunReport"),console.time("rsperf: onSelectItem->render");var v_oCmProperties,deferred=Q.defer();if(context.target&&context.target.activeObject)v_oCmProperties=context.target.activeObject.aSelectedContext[0];else{if(!context.target||!context.target.objectInformation)return console.log("rsContextMenuActions.onSelectItem ... FAILED -- no target"),deferred.reject(new Error(context.target.toString())),deferred.promise;v_oCmProperties=context.target.objectInformation}return"com.ibm.bi.authoring.saveAsReportView"===context.target.itemId||"com.ibm.bi.authoring.saveAsPowerPlayView"===context.target.itemId?rsSaveReportView.saveReportView(v_oCmProperties,context)["catch"](function(err){deferred.reject(err)}).done(function(result){deferred.resolve(result)}):OpenHelper.openView({cmProperties:v_oCmProperties,actionId:context.target.itemId,glassContext:context.glassContext,runOptions:context.target.runOptions})["catch"](function(err){console.log("rsContextMenuActions.onSelectItem ... FAILED"),deferred.reject(err)}).done(function(result){deferred.resolve(result)}),deferred.promise},getShareableItems:function(context){var items=[],view=context.glassContext.getCurrentContentView();return view&&view.getShareableItemsForCollaboration&&(items=view.getShareableItemsForCollaboration()),Q.resolve(items)}});return rsContextMenuActions}),define("bi/authoring/plugins/rsCreateMenuActions",["bi/glass/app/plugins/MenuActionInterface"],function(MenuActionInterface){var CreateReportMenu=MenuActionInterface.extend({onSelectItem:function(context){var v_sMenuItem=context.target.itemId;console.log("CreateReportMenu, "+v_sMenuItem+", selected"),console.log("CREATE TEMPLATE SELECTED."),context.glassContext.openAppView("authoring",{content:{id:Date.now().toString()}})},isItemVisible:function(context){return console.log("rsAppRunMenu.isItemVisible"),context.glassContext.hasCapability("canUseReportStudio")?!0:!1}});return CreateReportMenu}),define("bi/authoring/utils/U_Object",[],function(){var U_Object={};return U_Object.F_IsEmpty=function(o){for(var s in o)return!1;return!0},U_Object.F_ToValueArray=Object.values?function(o){return Object.values(o)}:function(o){var a=[];for(var s in o)a.push(o[s]);return a},U_Object.F_GetLength=function(o){var i=0;for(var s in o)i++;return i},U_Object.F_Copy=Object.assign?function(o){return Object.assign({},o)}:function(o){var v_oCopy={};for(var s in o)v_oCopy[s]=o[s];return v_oCopy},U_Object.F_TypeOf=function(v){var s=typeof v;if("object"==s){if(!v)return"null";if(Array.isArray(v))return"array"}return s},U_Object.F_Clone=function(o){switch(this.F_TypeOf(o)){case"number":case"string":case"boolean":case"undefined":return o;case"object":var v_oClone={};for(var s in o)o.hasOwnProperty(s)&&(v_oClone[s]=this.F_Clone(o[s]));return v_oClone;case"array":for(var v_aClone=[],v_iLength=o.length,i=0;v_iLength>i;i++)v_aClone[i]=this.F_Clone(o[i]);return v_aClone;case"function":}},U_Object.F_Subtract=function(o1,o2){var v_oNew=this.F_Copy(o1);for(var s in o2)delete v_oNew[s];return v_oNew},U_Object.F_Compare=function(o1,o2){if(this.F_GetLength(o1)!=this.F_GetLength(o2))return!1;for(var v_sPropName in o1){if("undefined"==typeof o2[v_sPropName])return!1;var v_oVal1=o1[v_sPropName],v_oVal2=o2[v_sPropName],v_bEqual=!1;switch(typeof o1[v_sPropName]){case"object":v_bEqual=this.F_Compare(v_oVal1,v_oVal2);break;case"function":v_bEqual=v_oVal1.toString()===v_oVal2.toString();break;default:v_bEqual=v_oVal1===v_oVal2}if(!v_bEqual)return!1}return!0},U_Object}),define("bi/authoring/utils/U_Blocker",[],function(){var m_divEventBlocker,K_iKeyTab=9,f_stopTabKey=function(e){e.keyCode==K_iKeyTab&&(e.preventDefault(),e.stopPropagation())},U_Blocker={};return U_Blocker.F_ShowEventBlocker=function(v_iZIndex){return m_divEventBlocker||(m_divEventBlocker=document.body.appendChild(document.createElement("DIV")),m_divEventBlocker.onkeydown=f_stopTabKey,m_divEventBlocker.style.position="absolute",m_divEventBlocker.style.left="0",m_divEventBlocker.style.top="0",m_divEventBlocker.style.width="100%",m_divEventBlocker.style.height="100%"),m_divEventBlocker.style.zIndex=v_iZIndex,m_divEventBlocker.style.visibility="visible",m_divEventBlocker},U_Blocker.F_HideEventBlocker=function(){m_divEventBlocker&&(m_divEventBlocker.style.visibility="hidden",["onmousedown","onmouseup","onmousemove","onclick","ondblclick","onmouseover","onmouseout"].forEach(function(s){this[s]=null},m_divEventBlocker))},U_Blocker}),define("bi/authoring/utils/U_ClearableTimeout",[],function(){var f_timeoutHandler=function(v_fn,v_oTimeoutHandle){null!==v_oTimeoutHandle.m_iTimeoutId&&(v_oTimeoutHandle.m_iTimeoutId=null,v_fn())},U_ClearableTimeout={};return U_ClearableTimeout.F_Create=function(v_fn,v_iTimeout){var v_oTimeoutHandle={};return v_oTimeoutHandle.m_iTimeoutId=setTimeout(f_timeoutHandler.bind(this,v_fn,v_oTimeoutHandle),v_iTimeout),v_oTimeoutHandle},U_ClearableTimeout.F_Clear=function(v_oTimeoutHandle){if(v_oTimeoutHandle.m_iTimeoutId){var v_iTimeoutId=v_oTimeoutHandle.m_iTimeoutId;v_oTimeoutHandle.m_iTimeoutId=null,clearTimeout(v_iTimeoutId)}},U_ClearableTimeout}),define("bi/authoring/utils/rsPromptHandler",["bi/authoring/utils/pat/rsLaunchParameters","bi/authoring/utils/U_Blocker","bi/authoring/utils/U_Object","bi/authoring/utils/U_ClearableTimeout"],function(rsLaunchParameters,U_Blocker,U_Object,U_ClearableTimeout){var rsPromptHandler={};return rsPromptHandler.k_iPollPromptWindow=1e3,rsPromptHandler.m_oPromptListeners={},rsPromptHandler.m_oPromptWindows={},rsPromptHandler.m_iPromptId=0,rsPromptHandler.f_getPromptId=function(){return++this.m_iPromptId},rsPromptHandler.f_createSoapPromptLaunchParameters=function(v_docSOAPResponse,v_fnOkCallback){return this.f_createPromptLaunchParameters(v_docSOAPResponse,null,v_fnOkCallback)},rsPromptHandler.f_createPromptLaunchParameters=function(v_docSOAPResponse,v_oRequest,v_fnOkCallback){var v_oLaunchParameters={promptFnOkCallback:v_fnOkCallback,reportXML:null};return v_docSOAPResponse&&(v_oLaunchParameters.promptSOAPResponse=(new XMLSerializer).serializeToString(v_docSOAPResponse)),v_oRequest&&(v_oLaunchParameters.promptRequest=v_oRequest),v_oLaunchParameters},rsPromptHandler.f_createRestPromptLaunchParameters=function(v_oRequest,v_fnOkCallback){return this.f_createPromptLaunchParameters(null,v_oRequest,v_fnOkCallback)},rsPromptHandler.f_prompting_OkCallback=function(v_sPromptId,v_oResponse,v_oAttachments,v_sParameters,v_oOpener){var pdsState={v_sClientContext:v_sPromptId,response:v_oResponse,attachments:v_oAttachments,parameters:v_sParameters,opener:v_oOpener},v_oOpener=null;"Cancel"!=pdsState.state&&(pdsState.parameters,this.m_oPromptListeners[pdsState.v_sClientContext].F_SetPromptCallbackResponse&&this.m_oPromptListeners[pdsState.v_sClientContext].F_SetPromptCallbackResponse(pdsState.response,pdsState.attachments),v_oOpener=pdsState.opener);var v_sClientContext=pdsState.v_sClientContext;if(!v_sClientContext)for(var s in this.m_oPromptWindows)v_sClientContext=s;if(this.m_iLastPromptTimeoutId&&(U_ClearableTimeout.F_Clear(this.m_iLastPromptTimeoutId),this.m_iLastPromptTimeoutId=null),setTimeout(function(v_sClientContext){this.f_fireOnPromptingComplete(v_sClientContext),v_oOpener&&v_oOpener.close()}.bind(rsPromptHandler,v_sClientContext),0),delete this.m_oPromptWindows[v_sClientContext],U_Object.F_IsEmpty(this.m_oPromptWindows))U_Blocker.F_HideEventBlocker();else for(var s in this.m_oPromptWindows){this.m_oPromptWindows[s].focus();break}},rsPromptHandler.F_DoPrompting=function(v_oListener,v_docSOAPResponse,v_oGlassContext){var v_frmPrompting,v_sUrl,v_oLaunchParameters,v_sPromptId=this.f_getPromptId();v_oLaunchParameters=this.f_createSoapPromptLaunchParameters(v_docSOAPResponse,this.f_prompting_OkCallback.bind(this,v_sPromptId)),v_oLaunchParameters.promptOutputPages=v_oListener.getOutputPages(v_docSOAPResponse);var v_oContext={urlMap:{perspective:"authoring",isViewer:!0,UIProfile:"Titan",promptResponse:"promptPage",ui_appbar:!1,ui_navbar:!1,launchParametersKey:rsLaunchParameters.Store(v_oLaunchParameters)}};return v_sUrl=v_oGlassContext.getUrl(v_oContext),this.f_launchPrompt(v_oListener,v_sUrl,v_frmPrompting,v_oLaunchParameters,v_sPromptId)},rsPromptHandler.f_onPromptBlockerMouseDown=function(){for(var s in this.m_oPromptWindows)return void this.m_oPromptWindows[s].focus();U_Blocker.F_HideEventBlocker()},rsPromptHandler.f_launchPrompt=function(v_oListener,v_sUrl,v_frmPrompting,v_oLaunchParameters,v_sPromptId){var v_elBlocker=U_Blocker.F_ShowEventBlocker(1e6);return v_elBlocker.onmousedown=this.f_onPromptBlockerMouseDown.bind(this),this.m_oPromptListeners[v_sPromptId]=v_oListener,this.m_oPromptWindows[v_sPromptId]=window.open(v_sUrl,v_frmPrompting?v_frmPrompting.target:"_blank","directories=no,location=no,status=no,toolbar=no,resizable=yes,scrollbars=yes,top=100,left=100,height=600,width=1000"),Boolean(this.m_oPromptWindows[v_sPromptId])?(this.m_oPromptWindows[v_sPromptId].focus(),v_frmPrompting&&v_frmPrompting.submit(),v_oLaunchParameters&&(v_oLaunchParameters.promptOpener=this.m_oPromptWindows[v_sPromptId]),this.m_iLastPromptTimeoutId=U_ClearableTimeout.F_Create(this.f_checkPromptingWindowState.bind(this,v_sPromptId),this.k_iPollPromptWindow),!0):(U_Blocker.F_HideEventBlocker(),!1)},rsPromptHandler.f_checkPromptingWindowState=function(v_sPromptId){if(this.m_iLastPromptTimeoutId=null,this.m_oPromptWindows[v_sPromptId]){var v_bWindowClosed=!1;try{v_bWindowClosed=this.m_oPromptWindows[v_sPromptId].closed}catch(e){v_bWindowClosed=!0}if(v_bWindowClosed){if(delete this.m_oPromptWindows[v_sPromptId],U_Object.F_IsEmpty(this.m_oPromptWindows))U_Blocker.F_HideEventBlocker();else for(var s in this.m_oPromptWindows){this.m_oPromptWindows[s].focus();break}setTimeout(this.f_fireOnPromptingComplete.bind(this,v_sPromptId),0)}else this.m_iLastPromptTimeoutId=U_ClearableTimeout.F_Create(this.f_checkPromptingWindowState.bind(this,v_sPromptId),this.k_iPollPromptWindow)}},rsPromptHandler.f_OnUnLoad=function(v_fOnUnLoad){for(var v_sPromptId in this.m_oPromptWindows){var v_bWindowClosed=!1;try{v_bWindowClosed=this.m_oPromptWindows[v_sPromptId].closed}catch(e){v_bWindowClosed=!0}if(!v_bWindowClosed)try{this.m_oPromptWindows[v_sPromptId].close()}catch(e){}delete this.m_oPromptWindows[v_sPromptId]}v_fOnUnLoad&&v_fOnUnLoad()},rsPromptHandler.f_fireOnPromptingComplete=function(v_sClientContext){this.m_oPromptListeners[v_sClientContext]&&this.m_oPromptListeners[v_sClientContext].F_OnServerPromptingComplete&&this.m_oPromptListeners[v_sClientContext].F_OnServerPromptingComplete(),delete this.m_oPromptListeners[v_sClientContext]},rsPromptHandler.F_DoRestPrompting=function(v_oListener,v_oRequest,v_oGlassContext){var v_iPromptId=this.f_getPromptId(),v_oLaunchParameters=this.f_createRestPromptLaunchParameters(v_oRequest,this.f_prompting_OkCallback.bind(this,v_iPromptId)),v_oContext={urlMap:{perspective:"authoring",isViewer:!0,UIProfile:"Titan",promptResponse:"url",ui_appbar:!1,ui_navbar:!1,launchParametersKey:rsLaunchParameters.Store(v_oLaunchParameters,!0)}},v_sUrl=v_oGlassContext.getUrl(v_oContext);return this.f_launchPrompt(v_oListener,v_sUrl,null,v_oLaunchParameters,v_iPromptId)},window.onunload=rsPromptHandler.f_OnUnLoad.bind(rsPromptHandler,window.onunload),rsPromptHandler}),define("bi/authoring/utils/C_rsRestRequest",["bi/authoring/utils/U_Object","bi/authoring/utils/rsPromptHandler"],function(U_Object,rsPromptHandler){function C_rsRestRequest(v_oGlassContext,v_oListener,v_oRequest){this.m_oGlassContext=v_oGlassContext,this.m_oListener=v_oListener,this.m_oRequest=v_oRequest,this.m_oPromptCallbackResponse=null,this.M_iResponseDelay=0}function f_fireEvent(v_sEvent){this.m_oListener&&this.m_oListener[v_sEvent]&&setTimeout(this.m_oListener[v_sEvent].bind(this.m_oListener,this),0)}function f_onRestResponseDontCare(){}function f_doResponseProcessing(){if(202==this.F_GetStatus())f_processAsyncResponse.bind(this)();else{if(this.m_bAborted)return;this.F_ProcessResponse(),f_fireEvent.bind(this)("F_Request_OnComplete")}}function f_initiateResponseProcessing(){return this.M_iResponseDelay?void setTimeout(f_doResponseProcessing.bind(this),this.M_iResponseDelay):void f_doResponseProcessing.bind(this)()}function f_onRestResponseOK(v_oResponseData,v_sStatus,v_oXHR){this.m_oResponseData=v_oResponseData,this.m_oXHR=v_oXHR,f_initiateResponseProcessing.bind(this)()}function f_onRestResponseFailed(v_sStatus,v_oXHR,v_sErrorThrown){this.m_oXHR=v_oXHR,this.m_oFailed={status:v_sStatus,error:v_sErrorThrown,response:this.F_GetResponseText()},this.F_OnFailed(),f_initiateResponseProcessing.bind(this)()}function f_processAsyncResponse(){var v_bPrompting=this.m_oResponseData&&"prompting"==this.m_oResponseData.status,v_sLocation=this.m_oXHR.getResponseHeader("Location"),v_sAffinity=this.m_oXHR.getResponseHeader("X-CA-Affinity"),v_oRequestHeaders={};v_sAffinity&&(v_oRequestHeaders["X-CA-Affinity"]=v_sAffinity);var v_oRequest={url:v_sLocation,headers:v_oRequestHeaders};this.m_bAborted?(v_oRequest.type="DELETE",Application.GlassContext.services.ajax.ajax(v_oRequest).done(f_onRestResponseDontCare.bind(this)).fail(f_onRestResponseDontCare.bind(this))):(v_oRequest.type="GET",v_bPrompting?(v_oRequest.dataType="text",rsPromptHandler.F_DoRestPrompting(this,v_oRequest,this.m_oGlassContext)||(this.m_oFailed={status:"popup blocked"},this.F_ProcessResponse(),f_fireEvent.bind(this)("F_Request_OnComplete"))):this.m_oGlassContext.services.ajax.ajax(v_oRequest).done(f_onRestResponseOK.bind(this)).fail(f_onRestResponseFailed.bind(this)))}function f_getPropertyInTryCatch(o,p){try{return o[p]}catch(e){return null}}var f_processAsyncResponse;return C_rsRestRequest.prototype.F_GetListener=function(){return this.m_oListener},C_rsRestRequest.prototype.F_SetListener=function(v_oListener){this.m_oListener=v_oListener},C_rsRestRequest.prototype.F_SetHeaders=function(v_oRequestHeaders){return v_oRequestHeaders},C_rsRestRequest.prototype.F_Send=function(){this.m_oRequest.headers=this.F_SetHeaders(this.m_oRequest.headers),this.m_oGlassContext.services.ajax.ajax(this.m_oRequest).done(f_onRestResponseOK.bind(this)).fail(f_onRestResponseFailed.bind(this))},C_rsRestRequest.prototype.F_Abort=function(){this.m_bAborted=!0,f_fireEvent.bind(this)("F_Request_OnAborted"),this.F_SetListener(null)},C_rsRestRequest.prototype.F_GetStatus=function(){return this.m_oXHR?f_getPropertyInTryCatch(this.m_oXHR,"status"):null},C_rsRestRequest.prototype.F_ProcessResponse=function(){},C_rsRestRequest.prototype.F_GetResponseData=function(){return this.m_oResponseData},C_rsRestRequest.prototype.F_GetResponseText=function(){return this.m_oXHR?this.m_oXHR.responseText:null},C_rsRestRequest.prototype.F_OnFailed=function(){},C_rsRestRequest.prototype.F_GetFailed=function(){return this.m_oFailed},C_rsRestRequest.prototype.F_SetPromptCallbackResponse=function(v_oResponse,v_oAttachments){this.m_oPromptCallbackResponse=v_oResponse?U_Object.F_Clone(v_oResponse):null},C_rsRestRequest.prototype.F_OnServerPromptingComplete=function(){this.m_oPromptCallbackResponse?(this.m_oResponseData=this.m_oPromptCallbackResponse,this.m_oPromptCallbackResponse=null,this.m_oFailed=null,this.F_ProcessResponse()):this.m_oFailed={status:"cancelled"},f_fireEvent.bind(this)("F_Request_OnComplete")},C_rsRestRequest}),define("bi/authoring/plugins/rsDrillInfoService",["baglass/core-client/js/core-client/ui/core/Class","q","bi/authoring/utils/C_rsRestRequest"],function(Class,Q,C_rsRestRequest){"use strict";var rsDrillInfoService=Class.extend({init:function(attributes){this._glassContext=attributes.glassContext,rsDrillInfoService.inherited("init",this,arguments)},getParameters:function(storeId){this.deferred=Q.defer();var v_oRequest={url:"v1/reports/"+storeId+"/parameters?&layoutParameters=true",type:"GET",dataType:"json"},v_oRestRequest=new C_rsRestRequest(this._glassContext,this,v_oRequest);return v_oRestRequest.F_Send(),this.deferred.promise},F_Request_OnComplete:function(v_oRequest){var fail=v_oRequest.F_GetFailed();fail?this.deferred.reject(fail):this.deferred.resolve(v_oRequest.F_GetResponseData())}});return rsDrillInfoService}),define("bi/authoring/utils/V5ToDashboard",["q","bi/authoring/nls/StringResource"],function(Q,StringResource){var V5ToDashboard={};V5ToDashboard.K_iNODE_ELEMENT=1;var v_bRunInProduction=!1;return V5ToDashboard.LaunchInExploration=function(v_nReport,v_oAuthoringApp,v_aSelectionIids,v_sReportSpec,v_sExploreStoreID,v_oGlassContext){var v_oDBSpec;v_bRunInProduction=!0;var v_sStoreID=v_oAuthoringApp.SharedState.Get("storeID"),v_sExistingExploreSpec=null;return this.f_getExploreSpec(v_sExploreStoreID,v_oGlassContext).then(function(v_oExploreData){return v_oExploreData&&v_oExploreData.data[0]&&v_oExploreData.data[0].specification&&(v_sExistingExploreSpec=v_oExploreData.data[0].specification),this.ConvertV5toDBFrag(v_nReport,v_sStoreID,v_aSelectionIids,v_sReportSpec,v_oGlassContext)}.bind(this)).then(function(v_oDBFragSpec){return v_oDBSpec=v_oDBFragSpec,v_oGlassContext.getSvc(".ConversionService")}).then(function(conversionSvc){return conversionSvc.convert("DASHBOARD","EXPLORE",JSON.stringify(v_oDBSpec))}).then(function(v_sExploreSpec){console.log("RS->DB->EX spec: "+v_sExploreSpec);var v_oEXSpec=JSON.parse(v_sExploreSpec);v_sExistingExploreSpec&&(v_oEXSpec=this.f_mergeNewExplorationIntoExisting(v_oEXSpec,JSON.parse(v_sExistingExploreSpec)),console.log("Merged exploration spec: "+JSON.stringify(v_oEXSpec)));var perspectiveOptions={content:{boardSpec:v_oEXSpec,isAuthoringMode:!0,openAppViewCallback:function(){}},id:"Explore_"+Date.now()};return v_oGlassContext.openAppView("explore",perspectiveOptions)}.bind(this)).then(function(view){return view?(v_nReport.selectSingleNode("./layouts//dataSource/reportExpression")&&v_oGlassContext.showToast(v_oAuthoringApp.GetString("IDS_MSG_UNSUPPORTED_LAYOUT_CALC_IN_EXPLORE"),{type:"warning"}),view.currentContentView.openDatasetpane(!1)):void 0})},V5ToDashboard.f_getExploreSpec=function(v_sExploreStoreID,v_oGlassContext){return v_sExploreStoreID?v_oGlassContext.services.ajax.ajax({url:"v1/objects/"+v_sExploreStoreID+"?fields=specification",type:"GET"}):Q.resolve(null)},V5ToDashboard.f_mergeNewExplorationIntoExisting=function(v_oNewExploreSpec,v_oExistingExploreSpec){for(var v_aNewWidgetsKeys=Object.keys(v_oNewExploreSpec.widgets),i=0;i<v_aNewWidgetsKeys.length;i++)v_oExistingExploreSpec.widgets[v_aNewWidgetsKeys[i]]=v_oNewExploreSpec.widgets[v_aNewWidgetsKeys[i]];for(i=0;i<v_oNewExploreSpec.dataSources.sources.length;i++)v_oExistingExploreSpec.dataSources.sources.push(v_oNewExploreSpec.dataSources.sources[i]);for(i=0;i<v_oNewExploreSpec.layout.items.length;i++)v_oExistingExploreSpec.layout.items.push(v_oNewExploreSpec.layout.items[i]);return v_oExistingExploreSpec},V5ToDashboard.ConvertV5toDBFrag=function(v_nReport,v_sStoreID,v_aSelectionIids,v_sReportSpec,v_oGlassContext){var v_oData={};return"true"==v_nReport.getAttribute("stubbed")&&(v_oData.objectPath='storeID("'+v_sStoreID+'")'),v_oData.specification=v_sReportSpec,v_oGlassContext.services.ajax.post("v1/metadata/reports/normalizedspec",{contentType:"application/json",processData:!1,dataType:"json",data:JSON.stringify(v_oData)}).then(function(v_oReportModelInfo){var v_oDBSpec=this.f_doConvert(v_nReport,v_aSelectionIids,v_oReportModelInfo.id);return Q.resolve(v_oDBSpec)}.bind(this)).fail(function(err){return Q.reject(err)})},V5ToDashboard.f_doConvert=function(v_nReport,v_aSelectionIids,v_sReportTempStoreId){console.log(v_nReport.outerHTML),console.log("Report selection: "+JSON.stringify(v_aSelectionIids)),console.log("Report temp store ID: "+v_sReportTempStoreId);var v_oDBSpec={};this.f_setName(v_oDBSpec),this.f_setVersion(v_oDBSpec),this.f_setLayout(v_oDBSpec),this.f_setPalette(v_oDBSpec),this.f_setDBDataSource(v_oDBSpec,v_sReportTempStoreId);var v_aValidSelectionIids=this.f_validateReportSelections(v_nReport,v_aSelectionIids);return this.f_convertV5SelectionToDB(v_oDBSpec,v_nReport,v_aValidSelectionIids,v_sReportTempStoreId),console.log("RS->DB spec: "+JSON.stringify(v_oDBSpec)),v_oDBSpec},V5ToDashboard.f_validateReportSelections=function(v_nReport,v_aSelectionIids){var v_aValidSelectionIids=v_aSelectionIids;if(1===v_aSelectionIids.length){var v_nSingleNodeSelection=v_bRunInProduction?v_nReport.selectSingleNode(".//*[@iid='"+v_aSelectionIids[0]+"']"):v_nReport.querySelector("[iid="+v_aSelectionIids[0]+"]");if("pageBody"===v_nSingleNodeSelection.nodeName||"table"===v_nSingleNodeSelection.nodeName){v_aValidSelectionIids=[];for(var nlContents=v_bRunInProduction?v_nSingleNodeSelection.selectNodes(".//contents"):v_nSingleNodeSelection.querySelectorAll("contents"),i=0;i<nlContents.length;i++)for(var v_nlChildNodes=nlContents.item(i).childNodes,j=0;j<v_nlChildNodes.length;j++){var v_nChildNode=v_nlChildNodes.item(j);v_nChildNode.nodeType==V5ToDashboard.K_iNODE_ELEMENT&&this.f_isSupportedLayoutSelection(v_nChildNode.nodeName)&&v_aValidSelectionIids.push(v_nChildNode.getAttribute("iid"))}}}return v_aValidSelectionIids},V5ToDashboard.f_isSupportedLayoutSelection=function(v_sName){switch(v_sName){case"list":case"crosstab":case"viz":case"vizControl":case"mapChart":return!0}return!1},V5ToDashboard.f_setName=function(v_oDBSpec){v_oDBSpec.name=StringResource.get("new_exploration")},V5ToDashboard.f_setVersion=function(v_oDBSpec){v_oDBSpec.version=1402},V5ToDashboard.f_setPalette=function(v_oDBSpec){},V5ToDashboard.f_setLayout=function(v_oDBSpec){v_oDBSpec.layout=[]},V5ToDashboard.f_setDBDataSource=function(v_oDBSpec,v_sReportTempStoreId){v_oDBSpec.dataSources={},v_oDBSpec.dataSources.version="1.0",v_oDBSpec.dataSources.sources=[],v_oDBSpec.dataSources.sources.push({id:v_sReportTempStoreId,assetId:v_sReportTempStoreId,type:"report",name:"",shaping:{embeddedModuleUpToDate:!0}})},V5ToDashboard.f_convertV5SelectionToDB=function(v_oDBSpec,v_nReport,v_aSelectionIids,v_sReportTempStoreId){var v_iHeightOffset=0;v_oDBSpec.widgets=[];for(var i=0;i<v_aSelectionIids.length;i++){var v_aQueries=[],v_aDataViews=[],v_nSelection=v_bRunInProduction?v_nReport.selectSingleNode(".//*[@iid='"+v_aSelectionIids[i]+"']"):v_nReport.querySelector("[iid="+v_aSelectionIids[i]+"]");if(v_nSelection){v_aQueries=this.f_getQueriesForSelection(v_nReport,v_nSelection);for(var j=0;j<v_aQueries.length;j++){var v_oDataView=this.f_createEmptyWidgetDataViewForV5Query(v_sReportTempStoreId,j);v_oDataView&&v_aDataViews.push(v_oDataView)}var v_iIndex=i+1,v_sWidgetId="widget"+v_iIndex;v_bRunInProduction&&(v_sWidgetId+="-"+Date.now());var v_oWidget=this.f_createWidget(v_sWidgetId);switch(v_nSelection.nodeName){case"list":this.f_setListWidget(v_oWidget,v_nSelection,v_aQueries[0],v_aDataViews[0]);break;case"crosstab":this.f_setCrosstabWidget(v_oWidget,v_nSelection,v_aQueries[0],v_aDataViews[0]);break;case"vizControl":var v_nlReportDataStore=v_bRunInProduction?v_nReport.selectNodes(".//reportDataStore"):v_nReport.querySelectorAll("reportDataStore");this.f_setVizControlWidget(v_oWidget,v_nSelection,v_aQueries,v_aDataViews,v_nlReportDataStore);break;default:continue}v_oDBSpec.widgets.push(v_oWidget);var v_oWidthHeight=this.f_getV5ObjectWidthHeight(v_nSelection);this.f_addWidgetToLayout(v_oDBSpec,v_sWidgetId,v_oWidthHeight,v_iHeightOffset),v_iHeightOffset+=parseInt(v_oWidthHeight.height)}}},V5ToDashboard.f_getV5ObjectWidthHeight=function(v_nSelection){var v_nCSS,v_sWidth,v_sHeight,i,v_nlSelectionChildren=v_nSelection.childNodes;for(i=0;i<v_nlSelectionChildren.length;i++){var v_nSelectionChild=v_nlSelectionChildren.item(i);if("style"==v_nSelectionChild.nodeName){v_nCSS=v_bRunInProduction?v_nSelectionChild.selectSingleNode(".//CSS"):v_nSelectionChild.querySelector("CSS");break}}if(v_nCSS){var v_aCSSValueAttr=v_nCSS.getAttribute("value").split(";");for(i=0;i<v_aCSSValueAttr.length;i++){var v_sAttr=v_aCSSValueAttr[i];-1!=v_sAttr.indexOf("width:",0)?v_sWidth=v_sAttr.substring(v_sAttr.indexOf(":")+1):-1!=v_sAttr.indexOf("height:",0)&&(v_sHeight=v_sAttr.substring(v_sAttr.indexOf(":")+1))}}return v_sWidth=v_sWidth?v_sWidth:"500px",v_sHeight=v_sHeight?v_sHeight:"500px",{width:v_sWidth,height:v_sHeight}},V5ToDashboard.f_addWidgetToLayout=function(v_oDBSpec,v_sWidgetId,v_oWidthHeight,v_iHeightOffset){v_oDBSpec.layout.push({id:v_sWidgetId,style:{left:"0px",top:v_iHeightOffset+"px",height:v_oWidthHeight.height,width:v_oWidthHeight.width},type:"widget"})},V5ToDashboard.f_createWidget=function(v_sWidgetId){return{type:"live",id:v_sWidgetId,visId:"",name:v_sWidgetId,data:{dataViews:[]},visTypeLocked:!0,slotmapping:{slots:[]},localFilters:[],properties:[]}},V5ToDashboard.f_createEmptyWidgetDataViewForV5Query=function(v_sReportTempStoreId,v_iQueryIndex){var v_oDataView={};return v_oDataView.modelRef=v_sReportTempStoreId,v_oDataView.modelType="report",v_oDataView.searchPath="",v_oDataView.dataItems=[],v_oDataView.id="dataView"+(v_iQueryIndex+1),v_oDataView},V5ToDashboard.f_isDataItemUsedInSelection=function(v_nDataItem,v_nSelection,v_sRefName){return"#text"==v_nDataItem.nodeName?!1:!!(v_bRunInProduction?v_nSelection.selectSingleNode(".//*[@"+v_sRefName+"='"+v_nDataItem.getAttribute("name")+"']"):v_nSelection.querySelector("["+v_sRefName+"='"+v_nDataItem.getAttribute("name")+"']"))},V5ToDashboard.f_getRefDataItemExpression=function(v_nDataItem){switch(v_nDataItem.nodeName){case"dataItemMeasure":var v_nMUN=v_bRunInProduction?v_nDataItem.selectSingleNode(".//MUN"):v_nDataItem.querySelector("MUN");return v_nMUN?v_nMUN.childNodes[0].nodeValue:null;case"dataItemLevelSet":case"dataItemMemberSet":var v_nLUN=v_bRunInProduction?v_nDataItem.selectSingleNode(".//LUN"):v_nDataItem.querySelector("LUN");return v_nLUN?v_nLUN.childNodes[0].nodeValue:null;case"dataItem":var v_nExpression=v_bRunInProduction?v_nDataItem.selectSingleNode(".//expression"):v_nDataItem.querySelector("expression");return v_nExpression?v_nExpression.childNodes[0].nodeValue:null;default:return null}},V5ToDashboard.f_getQueriesForSelection=function(v_nReport,v_nSelection){var v_sRefQueryName,v_aRefQueryNames=[],v_aQueries=[];switch(v_nSelection.nodeName){case"list":case"crosstab":v_sRefQueryName=v_nSelection.getAttribute("refQuery"),v_aRefQueryNames.push(v_sRefQueryName);break;case"viz":v_sRefQueryName=v_bRunInProduction?v_nSelection.selectSingleNode(".//vizDataSet").getAttribute("refQuery"):v_nSelection.querySelector("vizDataSet").getAttribute("refQuery"),v_aRefQueryNames.push(v_sRefQueryName);break;case"vizControl":for(var v_nlRefDataStore=v_bRunInProduction?v_nSelection.selectNodes(".//vcDataSet"):v_nSelection.querySelectorAll("vcDataSet"),i=0;i<v_nlRefDataStore.length;i++){var v_sRefDataStore=v_nlRefDataStore.item(i).getAttribute("refDataStore");if(v_sRefDataStore){var v_nReportDataStore=v_bRunInProduction?v_nReport.selectSingleNode(".//reportDataStore[@name='"+v_sRefDataStore+"']"):v_nReport.querySelector("reportDataStore[name='"+v_sRefDataStore+"']");v_sRefQueryName=v_bRunInProduction?v_nReportDataStore.selectSingleNode(".//dsV5ListQuery").getAttribute("refQuery"):v_nReportDataStore.querySelector("dsV5ListQuery").getAttribute("refQuery"),v_aRefQueryNames.push(v_sRefQueryName)}}break;case"mapChart":}for(var j=0;j<v_aRefQueryNames.length;j++){var v_nQuery=v_bRunInProduction?v_nReport.selectSingleNode("./queries/query[@name='"+v_aRefQueryNames[j]+"']"):v_nReport.querySelector("queries > query[name='"+v_aRefQueryNames[j]+"']");v_aQueries.push(v_nQuery)}return v_aQueries},V5ToDashboard.f_convertV5DataItemSortToDB=function(v_nSelection,v_nDataItem,v_sDataItemName,v_sDataItemIndex){var v_nLayoutSortItem,v_aSelection=[],v_bIsDescending=null;switch(v_nSelection.nodeName){case"list":v_nLayoutSortItem=v_bRunInProduction?v_nSelection.selectSingleNode(".//sortList/sortItem[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("sortList > sortItem[refDataItem='"+v_sDataItemName+"']");break;case"crosstab":case"viz":case"vizControl":case"mapChart":v_nLayoutSortItem=v_bRunInProduction?v_nSelection.selectSingleNode(".//*[@refDataItem='"+v_sDataItemName+"']//sortList/sortItem"):v_nSelection.querySelector("* > [refDataItem='"+v_sDataItemName+"'] > sortList > sortItem")}if(v_nLayoutSortItem)v_bIsDescending="descending"==v_nLayoutSortItem.getAttribute("sortOrder");else{var v_nSetSorting=v_bRunInProduction?v_nDataItem.selectSingleNode(".//setSorting"):v_nDataItem.querySelector("setSorting");v_nSetSorting&&(v_bIsDescending="false"==v_nSetSorting.getAttribute("ascending"))}return null!=v_bIsDescending&&v_aSelection.push({operation:"order",sort:{type:v_bIsDescending?"desc":"asc",priority:v_sDataItemIndex,by:"caption"}}),v_aSelection},V5ToDashboard.f_getXMLAttribute=function(v_nParent,v_sName){if(!v_nParent||!v_sName)return null;var v_nXMLAttribute=v_bRunInProduction?v_nParent.selectSingleNode(".//XMLAttributes/XMLAttribute[@name='"+v_sName+"']"):v_nParent.querySelector("XMLAttributes > XMLAttribute[name='"+v_sName+"']"),v_sXMLAttributeValue=v_nXMLAttribute?v_nXMLAttribute.getAttribute("value"):null;return v_sXMLAttributeValue},V5ToDashboard.K_iDataUsage_Fact=2,V5ToDashboard.K_sDataUsage_Fact="fact",V5ToDashboard.f_getDataUsage=function(v_nDataItem){return this.f_getXMLAttribute(v_nDataItem,"RS_dataUsage")||this.K_sDataUsage_Unknown},V5ToDashboard.F_IsLikelyMeasure=function(v_nDataItem){switch(v_nDataItem.nodeName){case"dataItem":return this.f_getDataUsage(v_nDataItem)==this.K_iDataUsage_Fact||this.f_getDataUsage(v_nDataItem)==this.K_sDataUsage_Fact;case"dataItemMeasure":case"dataItemCalculatedMeasure":case"dataItemMeasurePercentage":return!0}return!1},V5ToDashboard.F_IsLikelyCalculation=function(v_nDataItem){switch(v_nDataItem.nodeName){case"dataItemCalculatedMember":case"dataItemCalculatedMeasure":case"dataItemMeasurePercentage":return!0}return!1},V5ToDashboard.f_convertV5FormatToDB=function(v_nSelection,v_nDataItem,v_sDataItemName){var v_oFormat={};if(this.F_IsLikelyMeasure(v_nDataItem)){var v_nDataFormat;switch(v_nSelection.nodeName){case"list":var v_nListColumnBody=this.f_getAncestorNode(v_bRunInProduction?v_nSelection.selectSingleNode(".//listColumnBody//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("listColumnBody * [refDataItem='"+v_sDataItemName+"']"),"listColumnBody");v_nDataFormat=v_bRunInProduction?v_nListColumnBody.selectSingleNode(".//style//dataFormat"):v_nListColumnBody.querySelector("style > dataFormat");break;case"crosstab":v_nDataFormat=v_bRunInProduction?v_nSelection.selectSingleNode(".//crosstabFactCell//style//dataFormat"):v_nSelection.querySelector("crosstabFactCell > style > dataFormat");break;case"viz":break;case"vizControl":break;case"mapChart":}v_nDataFormat&&v_nDataFormat.firstElementChild&&(v_oFormat.formatSpec={},this.f_convertV5DataFormatToDB(v_nDataFormat.firstElementChild,v_oFormat.formatSpec))}return v_oFormat},V5ToDashboard.f_getAncestorNode=function(v_nCurrentNode,v_sAncestorName){
- return v_nCurrentNode&&v_nCurrentNode.parentNode?v_nCurrentNode.parentNode.nodeName==v_sAncestorName?v_nCurrentNode.parentNode:this.f_getAncestorNode(v_nCurrentNode.parentNode,v_sAncestorName):null},V5ToDashboard.f_getDataItems=function(v_nQuery){return v_bRunInProduction?v_nQuery.selectNodes(".//selection/*"):v_nQuery.querySelector("selection").childNodes},V5ToDashboard.f_getDataItem=function(v_nQuery,v_sDataItemName){return v_bRunInProduction?v_nQuery.selectSingleNode(".//*[@name='"+v_sDataItemName+"']"):v_nQuery.querySelector("* [name='"+v_sDataItemName+"']")},V5ToDashboard.f_escapeEndBracket=function(v_sName){return v_sName.replace(/\]/g,"]]")},V5ToDashboard.f_addV5DataItemToDBDataView=function(v_nSelection,v_sQueryName,v_nDataItem,v_sRefName,v_oDataView,v_iIndex){if(!this.f_isDataItemUsedInSelection(v_nDataItem,v_nSelection,v_sRefName))return!1;var v_sDataItemName=v_nDataItem.getAttribute("name"),v_aSelection=this.f_convertV5DataItemSortToDB(v_nSelection,v_nDataItem,v_sDataItemName,v_iIndex),v_oFormat=this.f_convertV5FormatToDB(v_nSelection,v_nDataItem,v_sDataItemName),v_sV5DataItemAggregate=v_nDataItem.getAttribute("aggregate"),v_sDBDataItemAggregate=v_sV5DataItemAggregate?this.f_convertAggregateOpToDB(v_sV5DataItemAggregate):"",v_sDataItemNameFull="["+this.f_escapeEndBracket(v_sQueryName)+"].["+this.f_escapeEndBracket(v_sDataItemName)+"]",v_oDataItem={id:v_sDataItemNameFull,itemId:v_sDataItemNameFull,itemLabel:v_sDataItemName};return v_aSelection&&v_aSelection.length>0&&(v_oDataItem.selection=v_aSelection),v_oFormat&&v_oFormat.formatSpec&&(v_oDataItem.format=v_oFormat),v_sDBDataItemAggregate&&(v_oDataItem.aggregate=v_sDBDataItemAggregate),v_oDataView.dataItems.push(v_oDataItem),!0},V5ToDashboard.f_setListWidget=function(v_oWidget,v_nSelection,v_nQuery,v_oDataView){var v_oSlot={};v_oSlot.name="grid_cols",v_oSlot.dataItems=[];for(var v_sQueryName=v_nQuery.getAttribute("name"),v_nlDataItemValue=v_bRunInProduction?v_nSelection.selectNodes(".//listColumnBody//*[@refDataItem]"):v_nSelection.querySelectorAll("* listColumnBody * [refDataItem]"),i=0;i<v_nlDataItemValue.length;i++)if("dataItemValue"==v_nlDataItemValue.item(i).nodeName){var v_sRefDataItem=v_nlDataItemValue.item(i).getAttribute("refDataItem"),v_nDataItem=this.f_getDataItem(v_nQuery,v_sRefDataItem);this.f_addV5DataItemToDBDataView(v_nSelection,v_sQueryName,v_nDataItem,"refDataItem",v_oDataView,i)&&v_oSlot.dataItems.push(v_sRefDataItem)}v_oWidget.data.dataViews.push(v_oDataView),v_oWidget.slotmapping.slots.push(v_oSlot),v_oWidget.visId="JQGrid"},V5ToDashboard.f_convertV5DataFormatToDB=function(v_nV5Format,v_oDBFormat){switch(v_nV5Format.nodeName){case"currencyFormat":v_oDBFormat.type="currency";var v_sCurrencyCode=v_nV5Format.getAttribute("currencyCode");v_sCurrencyCode&&(v_oDBFormat.currencyCode=v_sCurrencyCode,v_oDBFormat.currencyDisplay="symbol");break;case"numberFormat":v_oDBFormat.type="number";break;case"percentFormat":v_oDBFormat.type="percent"}var v_sDecimalSize=v_nV5Format.getAttribute("decimalSize");v_sDecimalSize&&(v_oDBFormat.maximumFractionDigits=v_oDBFormat.minimumFractionDigits=parseInt(v_sDecimalSize))},V5ToDashboard.f_addV5VidaFiltersToDBWidgetLocalFilters=function(v_nQuery,v_nSelection,v_aLocalFilters,v_nlReportDataStore){for(var i=0;i<v_nlReportDataStore.length;i++)for(var v_nReportDataStore=v_nlReportDataStore.item(i),v_nDsFilters=v_bRunInProduction?v_nReportDataStore.selectNodes(".//dsFilters/dsFilter"):v_nReportDataStore.querySelectorAll("* > dsFilters > dsFilter"),j=0;j<v_nDsFilters.length;j++){var v_nFilterRoot,v_nDsFilter=v_nDsFilters.item(j),v_nlFilterDefinition=v_bRunInProduction?v_nDsFilter.selectNodes(".//dsFilterDefinition"):v_nDsFilter.querySelector("dsFilterDefinition");if(v_nlFilterDefinition){for(var v_nlFilterDefChildren=v_bRunInProduction?v_nDsFilter.selectNodes(".//dsFilterDefinition/*"):v_nDsFilter.querySelector("dsFilterDefinition").childNodes,k=0;k<v_nlFilterDefChildren.length;k++)if(v_nlFilterDefChildren.item(k).nodeType==V5ToDashboard.K_iNODE_ELEMENT){v_nFilterRoot=v_nlFilterDefChildren.item(k);break}if(v_nFilterRoot){var v_oDBFilter={};v_oDBFilter.id="Filter"+(i+1),v_oDBFilter.values=[],this.f_convertV5DetailFilterToDBFilter(v_nFilterRoot,v_oDBFilter,v_nQuery,v_nSelection),this.f_filterIsInvalid(v_oDBFilter)||v_aLocalFilters.push(v_oDBFilter)}}}},V5ToDashboard.f_filterIsInvalid=function(v_oDBFilter){for(var i=0;i<v_oDBFilter.values.length;i++){if(!v_oDBFilter.values[i].id)return!1;if(this.f_filterIsInvalid(v_oDBFilter.values[i]))return!0}return!1},V5ToDashboard.f_convertV5CombineFilterOperatorToDB=function(v_sV5CombineFilterOperator){switch(v_sV5CombineFilterOperator){case"filterAnd":return"and";case"filterOr":return"or";case"filterNot":return"not";default:return alert("V5 filter not supported: "+v_sV5CombineFilterOperator),null}},V5ToDashboard.f_convertV5DetailFilterToDBFilter=function(v_nFilter,v_oDBFilter,v_nQuery,v_nSelection){switch(v_nFilter.nodeName){case"filterAnd":case"filterOr":case"filterNot":for(var v_nlFilterChildren=v_nFilter.childNodes,i=0;i<v_nlFilterChildren.length;i++)if(v_nlFilterChildren.item(i).nodeType==V5ToDashboard.K_iNODE_ELEMENT){var v_nFilterChild=v_nlFilterChildren.item(i),v_oDBFilterChild={};v_oDBFilterChild.id=v_oDBFilter.id+"_"+(i+1),v_oDBFilterChild.values=[],v_oDBFilter.values.push(v_oDBFilterChild),this.f_convertV5DetailFilterToDBFilter(v_nFilterChild,v_oDBFilterChild,v_nQuery,v_nSelection)}v_oDBFilter.operator=this.f_convertV5CombineFilterOperatorToDB(v_nFilter.nodeName);break;case"#text":break;default:this.f_convertV5VidaFilterElementToDB(v_nFilter,v_oDBFilter,v_nQuery)}},V5ToDashboard.f_convertV5VidaFilterElementToDB=function(v_nFilter,v_oDBFilter,v_nQuery){var v_sRefDataItem=v_nFilter.getAttribute("refDsColumn"),v_sQueryName=v_nQuery.getAttribute("name");v_oDBFilter.id=v_oDBFilter.columnId="["+this.f_escapeEndBracket(v_sQueryName)+"].["+this.f_escapeEndBracket(v_sRefDataItem)+"]";var v_nFilterValue,i;switch(v_nFilter.nodeName){case"dsFilterIn":var v_nlFilterValues=v_bRunInProduction?v_nFilter.selectNodes(".//dsFilterInValues/dsFilterInValue"):v_nFilter.querySelectorAll("dsFilterInValues > dsFilterInValue");for(i=0;i<v_nlFilterValues.length;i++)if(v_nFilterValue=v_nlFilterValues.item(i)){var v_sFilterValue=v_nFilterValue.childNodes[0].nodeValue;v_oDBFilter.values.push({d:v_sFilterValue,u:v_sFilterValue})}v_oDBFilter.operator="true"===v_nFilter.getAttribute("not")?"notin":"in";break;case"dsFilterCompare":if(v_nFilterValue=v_bRunInProduction?v_nFilter.selectSingleNode(".//dsFilterCompareValue"):v_nFilter.querySelector("dsFilterCompareValue"),!v_nFilterValue)break;var v_FilterValue=Number(v_nFilterValue.childNodes[0].nodeValue);v_oDBFilter.values.push({d:v_FilterValue,u:v_FilterValue}),v_oDBFilter.operator=this.f_convertCompareOperatorToDB(v_nFilter);break;case"dsFilterRange":var v_nFilterFrom=v_bRunInProduction?v_nFilter.selectSingleNode(".//dsFilterFromValue"):v_nFilter.querySelector("dsFilterFromValue"),v_nFilterTo=v_bRunInProduction?v_nFilter.selectSingleNode(".//dsFilterToValue"):v_nFilter.querySelector("dsFilterToValue");if(!v_nFilterFrom&&!v_nFilterTo||0==v_nFilterFrom.childNodes.length&&0==v_nFilterTo.childNodes.length)break;var v_FilterFrom,v_FilterTo;if(v_nFilterFrom.childNodes.length>0&&v_nFilterTo.childNodes.length>0){v_FilterFrom=Number(v_nFilterFrom.childNodes[0].nodeValue),v_FilterTo=Number(v_nFilterTo.childNodes[0].nodeValue),v_oDBFilter.values.push({d:v_FilterFrom,u:v_FilterFrom},{d:v_FilterTo,u:v_FilterTo}),v_oDBFilter.operator="true"===v_nFilter.getAttribute("not")?"notbetween":"between";break}if(v_nFilterFrom.childNodes.length>0&&0==v_nFilterTo.childNodes.length){v_FilterFrom=Number(v_nFilterFrom.childNodes[0].nodeValue),v_oDBFilter.values.push({d:v_FilterFrom,u:v_FilterFrom}),v_oDBFilter.operator="gt";break}if(0==v_nFilterFrom.childNodes.length&&v_nFilterTo.childNodes.length>0){v_FilterTo=Number(v_nFilterTo.childNodes[0].nodeValue),v_oDBFilter.values.push({d:v_FilterTo,u:v_FilterTo}),v_oDBFilter.operator="lt";break}}},V5ToDashboard.f_convertCompareOperatorToDB=function(v_nFilterCompare){var v_bIsNot="true"===v_nFilterCompare.getAttribute("not");switch(v_nFilterCompare.getAttribute("operator")){case"greaterThan":case"greaterThanEqual":return v_bIsNot?"lt":"gt";case"lessThan":case"lessThanEqual":return v_bIsNot?"gt":"lt";case"equal":return"eq"}return"eq"},V5ToDashboard.f_setCrosstabWidget=function(v_oWidget,v_nSelection,v_nQuery,v_oDataView){var v_sQueryName=v_nQuery.getAttribute("name");v_oWidget.slotmapping.slots=[{name:"row_level1",dataItems:[],caption:"Rows",id:"row_level1"},{name:"column_level1",dataItems:[],caption:"Columns",id:"column_level1"},{name:"values",dataItems:[],caption:"Values",id:"values"}];var v_sRefDataItem,v_nDataItem,i,v_nlRowsCrosstabNodeMember=v_bRunInProduction?v_nSelection.selectNodes(".//crosstabRows//crosstabNodeMember"):v_nSelection.querySelectorAll("crosstabRows * crosstabNodeMember");for(i=v_nlRowsCrosstabNodeMember.length-1;i>=0;i--)v_sRefDataItem=v_nlRowsCrosstabNodeMember.item(i).getAttribute("refDataItem"),v_nDataItem=this.f_getDataItem(v_nQuery,v_sRefDataItem),this.f_addV5DataItemToDBDataView(v_nSelection,v_sQueryName,v_nDataItem,"refDataItem",v_oDataView,i)&&v_oWidget.slotmapping.slots[0].dataItems.push(v_sRefDataItem);var v_nlColsCrosstabNodeMember=v_bRunInProduction?v_nSelection.selectNodes(".//crosstabColumns//crosstabNodeMember"):v_nSelection.querySelectorAll("crosstabColumns * crosstabNodeMember");for(i=v_nlColsCrosstabNodeMember.length-1;i>=0;i--)if(v_sRefDataItem=v_nlColsCrosstabNodeMember.item(i).getAttribute("refDataItem"),v_nDataItem=this.f_getDataItem(v_nQuery,v_sRefDataItem),this.f_addV5DataItemToDBDataView(v_nSelection,v_sQueryName,v_nDataItem,"refDataItem",v_oDataView,i)){var v_iSlotIndex=1;this.F_IsLikelyMeasure(v_nDataItem)&&(v_iSlotIndex=2),v_oWidget.slotmapping.slots[v_iSlotIndex].dataItems.push(v_sRefDataItem)}var v_nCrosstabCornerDataItemLabel=v_bRunInProduction?v_nSelection.selectSingleNode(".//crosstabCorner//*[@refDataItem]"):v_nSelection.querySelector("crosstabCorner * [refDataItem]");v_nCrosstabCornerDataItemLabel&&(v_sRefDataItem=v_nCrosstabCornerDataItemLabel.getAttribute("refDataItem"),v_nDataItem=this.f_getDataItem(v_nQuery,v_sRefDataItem),this.f_addV5DataItemToDBDataView(v_nSelection,v_sQueryName,v_nDataItem,"refDataItem",v_oDataView,0),v_oWidget.slotmapping.slots[2].dataItems.push(v_sRefDataItem)),v_oWidget.data.dataViews.push(v_oDataView),v_oWidget.visId="crosstab"},V5ToDashboard.f_convertAggregateOpToDB=function(v_sV5AggregateOp){switch(v_sV5AggregateOp){case"average":return"avg";case"summarize":return"sum";case"minimum":return"min";case"maximum":return"max";case"count":return"count";case"countDistinct":return"countdistinct";default:return null}},V5ToDashboard.f_setVizControlWidget=function(v_oWidget,v_nSelection,v_aQueries,v_aDataViews,v_nlReportDataStore){v_oWidget.visId=this.f_convertV5VidaTypeToDB(v_nSelection),this.f_addVizControlPropertiesToWidget(v_oWidget,v_nSelection);var v_aLayers=[];"com.ibm.vis.rave2bundletiledmap"==v_oWidget.visId&&(v_oWidget.slotmapping.layers=[]);for(var i=0;i<v_aQueries.length;i++){for(var v_nQuery=v_aQueries[i],v_sQueryName=v_nQuery.getAttribute("name"),v_oDataView=v_aDataViews[i],v_nlDataItems=this.f_getDataItems(v_nQuery),j=0;j<v_nlDataItems.length;j++){var v_nDataItem=v_nlDataItems.item(j);if(this.f_addV5DataItemToDBDataView(v_nSelection,v_sQueryName,v_nDataItem,"refDsColumn",v_oDataView,j)){var v_oSlot=this.f_createVizControlSlot(v_nSelection,v_nDataItem,v_oWidget.visId);v_oWidget.slotmapping.slots.push(v_oSlot),"com.ibm.vis.rave2bundletiledmap"==v_oWidget.visId&&-1==v_aLayers.indexOf(v_oSlot.layerId)&&(v_aLayers.push(v_oSlot.layerId),v_oWidget.slotmapping.layers.push({type:v_oSlot.layerId,id:v_oSlot.layerId,dataViewId:v_oDataView.id}))}}this.f_addV5VidaFiltersToDBWidgetLocalFilters(v_nQuery,v_nSelection,v_oWidget.localFilters,v_nlReportDataStore),v_oWidget.data.dataViews.push(v_oDataView)}},V5ToDashboard.f_convertV5VidaTypeToDB=function(v_nSelection){var v_sType=v_nSelection.getAttribute("type");switch(v_sType){case"com.ibm.vis.clusteredColumn":return"com.ibm.vis.rave2bundlecolumn";case"com.ibm.vis.clusteredBar":return"com.ibm.vis.rave2bundlebar";case"com.ibm.vis.stackedColumn":return"com.ibm.vis.rave2bundlestackedcolumn";case"com.ibm.vis.stackedBar":return"com.ibm.vis.rave2bundlestackedbar";case"com.ibm.vis.area":return"com.ibm.vis.rave2bundlearea";case"com.ibm.vis.treemap":return"com.ibm.vis.rave2bundletreemap";case"com.ibm.vis.bubble":return"com.ibm.vis.ravebubble";case"com.ibm.vis.bullet":return"com.ibm.vis.rave2bundlebullet";case"com.ibm.vis.point":return"com.ibm.vis.rave2point";case"com.ibm.vis.packedBubble":return"com.ibm.vis.rave2bundlepackedbubble";case"com.ibm.vis.hierarchicalPackedBubble":return"com.ibm.vis.rave2bundlehierarchicalpackedbubble";case"com.ibm.vis.marimekko":return"com.ibm.vis.rave2marimekko";case"com.ibm.vis.heatmap":return"com.ibm.vis.rave2heat";case"com.ibm.vis.line":return"com.ibm.vis.rave2line";case"com.ibm.vis.simpleCombination":return"com.ibm.vis.rave2bundlecomposite";case"com.ibm.vis.pie":return"com.ibm.vis.rave2bundlepie";case"com.ibm.vis.dial":return"com.ibm.vis.rave2bundleradialbar";case"com.ibm.vis.radar":return"com.ibm.vis.rave2bundleradar";case"com.ibm.vis.scatter":return"com.ibm.vis.ravescatter";case"com.ibm.vis.wordcloud":return"com.ibm.vis.rave2bundlewordcloud";case"com.ibm.vis.boxplot":return"com.ibm.vis.rave2bundleboxplot";case"com.ibm.vis.smoothArea":return"com.ibm.vis.rave2bundlesmootharea";case"com.ibm.vis.waterfall":return"com.ibm.vis.rave2bundlewaterfall";case"com.ibm.vis.tiledmap":return"com.ibm.vis.rave2bundletiledmap";default:return v_sType}},V5ToDashboard.f_addVizPropertiesToWidget=function(v_oWidget,v_nSelection){for(var v_nlVizPropertyValues=v_bRunInProduction?v_nSelection.selectNodes(".//vizPropertyValues/*"):v_nSelection.querySelectorAll("vizPropertyValues > *"),i=0;i<v_nlVizPropertyValues.length;i++){var v_nVizProperty=v_nlVizPropertyValues.item(i);if(v_nVizProperty)switch(v_nVizProperty.getAttribute("name")){case"color.palette":this.f_setDBVizProperty(v_oWidget,v_nVizProperty,"colorPalette");break;case"legend.position":this.f_setDBVizProperty(v_oWidget,v_nVizProperty,"widget.legend.position");break;case"legend.display":this.f_setDBVizProperty(v_oWidget,v_nVizProperty,"widget.legend.display")}}},V5ToDashboard.f_addVizControlPropertiesToWidget=function(v_oWidget,v_nSelection,v_sWidgetId){for(var v_nlVizPropertyValues=v_bRunInProduction?v_nSelection.selectNodes(".//vizPropertyValues/*"):v_nSelection.querySelectorAll("vizPropertyValues > *"),i=0;i<v_nlVizPropertyValues.length;i++){var v_nVizProperty=v_nlVizPropertyValues.item(i);if(v_nVizProperty){var v_sDBVizPropertyName=v_nVizProperty.getAttribute("name");if(!v_sDBVizPropertyName)return;v_sDBVizPropertyName=v_sDBVizPropertyName.substring(v_sDBVizPropertyName.indexOf("_")+1),this.f_setDBVizProperty(v_oWidget,v_nVizProperty,v_sDBVizPropertyName)}}},V5ToDashboard.f_setDBVizProperty=function(v_oWidget,v_nVizProperty,v_sDBVizPropertyName){if(v_nVizProperty&&v_nVizProperty.childNodes&&v_nVizProperty.childNodes[0]){var v_sValue=v_nVizProperty.childNodes[0].nodeValue;if(v_sValue)switch(v_sDBVizPropertyName){case"color_cat":v_oWidget.properties.push({id:"colorPalette",value:v_sValue});break;default:v_oWidget.properties.push({id:v_sDBVizPropertyName,value:v_sValue})}}},V5ToDashboard.f_setDBVizType=function(v_oWidget,v_sVizType){switch(v_sVizType){case"rave-library-column,clusteredcolumn":v_oWidget.visId="com.ibm.vis.rave2bundlecolumn";break;case"rave-library-column,clusteredbar":v_oWidget="com.ibm.vis.rave2bundlebar";break;case"rave-library-column,stackedcolumn":v_oWidget.visId="com.ibm.vis.rave2bundlestackedcolumn";break;case"rave-library-column,stackedbar":v_oWidget.visId="com.ibm.vis.rave2bundlestackedbar";break;case"rave-library-area,area":v_oWidget.visId="com.ibm.vis.rave2bundlearea";break;case"rave-library-line,line":v_oWidget.visId="com.ibm.vis.rave2line";break;case"rave-library-bubble,point":v_oWidget.visId="com.ibm.vis.rave2point";break;case"rave-library-bubble,scatter":v_oWidget.visId="com.ibm.vis.ravescatter";break;case"rave-library-dial,dial":v_oWidget.visId="com.ibm.vis.rave2bundleradialbar";break;case"rave-library-bubble,packedBubble":v_oWidget.visId="com.ibm.vis.rave2bundlepackedbubble";break;case"rave-library-wordcloud,wordcloud":v_oWidget.visId="com.ibm.vis.rave2bundlewordcloud";break;case"rave-library-pie,pie":v_oWidget.visId="com.ibm.vis.rave2bundlepie";break;case"rave-library-heatmap,heatmap":v_oWidget.visId="com.ibm.vis.rave2heat";break;case"rave-library-bubble,bubble":v_oWidget.visId="com.ibm.vis.ravebubble";break;case"rave-library-composite,compositeOneDataSet":v_oWidget.visId="com.ibm.vis.rave2bundlecomposite"}},V5ToDashboard.f_createVizSlot=function(v_nSelection,v_sVizType,v_nDataItem){if("viz"!==v_nSelection.nodeName)return null;var v_sDataItemName=v_nDataItem.getAttribute("name"),v_oSlot={};v_oSlot.dataItems=[],v_oSlot.dataItems.push(v_sDataItemName);var v_nVizValue,v_bIsMeasure=this.F_IsLikelyMeasure(v_nDataItem);switch(v_sVizType){case"rave-library-column,clusteredcolumn":case"rave-library-column,clusteredbar":case"rave-library-column,stackedcolumn":case"rave-library-column,stackedbar":case"rave-library-area,area":case"rave-library-line,line":case"rave-library-bubble,point":if(v_bIsMeasure)v_oSlot.name=v_oSlot.caption=v_oSlot.id="values";else if(v_bRunInProduction?v_nSelection.selectSingleNode(".//vizCategoryEdge[@refEdge='xEdge']//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizCategoryEdge[refEdge='xEdge'] > * [refDataItem='"+v_sDataItemName+"']"))v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories";else switch(v_sVizType){case"rave-library-area,area":case"rave-library-line,line":case"rave-library-bubble,point":v_oSlot.name=v_oSlot.caption=v_oSlot.id="series";break;default:v_oSlot.name=v_oSlot.caption=v_oSlot.id="color"}v_oSlot.dataItems=[],v_oSlot.dataItems.push(v_sDataItemName);break;case"rave-library-bubble,scatter":v_bIsMeasure?(v_nVizValue=v_bRunInProduction?v_nSelection.selectSingleNode(".//vizValue[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizValue[refDataItem='"+v_sDataItemName+"']"),v_oSlot.name=v_oSlot.caption=v_oSlot.id=v_nVizValue.getAttribute("idField")):(v_bRunInProduction?v_nSelection.selectSingleNode(".//vizCategoryEdge[@refEdge='labelEdge']//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizCategoryEdge[refEdge='labelEdge'] > * [refDataItem='"+v_sDataItemName+"']"))?v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories":v_oSlot.name=v_oSlot.caption=v_oSlot.id="color";break;case"rave-library-dial,dial":v_bIsMeasure?v_oSlot.name=v_oSlot.caption=v_oSlot.id="values":(v_bRunInProduction?v_nSelection.selectSingleNode(".//vizCategoryEdge[@refEdge='labelEdge']//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizCategoryEdge[refEdge='labelEdge'] > * [refDataItem='"+v_sDataItemName+"']"))?v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories":v_oSlot.name=v_oSlot.caption=v_oSlot.id="color";break;case"rave-library-bubble,packedBubble":case"rave-library-wordcloud,wordcloud":v_bIsMeasure?v_oSlot.name=v_oSlot.caption=v_oSlot.id="size":(v_bRunInProduction?v_nSelection.selectSingleNode(".//vizCategoryEdge[@refEdge='labelEdge']//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizCategoryEdge[refEdge='labelEdge'] > * [refDataItem='"+v_sDataItemName+"']"))?v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories":v_oSlot.name=v_oSlot.caption=v_oSlot.id="color";break;case"rave-library-pie,pie":v_bIsMeasure?v_oSlot.name=v_oSlot.caption=v_oSlot.id="values":v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories";break;case"rave-library-heatmap,heatmap":v_bIsMeasure?v_oSlot.name=v_oSlot.caption=v_oSlot.id="color":(v_bRunInProduction?v_nSelection.selectSingleNode(".//vizCategoryEdge[@refEdge='xEdge']//*[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizCategoryEdge[refEdge='xEdge'] > * [refDataItem='"+v_sDataItemName+"']"))?v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories":v_oSlot.name=v_oSlot.caption=v_oSlot.id="series";break;case"rave-library-bubble,bubble":v_bIsMeasure?(v_nVizValue=v_bRunInProduction?v_nSelection.selectSingleNode(".//vizValue[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizValue[refDataItem='"+v_sDataItemName+"']"),v_oSlot.name=v_oSlot.caption=v_oSlot.id=v_nVizValue.getAttribute("idField")):v_oSlot.name=v_oSlot.caption=v_oSlot.id="color";break;case"rave-library-composite,compositeOneDataSet":v_bIsMeasure?(v_nVizValue=v_bRunInProduction?v_nSelection.selectSingleNode(".//vizValue[@refDataItem='"+v_sDataItemName+"']"):v_nSelection.querySelector("vizValue[refDataItem='"+v_sDataItemName+"']"),v_oSlot.name=v_oSlot.caption=v_oSlot.id="yLine"==v_nVizValue.getAttribute("idField")?"lineValue":"columnValue"):v_oSlot.name=v_oSlot.caption=v_oSlot.id="categories";break;default:return null}return v_oSlot},V5ToDashboard.f_createVizControlSlot=function(v_nSelection,v_nDataItem,v_sVisId){var v_sDataItemName=v_nDataItem.getAttribute("name"),v_oSlot={};v_oSlot.dataItems=[],v_oSlot.dataItems.push(v_sDataItemName);var v_nVcSlotData=this.f_getAncestorNode(v_bRunInProduction?v_nSelection.selectSingleNode(".//*[@refDsColumn='"+v_sDataItemName+"']"):v_nSelection.querySelector("[refDsColumn='"+v_sDataItemName+"']"),"vcSlotData");if("com.ibm.vis.rave2bundletiledmap"==v_sVisId){var v_nVcSlotDataSet=this.f_getAncestorNode(v_bRunInProduction?v_nSelection.selectSingleNode(".//*[@refDsColumn='"+v_sDataItemName+"']"):v_nSelection.querySelector("[refDsColumn='"+v_sDataItemName+"']"),"vcDataSet");v_oSlot.layerId=v_nVcSlotDataSet.getAttribute("idDataSet")}var v_sIdSlot=(v_bRunInProduction?v_nSelection.selectSingleNode(".//vcDataSet").getAttribute("refDataStore"):v_nSelection.querySelector("vcDataSet").getAttribute("refDataStore"),v_nVcSlotData.getAttribute("idSlot"));return v_oSlot.name=v_oSlot.caption=v_oSlot.id=v_sIdSlot,v_oSlot},V5ToDashboard}),define("bi/authoring/plugins/rsReportToDashboardService",["baglass/core-client/js/core-client/ui/core/Class","q","bi/authoring/utils/V5ToDashboard"],function(Class,Q,V5ToDashboard){"use strict";var rsReportToDashboardService=Class.extend({init:function(attributes){this._glassContext=attributes.glassContext,rsReportToDashboardService.inherited("init",this,arguments)},convertReportToDashboard:function(){return this.deferred=Q.defer(),this._glassContext.getCoreSvc(".Clipboard").get().then(function(v_oExternalCopy){if(v_oExternalCopy&&"REPORT"==v_oExternalCopy.type){var v_nSourceReport=(new DOMParser).parseFromString(v_oExternalCopy.spec,"text/xml").documentElement,v_aSelectionIids=v_oExternalCopy.selectionIids;V5ToDashboard.ConvertV5toDB(v_nSourceReport,v_aSelectionIids,this._glassContext).then(function(v_oDBSpec){this.deferred.resolve(JSON.stringify(v_oDBSpec))}.bind(this))}else this.deferred.resolve("")}.bind(this)),this.deferred.promise}});return rsReportToDashboardService}),define("js/authoring/bundle",function(){});
|