/** * 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,""")}function addClassicViewerPrompts(v_elForm,v_aPromptParameters){for(var i=0;i"}function buildBoundRangeXML(v_oValue){return'"}function buildUnboundedEndRangeXML(v_oValue){return'"}function buildUnboundedStartRangeXML(v_oValue){return'"}function convertPromptValuesToXML(v_aValues){for(var v_sXMLValues="",i=0;i"+v_sXMLValues+"";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_aValue.push(">"),v_aValue.push(xmlEncode(v_oValue.toString())),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'true'+emitUseDisplay(v_oValue)+""}function buildBoundRangeParmValue(v_oValue){return'truetrue'+emitUseDisplay(v_oValue.boundRange.start)+'true'+emitUseDisplay(v_oValue.boundRange.end)+""}function buildUnboundedEndRangeParmValue(v_oValue){return'truetrue'+emitUseDisplay(v_oValue.unboundedEndRange.start)+""}function buildUnboundedStartRangeParmValue(v_oValue){return'truetrue'+emitUseDisplay(v_oValue.unboundedStartRange.end)+""}function buildBusParameterValues(v_oPromptParameters,v_oPromptParametersComplex,v_sParamsTagName){var v_sParameterValues="',v_oPromptParameters=groupPromptParamters(v_oPromptParameters,v_oPromptParametersComplex);for(var v_sName in v_oPromptParameters)if(v_oPromptParameters.hasOwnProperty(v_sName)){v_sParameterValues+='',v_sParameterValues+=''+xmlEncode(v_sName)+"",v_sParameterValues+='';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+="",v_sParameterValues+=""}return v_sParameterValues+=""}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/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('