1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504 |
- dojo.provide("TM1WebCubeViewerWidget");
- dojo.require("bux.Helper");
- dojo.require("bux.iwidget.utilities.UtilityWidgetBase"); //For Bux Action Button issue, can't remove
- dojo.declare("TM1WebCubeViewerWidget", [tm1.iwidget.utilities.Filter], {
- iframeCtrl: null,
- iframeCtrlCantLoadDojo: null,
- dimensionNames: null,
- elementNames: null,
- elementNameCounter: 0,
- subscriptionHandle: null,
- cubeViewState: null,
- app: null,
- inDoMore: false,
- _Widget: null,
- cantLoadDojo: false,
- onbeforeunloadHandler: null,
- // Filter variable
- filterFieldName: "tm1Cube",
-
- // ====== Multilingual Support - Start ========
- _productLocale: null,
- _tm1messages: null,
- // ====== Multilingual Support - End ========
- onLoad: function () {
- // ====== Multilingual Support - Start ========
- // Remember where we were loaded from: this is our path for future AJAX calls and .js loads
- dojo.registerModulePath("TM1WebCubeViewerWidget", this.iContext.io.rewriteURI("js"));
- this.setLanguage().then(dojo.hitch(this, "getWidgetAttributes"));
- // ====== Multilingual Support - End ========
- },
- loadWithAttributes: function () {
- // load tm1web css file
- var element = document.createElement('link');
- element.href = this.tm1WebURL + "/css/cubeviewer.css";
- element.rel = 'stylesheet';
- element.type = 'text/css';
- document.body.appendChild(element);
- element = document.createElement('link');
- element.href = this.tm1WebURL + "/scripts/tm1web/themes/tm1web/tm1web.css";
- element.rel = 'stylesheet';
- element.type = 'text/css';
- document.body.appendChild(element);
- dojo.addClass(document.body, "tm1web");
- var scriptsPath = this.tm1WebURL + "/scripts/";
- require({
- packages: [
- {
- name: "tm1web",
- location: scriptsPath + "tm1web",
- packageMap: {
- dojo: "tm1webDojo",
- dijit: "tm1webDijit",
- dojox: "tm1webDojox",
- com: "tm1webCom"
- }
- }, {
- name: "tm1webCom",
- location: scriptsPath + "com",
- packageMap: {
- dojo: "tm1webDojo",
- dijit: "tm1webDijit",
- dojox: "tm1webDojox",
- com: "tm1webCom"
- }
- }, {
- name: "tm1webRave",
- location: scriptsPath + "com",
- packageMap: {
- dojo: "tm1webDojo",
- dijit: "tm1webDijit",
- dojox: "tm1webDojox",
- com: "tm1webCom"
- }
- }, {
- name: "tm1webDojo",
- location: scriptsPath + "dojo",
- packageMap: {
- dojo: "tm1webDojo",
- dijit: "tm1webDijit",
- dojox: "tm1webDojox"
- }
- }, {
- name: "tm1webDijit",
- location: scriptsPath + "dijit",
- packageMap: {
- dojo: "tm1webDojo",
- dijit: "tm1webDijit",
- dojox: "tm1webDojox"
- }
- }, {
- name: "tm1webDojox",
- location: scriptsPath + "dojox",
- packageMap: {
- dojo: "tm1webDojo",
- dijit: "tm1webDijit",
- dojox: "tm1webDojox"
- }
- }
- ]
- });
- //if (this.getCookie("tm1webcremote") != "" || (this.tm1Toolbar == "1")) {
- // this.cantLoadDojo = true;
- //} else {
- try {
- var self = this;
- require([
- "tm1web/cubeview/CubeViewer",
- "tm1web/utility/message-localizer"
- ], function(TM1Widget, MessageLocalizer) {
- window.MessageLocalizer = MessageLocalizer;
- self._Widget = TM1Widget;
- self.app = null;
- if (self.areTM1ParametersValid()) {
- self.refreshView();
- } else {
- self.onGetProperties(null, true);
- }
- });
- } catch (err) {
- self.cantLoadDojo = true;
- // document.cookie = "tm1webcremote=true; path=/";
- self.app = null;
- if (self.areTM1ParametersValid()) {
- self.refreshView();
- } else {
- self.onGetProperties(null, true);
- }
- }
- //}
- },
- // ====== Multilingual Support - Start ========
- updateView: function () {
- this.setLanguage();
- },
- getCookie: function (name) {
- if (document.cookie.length <= 0)
- return (""); // no cookies
- var search = name + "=";
- var offset = document.cookie.indexOf(search);
- if (offset == -1)
- return (""); // cookie does not exist
- offset += search.length;
- // set index of beginning of value
- var end = document.cookie.indexOf(";", offset);
- // set index of end of cookie value
- if (end == -1)
- end = document.cookie.length;
- return (unescape(document.cookie.substring(offset, end)));
- },
- setLanguage: function () {
- // Setup Localization tables - Use the BUX preferences for locale. Use Product locale for loading strings
- var curProductLocale = bux.Helper.getUserPreference("productLocale");
- if (this._productLocale != curProductLocale) {
- this._productLocale = curProductLocale;
- var deferred = new dojo.Deferred();
- var self = this;
- dojo.requireLocalization("TM1WebCubeViewerWidget", "tm1ContentCubeViewerWidget_msg", curProductLocale);
- dojo.ready(function() {
- self._tm1messages = dojo.i18n.getLocalization("TM1WebCubeViewerWidget", "tm1ContentCubeViewerWidget_msg", curProductLocale);
- deferred.resolve();
- });
-
- return deferred;
- }
- },
- createBasicWidgetToolbar: function () {
- var toolbarItems =
- [
- {
- _root:
- [
- { separator: true },
- { name: "Restart", action: "IDM_RESTART", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESTART, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada" }
- ]
- }
- ];
- this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, toolbarItems);
- },
- createWidgetToolbar: function () {
- var toolbarItems =
- [
- {
- _root:
- [
- { separator: true },
- { name: "Refresh", action: "IDM_RECALCULATE", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_REFRESH, showLabel: false, "iconClass": "bux-refresh-image" },
- { name: "Reset", action: "IDM_RESET", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESET, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada" },
- { name: "Restart", action: "IDM_RESTART", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESTART, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada" }
- ]
- }
- ];
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_COMMIT");
- //toolbarItems = this.addToolbutton(toolbarItems, "IDM_SAVEVIEW");
- //toolbarItems = this.addToolbutton(toolbarItems, "IDM_SAVEAS");
- toolbarItems = this.addToolbuttonWithSubmenu(toolbarItems, "IDM_EXPORT");
- toolbarItems = this.addSeparator(toolbarItems);
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_SAVEDATACHANGES");
- //toolbarItems = this.addToolbutton(toolbarItems, "IDM_REVIEWDATACHANGES");
- toolbarItems = this.addSeparator(toolbarItems);
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_RECALCULATE");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_TOGGLE_AUTOMATICRECALCULATE");
- toolbarItems = this.addToolbuttonWithSubmenu(toolbarItems, "IDM_SUPPRESS_ZEROS");
- toolbarItems = this.addSeparator(toolbarItems);
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_CHART");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_CHARTANDGRID");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_GRID");
- toolbarItems = this.addToolbuttonWithSubmenu(toolbarItems, "IDM_CHART-SELECT");
- toolbarItems = this.addSeparator(toolbarItems);
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_RESET_DATA");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_SANDBOX_UNDO");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_SANDBOX_REDO");
- toolbarItems = this.addSeparator(toolbarItems);
- toolbarItems = this.addToolbuttonWithSubmenu(toolbarItems, "IDM_SANDBOX");
- toolbarItems = this.addToolbuttonWithSubmenu(toolbarItems, "IDM_SANDBOXITEMS");
- this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, toolbarItems);
- },
- addSeparator: function (toolbarItems) {
- var separator = { "separator": true };
- return toolbarItems.concat(separator);
- },
- addToolbutton: function (toolbarItems, toolbarAction) {
- if (this.isToolbuttonVisible(toolbarAction)) {
- return toolbarItems.concat(this.createSimpleToolbutton(toolbarAction));
- } else {
- return toolbarItems;
- }
- },
- addToolbuttonWithSubmenu: function (toolbarItems, toolbarAction) {
- if (this.isToolbuttonVisible(toolbarAction)) {
- return toolbarItems.concat(this.createToolbuttonWithSubmenu(toolbarAction));
- } else {
- return toolbarItems;
- }
- },
- createSimpleToolbutton: function (toolbarAction) {
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction)
- }
- return toolbutton;
- },
- appendSandboxMenuChoice: function (menuItems, sandboxIndex, sandboxName, activeSandbox) {
- var toolbarAction = "SANDBOXCHOICE" + sandboxIndex;
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": sandboxName,
- "iconClass": (activeSandbox == sandboxName ? "tm1-menu-radioselection" : "tm1-menu-empty")
- }
- return menuItems.concat(toolbutton);
- },
- appendStrategyDiagramMenuChoice: function (menuItems, diagramIndex, diagramName) {
- var toolbarAction = "STRATEGYDIAGRAMCHOICE" + diagramIndex;
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": diagramName,
- "iconClass": this.getToolbuttonImage("IDM_METRICS_STRATEGY")
- }
- return menuItems.concat(toolbutton);
- },
- createToolbuttonWithSubmenu: function (toolbarAction) {
- var menuitems = null;
- if (toolbarAction == "IDM_EXPORT") {
- var menuItems = [];
- menuItems = this.addToolbutton(menuItems, "IDM_SLICE_TO_EXCEL");
- menuItems = this.addToolbutton(menuItems, "IDM_SNAPSHOT_TO_EXCEL");
- menuItems = this.addToolbutton(menuItems, "IDM_EXPORT_TO_PDF");
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items": menuItems
- }
- return toolbutton;
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
- var menuItems = [];
- menuItems = this.addToolbutton(menuItems, "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS");
- menuItems = this.addToolbutton(menuItems, "IDM_SUPPRESS_ZEROS_ROWS");
- menuItems = this.addToolbutton(menuItems, "IDM_SUPPRESS_ZEROS_COLUMNS");
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items": menuItems
- }
- return toolbutton;
- } else if (toolbarAction == "IDM_CHART-SELECT") {
- var menuItems = [];
- menuItems = this.addToolbuttonWithSubmenu(menuItems, "IDM_CHARTTYPE");
- menuItems = this.addToolbuttonWithSubmenu(menuItems, "IDM_METRICS");
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items": menuItems
- }
- return toolbutton;
- } else if (toolbarAction == "IDM_METRICS") {
- var menuItems = [];
- menuItems = this.addToolbutton(menuItems, "IDM_METRICS_IMPACT");
- // menuItems = this.addToolbuttonWithSubmenu(menuItems, "IDM_METRICS_STRATEGY");
- if (this.cubeViewState != null && this.cubeViewState.strategyDiagramList != null && this.cubeViewState.strategyDiagramList.length > 0) {
- for (i = 0; i < this.cubeViewState.strategyDiagramList.length; i++) {
- menuItems = this.appendStrategyDiagramMenuChoice(menuItems, i, this.cubeViewState.strategyDiagramList[i].displayString);
- }
- }
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items": menuItems
- }
- return toolbutton;
- } else if (toolbarAction == "IDM_CHARTTYPE") {
- var menuItems = [];
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_POINT");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_BUBBLE");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_LINE");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_SPLINE");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_STEPLINE");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_FASTLINE");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_BAR");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDBAR");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDBAR100");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_COLUMN");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDCOLUMN");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDCOLUMN100");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_AREA");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDAREA");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDAREA100");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_PIE");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_DOUGHNUT");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_STOCK");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_CANDLESTICK");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_RANGE");
- menuItems = this.addToolbutton(menuItems, "IDM_CHART_SPLINERANGE");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_GANTT");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_RANGECOLUMN");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_RADAR");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_POLAR");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_BOXPLOT");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_FUNNEL");
- //menuItems = this.addToolbutton(menuItems, "IDM_CHART_PYRAMID");
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items": menuItems
- }
- return toolbutton;
- } else if (toolbarAction == "IDM_SANDBOX") {
- var menuItems = [];
- menuItems = this.addToolbutton(menuItems, "IDM_CREATE_SANDBOX");
- menuItems = this.addToolbutton(menuItems, "IDM_DELETE_SANDBOX");
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items": menuItems
- }
- return toolbutton;
- } else if (toolbarAction == "IDM_SANDBOXITEMS") {
- var menuItems = [];
- if (this.sandboxNames) {
- menuItems = this.appendSandboxMenuChoice(menuItems, 0, "[Base]", this.sandboxNames.currentSandbox);
- if (this.sandboxNames.sandboxes.length > 1) {
- for (i = 1; i < this.sandboxNames.sandboxes.length; i++) {
- menuItems = this.appendSandboxMenuChoice(menuItems, i, this.sandboxNames.sandboxes[i].name, this.sandboxNames.currentSandbox);
- }
- }
- } else {
- menuItems = this.appendSandboxMenuChoice(menuItems, 0, "[Base]", "[Base]");
- }
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items": menuItems
- }
- return toolbutton;
- } else if (toolbarAction == "IDM_METRICS_STRATEGY") {
- var menuItems = [];
- if (this.cubeViewState != null && this.cubeViewState.strategyDiagramList != null && this.cubeViewState.strategyDiagramList.length > 0) {
- for (i = 0; i < this.cubeViewState.strategyDiagramList.length; i++) {
- menuItems = this.appendStrategyDiagramMenuChoice(menuItems, i, this.cubeViewState.strategyDiagramList[i].displayString);
- }
- }
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items": menuItems
- }
- return toolbutton;
- }
- var toolbutton = {
- "name": toolbarAction,
- "action": toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items": menuitems
- }
- return toolbutton;
- },
- isToolbuttonVisible: function (toolbarAction) {
- if (toolbarAction == "IDM_SANDBOXITEMS") {
- if (this.app != null) {
- if (this.cubeViewState == null) {
- return true;
- } else {
- return (this.cubeViewState.sandboxes.display);
- }
- }
- } else
- return true;
- },
- isToolbuttonDisabled: function (toolbarAction) {
- if (toolbarAction == "IDM_CHART-SELECT") {
- if (this.app != null) {
- if (this.cubeViewState == null) {
- return true;
- } else {
- return (this.cubeViewState.displayMode == "Grid");
- }
- }
- } else if (toolbarAction == "IDM_METRICS") {
- if (this.app != null) {
- if (this.cubeViewState == null) {
- return true;
- } else {
- return (this.cubeViewState.metricView == false);
- }
- }
- } else if (toolbarAction == "IDM_METRICS_IMPACT") {
- return false;
- } else if (toolbarAction == "IDM_METRICS_STRATEGY") {
- return false;
- } else if (toolbarAction == "IDM_COMMIT") {
- if (this.app != null) {
- if (this.cubeViewState == null) {
- return true;
- } else {
- return this.cubeViewState.baseSandbox;
- }
- }
- return true;
- } else if (toolbarAction == "IDM_SAVEVIEW") {
- return false;
- } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
- if (this.app != null) {
- if (this.cubeViewState == null) {
- return true;
- } else {
- return (this.cubeViewState.unsavedChanges == false);
- }
- }
- return true;
- } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
- if (this.app != null) {
- if (this.cubeViewState == null) {
- return true;
- } else {
- return (this.cubeViewState.unsavedChanges == false);
- }
- }
- return true;
- } else if (toolbarAction == "IDM_RESET_DATA") {
- if (this.app != null) {
- if (this.cubeViewState == null) {
- return true;
- } else {
- return this.cubeViewState.baseSandbox;
- }
- }
- } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
- if (this.app != null) {
- if (this.cubeViewState == null) {
- return true;
- } else {
- return (this.cubeViewState.redoUndoStatus.canUndo == false);
- }
- }
- return true;
- } else if (toolbarAction == "IDM_SANDBOX_REDO") {
- if (this.app != null) {
- if (this.cubeViewState == null) {
- return true;
- } else {
- return (this.cubeViewState.redoUndoStatus.canRedo == false);
- }
- }
- return true;
- } else if (toolbarAction == "IDM_SANDBOX") {
- return false;
- } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
- return false;
- } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
- return false;
- } else if (toolbarAction == "IDM_SANDBOXITEMS") {
- return false;
- } else {
- return false;
- }
- return "tm1-toolbar-empty";
- },
- getToolbuttonTooltip: function (toolbarAction) {
- if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
- return window.MessageLocalizer.get("SUPPRESS_ZEROES_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_COMMIT") {
- return window.MessageLocalizer.get("COMMIT_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SAVEVIEW") {
- return window.MessageLocalizer.get("SAVE_VIEW_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SAVEAS") {
- return window.MessageLocalizer.get("SAVE_AS_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_EXPORT") {
- return window.MessageLocalizer.get("EXPORT_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
- return window.MessageLocalizer.get("SLICE_TO_EXCEL_STR");
- } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
- return window.MessageLocalizer.get("SNAP_TO_EXCEL_STR");
- } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
- return window.MessageLocalizer.get("EXPORT_TO_PDF_STR");
- } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
- return window.MessageLocalizer.get("SAVE_DATA_CHANGES_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
- return window.MessageLocalizer.get("REVIEW_DATA_CHANGES_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_RECALCULATE") {
- return window.MessageLocalizer.get("RECALCULATE_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
- if (this.app && this.cubeViewState && this.cubeViewState.automaticRecalculationEnabled) {
- return window.MessageLocalizer.get("AUTO_RECALCULATE_OFF_TOOLTIP_STR");
- } else {
- return window.MessageLocalizer.get("AUTO_RECALCULATE_ON_TOOLTIP_STR");
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
- return window.MessageLocalizer.get("SUP_ZERO_ROW_COL_STR");
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
- return window.MessageLocalizer.get("SUP_ZERO_ROW_STR");
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
- return window.MessageLocalizer.get("SUP_ZERO_COL_STR");
- } else if (toolbarAction == "IDM_CHART") {
- return window.MessageLocalizer.get("VIEW_CHART_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_CHARTANDGRID") {
- return window.MessageLocalizer.get("VIEW_CHARTGRID_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_GRID") {
- return window.MessageLocalizer.get("VIEW_GRID_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_CHART-SELECT") {
- return window.MessageLocalizer.get("CHART_PROP_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_CHARTTYPE") {
- return window.MessageLocalizer.get("CHART_TYPE_STR");
- } else if (toolbarAction == "IDM_METRICS") {
- return window.MessageLocalizer.get("METRIC_DIAGRAM_STR");
- } else if (toolbarAction == "IDM_METRICS_IMPACT") {
- return window.MessageLocalizer.get("METRIC_IMPACT_DIAGRAM_STR");
- } else if (toolbarAction == "IDM_METRICS_STRATEGY") {
- return window.MessageLocalizer.get("METRIC_STRATEGY_DIAGRAMS_STR");
- } else if (toolbarAction == "IDM_CHART_POINT") {
- return window.MessageLocalizer.get("POINT_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_BUBBLE") {
- return window.MessageLocalizer.get("BUBBLE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_LINE") {
- return window.MessageLocalizer.get("LINE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_SPLINE") {
- return window.MessageLocalizer.get("SPLINE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STEPLINE") {
- return window.MessageLocalizer.get("STEP_LINE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_FASTLINE") {
- return window.MessageLocalizer.get("FAST_LINE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_BAR") {
- return window.MessageLocalizer.get("BAR_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDBAR") {
- return window.MessageLocalizer.get("STACKED_BAR_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDBAR100") {
- return window.MessageLocalizer.get("STACKED_BAR_100_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_COLUMN") {
- return window.MessageLocalizer.get("COLUMN_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN") {
- return window.MessageLocalizer.get("STACKED_COL_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN100") {
- return window.MessageLocalizer.get("STACKED_COL_100_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_AREA") {
- return window.MessageLocalizer.get("AREA_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_SPLINEAREA") {
- return window.MessageLocalizer.get("SPLINE_AREA_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDAREA") {
- return window.MessageLocalizer.get("STACKED_AREA_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDAREA100") {
- return window.MessageLocalizer.get("STACKED_AREA_100_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_PIE") {
- return window.MessageLocalizer.get("PIE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_DOUGHNUT") {
- return window.MessageLocalizer.get("DOUGHNUT_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STOCK") {
- return window.MessageLocalizer.get("STOCK_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_CANDLESTICK") {
- return window.MessageLocalizer.get("CANDLE_STICK_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_RANGE") {
- return window.MessageLocalizer.get("RANGE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_SPLINERANGE") {
- return window.MessageLocalizer.get("SPLINE_RANGE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_GANTT") {
- return window.MessageLocalizer.get("GANTT_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_RANGECOLUMN") {
- return window.MessageLocalizer.get("RANGE_COLUMN_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_RADAR") {
- return window.MessageLocalizer.get("RADAR_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_POLAR") {
- return window.MessageLocalizer.get("POLAR_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_BOXPLOT") {
- return window.MessageLocalizer.get("BOX_PLOT_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_FUNNEL") {
- return window.MessageLocalizer.get("FUNNEL_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_PYRAMID") {
- return window.MessageLocalizer.get("PYRAMID_CHART_STR");
- } else if (toolbarAction == "IDM_RESET_DATA") {
- return window.MessageLocalizer.get("RESET_DATA_STR");
- } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
- return window.MessageLocalizer.get("UNDO_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SANDBOX_REDO") {
- return window.MessageLocalizer.get("REDO_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SANDBOX") {
- return window.MessageLocalizer.get("SANDBOX_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
- return window.MessageLocalizer.get("CREATE_SANDBOX_STR");
- } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
- return window.MessageLocalizer.get("DELETE_SANDBOX_STR");
- } else if (toolbarAction == "IDM_SANDBOXITEMS") {
- if (this.sandboxNames) {
- return this.sandboxNames.currentSandbox;
- } else {
- return "[Base]";
- }
- }
- return "";
- },
- getToolbuttonImage: function (toolbarAction) {
- if (toolbarAction == "IDM_CHARTTYPE") {
- return "tm1-toolbar-chart-select";
- } else if (toolbarAction == "IDM_METRICS") {
- return "tm1-toolbar-metrics";
- } else if (toolbarAction == "IDM_METRICS_IMPACT") {
- return "tm1-toolbar-metrics-impact";
- } else if (toolbarAction == "IDM_METRICS_STRATEGY") {
- return "tm1-toolbar-metrics-strategy";
- } else if (toolbarAction == "IDM_CHART_POINT") {
- return "tm1-toolbar-chart-point";
- } else if (toolbarAction == "IDM_CHART_BUBBLE") {
- return "tm1-toolbar-chart-bubble";
- } else if (toolbarAction == "IDM_CHART_LINE") {
- return "tm1-toolbar-chart-line";
- } else if (toolbarAction == "IDM_CHART_SPLINE") {
- return "tm1-toolbar-chart-spline";
- } else if (toolbarAction == "IDM_CHART_STEPLINE") {
- return "tm1-toolbar-chart-stepline";
- } else if (toolbarAction == "IDM_CHART_FASTLINE") {
- return "tm1-toolbar-chart-fastline";
- } else if (toolbarAction == "IDM_CHART_BAR") {
- return "tm1-toolbar-chart-bar";
- } else if (toolbarAction == "IDM_CHART_STACKEDBAR") {
- return "tm1-toolbar-chart-stackedbar";
- } else if (toolbarAction == "IDM_CHART_STACKEDBAR100") {
- return "tm1-toolbar-chart-stackedbar100";
- } else if (toolbarAction == "IDM_CHART_COLUMN") {
- return "tm1-toolbar-chart-column";
- } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN") {
- return "tm1-toolbar-chart-stackedcolumn";
- } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN100") {
- return "tm1-toolbar-chart-stackedcolumn100";
- } else if (toolbarAction == "IDM_CHART_AREA") {
- return "tm1-toolbar-chart-area";
- } else if (toolbarAction == "IDM_CHART_SPLINEAREA") {
- return "tm1-toolbar-chart-splinearea";
- } else if (toolbarAction == "IDM_CHART_STACKEDAREA") {
- return "tm1-toolbar-chart-stackedarea";
- } else if (toolbarAction == "IDM_CHART_STACKEDAREA100") {
- return "tm1-toolbar-chart-stackedarea100";
- } else if (toolbarAction == "IDM_CHART_PIE") {
- return "tm1-toolbar-chart-pie";
- } else if (toolbarAction == "IDM_CHART_DOUGHNUT") {
- return "tm1-toolbar-chart-doughnut";
- } else if (toolbarAction == "IDM_CHART_STOCK") {
- return "tm1-toolbar-chart-stock";
- } else if (toolbarAction == "IDM_CHART_CANDLESTICK") {
- return "tm1-toolbar-chart-candlestick";
- } else if (toolbarAction == "IDM_CHART_RANGE") {
- return "tm1-toolbar-chart-range";
- } else if (toolbarAction == "IDM_CHART_SPLINERANGE") {
- return "tm1-toolbar-chart-splinerange";
- } else if (toolbarAction == "IDM_CHART_GANTT") {
- return "tm1-toolbar-chart-gantt";
- } else if (toolbarAction == "IDM_CHART_RANGECOLUMN") {
- return "tm1-toolbar-chart-rangecolumn";
- } else if (toolbarAction == "IDM_CHART_RADAR") {
- return "tm1-toolbar-chart-radar";
- } else if (toolbarAction == "IDM_CHART_POLAR") {
- return "tm1-toolbar-chart-polar";
- } else if (toolbarAction == "IDM_CHART_BOXPLOT") {
- return "tm1-toolbar-chart-boxplot";
- } else if (toolbarAction == "IDM_CHART_FUNNEL") {
- return "tm1-toolbar-chart-funnel";
- } else if (toolbarAction == "IDM_CHART_PYRAMID") {
- return "tm1-toolbar-chart-pyramid";
- } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
- return "tm1-toolbar-slice-excel2";
- } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
- return "tm1-toolbar-slice-snapshot";
- } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
- return "tm1-toolbar-slice-pdf";
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
- if (this.app._widget.GetSuppressZerosInfo().both == true) {
- return "tm1-toolbar-suppress-zeros dijitToggleButtonChecked";
- } else if (this.app._widget.GetSuppressZerosInfo().row == true) {
- return "tm1-toolbar-suppress-zeros-on-rows dijitToggleButtonChecked";
- } else if (this.app._widget.GetSuppressZerosInfo().column == true) {
- return "tm1-toolbar-suppress-zeros-on-columns dijitToggleButtonChecked";
- } else {
- return "tm1-toolbar-suppress-zeros";
- }
- } else if (toolbarAction == "IDM_COMMIT") {
- if (this.isToolbuttonDisabled("IDM_COMMIT")) {
- return "tm1-toolbar-apply disabled-toolbutton";
- } else {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_SAVEVIEW") {
- if (this.isToolbuttonDisabled("IDM_SAVEVIEW")) {
- return "tm1-toolbar-save-view disabled-toolbutton";
- } else {
- return "tm1-toolbar-save-view";
- }
- } else if (toolbarAction == "IDM_SAVEAS") {
- if (this.isToolbuttonDisabled("IDM_SAVEAS")) {
- return "tm1-toolbar-save-view-as disabled-toolbutton";
- } else {
- return "tm1-toolbar-save-view-as";
- }
- } else if (toolbarAction == "IDM_EXPORT") {
- if (this.isToolbuttonDisabled("IDM_EXPORT")) {
- return "tm1-toolbar-export disabled-toolbutton";
- } else {
- return "tm1-toolbar-export";
- }
- } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
- if (this.isToolbuttonDisabled("IDM_SAVEDATACHANGES")) {
- return "tm1-toolbar-save_data_changes disabled-toolbutton";
- } else {
- return "tm1-toolbar-save_data_changes";
- }
- } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
- if (this.isToolbuttonDisabled("IDM_REVIEWDATACHANGES")) {
- return "tm1-toolbar-review_data_changes disabled-toolbutton";
- } else {
- return "tm1-toolbar-review_data_changes";
- }
- } else if (toolbarAction == "IDM_RECALCULATE") {
- if (this.isToolbuttonDisabled("IDM_RECALCULATE")) {
- return "tm1-toolbar-recalculate disabled-toolbutton";
- } else {
- return "tm1-toolbar-recalculate";
- }
- } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
- if (this.app && this.cubeViewState && this.cubeViewState.automaticRecalculationEnabled) {
- return "tm1-toolbar-recalculation";
- } else {
- return "tm1-toolbar-recalculation dijitToggleButtonChecked";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
- if (this.app._widget.GetSuppressZerosInfo().both == true) {
- return "tm1-menu-radioselection";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
- if ((this.app._widget.GetSuppressZerosInfo().row == true) ||
- (this.app._widget.GetSuppressZerosInfo().both == true)) {
- return "tm1-menu-radioselection";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
- if ((this.app._widget.GetSuppressZerosInfo().column == true) ||
- (this.app._widget.GetSuppressZerosInfo().both == true)) {
- return "tm1-menu-radioselection";
- }
- } else if (toolbarAction == "IDM_CHART") {
- if (this.app && this.cubeViewState && this.cubeViewState.displayMode == "Chart") {
- return "tm1-toolbar-chart_only dijitToggleButtonChecked";
- } else {
- return "tm1-toolbar-chart_only";
- }
- } else if (toolbarAction == "IDM_CHARTANDGRID") {
- if (this.app && this.cubeViewState && this.cubeViewState.displayMode == "GridAndChart") {
- return "tm1-toolbar-chart-grid dijitToggleButtonChecked";
- } else {
- return "tm1-toolbar-chart-grid";
- }
- } else if (toolbarAction == "IDM_GRID") {
- if (this.app && this.cubeViewState && this.cubeViewState.displayMode == "Grid") {
- return "tm1-toolbar-grid_only dijitToggleButtonChecked";
- } else {
- return "tm1-toolbar-grid_only";
- }
- } else if (toolbarAction == "IDM_CHART-SELECT") {
- if (this.isToolbuttonDisabled("IDM_CHART-SELECT")) {
- return "tm1-toolbar-chart-select_type disabled-toolbutton";
- } else {
- return "tm1-toolbar-chart-select_type";
- }
- } else if (toolbarAction == "IDM_RESET_DATA") {
- if (this.isToolbuttonDisabled("IDM_RESET_DATA")) {
- return "tm1-toolbar-sandbox-reset disabled-toolbutton";
- } else {
- return "tm1-toolbar-sandbox-reset";
- }
- } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
- if (this.isToolbuttonDisabled("IDM_SANDBOX_UNDO")) {
- return "tm1-toolbar-sandbox-undo disabled-toolbutton";
- } else {
- return "tm1-toolbar-sandbox-undo";
- }
- } else if (toolbarAction == "IDM_SANDBOX_REDO") {
- if (this.isToolbuttonDisabled("IDM_SANDBOX_REDO")) {
- return "tm1-toolbar-sandbox-redo disabled-toolbutton";
- } else {
- return "tm1-toolbar-sandbox-redo";
- }
- } else if (toolbarAction == "IDM_SANDBOX") {
- if (this.isToolbuttonDisabled("IDM_SANDBOX")) {
- return "tm1-toolbar-sandbox-select disabled-toolbutton";
- } else {
- return "tm1-toolbar-sandbox-select";
- }
- } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
- return "tm1-toolbar-sandbox-new";
- } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
- return "tm1-toolbar-sandbox-delete";
- } else if (toolbarAction == "IDM_SANDBOXITEMS") {
- return null;
- }
- return "tm1-toolbar-empty";
- },
- //
- areTM1ParametersValid: function () {
- var bParametersAreValid = true;
- if (this.tm1Cube == "") {
- bParametersAreValid = false;
- } else if (this.tm1Host == "") {
- bParametersAreValid = false;
- } else if (this.tm1Server == "") {
- bParametersAreValid = false;
- } else if (this.tm1CubeView == "") {
- bParametersAreValid = false;
- }
- if (!bParametersAreValid) {
- console.log(this.tm1Cube);
- console.log(this.tm1Host);
- console.log(this.tm1Server);
- console.log(this.tm1CubeView);
- }
- return bParametersAreValid == true;
- },
- getWidgetAttributes: function () {
- this.tm1WebURL = this.iContext.getiWidgetAttributes().getItemValue("tm1WebURL");
- this.tm1Host = this.iContext.getiWidgetAttributes().getItemValue("tm1Host");
- this.tm1Server = this.iContext.getiWidgetAttributes().getItemValue("tm1Server");
- this.tm1Cube = this.iContext.getiWidgetAttributes().getItemValue("tm1Cube");
- this.tm1CubeView = this.iContext.getiWidgetAttributes().getItemValue("tm1CubeView");
- this.tm1UserName = this.iContext.getiWidgetAttributes().getItemValue("tm1UserName");
- this.tm1Password = this.iContext.getiWidgetAttributes().getItemValue("tm1Password");
- this.filterPackages = this.iContext.getiWidgetAttributes().getItemValue("FilterPackages");
- this.tm1AccessType = this.iContext.getiWidgetAttributes().getItemValue("AccessType");
- this.tm1HideDimBar = this.iContext.getiWidgetAttributes().getItemValue("TM1HideDimBar");
- this.tm1Toolbar = this.iContext.getiWidgetAttributes().getItemValue("TM1Toolbar");
- this.tm1Height = this.iContext.getiWidgetAttributes().getItemValue("tHeight");
- this.tm1Width = this.iContext.getiWidgetAttributes().getItemValue("tWidth");
- this.tm1FiltersToSetPayload = eval ("(" + this.iContext.getiWidgetAttributes().getItemValue("filtersToSetPayload") + ")");
- if (this.tm1UserName == null || this.tm1UserName.length == 0) {
- var cookieValue = dojo.cookie("cam_passport");
- if (cookieValue && cookieValue.length > 0) {
- this.camPassport = cookieValue;
- }
- }
- if (this.tm1AccessType == null || tm1.tm1AccessType == "") {
- if (this.tm1CubeView == null || this.tm1CubeView == "") {
- this.tm1ServerCubeView = this.iContext.getiWidgetAttributes().getItemValue("tm1ServerCubeView");
- if (this.tm1ServerCubeView != "") {
- var searchString = this.tm1ServerCubeView;
- var separatorIndex = searchString.indexOf('$$');
- this.tm1Server = searchString.substring(0, separatorIndex);
- searchString = searchString.substring(separatorIndex + 2, searchString.length);
- separatorIndex = searchString.indexOf('$$');
- this.tm1Cube = searchString.substring(0, separatorIndex);
- searchString = searchString.substring(separatorIndex + 2, searchString.length);
- separatorIndex = searchString.indexOf('$$');
- this.tm1CubeView = searchString;
- }
- }
- var separatorIndex = this.tm1CubeView.indexOf('$$');
- this.tm1AccessType = this.tm1CubeView.substring(separatorIndex + 2, this.tm1CubeView.length);
- this.tm1CubeView = this.tm1CubeView.substring(0, separatorIndex);
- this.upgradeWidget();
- } else {
- this.loadWithAttributes();
- }
- },
- upgradeWidget: function () {
- var attributes = this.iContext.getiWidgetAttributes();
- var _properties = {
- 'webLabel': this.tm1WebURL,
- 'label': this.tm1Host,
- 'serverLabel': this.tm1Server,
- 'cubeLabel': this.tm1Cube,
- 'cubeViewLabel': this.tm1CubeView,
- 'accessLabel': this.tm1AccessType,
- 'userNameLabel': this.tm1UserName,
- 'passwordLabel': ""
- };
- var propertiesDialog = new CubeViewPropertiesPane({
- properties: _properties,
- title: dojo.string.substitute(BUXMSG.WDG.IDS_WDG_PROPERTIES_DIALOG_TITLE, [attributes.getItemValue("widgetTitle")]),
- firstLine: "This dashboard was created for an earlier version of TM1. Please specify the new location including port of TM1Web, reenter the password if applicable, and make any other required changes.",
- sourceWidget: this,
- okPropertiesCallback: dojo.hitch(this, this.onSetProperties),
- cancelPropertiesCallback: dojo.hitch(this, this._onCancelProperties)
- });
- this._propertiesDialog = propertiesDialog;
- var _payload = { properties: _properties, propertiesDialogSpec: null, propertiesDialogTab: propertiesDialog };
- this.iContext.iEvents.fireEvent("com.ibm.bux.widget.properties.get.done", null, _payload);
- },
- refreshView: function () {
- if (this.cantLoadDojo) {
- if (this.iframeCtrlCantLoadDojo) {
- this.iframeCtrlCantLoadDojo.setUrl(this.getIFrameUrl()); //
- } else {
- var widgetTitle = "widgetTitle";
- var domObject = this.iContext.getElementById("_" + this.iContext.widgetId + "_" + "widgetFrame");
- this.iframeCtrlCantLoadDojo = new tm1.iwidget.utilities.IFrame({
- url: this.getIFrameUrl(), //
- frameTitle: widgetTitle
- }, domObject);
- this.iframeCtrlCantLoadDojo.startup();
- }
- this.createBasicWidgetToolbar();
- } else {
- var loadDeferred = new dojo.Deferred();
- this.app = new this._Widget({
- adminHost: this.tm1Host,
- tm1Server: this.tm1Server,
- camPassport: this.camPassport,
- sessionToken: this.sessionToken,
- username: !this.sessionToken ? (this.tm1UserName || undefined) : "",
- password: !this.sessionToken ? (this.tm1UserName ? (this.tm1Password ? this.tm1Password : "") : undefined) : "",
- cube: this.tm1Cube,
- view: this.tm1CubeView,
- isPublic: (this.tm1AccessType == "PUBLIC"),
- style: "width: 100%; height: 100%",
- onLoad: function() {
- loadDeferred.resolve();
- }
- }).placeAt(dojo.byId("_" + this.iContext.widgetId + "_" + "widgetFrame"));
-
- this.app.startup();
- loadDeferred.then(dojo.hitch(this, this.createCompleteCallback));
- }
- },
- refreshMore: function () {
- if (this.app != null) {
- if (this.subscriptionHandle) {
- this.app._widget.unsubscribeFromStateChangeUpdates(this.subscriptionHandle);
- }
-
- this.app.destroy();
- this.app = null;
- }
-
- if (this.iframeCtrl) {
- this.iframeCtrl.setUrl(this.getIFrameUrl()); //
- } else {
- var widgetTitle = "widgetTitle";
- var domObject = this.iContext.getElementById("_" + this.iContext.widgetId + "_" + "widgetFrameA");
- this.iframeCtrl = new tm1.iwidget.utilities.IFrame({
- url: this.getIFrameUrl(), //
- frameTitle: widgetTitle
- }, domObject);
- this.iframeCtrl.startup();
- }
- },
- getIFrameUrl: function () {
- return this.tm1WebURL + "/UrlApi.jsp#Action=Open&Type=CubeViewer"
- + "&Cube=" + this.tm1Cube + "&View=" + this.tm1CubeView + "&AccessType=" + this.tm1AccessType
- + (!this.sessionToken ?
- ("&TM1Server=" + this.tm1Server + "&AdminHost=" + this.tm1Host
- + (this.camPassport ?
- ("&CamPassport=" + this.camPassport) :
- ("&UserName=" + this.tm1UserName + "&Password=" + (this.tm1Password ? this.tm1Password : "")))) :
- ("&SessionToken=" + this.sessionToken));
- },
-
- createCompleteCallback: function (value) {
- if (!this.inDoMore) {
- if (this.tm1HideDimBar == "1") {
- this.app._widget.toggleDimensionBar(true);
- }
- this.createWidgetToolbar();
-
- if(this.onbeforeunloadHandler != null) {
- window.onbeforeunload = this.onbeforeunloadHandler;
- this.onbeforeunloadHandler = null;
- }
-
- this.sessionToken = this.app.sessionToken;
- }
- var dimensionNamePromise = this.app._widget.getDimensionNames();
- dimensionNamePromise.promise.then(dojo.hitch(this, function (inDimensionNames) {
- this.dimensionNames = inDimensionNames;
- this.elementNameCounter = 0;
- this.elementNames = [];
- if (inDimensionNames != null && inDimensionNames.length > 0) {
- var elementsPromise = this.app._widget.getElementNames(this.dimensionNames[0]);
- elementsPromise.promise.then(dojo.hitch(this, this.getElementNamesCallback));
- }
- }));
- if (this.subscriptionHandle) {
- this.app._widget.unsubscribeFromStateChangeUpdates(this.subscriptionHandle);
- }
- this.subscriptionHandle = this.app._widget.subscribeToStateChangeUpdates(dojo.hitch(this, this.getCubeViewStateCallback));
- },
- onView: function (iEvent) {
- if (this.inDoMore) {
- this.inDoMore = false;
- if ((dojo.isIE || dojo.isTrident) && window.onbeforeunload != null) {
- this.onbeforeunloadHandler = window.onbeforeunload;
- window.onbeforeunload = null;
- }
- this.refreshView();
- }
- },
- onEdit: function (iEvent) {
- this.refreshView();
- // example of a toolbar for edit mode
- this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, [{
- label: "Edit action",
- iconClass: "bux-toolbar-button-edit",
- action: "action.edit"
- }]);
- },
- onMore: function (iEvent) {
- if (!this.inDoMore) {
- this.inDoMore = true;
- this.refreshMore();
- }
- // example of a toolbar for more mode (not supported by BUX right now)
- // this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, [{
- // label: "More action",
- // iconClass: "bux-toolbar-button-more",
- // action: "action.more"
- // }]);
- },
- // ui actions
- doMode: function (mode) {
- // switch back to view mode
- this.iContext.iEvents.fireEvent("onModeChanged", null, {
- newMode: mode
- });
- },
- onModeChanged: function (mode) {
- },
- onToolbarAction: function (evt) {
- if (evt.payload == "IDM_RESTART") {
- if (this.app != null) {
- if (this.subscriptionHandle) {
- this.app._widget.unsubscribeFromStateChangeUpdates(this.subscriptionHandle);
- }
-
- this.app.destroy();
- this.app = null;
- }
-
- this.refreshView();
- } else if (this.app == null) {
- return;
- } else if (evt.payload == "IDM_RESET") {
- this.app._widget.resetView();
- } else if (evt.payload == "IDM_COMMIT") {
- this.app._widget.commitSandbox();
- } else if (evt.payload == "IDM_SAVEVIEW") {
- alert("not implemented yet");
- } else if (evt.payload == "IDM_SAVEAS") {
- alert("not implemented yet");
- } else if (evt.payload == "IDM_SAVEDATACHANGES") {
- this.app._widget.saveData();
- } else if (evt.payload == "IDM_REVIEWDATACHANGES") {
- alert("not implemented yet");
- } else if (evt.payload == "IDM_RECALCULATE") {
- this.app.recalculate();
- } else if (evt.payload == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
- if (this.app && this.cubeViewState && this.cubeViewState.automaticRecalculationEnabled) {
- this.app._widget.setAutomaticRecalculation(false);
- } else {
- this.app._widget.setAutomaticRecalculation(true);
- }
- } else if (evt.payload == "IDM_SLICE_TO_EXCEL") {
- this.app._widget.displayExportOptions("SLICE");
- } else if (evt.payload == "IDM_SNAPSHOT_TO_EXCEL") {
- this.app._widget.displayExportOptions("SNAPSHOT");
- } else if (evt.payload == "IDM_EXPORT_TO_PDF") {
- this.app._widget.displayExportOptions("PRINTTOPDF");
- } else if (evt.payload == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
- this.app._widget.SuppressZerosBoth();
- this.createWidgetToolbar();
- } else if (evt.payload == "IDM_SUPPRESS_ZEROS_ROWS") {
- this.app._widget.SuppressZerosRows();
- this.createWidgetToolbar();
- } else if (evt.payload == "IDM_SUPPRESS_ZEROS_COLUMNS") {
- this.app._widget.SuppressZerosCols();
- this.createWidgetToolbar();
- } else if (evt.payload == "IDM_CHART") {
- this.app._widget.ChangeDisplayMode("Chart");
- } else if (evt.payload == "IDM_CHARTANDGRID") {
- this.app._widget.ChangeDisplayMode("GridAndChart");
- } else if (evt.payload == "IDM_GRID") {
- this.app._widget.ChangeDisplayMode("Grid");
- } else if (evt.payload == "IDM_METRICS_IMPACT") {
- this.app._widget.ChartTypeChanged(33);
- } else if (evt.payload == "IDM_CHART_POINT") {
- this.app._widget.ChartTypeChanged(0, "");
- } else if (evt.payload == "IDM_CHART_BUBBLE") {
- this.app._widget.ChartTypeChanged(1, "");
- } else if (evt.payload == "IDM_CHART_LINE") {
- this.app._widget.ChartTypeChanged(2, "");
- } else if (evt.payload == "IDM_CHART_SPLINE") {
- this.app._widget.ChartTypeChanged(3, "");
- } else if (evt.payload == "IDM_CHART_STEPLINE") {
- this.app._widget.ChartTypeChanged(4, "");
- } else if (evt.payload == "IDM_CHART_FASTLINE") {
- this.app._widget.ChartTypeChanged(5, "");
- } else if (evt.payload == "IDM_CHART_BAR") {
- this.app._widget.ChartTypeChanged(6, "");
- } else if (evt.payload == "IDM_CHART_STACKEDBAR") {
- this.app._widget.ChartTypeChanged(7, "");
- } else if (evt.payload == "IDM_CHART_STACKEDBAR100") {
- this.app._widget.ChartTypeChanged(8, "");
- } else if (evt.payload == "IDM_CHART_COLUMN") {
- this.app._widget.ChartTypeChanged(9, "");
- } else if (evt.payload == "IDM_CHART_STACKEDCOLUMN") {
- this.app._widget.ChartTypeChanged(10, "");
- } else if (evt.payload == "IDM_CHART_STACKEDCOLUMN100") {
- this.app._widget.ChartTypeChanged(11, "");
- } else if (evt.payload == "IDM_CHART_AREA") {
- this.app._widget.ChartTypeChanged(12, "");
- } else if (evt.payload == "IDM_CHART_SPLINEAREA") {
- this.app._widget.ChartTypeChanged(13, "");
- } else if (evt.payload == "IDM_CHART_STACKEDAREA") {
- this.app._widget.ChartTypeChanged(14, "");
- } else if (evt.payload == "IDM_CHART_STACKEDAREA100") {
- this.app._widget.ChartTypeChanged(15, "");
- } else if (evt.payload == "IDM_CHART_PIE") {
- this.app._widget.ChartTypeChanged(16, "");
- } else if (evt.payload == "IDM_CHART_DOUGHNUT") {
- this.app._widget.ChartTypeChanged(17, "");
- } else if (evt.payload == "IDM_CHART_STOCK") {
- this.app._widget.ChartTypeChanged(18, "");
- } else if (evt.payload == "IDM_CHART_CANDLESTICK") {
- this.app._widget.ChartTypeChanged(19, "");
- } else if (evt.payload == "IDM_CHART_RANGE") {
- this.app._widget.ChartTypeChanged(20, "");
- } else if (evt.payload == "IDM_CHART_SPLINERANGE") {
- this.app._widget.ChartTypeChanged(21, "");
- } else if (evt.payload == "IDM_CHART_GANTT") {
- this.app._widget.ChartTypeChanged(22, "");
- } else if (evt.payload == "IDM_CHART_RANGECOLUMN") {
- this.app._widget.ChartTypeChanged(23, "");
- } else if (evt.payload == "IDM_CHART_RADAR") {
- this.app._widget.ChartTypeChanged(24, "");
- } else if (evt.payload == "IDM_CHART_POLAR") {
- this.app._widget.ChartTypeChanged(25, "");
- } else if (evt.payload == "IDM_CHART_BOXPLOT") {
- this.app._widget.ChartTypeChanged(26, "");
- } else if (evt.payload == "IDM_CHART_FUNNEL") {
- this.app._widget.ChartTypeChanged(27, "");
- } else if (evt.payload == "IDM_CHART_PYRAMID") {
- this.app._widget.ChartTypeChanged(28, "");
- } else if (evt.payload == "IDM_RESET_DATA") {
- this.app._widget.resetData();
- } else if (evt.payload == "IDM_SANDBOX_UNDO") {
- this.app.undo();
- } else if (evt.payload == "IDM_SANDBOX_REDO") {
- this.app.redo();
- } else if (evt.payload == "IDM_CREATE_SANDBOX") {
- this.app._widget.createSandbox();
- } else if (evt.payload == "IDM_DELETE_SANDBOX") {
- this.app._widget.deleteSandboxes();
- } else if (evt.payload.substring(0, 21) == "STRATEGYDIAGRAMCHOICE") {
- var strategyDiagramId = evt.payload.substring(21, evt.payload.length);
- var diagramId = parseInt(strategyDiagramId);
- var StrategyId = 34 + diagramId;
- this.app._widget.ChartTypeChanged(StrategyId, this.cubeViewState.strategyDiagramList[diagramId].name);
- } else if (evt.payload.substring(0, 13) == "SANDBOXCHOICE") {
- var sandBoxId = evt.payload.substring(13, evt.payload.length);
- if (sandBoxId == 0) {
- this.app._widget.setActiveSandbox("[Base]");
- } else {
- this.app._widget.setActiveSandbox(this.sandboxNames.sandboxes[sandBoxId].name);
- }
- }
- },
- getCubeViewStateCallback: function (inCubeViewState) {
- this.cubeViewState = inCubeViewState;
- var sandboxPromise = this.app._widget.getSandboxes();
- sandboxPromise.then(dojo.hitch(this, this.getSandboxNamesCallback));
- },
- getSandboxNamesCallback: function (inSandboxNames) {
- this.sandboxNames = inSandboxNames;
- this.createWidgetToolbar();
- },
- onUnload: function (evt) {
- if(this.recalPromise) {
- this.recalPromise.then(dojo.hitch(this, this.doOnUnload));
- } else {
- this.doOnUnload();
- }
-
- this.unloaded = true;
- },
-
- doOnUnload: function() {
- if (this.app) {
- if (this.subscriptionHandle) {
- this.app._widget.unsubscribeFromStateChangeUpdates(this.subscriptionHandle);
- }
-
- this.app.destroy();
- this.app.logout();
- this.app = null;
- this.sessionToken = null;
- }
-
- if (this.iframeCtrl != null) {
- this.iframeCtrl.destroy();
- }
- if (this.iframeCtrlCantLoadDojo != null) {
- this.iframeCtrlCantLoadDojo.destroy();
- }
- },
- onSetVisible: function(evt)
- {
- if(!this.unloaded) {
- if (evt.payload.isVisible) {
- if (this.app != null) {
- this.recalPromise = this.app.recalculate();
- }
- }
- }
- },
- onWidgetRefresh: function (evt) // Invoked when User preferences get modified (Including locales)
- {
- if (this.app != null) {
- this.app.recalculate();
- }
- return;
- },
- onWidgetSave: function() {
- var saveDonePayload = {'status':true};
- this.iContext.iEvents.fireEvent("com.ibm.bux.widget.save.done", null, saveDonePayload);
- },
- onWidgetResize: function (e) {
- if (this.inDoMore) {
- var newWidth = e.payload.resize.w;
- var newHeight = e.payload.resize.h;
- this.iframeCtrl.resize({
- w: newWidth,
- h: newHeight - 40
- });
- } else if (this.cantLoadDojo) {
- var newWidth = e.payload.resize.w;
- var newHeight = e.payload.resize.h;
- this.iframeCtrlCantLoadDojo.resize({
- w: newWidth,
- h: newHeight
- });
- } else {
- if (!this._preferredSizeSet) {
- var attributes = this.iContext.getiWidgetAttributes();
- var width = parseInt(((this.tm1Width != null) && (this.tm1Width > 0)) ? this.tm1Width : attributes.getItemValue("viewWidth"));
- var height = parseInt(((this.tm1Height != null) && (this.tm1Height > 0)) ? this.tm1Height : attributes.getItemValue("viewHeight"));
- var chromeObjectId = bux.Helper.widgetIdToChromeId(this.iContext.widgetId);
- var chromeObject = bux.Helper.getChromeById(chromeObjectId);
- chromeObject.setPreferredSize({ w: width, h: height });
- this._preferredSizeSet = true;
- chromeObject.doChromeAutoResize();
- }
- if (this.app != null) {
- this.app.resize();
- this.tm1Height = e.payload.resize.h;
- this.tm1Width = e.payload.resize.w;
- this.iContext.getiWidgetAttributes().setItemValue("tHeight", this.tm1Height);
- this.iContext.getiWidgetAttributes().setItemValue("tWidth", this.tm1Width);
- }
- }
- },
- onGetProperties: function (evt, init) {
- /*
- var attributes = this.iContext.getiWidgetAttributes();
- var _properties = {
- 'label': this.iContext.getiWidgetAttributes().getItemValue("tm1Host"),
- 'serverLabel': this.iContext.getiWidgetAttributes().getItemValue("tm1Server"),
- 'cubeLabel': this.iContext.getiWidgetAttributes().getItemValue("tm1Cube"),
- 'cubeViewLabel': this.iContext.getiWidgetAttributes().getItemValue("tm1CubeView"),
- 'userNameLabel': this.iContext.getiWidgetAttributes().getItemValue("tm1UserName"),
- 'passwordLabel': this.iContext.getiWidgetAttributes().getItemValue("tm1Password")
- };
- var propertiesDialog = new CubeViewPropertiesPane({
- properties: _properties,
- title: dojo.string.substitute(BUXMSG.WDG.IDS_WDG_PROPERTIES_DIALOG_TITLE, [attributes.getItemValue("widgetTitle")]),
- sourceWidget: this,
- cancelPropertiesCallback: (init) ? dojo.hitch(this, this._onCancelProperties) : null
- });
- this._propertiesDialog = propertiesDialog;
- var _payload = {properties: _properties, propertiesDialogSpec:null, propertiesDialogTab: propertiesDialog};
- this.iContext.iEvents.fireEvent("com.ibm.bux.widget.properties.get.done", null, _payload);
- */
- },
- _onCancelProperties: function () {
- if (this._firstRender == true) {
- var chromeObjectId = bux.Helper.widgetIdToChromeId(this.iContext.widgetId);
- var chromeObject = bux.Helper.getChromeById(chromeObjectId);
- chromeObject.widgetRemoveConfirmed();
- }
- },
- saveTM1CubeViewerParams: function (inIContext) {
- inIContext.getiWidgetAttributes().setItemValue("tm1WebURL", this.tm1WebURL);
- inIContext.getiWidgetAttributes().setItemValue("tm1Host", this.tm1Host);
- inIContext.getiWidgetAttributes().setItemValue("tm1Server", this.tm1Server);
- inIContext.getiWidgetAttributes().setItemValue("tm1Cube", this.tm1Cube);
- inIContext.getiWidgetAttributes().setItemValue("tm1CubeView", this.tm1CubeView);
- inIContext.getiWidgetAttributes().setItemValue("tm1UserName", this.tm1UserName);
- inIContext.getiWidgetAttributes().setItemValue("tm1Password", this.tm1Password);
- inIContext.getiWidgetAttributes().setItemValue("AccessType", this.tm1AccessType);
- // inIContext.getiWidgetAttributes().setItemValue("tHeight", this.tm1Height);
- return;
- },
- onSetProperties: function () {
- var attributes = this.iContext.getiWidgetAttributes();
- var tm1WebUrl = this._propertiesDialog.webLabelInput.value;
- var host = this._propertiesDialog.labelInput.value;
- var server = this._propertiesDialog.serverLabelInput.value;
- var cube = this._propertiesDialog.cubeLabelInput.value;
- var cubeView = this._propertiesDialog.cubeViewLabelInput.value;
- var access = this._propertiesDialog.accessLabelInput.value;
- var userName = this._propertiesDialog.userNameLabelInput.value;
- var password = this._propertiesDialog.passwordLabelInput.value;
- if (host != attributes.getItemValue("tm1Host") ||
- tm1WebUrl != attributes.getItemValue("tm1WebURL") ||
- server != attributes.getItemValue("tm1Server") ||
- cube != attributes.getItemValue("tm1Cube") ||
- cubeView != attributes.getItemValue("tm1CubeView") ||
- access != attributes.getItemValue("AccessType") ||
- userName != attributes.getItemValue("tm1UserName") ||
- password != attributes.getItemValue("tm1Password")) {
- this.tm1WebURL = tm1WebUrl;
- this.tm1Host = host;
- this.tm1Server = server;
- this.tm1Cube = cube;
- this.tm1CubeView = cubeView;
- this.tm1UserName = userName;
- this.tm1Password = password;
- this.tm1AccessType = access;
- this.saveTM1CubeViewerParams(this.iContext);
- this.loadWithAttributes();
- }
- return;
- },
- _onCancelProperties: function () {
- if (this._firstRender == true) {
- this.removeWidget();
- }
- },
- removeWidget: function () {
- var chromeObjectId = bux.Helper.widgetIdToChromeId(this.iContext.widgetId);
- var chromeObject = bux.Helper.getChromeById(chromeObjectId);
- chromeObject.widgetRemoveConfirmed();
- },
- _excludeList: ["copyright", "version"],
- _getProps: function (asDialog) {
- var results = {};
- var names = this.iContext.getiWidgetAttributes().getAllNames();
- for (var i = 0, l = names.length; i < l; i++) {
- var name = names[i];
- if (-1 != dojo.indexOf(this._excludeList, name)) {
- // skip read-only attributes
- // BUG: can't use enabler's isReadOnly() fails with a bizare javascript error.
- continue;
- }
- var value = this.iContext.getiWidgetAttributes().getItemValue(name);
- results[name] = (asDialog) ? {
- value: value
- } : value;
- }
- return results;
- }
- });
|