123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689 |
- try {
- require.isXdUrl = function(){return false;};
- } catch (err) {}
- dojo.provide("TM1WebCubeViewerWidget");
- dojo.require("bux.i18n");
- dojo.require("bux.Helper");
- dojo.require("bux.data.UserPreferencesStore");
- dojo.declare("TM1WebCubeViewerWidget", null,
- {
- iframeCtrl: null,
- iframeCtrlCantLoadDojo: null,
- container: null,
- myContent: null,
- initialHeight: 286,
- _exportContainer: null,
- dimensionNames: null,
- elementNames: null,
- elementNameCounter: 0,
- filterElement: null,
- subscriptionHandle: null,
- cubeViewState: null,
- app: null,
- inDoMore: false,
- webUrl: null,
- cantLoadDojo: false,
- // ====== Multilingual Support - Start ========
- _productLocale: null,
- _tm1messages: null,
- // ====== Multilingual Support - End ========
- _firstVisible:false,
- 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 () {
- var url = this.tm1WebURL;
- var lastSlashIndex = url.lastIndexOf("/");
- this.webUrl = url.substring(0, lastSlashIndex);
- url += "/scripts/tm1web";
- var url2 = this.tm1WebURL;
- url2 += "/scripts/com";
- dojo.registerModulePath("tm1web", url);
- dojo.registerModulePath("com", url2);
- if (this.getCookie("tm1webcremote") != "" || (this.tm1Toolbar == "1")) {
- this.cantLoadDojo = true;
- } else {
- try {
- dojo.require("tm1web.cubeview.CubeViewer");
- } catch (err) {
- this.cantLoadDojo = true;
- document.cookie = "tm1webcremote=true; path=/";
- }
- }
- this.app = null;
- if (this.areTM1ParametersValid()) {
- this.refreshView();
- } else {
- this.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]);
- }
- }
- 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], 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]);
- }
- }
- 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 MessageLocalizer.getMessage("SUPPRESS_ZEROES_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_COMMIT") {
- return MessageLocalizer.getMessage("COMMIT_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SAVEVIEW") {
- return MessageLocalizer.getMessage("SAVE_VIEW_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SAVEAS") {
- return MessageLocalizer.getMessage("SAVE_AS_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_EXPORT") {
- return MessageLocalizer.getMessage("EXPORT_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
- return MessageLocalizer.getMessage("SLICE_TO_EXCEL_STR");
- } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
- return MessageLocalizer.getMessage("SNAP_TO_EXCEL_STR");
- } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
- return MessageLocalizer.getMessage("EXPORT_TO_PDF_STR");
- } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
- return MessageLocalizer.getMessage("SAVE_DATA_CHANGES_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
- return MessageLocalizer.getMessage("REVIEW_DATA_CHANGES_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_RECALCULATE") {
- return MessageLocalizer.getMessage("RECALCULATE_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
- if (this.app && this.cubeViewState && this.cubeViewState.automaticRecalculationEnabled) {
- return MessageLocalizer.getMessage("AUTO_RECALCULATE_OFF_TOOLTIP_STR");
- } else {
- return MessageLocalizer.getMessage("AUTO_RECALCULATE_ON_TOOLTIP_STR");
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
- return MessageLocalizer.getMessage("SUP_ZERO_ROW_COL_STR");
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
- return MessageLocalizer.getMessage("SUP_ZERO_ROW_STR");
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
- return MessageLocalizer.getMessage("SUP_ZERO_COL_STR");
- } else if (toolbarAction == "IDM_CHART") {
- return MessageLocalizer.getMessage("VIEW_CHART_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_CHARTANDGRID") {
- return MessageLocalizer.getMessage("VIEW_CHARTGRID_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_GRID") {
- return MessageLocalizer.getMessage("VIEW_GRID_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_CHART-SELECT") {
- return MessageLocalizer.getMessage("CHART_PROP_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_CHARTTYPE") {
- return MessageLocalizer.getMessage("CHART_TYPE_STR");
- } else if (toolbarAction == "IDM_METRICS") {
- return MessageLocalizer.getMessage("METRIC_DIAGRAM_STR");
- } else if (toolbarAction == "IDM_METRICS_IMPACT") {
- return MessageLocalizer.getMessage("METRIC_IMPACT_DIAGRAM_STR");
- } else if (toolbarAction == "IDM_METRICS_STRATEGY") {
- return MessageLocalizer.getMessage("METRIC_STRATEGY_DIAGRAMS_STR");
- } else if (toolbarAction == "IDM_CHART_POINT") {
- return MessageLocalizer.getMessage("POINT_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_BUBBLE") {
- return MessageLocalizer.getMessage("BUBBLE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_LINE") {
- return MessageLocalizer.getMessage("LINE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_SPLINE") {
- return MessageLocalizer.getMessage("SPLINE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STEPLINE") {
- return MessageLocalizer.getMessage("STEP_LINE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_FASTLINE") {
- return MessageLocalizer.getMessage("FAST_LINE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_BAR") {
- return MessageLocalizer.getMessage("BAR_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDBAR") {
- return MessageLocalizer.getMessage("STACKED_BAR_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDBAR100") {
- return MessageLocalizer.getMessage("STACKED_BAR_100_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_COLUMN") {
- return MessageLocalizer.getMessage("COLUMN_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN") {
- return MessageLocalizer.getMessage("STACKED_COL_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN100") {
- return MessageLocalizer.getMessage("STACKED_COL_100_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_AREA") {
- return MessageLocalizer.getMessage("AREA_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_SPLINEAREA") {
- return MessageLocalizer.getMessage("SPLINE_AREA_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDAREA") {
- return MessageLocalizer.getMessage("STACKED_AREA_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STACKEDAREA100") {
- return MessageLocalizer.getMessage("STACKED_AREA_100_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_PIE") {
- return MessageLocalizer.getMessage("PIE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_DOUGHNUT") {
- return MessageLocalizer.getMessage("DOUGHNUT_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_STOCK") {
- return MessageLocalizer.getMessage("STOCK_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_CANDLESTICK") {
- return MessageLocalizer.getMessage("CANDLE_STICK_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_RANGE") {
- return MessageLocalizer.getMessage("RANGE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_SPLINERANGE") {
- return MessageLocalizer.getMessage("SPLINE_RANGE_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_GANTT") {
- return MessageLocalizer.getMessage("GANTT_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_RANGECOLUMN") {
- return MessageLocalizer.getMessage("RANGE_COLUMN_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_RADAR") {
- return MessageLocalizer.getMessage("RADAR_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_POLAR") {
- return MessageLocalizer.getMessage("POLAR_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_BOXPLOT") {
- return MessageLocalizer.getMessage("BOX_PLOT_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_FUNNEL") {
- return MessageLocalizer.getMessage("FUNNEL_CHART_STR");
- } else if (toolbarAction == "IDM_CHART_PYRAMID") {
- return MessageLocalizer.getMessage("PYRAMID_CHART_STR");
- } else if (toolbarAction == "IDM_RESET_DATA") {
- return MessageLocalizer.getMessage("RESET_DATA_STR");
- } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
- return MessageLocalizer.getMessage("UNDO_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SANDBOX_REDO") {
- return MessageLocalizer.getMessage("REDO_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_SANDBOX") {
- return MessageLocalizer.getMessage("SANDBOX_TOOLTIP_STR");
- } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
- return MessageLocalizer.getMessage("CREATE_SANDBOX_STR");
- } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
- return MessageLocalizer.getMessage("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.GetSuppressZerosInfo().both == true) {
- return "tm1-toolbar-suppress-zeros dijitToggleButtonChecked";
- } else if (this.app.GetSuppressZerosInfo().row == true) {
- return "tm1-toolbar-suppress-zeros-on-rows dijitToggleButtonChecked";
- } else if (this.app.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.GetSuppressZerosInfo().both == true) {
- return "tm1-menu-radioselection";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
- if ((this.app.GetSuppressZerosInfo().row == true) ||
- (this.app.GetSuppressZerosInfo().both == true)) {
- return "tm1-menu-radioselection";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
- if ((this.app.GetSuppressZerosInfo().column == true) ||
- (this.app.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.tm1Toolbar = this.iContext.getiWidgetAttributes().getItemValue("TM1Toolbar");
- this.tm1Height = this.iContext.getiWidgetAttributes().getItemValue("tHeight");
- if (this.tm1Height == "") {
- this.tm1Height = this.initialHeight;
- }
- 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.tm1Password = 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();
- }
- this._firstVisible = true;
- },
- 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 identity = { host: this.tm1Host, userName: this.tm1UserName, password: this.tm1Password, serverName: this.tm1Server, cubeName: this.tm1Cube,
- viewName: this.tm1CubeView, accessType: this.tm1AccessType
- };
- if (this._exportContainer == null) {
- this._exportContainer = new dijit.layout.BorderContainer({ gutters: false }, dojo.byId("_" + this.iContext.widgetId + "_" + "widgetFrame2"));
- this._exportContainer.download = function (url, frameId) {
- var webUrl = this.webUrl + "/tm1web/" + url;
- var hiddenFrame = dojo.byId(frameId);
- if (hiddenFrame == null) {
- hiddenFrame = dojo.create("iframe", { id: frameId });
- dojo.style(hiddenFrame, { display: "none" });
- document.body.appendChild(hiddenFrame);
- }
- hiddenFrame.src = webUrl;
- };
- this._exportContainer.webUrl = this.webUrl;
- dojo.addClass(this._exportContainer.domNode, " downloadParent");
- }
- var createCubeViewer = dojo.hitch(this, function () {
- try {
- this.app = new CubeViewer(dojo.byId("_" + this.iContext.widgetId + "_" + "widgetFrame"), identity);
- }
- catch (err) {
- setTimeout(createCubeViewer, 500);
- return;
- }
- var createPromise = this.app.create();
- createPromise.then(dojo.hitch(this, this.createCompleteCallback));
- });
- createCubeViewer();
- }
- },
- refreshMore: function () {
- try {
- if (this.app != null) {
- if (this.subscriptionHandle) {
- this.app.unsubscribeFromStateChangeUpdates(this.subscriptionHandle);
- }
- this.app.dispose();
- this.app = null;
- }
- } catch (err) { }
- 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 + "/TM1WebCubeViewer.jsp?CubeName=" + this.tm1Cube + "&CubeViewName=" + this.tm1CubeView + "&ServerName=" + this.tm1Server + "&HostName=" + this.tm1Host + "&UserName=" + this.tm1UserName + "&Password=" + ((this.tm1Password == null) ? "" : this.tm1Password) + "&AccessType=" + this.tm1AccessType;
- },
- createCompleteCallback: function (value) {
- if (!this.inDoMore) {
- this.app.toggleDimensionBar(true);
- this.createWidgetToolbar();
- }
- var dimensionNamePromise = this.app.getDimensionNames();
- dimensionNamePromise.promise.then(dojo.hitch(this, function (inDimensionNames) {
- this.dimensionNames = inDimensionNames;
- this.elementNameCounter = 0;
- this.elementNames = [];
- var elementsPromise = this.app.getElementNames(this.dimensionNames[0]);
- elementsPromise.promise.then(dojo.hitch(this, this.getElementNamesCallback));
- }));
- if (this.subscriptionHandle) {
- this.app.unsubscribeFromStateChangeUpdates(this.subscriptionHandle);
- }
- this.subscriptionHandle = this.app.subscribeToStateChangeUpdates(dojo.hitch(this, this.getCubeViewStateCallback));
- },
- onView: function (iEvent) {
- if (this.inDoMore) {
- this.inDoMore = false;
- 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.unsubscribeFromStateChangeUpdates(this.subscriptionHandle);
- }
- this.app.dispose();
- this.app = null;
- }
- this.refreshView();
- } else if (this.app == null) {
- return;
- } else if (evt.payload == "IDM_RESET") {
- this.app.resetView();
- } else if (evt.payload == "IDM_COMMIT") {
- this.app.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.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.setAutomaticRecalculation(false);
- } else {
- this.app.setAutomaticRecalculation(true);
- }
- } else if (evt.payload == "IDM_SLICE_TO_EXCEL") {
- this.app.displayExportOptions("SLICE");
- } else if (evt.payload == "IDM_SNAPSHOT_TO_EXCEL") {
- this.app.displayExportOptions("SNAPSHOT");
- } else if (evt.payload == "IDM_EXPORT_TO_PDF") {
- this.app.displayExportOptions("PRINTTOPDF");
- } else if (evt.payload == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
- this.app.SuppressZerosBoth();
- this.createWidgetToolbar();
- } else if (evt.payload == "IDM_SUPPRESS_ZEROS_ROWS") {
- this.app.SuppressZerosRows();
- this.createWidgetToolbar();
- } else if (evt.payload == "IDM_SUPPRESS_ZEROS_COLUMNS") {
- this.app.SuppressZerosCols();
- this.createWidgetToolbar();
- } else if (evt.payload == "IDM_CHART") {
- this.app.ChangeDisplayMode("Chart");
- } else if (evt.payload == "IDM_CHARTANDGRID") {
- this.app.ChangeDisplayMode("GridAndChart");
- } else if (evt.payload == "IDM_GRID") {
- this.app.ChangeDisplayMode("Grid");
- } else if (evt.payload == "IDM_METRICS_IMPACT") {
- this.app.ChartTypeChanged(33);
- } else if (evt.payload == "IDM_CHART_POINT") {
- this.app.ChartTypeChanged(0, "");
- } else if (evt.payload == "IDM_CHART_BUBBLE") {
- this.app.ChartTypeChanged(1, "");
- } else if (evt.payload == "IDM_CHART_LINE") {
- this.app.ChartTypeChanged(2, "");
- } else if (evt.payload == "IDM_CHART_SPLINE") {
- this.app.ChartTypeChanged(3, "");
- } else if (evt.payload == "IDM_CHART_STEPLINE") {
- this.app.ChartTypeChanged(4, "");
- } else if (evt.payload == "IDM_CHART_FASTLINE") {
- this.app.ChartTypeChanged(5, "");
- } else if (evt.payload == "IDM_CHART_BAR") {
- this.app.ChartTypeChanged(6, "");
- } else if (evt.payload == "IDM_CHART_STACKEDBAR") {
- this.app.ChartTypeChanged(7, "");
- } else if (evt.payload == "IDM_CHART_STACKEDBAR100") {
- this.app.ChartTypeChanged(8, "");
- } else if (evt.payload == "IDM_CHART_COLUMN") {
- this.app.ChartTypeChanged(9, "");
- } else if (evt.payload == "IDM_CHART_STACKEDCOLUMN") {
- this.app.ChartTypeChanged(10, "");
- } else if (evt.payload == "IDM_CHART_STACKEDCOLUMN100") {
- this.app.ChartTypeChanged(11, "");
- } else if (evt.payload == "IDM_CHART_AREA") {
- this.app.ChartTypeChanged(12, "");
- } else if (evt.payload == "IDM_CHART_SPLINEAREA") {
- this.app.ChartTypeChanged(13, "");
- } else if (evt.payload == "IDM_CHART_STACKEDAREA") {
- this.app.ChartTypeChanged(14, "");
- } else if (evt.payload == "IDM_CHART_STACKEDAREA100") {
- this.app.ChartTypeChanged(15, "");
- } else if (evt.payload == "IDM_CHART_PIE") {
- this.app.ChartTypeChanged(16, "");
- } else if (evt.payload == "IDM_CHART_DOUGHNUT") {
- this.app.ChartTypeChanged(17, "");
- } else if (evt.payload == "IDM_CHART_STOCK") {
- this.app.ChartTypeChanged(18, "");
- } else if (evt.payload == "IDM_CHART_CANDLESTICK") {
- this.app.ChartTypeChanged(19, "");
- } else if (evt.payload == "IDM_CHART_RANGE") {
- this.app.ChartTypeChanged(20, "");
- } else if (evt.payload == "IDM_CHART_SPLINERANGE") {
- this.app.ChartTypeChanged(21, "");
- } else if (evt.payload == "IDM_CHART_GANTT") {
- this.app.ChartTypeChanged(22, "");
- } else if (evt.payload == "IDM_CHART_RANGECOLUMN") {
- this.app.ChartTypeChanged(23, "");
- } else if (evt.payload == "IDM_CHART_RADAR") {
- this.app.ChartTypeChanged(24, "");
- } else if (evt.payload == "IDM_CHART_POLAR") {
- this.app.ChartTypeChanged(25, "");
- } else if (evt.payload == "IDM_CHART_BOXPLOT") {
- this.app.ChartTypeChanged(26, "");
- } else if (evt.payload == "IDM_CHART_FUNNEL") {
- this.app.ChartTypeChanged(27, "");
- } else if (evt.payload == "IDM_CHART_PYRAMID") {
- this.app.ChartTypeChanged(28, "");
- } else if (evt.payload == "IDM_RESET_DATA") {
- this.app.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.createSandbox();
- } else if (evt.payload == "IDM_DELETE_SANDBOX") {
- this.app.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.ChartTypeChanged(StrategyId, this.cubeViewState.strategyDiagramList[diagramId]);
- } else if (evt.payload.substring(0, 13) == "SANDBOXCHOICE") {
- var sandBoxId = evt.payload.substring(13, evt.payload.length);
- if (sandBoxId == 0) {
- this.app.setActiveSandbox("[Base]");
- } else {
- this.app.setActiveSandbox(this.sandboxNames.sandboxes[sandBoxId]);
- }
- }
- },
- getCubeViewStateCallback: function (inCubeViewState) {
- this.cubeViewState = inCubeViewState;
- var sandboxPromise = this.app.getSandboxes();
- sandboxPromise.then(dojo.hitch(this, this.getSandboxNamesCallback));
- },
- getSandboxNamesCallback: function (inSandboxNames) {
- this.sandboxNames = inSandboxNames;
- this.createWidgetToolbar();
- },
- getElementNamesCallback: function (elements) {
- this.elementNames[this.elementNameCounter++] = elements;
- if (this.elementNameCounter < this.dimensionNames.length) {
- var elementsPromise = this.app.getElementNames(this.dimensionNames[this.elementNameCounter]);
- elementsPromise.promise.then(dojo.hitch(this, this.getElementNamesCallback));
- } else {
- this.setExistingFilters();
- //filtersToSetPayload this.iContext.iEvents.fireEvent("com.ibm.bux.canvas.get");
- }
- },
- setExistingFilters: function () {
- if (this.tm1FiltersToSetPayload != null) {
- for (var filters = 0; filters < this.tm1FiltersToSetPayload.length; filters++) {
- try {
- var filterPayload = this.tm1FiltersToSetPayload[filters];
- var selectValueControl = this.tm1FiltersToSetPayload[filters]["com.ibm.widget.context.bux.selectValueControl"].selectValueControl;
- var itemSpecification = "/content/package[@name='" + this.filterPackages + "']";
- var itemSpec2 = this.tm1FiltersToSetPayload[filters]["com.ibm.widget.context.bux.selectValueControl"].selectValueControl.itemSpecification[itemSpecification];
- var correctDimName = null;
- for (var i = 0; i < this.dimensionNames.length; i++) {
- correctDimName = itemSpec2[this.dimensionNames[i]];
- if (correctDimName != null) {
- break;
- }
- }
- if (correctDimName != null) {
- var itemSpec3 = correctDimName.values[0].mun;
- this.app.filterElement(itemSpec3);
- }
- } catch (err) { }
- }
- // this.filtersToSetPayload = null;
- }
- },
- onGetCanvasContextDone: function (evt) {
- if (evt != null && typeof evt != "undefined" && evt.payload && evt.payload.length != 0) {
- this.tm1FiltersToSetPayload = evt.payload;
- var filterPayload = (evt.type == "string" ? evt.payload : dojo.toJson(evt.payload));
- this.iContext.getiWidgetAttributes().setItemValue("filtersToSetPayload", filterPayload);
- }
- },
- getElementNameFromMUN: function (mun) {
- var positionInMUN = ".[";
- var indexInMUN = mun.lastIndexOf(positionInMUN);
- var elementName = mun.substring(indexInMUN + positionInMUN.length);
- elementName = elementName.substring(0, elementName.indexOf("]"));
- return elementName;
- },
- getMUN: function (dimensionName, elementName) {
- // { caption: "Europe", mun: "[plan_BudgetPlan].[plan_business_unit].[plan_business_unit]->:[TM].[plan_business_unit].[plan_business_unit].[@Member].[Europe]" },
- var mun = "[";
- mun += this.iContext.getiWidgetAttributes().getItemValue("tm1Cube");
- mun += "].[";
- mun += dimensionName;
- mun += "].[";
- mun += dimensionName;
- mun += "]->:[TM].[";
- mun += dimensionName;
- mun += "].[";
- mun += dimensionName;
- mun += "].[@MEMBER].[";
- mun += elementName;
- mun += "]";
- return mun;
- },
- createMunFromFacet: function (facetMun) {
- // { caption: "Europe", mun: "[plan_BudgetPlan].[plan_business_unit].[plan_business_unit]->:[TM].[plan_business_unit].[plan_business_unit].[@Member].[Europe]" },
- var lastOpenBracketIndex = facetMun.lastIndexOf("[");
- var elementName = facetMun.substring(lastOpenBracketIndex);
- elementName = elementName.substring(1, elementName.length - 1);
- var dimensionName = facetMun.substring(1, lastOpenBracketIndex - 2);
- var mun = "[";
- mun += this.iContext.getiWidgetAttributes().getItemValue("tm1Cube");
- mun += "].[";
- mun += dimensionName;
- mun += "].[";
- mun += dimensionName;
- mun += "]->:[TM].[";
- mun += dimensionName;
- mun += "].[";
- mun += dimensionName;
- mun += "].[@MEMBER].[";
- mun += elementName;
- mun += "]";
- return mun;
- },
- onFilter: function (evt) {
- if (evt != null && typeof evt != "undefined" && this.app != null) {
- var parms = eval("(" + evt.payload + ")");
- this.app.filterElement(parms.values[0].values[0].mun);
- }
- },
- onGenericSelectValueControl: function (evt) {
- if (evt != null && typeof evt != "undefined" && this.app != null) {
- try {
- var filterPayload = (evt.type == "string" ? evt.payload : dojo.toJson(evt.payload));
- var selectValueControl = evt.payload["com.ibm.widget.context.bux.selectValueControl"].selectValueControl;
- var itemSpecification = "/content/package[@name='" + this.filterPackages + "']";
- var itemSpec2 = evt.payload["com.ibm.widget.context.bux.selectValueControl"].selectValueControl.itemSpecification[itemSpecification];
- var correctDimName = null;
- for (var i = 0; i < this.dimensionNames.length; i++) {
- correctDimName = itemSpec2[this.dimensionNames[i]];
- if (correctDimName != null) {
- break;
- }
- }
- if (correctDimName != null) {
- var itemSpec3 = correctDimName.values[0].mun;
- this.app.filterElement(itemSpec3);
- }
- } catch (err) {
- // need to clear filters
- }
- }
- },
- onGetFilterableItems: function (evt) {
- var payload = { "invisible": {}, "visible": {} };
- if (this.dimensionNames != null) {
- var visibleDimensions = [];
- for (var i = 0; i < this.dimensionNames.length; i++) {
- visibleDimensions[i] = { "name": this.dimensionNames[i] };
- }
- payload.visible = visibleDimensions;
- }
- this.iContext.iEvents.fireEvent("com.ibm.bux.filter.items.get.done", null, payload);
- },
- getDimensionIndex: function (dimensionName) {
- var result = -1;
- if (this.dimensionNames != null) {
- for (var i = 0; i < this.dimensionNames.length; i++) {
- if (dimensionName == this.dimensionNames[i]) {
- result = i;
- break;
- }
- }
- }
- return result;
- },
- onGetFilterValues: function (evt) {
- // mun [plan_BudgetPlan].[plan_chart_of_accounts].[plan_chart_of_accounts]->:[TM].[plan_chart_of_accounts].[plan_chart_of_accounts].[@MEMBER].[Revenue]
- var filterDimension = evt.payload.payload.name;
- // var pathInfo = "/content/package[@name='planning_sample_app']"
- var pathInfo = "/content/package[@name='" + this.filterPackages + "']";
- var payload = {
- name: filterDimension,
- modelInfo: { path: pathInfo },
- values: []
- };
- var dimensionIndex = this.getDimensionIndex(filterDimension);
- if (dimensionIndex > -1) {
- for (var i = 0; i < this.elementNames[dimensionIndex].length; i++) {
- payload.values[i] = { caption: this.elementNames[dimensionIndex][i].alias, modelInfo: { path: pathInfo }, mun: this.getMUN(filterDimension, this.elementNames[dimensionIndex][i].name) };
- }
- }
- this.iContext.iEvents.fireEvent("com.ibm.bux.filter.values.get.done", null, payload);
- },
- onUnload: function (evt) {
- if (this.app) {
- if (this.subscriptionHandle) {
- this.app.unsubscribeFromStateChangeUpdates(this.subscriptionHandle);
- }
- this.app.dispose();
- }
- if (this.myContent)
- this.myContent.destroy();
- if (this.container)
- this.container.destroy();
- if (this.iframeCtrl != null) {
- this.iframeCtrl.destroy();
- }
- if (this.iframeCtrlCantLoadDojo != null) {
- this.iframeCtrlCantLoadDojo.destroy();
- }
- },
- onSetVisible: function(evt)
- {
- if (evt.payload.isVisible) {
- if (this.app != null) {
- this.app.recalculate();
- }
- }
- return;
- },
- 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) {
- if(!this._firstVisible) {
- setTimeout(dojo.hitch(this, this.onWidgetResize, e), 10);
- return;
- }
- var attributes = this.iContext.getiWidgetAttributes();
- var width = parseInt(attributes.getItemValue("viewWidth"));
- var height = parseInt(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.container) {
- this.container.resize(e.payload.resize);
- this.tm1Height = e.payload.resize.h;
- inIContext.getiWidgetAttributes().setItemValue("tHeight", this.tm1Height);
- }
- if (this.app != null) {
- this.app.resize();
- }
- }
- },
- 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) {
- console.log("_getProps");
- 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;
- }
- });
- dojo.provide("tm1.iwidget.utilities.IFrame");
- dojo.declare("tm1.iwidget.utilities.IFrame", dijit._Widget, {
- url: null,
- frameTitle: null,
- resizeZone: null,
- iframe: null,
- iframeId: null,
- constructor: function(params) {
- },
- setUrl: function(url) {
- this.url = url;
- if (this.iframe) {
- var preparedUrl = this.prepareUrl(url);
- if (this.iframe.contentDocument) {
- this.iframe.src = this.prepareUrl(url); //firefox
- } else {
- window.frames[this.iframeId].location = url; //IE
- }
- }
- },
- prepareUrl: function(url) {
- if (url === null || url === "") {
- return url;
- }
- url = bux.Helper.normalizeURL(url);
- return url;
- },
- setFrameTitle: function(title) {
- this.frameTitle = title;
- if (this.iframe) {
- this.iframe.title = bux.Encodings.htmlencode(title);
- }
- },
- startup: function() {
- this.inherited(arguments);
- var dn = this.domNode;
- this.resizeZone = dn.ownerDocument.createElement("div");
- dn.appendChild(this.resizeZone);
- dn = (this.iframe = dojo.doc.createElement('iframe'));
- var url = this.url;
- dn.id = this.id + "_iframe";
- this.iframeId = dn.id;
- dn.style.border = "none";
- dn.style.width = "100%";
- dn.frameBorder = 0;
- dn.tabIndex = 0;
- dn.title = this.frameTitle;
- dn.setAttribute('src', this.prepareUrl(url));
- this.resizeZone.appendChild(dn);
- if (dojo.isWebKit) {
- setTimeout(function() {
- dn.setAttribute('src', this.prepareUrl(url));
- }, 0);
- }
- },
- resize: function(size) {
- dijit.layout._LayoutWidget.prototype.resize.apply(this, arguments);
- if (dojo.isWebKit) {
- this.domNode.style.display = "none";
- setTimeout(dojo.hitch(this, function(){
- this.domNode.style.display = "";
- }), 1);
- }
- },
- layout: function() {
- this.resizeZone.style.height = this._contentBox.h + "px";
- if (this.iframe) {
- this.iframe.style.height = "100%";
- }
- }
- });
|