tm1ContentCubeViewerWidget.js 82 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *|
  5. *| BI and PM: BUX
  6. *|
  7. *| (C) Copyright IBM Corp. 2009
  8. *|
  9. *| US Government Users Restricted Rights - Use, duplication or
  10. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  11. *|
  12. *+------------------------------------------------------------------------+
  13. */
  14. // create script variables used to store TM1 callbacks
  15. var COGNOS_TM1_cubeWgtToolbarFuncs;
  16. var COGNOS_TM1_cubeWgtFilterFuncs;
  17. dojo.require("dojo.string");
  18. dojo.require("dojo._base.array");
  19. dojo.require("bux.i18n");
  20. dojo.require("bux.Helper");
  21. dojo.require("bux.data.UserPreferencesStore");
  22. dojo.provide("tm1ContentCubeViewerWidget");
  23. dojo.declare("tm1ContentCubeViewerWidget", null, {
  24. iframeCtrl: null,
  25. _paramgizmo_id: null,
  26. returnURL: null,
  27. initialHeight: 286,
  28. xmlhttp: null,
  29. commonDomain: null,
  30. bTurnOffCallbacks: false,
  31. tm1Toolbar: null,
  32. _currentRole: null,
  33. // ====== DefaultSize Support - Start ========
  34. _defaultWidth:700,
  35. _defaultHeight:400,
  36. _firstRender:true,
  37. // ====== DefaultSize Support - End ========
  38. // ====== Multilingual Support - Start ========
  39. _productLocale:null,
  40. _tm1messages:null,
  41. // ====== Multilingual Support - End ========
  42. _firstVisible:false,
  43. onSetVisible: function(evt) {
  44. if(!this._firstVisible && evt.payload.isVisible) {
  45. this._firstVisible = true;
  46. }
  47. },
  48. onLoad: function(evt) {
  49. if(!this._firstVisible && this.iContext._mm.widget.widgetInstance.itemSets.buxdelayedload.widgetVisible.value == "false") {
  50. setTimeout(dojo.hitch(this, this.onLoad), 50);
  51. return;
  52. }
  53. this._firstVisible = true;
  54. // ====== Multilingual Support - Start ========
  55. // Remember where we were loaded from: this is our path for future AJAX calls and .js loads
  56. dojo.registerModulePath("tm1ContentCubeViewerWidget",this.iContext.io.rewriteURI("js"));
  57. this.setLanguage().then(dojo.hitch(this, "continueOnLoad"));
  58. // ====== Multilingual Support - End ========
  59. },
  60. continueOnLoad: function() {
  61. this.getRole();
  62. this.createBasicWidgetToolbar();
  63. this.getWidgetAttributes();
  64. if (this.areTM1ParametersValid ()) {
  65. this.refreshView();
  66. } else {
  67. this.onGetProperties(null, true);
  68. }
  69. // ====== DefaultSize Support - Start ========
  70. //Delay the creation of some dynamic content to allow the widget to render first,
  71. //otherwise the dojo controlscannot properly render within its allowed real-estate.
  72. setTimeout(dojo.hitch(this,this.postLoadInit),1);
  73. // ====== DefaultSize Support - End ========
  74. },
  75. // ====== DefaultSize Support - Start ========
  76. postLoadInit: function()
  77. {
  78. // In this function, create the dynamic contents of the iWidget that are dojo objects based on dynamic HTML
  79. // call auto resize if it's the first time and is this widget was never saved.
  80. if (this._firstRender == true) {
  81. this._firstRender = false;
  82. var setDefaultSize = this.iContext.getiWidgetAttributes().getItemValue("setDefaultSize");
  83. if (setDefaultSize == "1") {
  84. // Next time the container dashboard loads, the default size must be ignored - as desired
  85. this.iContext.getiWidgetAttributes().setItemValue("setDefaultSize", "0");
  86. this.setPreferredSize();
  87. }
  88. }
  89. },
  90. getChrome: function() {
  91. var chromeObjectId = bux.Helper.widgetIdToChromeId(this.iContext.widgetId);
  92. var chromeObject = bux.Helper.getChromeById(chromeObjectId);
  93. return chromeObject;
  94. },
  95. setPreferredSize: function() {
  96. var chromeObject = this.getChrome();
  97. var newSize = {h: this._defaultHeight, w : this._defaultWidth};
  98. chromeObject.setPreferredSize(newSize);
  99. chromeObject.doChromeAutoResize();
  100. },
  101. // ====== DefaultSize Support - End ========
  102. // ====== Multilingual Support - Start ========
  103. updateView: function() {
  104. this.setLanguage();
  105. },
  106. setLanguage: function() {
  107. // Setup Localization tables - Use the BUX preferences for locale. Use Product locale for loading strings
  108. var curProductLocale=bux.Helper.getUserPreference("productLocale");
  109. if (this._productLocale != curProductLocale)
  110. {
  111. this._productLocale = curProductLocale;
  112. var deferred = new dojo.Deferred();
  113. var self = this;
  114. dojo.requireLocalization("tm1ContentCubeViewerWidget", "tm1ContentCubeViewerWidget_msg", curProductLocale);
  115. dojo.ready(function() {
  116. self._tm1messages = dojo.i18n.getLocalization("tm1ContentCubeViewerWidget", "tm1ContentCubeViewerWidget_msg", curProductLocale);
  117. deferred.resolve();
  118. });
  119. return deferred;
  120. }
  121. },
  122. // ====== Multilingual Support - End ========
  123. getRole: function () {
  124. if( this.iContext ) {
  125. var userProfileItemSet = this.iContext.getItemSet("buxuserprofile", false);
  126. if( userProfileItemSet ){
  127. var role = userProfileItemSet.getItemValue("currentUserRole");
  128. if( role && bux.UserRole.isValidRole(role) ) {
  129. this._currentRole = role;
  130. }
  131. }
  132. }
  133. },
  134. createBasicWidgetToolbar: function () {
  135. if (this.bTurnOffCallbacks) {
  136. var toolbarItems =
  137. [
  138. {
  139. _root:
  140. [
  141. {separator: true },
  142. {name: "Restart", action: "IDM_RESTART", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESTART, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada"}
  143. ]
  144. }
  145. ];
  146. this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, toolbarItems);
  147. } else {
  148. var toolbarItems =
  149. [
  150. {
  151. _root:
  152. [
  153. {separator: true },
  154. {name: "Refresh", action: "IDM_RECALCULATE", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_REFRESH, showLabel: false, "iconClass": "bux-refresh-image"},
  155. {name: "Reset", action: "IDM_RESET", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESET, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada"},
  156. {name: "Restart", action: "IDM_RESTART", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESTART, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada"}
  157. ]
  158. }
  159. ];
  160. this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, toolbarItems);
  161. }
  162. },
  163. fireFilterChanged: function (dimName, subsetName, elemName) {
  164. var extraParams = "title_";
  165. extraParams += dimName;
  166. extraParams += "=";
  167. extraParams += encodeURIComponent(elemName);
  168. this.iContext.iEvents.fireEvent("Context filter change", null, extraParams);
  169. },
  170. createWidgetToolbar: function (inToolbar) {
  171. var temptoolbarItems;
  172. this.tm1Toolbar = inToolbar;
  173. var toolbarItems =
  174. [
  175. {
  176. _root:
  177. [
  178. {separator: true },
  179. {name: "Refresh", action: "IDM_RECALCULATE", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_REFRESH, showLabel: false, "iconClass": "bux-refresh-image"},
  180. {name: "Reset", action: "IDM_RESET", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESET, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada"},
  181. {name: "Restart", action: "IDM_RESTART", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESTART, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada"}
  182. ]
  183. }
  184. ];
  185. toolbarItems = this.addToolbutton(toolbarItems, "IDM_COMMIT");
  186. toolbarItems = this.addToolbutton(toolbarItems, "IDM_SAVEVIEW");
  187. toolbarItems = this.addToolbutton(toolbarItems, "IDM_SAVEAS");
  188. toolbarItems = this.addToolbuttonWithSubmenu (toolbarItems, "IDM_EXPORT");
  189. toolbarItems = this.addSeparator(toolbarItems);
  190. toolbarItems = this.addToolbutton(toolbarItems, "IDM_SAVEDATACHANGES");
  191. toolbarItems = this.addToolbutton(toolbarItems, "IDM_REVIEWDATACHANGES");
  192. toolbarItems = this.addSeparator(toolbarItems);
  193. toolbarItems = this.addToolbutton(toolbarItems, "IDM_RECALCULATE");
  194. toolbarItems = this.addToolbutton(toolbarItems, "IDM_TOGGLE_AUTOMATICRECALCULATE");
  195. toolbarItems = this.addToolbuttonWithSubmenu (toolbarItems, "IDM_SUPPRESS_ZEROS");
  196. toolbarItems = this.addSeparator(toolbarItems);
  197. toolbarItems = this.addToolbutton(toolbarItems, "IDM_CHART");
  198. toolbarItems = this.addToolbutton(toolbarItems, "IDM_CHARTANDGRID");
  199. toolbarItems = this.addToolbutton(toolbarItems, "IDM_GRID");
  200. toolbarItems = this.addToolbuttonWithSubmenu (toolbarItems, "IDM_CHART-SELECT");
  201. toolbarItems = this.addSeparator(toolbarItems);
  202. toolbarItems = this.addToolbutton(toolbarItems, "IDM_RESET_DATA");
  203. toolbarItems = this.addToolbutton(toolbarItems, "IDM_SANDBOX_UNDO");
  204. toolbarItems = this.addToolbutton(toolbarItems, "IDM_SANDBOX_REDO");
  205. toolbarItems = this.addSeparator(toolbarItems);
  206. toolbarItems = this.addToolbuttonWithSubmenu (toolbarItems, "IDM_SANDBOX");
  207. toolbarItems = this.addToolbuttonWithSubmenu (toolbarItems, "IDM_SANDBOXITEMS");
  208. this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, toolbarItems);
  209. },
  210. addSeparator: function (toolbarItems) {
  211. var separator = { "separator": true };
  212. return toolbarItems.concat(separator);
  213. },
  214. addToolbutton: function (toolbarItems, toolbarAction) {
  215. if (this.isToolbuttonVisible(toolbarAction)) {
  216. return toolbarItems.concat(this.createSimpleToolbutton(toolbarAction));
  217. } else {
  218. return toolbarItems;
  219. }
  220. },
  221. addToolbuttonWithSubmenu: function (toolbarItems, toolbarAction) {
  222. if (this.isToolbuttonVisible(toolbarAction)) {
  223. return toolbarItems.concat(this.createToolbuttonWithSubmenu(toolbarAction));
  224. } else {
  225. return toolbarItems;
  226. }
  227. },
  228. createSimpleToolbutton: function (toolbarAction) {
  229. var toolbutton = {
  230. "name" : toolbarAction,
  231. "action" : toolbarAction,
  232. "label": this.getToolbuttonTooltip(toolbarAction),
  233. "iconClass": this.getToolbuttonImage(toolbarAction),
  234. "disabled": this.isToolbuttonDisabled(toolbarAction)
  235. }
  236. return toolbutton;
  237. },
  238. appendSandboxMenuChoice: function (menuItems, sandboxIndex, sandboxName, activeSandbox) {
  239. var toolbarAction = "SANDBOXCHOICE" + sandboxIndex;
  240. var toolbutton = {
  241. "name" : toolbarAction,
  242. "action" : toolbarAction,
  243. "label": sandboxName,
  244. "iconClass": (activeSandbox == sandboxName ? "tm1-menu-radioselection" : "tm1-menu-empty")
  245. }
  246. return menuItems.concat(toolbutton);
  247. },
  248. createToolbuttonWithSubmenu: function (toolbarAction) {
  249. var menuitems = null;
  250. if (toolbarAction == "IDM_EXPORT") {
  251. var menuItems = [];
  252. menuItems = this.addToolbutton(menuItems, "IDM_SLICE_TO_EXCEL");
  253. menuItems = this.addToolbutton(menuItems, "IDM_SNAPSHOT_TO_EXCEL");
  254. menuItems = this.addToolbutton(menuItems, "IDM_EXPORT_TO_PDF");
  255. var toolbutton = {
  256. "name" : toolbarAction,
  257. "action" : toolbarAction,
  258. "label": this.getToolbuttonTooltip(toolbarAction),
  259. "iconClass": this.getToolbuttonImage(toolbarAction),
  260. "disabled": this.isToolbuttonDisabled(toolbarAction),
  261. "items" : menuItems
  262. }
  263. return toolbutton;
  264. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
  265. var menuItems = [];
  266. menuItems = this.addToolbutton(menuItems, "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS");
  267. menuItems = this.addToolbutton(menuItems, "IDM_SUPPRESS_ZEROS_ROWS");
  268. menuItems = this.addToolbutton(menuItems, "IDM_SUPPRESS_ZEROS_COLUMNS");
  269. var toolbutton = {
  270. "name" : toolbarAction,
  271. "action" : toolbarAction,
  272. "label": this.getToolbuttonTooltip(toolbarAction),
  273. "iconClass": this.getToolbuttonImage(toolbarAction),
  274. "disabled": this.isToolbuttonDisabled(toolbarAction),
  275. "items" : menuItems
  276. }
  277. return toolbutton;
  278. } else if (toolbarAction == "IDM_CHART-SELECT") {
  279. var menuItems = [];
  280. menuItems = this.addToolbuttonWithSubmenu (menuItems, "IDM_CHARTTYPE");
  281. menuItems = this.addToolbuttonWithSubmenu (menuItems, "IDM_CHARTPALETTE");
  282. menuItems = this.addToolbutton(menuItems, "IDM_SHOWLEGEND");
  283. menuItems = this.addToolbutton(menuItems, "IDM_3DVIEW");
  284. menuItems = this.addToolbutton(menuItems, "IDM_CHART_PROPERTIES");
  285. var toolbutton = {
  286. "name" : toolbarAction,
  287. "action" : toolbarAction,
  288. "label": this.getToolbuttonTooltip(toolbarAction),
  289. "iconClass": this.getToolbuttonImage(toolbarAction),
  290. "disabled": this.isToolbuttonDisabled(toolbarAction),
  291. "items" : menuItems
  292. }
  293. return toolbutton;
  294. } else if (toolbarAction == "IDM_CHARTTYPE") {
  295. var menuItems = [];
  296. menuItems = this.addToolbutton(menuItems, "IDM_CHART_POINT");
  297. menuItems = this.addToolbutton(menuItems, "IDM_CHART_BUBBLE");
  298. menuItems = this.addToolbutton(menuItems, "IDM_CHART_LINE");
  299. menuItems = this.addToolbutton(menuItems, "IDM_CHART_SPLINE");
  300. menuItems = this.addToolbutton(menuItems, "IDM_CHART_STEPLINE");
  301. menuItems = this.addToolbutton(menuItems, "IDM_CHART_FASTLINE");
  302. menuItems = this.addToolbutton(menuItems, "IDM_CHART_BAR");
  303. menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDBAR");
  304. menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDBAR100");
  305. menuItems = this.addToolbutton(menuItems, "IDM_CHART_COLUMN");
  306. menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDCOLUMN");
  307. menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDCOLUMN100");
  308. menuItems = this.addToolbutton(menuItems, "IDM_CHART_AREA");
  309. menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDAREA");
  310. menuItems = this.addToolbutton(menuItems, "IDM_CHART_STACKEDAREA100");
  311. menuItems = this.addToolbutton(menuItems, "IDM_CHART_PIE");
  312. menuItems = this.addToolbutton(menuItems, "IDM_CHART_DOUGHNUT");
  313. menuItems = this.addToolbutton(menuItems, "IDM_CHART_STOCK");
  314. menuItems = this.addToolbutton(menuItems, "IDM_CHART_CANDLESTICK");
  315. menuItems = this.addToolbutton(menuItems, "IDM_CHART_RANGE");
  316. menuItems = this.addToolbutton(menuItems, "IDM_CHART_SPLINERANGE");
  317. menuItems = this.addToolbutton(menuItems, "IDM_CHART_GANTT");
  318. menuItems = this.addToolbutton(menuItems, "IDM_CHART_RANGECOLUMN");
  319. menuItems = this.addToolbutton(menuItems, "IDM_CHART_RADAR");
  320. menuItems = this.addToolbutton(menuItems, "IDM_CHART_POLAR");
  321. menuItems = this.addToolbutton(menuItems, "IDM_CHART_BOXPLOT");
  322. menuItems = this.addToolbutton(menuItems, "IDM_CHART_FUNNEL");
  323. menuItems = this.addToolbutton(menuItems, "IDM_CHART_PYRAMID");
  324. var toolbutton = {
  325. "name" : toolbarAction,
  326. "action" : toolbarAction,
  327. "label": this.getToolbuttonTooltip(toolbarAction),
  328. "iconClass": this.getToolbuttonImage(toolbarAction),
  329. "disabled": this.isToolbuttonDisabled(toolbarAction),
  330. "items" : menuItems
  331. }
  332. return toolbutton;
  333. } else if (toolbarAction == "IDM_CHARTPALETTE") {
  334. var menuItems = [];
  335. menuItems = this.addToolbutton(menuItems, "IDM_PALETTE_DEFAULT");
  336. menuItems = this.addToolbutton(menuItems, "IDM_PALETTE_STEEL");
  337. menuItems = this.addToolbutton(menuItems, "IDM_PALETTE_EARTH");
  338. menuItems = this.addToolbutton(menuItems, "IDM_PALETTE_GRAYS");
  339. menuItems = this.addToolbutton(menuItems, "IIDM_PALETTE_TRANSPARENT");
  340. menuItems = this.addToolbutton(menuItems, "IDM_PALETTE_EXCEL");
  341. menuItems = this.addToolbutton(menuItems, "IDM_PALETTE_BEIGE");
  342. menuItems = this.addToolbutton(menuItems, "IDM_PALETTE_BERRY");
  343. menuItems = this.addToolbutton(menuItems, "IDM_PALETTE_FIRE");
  344. menuItems = this.addToolbutton(menuItems, "IDM_PALETTE_GREEN");
  345. var toolbutton = {
  346. "name" : toolbarAction,
  347. "action" : toolbarAction,
  348. "label": this.getToolbuttonTooltip(toolbarAction),
  349. "iconClass": this.getToolbuttonImage(toolbarAction),
  350. "disabled": this.isToolbuttonDisabled(toolbarAction),
  351. "items" : menuItems
  352. }
  353. return toolbutton;
  354. } else if (toolbarAction == "IDM_SANDBOX") {
  355. var menuItems = [];
  356. menuItems = this.addToolbutton(menuItems, "IDM_CREATE_SANDBOX");
  357. menuItems = this.addToolbutton(menuItems, "IDM_DELETE_SANDBOX");
  358. var toolbutton = {
  359. "name" : toolbarAction,
  360. "action" : toolbarAction,
  361. "label": this.getToolbuttonTooltip(toolbarAction),
  362. "iconClass": this.getToolbuttonImage(toolbarAction),
  363. "disabled": this.isToolbuttonDisabled(toolbarAction),
  364. "items" : menuItems
  365. }
  366. return toolbutton;
  367. } else if (toolbarAction == "IDM_SANDBOXITEMS") {
  368. var menuItems = [];
  369. menuItems = this.appendSandboxMenuChoice(menuItems, 0, "[Base]", this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox);
  370. if (this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList.length > 0) {
  371. for (i=0; i<this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList.length; i++) {
  372. menuItems = this.appendSandboxMenuChoice(menuItems, i+1, this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList[i], this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox);
  373. }
  374. }
  375. var toolbutton = {
  376. "name" : toolbarAction,
  377. "action" : toolbarAction,
  378. "label": this.getToolbuttonTooltip(toolbarAction),
  379. "iconClass": this.getToolbuttonImage(toolbarAction),
  380. "disabled": this.isToolbuttonDisabled(toolbarAction),
  381. "items" : menuItems
  382. }
  383. return toolbutton;
  384. }
  385. var toolbutton = {
  386. "name" : toolbarAction,
  387. "action" : toolbarAction,
  388. "label": this.getToolbuttonTooltip(toolbarAction),
  389. "iconClass": this.getToolbuttonImage(toolbarAction),
  390. "disabled": this.isToolbuttonDisabled(toolbarAction),
  391. "items" : menuitems
  392. }
  393. return toolbutton;
  394. },
  395. getSandboxName: function(sandboxId) {
  396. if (sandboxId == 1) {
  397. return "[Base]";
  398. } else {
  399. return this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList[sandboxId - 1];
  400. }
  401. },
  402. getSandboxCheck: function (sandboxId) {
  403. if (this.getSandboxName(sandboxId) == this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox) {
  404. return "tm1-menu-radioselection";
  405. } else {
  406. return "tm1-menu-empty";
  407. }
  408. },
  409. isToolbuttonVisible: function(toolbarAction) {
  410. if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
  411. return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton != null && this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.IsAdded;
  412. } else if (toolbarAction == "IDM_COMMIT") {
  413. return this.tm1Toolbar.ToolbarInfo.CommitSandboxButton != null && this.tm1Toolbar.ToolbarInfo.CommitSandboxButton.IsAdded;
  414. } else if (toolbarAction == "IDM_SAVEVIEW") {
  415. return this.tm1Toolbar.ToolbarInfo.SaveViewButton != null && this.tm1Toolbar.ToolbarInfo.SaveViewButton.IsAdded;
  416. } else if (toolbarAction == "IDM_SAVEAS") {
  417. return this.tm1Toolbar.ToolbarInfo.SaveAsViewButton != null && this.tm1Toolbar.ToolbarInfo.SaveAsViewButton.IsAdded;
  418. } else if (toolbarAction == "IDM_EXPORT") {
  419. return this.tm1Toolbar.ToolbarInfo.ExportButton != null && this.tm1Toolbar.ToolbarInfo.ExportButton.IsAdded;
  420. } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
  421. return this.tm1Toolbar.ToolbarInfo.ExportButton != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSlice != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSlice.IsAdded;
  422. } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
  423. return this.tm1Toolbar.ToolbarInfo.ExportButton != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSnapshot != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSnapshot.IsAdded;
  424. } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
  425. return this.tm1Toolbar.ToolbarInfo.ExportButton != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemExportPDF != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemExportPDF.IsAdded;
  426. } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
  427. return this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton != null && this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton.IsAdded;
  428. } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
  429. return this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton != null && this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton.IsAdded;
  430. } else if (toolbarAction == "IDM_RECALCULATE") {
  431. return this.tm1Toolbar.ToolbarInfo.RecalcButton != null && this.tm1Toolbar.ToolbarInfo.RecalcButton.IsAdded;
  432. } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
  433. return this.tm1Toolbar.ToolbarInfo.AutoRecalcButton != null && this.tm1Toolbar.ToolbarInfo.AutoRecalcButton.IsAdded;
  434. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
  435. return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton != null && this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZeros != null && this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZeros.IsAdded;
  436. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
  437. return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton != null && this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnRows != null && this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnRows.IsAdded;
  438. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
  439. return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton != null && this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnColumns != null && this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnColumns.IsAdded;
  440. } else if (toolbarAction == "IDM_CHART") {
  441. return this.tm1Toolbar.ToolbarInfo.ViewChartButton != null && this.tm1Toolbar.ToolbarInfo.ViewChartButton.IsAdded;
  442. } else if (toolbarAction == "IDM_CHARTANDGRID") {
  443. return this.tm1Toolbar.ToolbarInfo.ViewChartGridButton != null && this.tm1Toolbar.ToolbarInfo.ViewChartGridButton.IsAdded;
  444. } else if (toolbarAction == "IDM_GRID") {
  445. return this.tm1Toolbar.ToolbarInfo.ViewGridButton != null && this.tm1Toolbar.ToolbarInfo.ViewGridButton.IsAdded;
  446. } else if (toolbarAction == "IDM_CHART-SELECT") {
  447. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.IsAdded;
  448. } else if (toolbarAction == "IDM_CHARTTYPE") {
  449. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  450. } else if (toolbarAction == "IDM_CHART_POINT") {
  451. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  452. } else if (toolbarAction == "IDM_CHART_BUBBLE") {
  453. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  454. } else if (toolbarAction == "IDM_CHART_LINE") {
  455. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  456. } else if (toolbarAction == "IDM_CHART_SPLINE") {
  457. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  458. } else if (toolbarAction == "IDM_CHART_STEPLINE") {
  459. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  460. } else if (toolbarAction == "IDM_CHART_FASTLINE") {
  461. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  462. } else if (toolbarAction == "IDM_CHART_BAR") {
  463. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  464. } else if (toolbarAction == "IDM_CHART_STACKEDBAR") {
  465. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  466. } else if (toolbarAction == "IDM_CHART_STACKEDBAR100") {
  467. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  468. } else if (toolbarAction == "IDM_CHART_COLUMN") {
  469. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  470. } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN") {
  471. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  472. } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN100") {
  473. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  474. } else if (toolbarAction == "IDM_CHART_AREA") {
  475. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  476. } else if (toolbarAction == "IDM_CHART_SPLINEAREA") {
  477. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  478. } else if (toolbarAction == "IDM_CHART_STACKEDAREA") {
  479. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  480. } else if (toolbarAction == "IDM_CHART_STACKEDAREA100") {
  481. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  482. } else if (toolbarAction == "IDM_CHART_PIE") {
  483. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  484. } else if (toolbarAction == "IDM_CHART_DOUGHNUT") {
  485. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  486. } else if (toolbarAction == "IDM_CHART_STOCK") {
  487. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  488. } else if (toolbarAction == "IDM_CHART_CANDLESTICK") {
  489. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  490. } else if (toolbarAction == "IDM_CHART_RANGE") {
  491. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  492. } else if (toolbarAction == "IDM_CHART_SPLINERANGE") {
  493. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  494. } else if (toolbarAction == "IDM_CHART_GANTT") {
  495. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  496. } else if (toolbarAction == "IDM_CHART_RANGECOLUMN") {
  497. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  498. } else if (toolbarAction == "IDM_CHART_RADAR") {
  499. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  500. } else if (toolbarAction == "IDM_CHART_POLAR") {
  501. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  502. } else if (toolbarAction == "IDM_CHART_BOXPLOT") {
  503. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  504. } else if (toolbarAction == "IDM_CHART_FUNNEL") {
  505. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  506. } else if (toolbarAction == "IDM_CHART_PYRAMID") {
  507. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsAdded;
  508. } else if (toolbarAction == "IDM_CHARTPALETTE") {
  509. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  510. } else if (toolbarAction == "IDM_PALETTE_DEFAULT") {
  511. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  512. } else if (toolbarAction == "IDM_PALETTE_STEEL") {
  513. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  514. } else if (toolbarAction == "IDM_PALETTE_EARTH") {
  515. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  516. } else if (toolbarAction == "IDM_PALETTE_GRAYS") {
  517. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  518. } else if (toolbarAction == "IDM_PALETTE_TRANSPARENT") {
  519. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  520. } else if (toolbarAction == "IDM_PALETTE_EXCEL") {
  521. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  522. } else if (toolbarAction == "IDM_PALETTE_BEIGE") {
  523. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  524. } else if (toolbarAction == "IDM_PALETTE_BERRY") {
  525. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  526. } else if (toolbarAction == "IDM_PALETTE_CHOCOLATE") {
  527. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  528. } else if (toolbarAction == "IDM_PALETTE_FIRE") {
  529. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  530. } else if (toolbarAction == "IDM_PALETTE_GREEN") {
  531. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsAdded;
  532. } else if (toolbarAction == "IDM_SHOWLEGEND") {
  533. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemToggleChartLegend.IsAdded;
  534. } else if (toolbarAction == "IDM_3DVIEW") {
  535. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemToggle3DView.IsAdded;
  536. } else if (toolbarAction == "IDM_CHART_PROPERTIES") {
  537. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton != null && this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.ChartPropertiesMenuItemChartProperties.IsAdded;
  538. } else if (toolbarAction == "IDM_RESET_DATA") {
  539. return this.tm1Toolbar.ToolbarInfo.ResetSandboxButton != null && this.tm1Toolbar.ToolbarInfo.ResetSandboxButton.IsAdded;
  540. } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
  541. return this.tm1Toolbar.ToolbarInfo.UndoButton != null && this.tm1Toolbar.ToolbarInfo.UndoButton.IsAdded;
  542. } else if (toolbarAction == "IDM_SANDBOX_REDO") {
  543. return this.tm1Toolbar.ToolbarInfo.RedoButton != null && this.tm1Toolbar.ToolbarInfo.RedoButton.IsAdded;
  544. } else if (toolbarAction == "IDM_SANDBOX") {
  545. return this.tm1Toolbar.ToolbarInfo.SandboxButton != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.IsAdded;
  546. } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
  547. return this.tm1Toolbar.ToolbarInfo.SandboxButton != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemCreateSandbox != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemCreateSandbox.IsAdded;
  548. } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
  549. return this.tm1Toolbar.ToolbarInfo.SandboxButton != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemDeleteSandbox != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemDeleteSandbox.IsAdded;
  550. } else if (toolbarAction == "IDM_SANDBOXITEMS") {
  551. return this.tm1Toolbar.ToolbarInfo.SandboxButton != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.IsAdded;
  552. }
  553. return false;
  554. },
  555. isToolbuttonDisabled: function(toolbarAction) {
  556. if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
  557. return (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.IsEnabled == false);
  558. } else if (toolbarAction == "IDM_COMMIT") {
  559. return (this.tm1Toolbar.ToolbarInfo.CommitSandboxButton.IsEnabled == false);
  560. } else if (toolbarAction == "IDM_SAVEVIEW") {
  561. return (this.tm1Toolbar.ToolbarInfo.SaveViewButton.IsEnabled == false);
  562. } else if (toolbarAction == "IDM_SAVEAS") {
  563. return (this.tm1Toolbar.ToolbarInfo.SaveAsViewButton.IsEnabled == false);
  564. } else if (toolbarAction == "IDM_EXPORT") {
  565. return (this.tm1Toolbar.ToolbarInfo.ExportButton.IsEnabled == false);
  566. } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
  567. return (this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSlice.IsEnabled == false);
  568. } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
  569. return (this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSnapshot.IsEnabled == false);
  570. } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
  571. return (this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemExportPDF.IsEnabled == false);
  572. } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
  573. return (this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton.IsEnabled == false);
  574. } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
  575. return (this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton.IsEnabled == false);
  576. } else if (toolbarAction == "IDM_RECALCULATE") {
  577. return (this.tm1Toolbar.ToolbarInfo.RecalcButton.IsEnabled == false);
  578. } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
  579. return (this.tm1Toolbar.ToolbarInfo.AutoRecalcButton.IsEnabled == false);
  580. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
  581. return ( this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZeros.IsEnabled == false);
  582. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
  583. return (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnRows.IsEnabled == false);
  584. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
  585. return (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnColumns.IsEnabled == false);
  586. } else if (toolbarAction == "IDM_CHART") {
  587. return (this.tm1Toolbar.ToolbarInfo.ViewChartButton.IsEnabled == false);
  588. } else if (toolbarAction == "IDM_CHARTANDGRID") {
  589. return (this.tm1Toolbar.ToolbarInfo.ViewChartGridButton.IsEnabled == false);
  590. } else if (toolbarAction == "IDM_GRID") {
  591. return (this.tm1Toolbar.ToolbarInfo.ViewGridButton.IsEnabled == false);
  592. } else if (toolbarAction == "IDM_CHART-SELECT") {
  593. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.IsEnabled == false);
  594. } else if (toolbarAction == "IDM_CHARTTYPE") {
  595. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  596. } else if (toolbarAction == "IDM_CHART_POINT") {
  597. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  598. } else if (toolbarAction == "IDM_CHART_BUBBLE") {
  599. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  600. } else if (toolbarAction == "IDM_CHART_LINE") {
  601. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  602. } else if (toolbarAction == "IDM_CHART_SPLINE") {
  603. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  604. } else if (toolbarAction == "IDM_CHART_STEPLINE") {
  605. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  606. } else if (toolbarAction == "IDM_CHART_FASTLINE") {
  607. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  608. } else if (toolbarAction == "IDM_CHART_BAR") {
  609. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  610. } else if (toolbarAction == "IDM_CHART_STACKEDBAR") {
  611. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  612. } else if (toolbarAction == "IDM_CHART_STACKEDBAR100") {
  613. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  614. } else if (toolbarAction == "IDM_CHART_COLUMN") {
  615. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  616. } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN") {
  617. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  618. } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN100") {
  619. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  620. } else if (toolbarAction == "IDM_CHART_AREA") {
  621. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  622. } else if (toolbarAction == "IDM_CHART_SPLINEAREA") {
  623. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  624. } else if (toolbarAction == "IDM_CHART_STACKEDAREA") {
  625. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  626. } else if (toolbarAction == "IDM_CHART_STACKEDAREA100") {
  627. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  628. } else if (toolbarAction == "IDM_CHART_PIE") {
  629. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  630. } else if (toolbarAction == "IDM_CHART_DOUGHNUT") {
  631. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  632. } else if (toolbarAction == "IDM_CHART_STOCK") {
  633. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  634. } else if (toolbarAction == "IDM_CHART_CANDLESTICK") {
  635. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  636. } else if (toolbarAction == "IDM_CHART_RANGE") {
  637. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  638. } else if (toolbarAction == "IDM_CHART_SPLINERANGE") {
  639. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  640. } else if (toolbarAction == "IDM_CHART_GANTT") {
  641. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  642. } else if (toolbarAction == "IDM_CHART_RANGECOLUMN") {
  643. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  644. } else if (toolbarAction == "IDM_CHART_RADAR") {
  645. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  646. } else if (toolbarAction == "IDM_CHART_POLAR") {
  647. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  648. } else if (toolbarAction == "IDM_CHART_BOXPLOT") {
  649. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  650. } else if (toolbarAction == "IDM_CHART_FUNNEL") {
  651. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  652. } else if (toolbarAction == "IDM_CHART_PYRAMID") {
  653. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.IsEnabled == false);
  654. } else if (toolbarAction == "IDM_CHARTPALETTE") {
  655. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  656. } else if (toolbarAction == "IDM_PALETTE_DEFAULT") {
  657. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  658. } else if (toolbarAction == "IDM_PALETTE_STEEL") {
  659. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  660. } else if (toolbarAction == "IDM_PALETTE_EARTH") {
  661. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  662. } else if (toolbarAction == "IDM_PALETTE_GRAYS") {
  663. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  664. } else if (toolbarAction == "IDM_PALETTE_TRANSPARENT") {
  665. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  666. } else if (toolbarAction == "IDM_PALETTE_EXCEL") {
  667. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  668. } else if (toolbarAction == "IDM_PALETTE_BEIGE") {
  669. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  670. } else if (toolbarAction == "IDM_PALETTE_BERRY") {
  671. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  672. } else if (toolbarAction == "IDM_PALETTE_CHOCOLATE") {
  673. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  674. } else if (toolbarAction == "IDM_PALETTE_FIRE") {
  675. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  676. } else if (toolbarAction == "IDM_PALETTE_GREEN") {
  677. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.IsEnabled == false);
  678. } else if (toolbarAction == "IDM_SHOWLEGEND") {
  679. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemToggleChartLegend.IsEnabled == false);
  680. } else if (toolbarAction == "IDM_3DVIEW") {
  681. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemToggle3DView.IsEnabled == false);
  682. } else if (toolbarAction == "IDM_CHART_PROPERTIES") {
  683. return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.ChartPropertiesMenuItemChartProperties.IsEnabled == false);
  684. } else if (toolbarAction == "IDM_RESET_DATA") {
  685. return (this.tm1Toolbar.ToolbarInfo.ResetSandboxButton.IsEnabled == false);
  686. } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
  687. return (this.tm1Toolbar.ToolbarInfo.UndoButton.IsEnabled == false);
  688. } else if (toolbarAction == "IDM_SANDBOX_REDO") {
  689. return (this.tm1Toolbar.ToolbarInfo.RedoButton.IsEnabled == false);
  690. } else if (toolbarAction == "IDM_SANDBOX") {
  691. return (this.tm1Toolbar.ToolbarInfo.SandboxButton.IsEnabled == false);
  692. } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
  693. return (this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemCreateSandbox.IsEnabled == false);
  694. } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
  695. return (this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemDeleteSandbox.IsEnabled == false);
  696. } else if (toolbarAction == "IDM_SANDBOXITEMS") {
  697. return (this.tm1Toolbar.ToolbarInfo.SandboxButton.IsEnabled == false);
  698. }
  699. return "tm1-toolbar-empty";
  700. },
  701. getToolbuttonTooltip: function(toolbarAction) {
  702. if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
  703. return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.CurrentSuppressZerosStateTooltip;
  704. } else if (toolbarAction == "IDM_COMMIT") {
  705. return this.tm1Toolbar.ToolbarInfo.CommitSandboxButton.Tooltip;
  706. } else if (toolbarAction == "IDM_SAVEVIEW") {
  707. return this.tm1Toolbar.ToolbarInfo.SaveViewButton.Tooltip;
  708. } else if (toolbarAction == "IDM_SAVEAS") {
  709. return this.tm1Toolbar.ToolbarInfo.SaveAsViewButton.Tooltip;
  710. } else if (toolbarAction == "IDM_EXPORT") {
  711. return this.tm1Toolbar.ToolbarInfo.ExportButton.Tooltip;
  712. } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
  713. return this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSlice.Tooltip;
  714. } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
  715. return this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSnapshot.Tooltip;
  716. } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
  717. return this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemExportPDF.Tooltip;
  718. } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
  719. return this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton.Tooltip;
  720. } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
  721. return this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton.Tooltip;
  722. } else if (toolbarAction == "IDM_RECALCULATE") {
  723. return this.tm1Toolbar.ToolbarInfo.RecalcButton.Tooltip;
  724. } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
  725. return this.tm1Toolbar.ToolbarInfo.AutoRecalcButton.Tooltip;
  726. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
  727. return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZeros.Tooltip;
  728. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
  729. return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnRows.Tooltip;
  730. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
  731. return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnColumns.Tooltip;
  732. } else if (toolbarAction == "IDM_CHART") {
  733. return this.tm1Toolbar.ToolbarInfo.ViewChartButton.Tooltip;
  734. } else if (toolbarAction == "IDM_CHARTANDGRID") {
  735. return this.tm1Toolbar.ToolbarInfo.ViewChartGridButton.Tooltip;
  736. } else if (toolbarAction == "IDM_GRID") {
  737. return this.tm1Toolbar.ToolbarInfo.ViewGridButton.Tooltip;
  738. } else if (toolbarAction == "IDM_CHART-SELECT") {
  739. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.Tooltip;
  740. } else if (toolbarAction == "IDM_CHARTTYPE") {
  741. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.Tooltip;
  742. } else if (toolbarAction == "IDM_CHART_POINT") {
  743. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[0];
  744. } else if (toolbarAction == "IDM_CHART_BUBBLE") {
  745. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[1];
  746. } else if (toolbarAction == "IDM_CHART_LINE") {
  747. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[2];
  748. } else if (toolbarAction == "IDM_CHART_SPLINE") {
  749. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[3];
  750. } else if (toolbarAction == "IDM_CHART_STEPLINE") {
  751. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[4];
  752. } else if (toolbarAction == "IDM_CHART_FASTLINE") {
  753. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[5];
  754. } else if (toolbarAction == "IDM_CHART_BAR") {
  755. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[6];
  756. } else if (toolbarAction == "IDM_CHART_STACKEDBAR") {
  757. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[7];
  758. } else if (toolbarAction == "IDM_CHART_STACKEDBAR100") {
  759. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[8];
  760. } else if (toolbarAction == "IDM_CHART_COLUMN") {
  761. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[9];
  762. } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN") {
  763. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[10];
  764. } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN100") {
  765. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[11];
  766. } else if (toolbarAction == "IDM_CHART_AREA") {
  767. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[12];
  768. } else if (toolbarAction == "IDM_CHART_SPLINEAREA") {
  769. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[13];
  770. } else if (toolbarAction == "IDM_CHART_STACKEDAREA") {
  771. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[14];
  772. } else if (toolbarAction == "IDM_CHART_STACKEDAREA100") {
  773. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[15];
  774. } else if (toolbarAction == "IDM_CHART_PIE") {
  775. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[16];
  776. } else if (toolbarAction == "IDM_CHART_DOUGHNUT") {
  777. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[17];
  778. } else if (toolbarAction == "IDM_CHART_STOCK") {
  779. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[18];
  780. } else if (toolbarAction == "IDM_CHART_CANDLESTICK") {
  781. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[19];
  782. } else if (toolbarAction == "IDM_CHART_RANGE") {
  783. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[20];
  784. } else if (toolbarAction == "IDM_CHART_SPLINERANGE") {
  785. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[21];
  786. } else if (toolbarAction == "IDM_CHART_GANTT") {
  787. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[22];
  788. } else if (toolbarAction == "IDM_CHART_RANGECOLUMN") {
  789. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[23];
  790. } else if (toolbarAction == "IDM_CHART_RADAR") {
  791. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[24];
  792. } else if (toolbarAction == "IDM_CHART_POLAR") {
  793. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[25];
  794. } else if (toolbarAction == "IDM_CHART_BOXPLOT") {
  795. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[26];
  796. } else if (toolbarAction == "IDM_CHART_FUNNEL") {
  797. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[27];
  798. } else if (toolbarAction == "IDM_CHART_PYRAMID") {
  799. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemType.TypeNames[28];
  800. } else if (toolbarAction == "IDM_CHARTPALETTE") {
  801. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.Tooltip;
  802. } else if (toolbarAction == "IDM_PALETTE_DEFAULT") {
  803. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[0];
  804. } else if (toolbarAction == "IDM_PALETTE_STEEL") {
  805. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[1];
  806. } else if (toolbarAction == "IDM_PALETTE_EARTH") {
  807. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[2];
  808. } else if (toolbarAction == "IDM_PALETTE_GRAYS") {
  809. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[3];
  810. } else if (toolbarAction == "IDM_PALETTE_TRANSPARENT") {
  811. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[4];
  812. } else if (toolbarAction == "IDM_PALETTE_EXCEL") {
  813. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[5];
  814. } else if (toolbarAction == "IDM_PALETTE_BEIGE") {
  815. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[6];
  816. } else if (toolbarAction == "IDM_PALETTE_BERRY") {
  817. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[7];
  818. } else if (toolbarAction == "IDM_PALETTE_CHOCOLATE") {
  819. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[8];
  820. } else if (toolbarAction == "IDM_PALETTE_FIRE") {
  821. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[9];
  822. } else if (toolbarAction == "IDM_PALETTE_GREEN") {
  823. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemColorPalette.ColorPaletteNames[10];
  824. } else if (toolbarAction == "IDM_SHOWLEGEND") {
  825. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemToggleChartLegend.Tooltip;
  826. } else if (toolbarAction == "IDM_3DVIEW") {
  827. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.MenuItemToggle3DView.Tooltip;
  828. } else if (toolbarAction == "IDM_CHART_PROPERTIES") {
  829. return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.ChartPropertiesMenuItemChartProperties.Tooltip;
  830. } else if (toolbarAction == "IDM_SANDBOX") {
  831. return this.tm1Toolbar.ToolbarInfo.SandboxButton.Tooltip;
  832. } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
  833. return this.tm1Toolbar.ToolbarInfo.UndoButton.Tooltip;
  834. } else if (toolbarAction == "IDM_SANDBOX_REDO") {
  835. return this.tm1Toolbar.ToolbarInfo.RedoButton.Tooltip;
  836. } else if (toolbarAction == "IDM_RESET_DATA") {
  837. return this.tm1Toolbar.ToolbarInfo.ResetSandboxButton.Tooltip;
  838. } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
  839. return this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemCreateSandbox.Tooltip;
  840. } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
  841. return this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemDeleteSandbox.Tooltip;
  842. } else if (toolbarAction == "IDM_SANDBOXITEMS") {
  843. if (this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox == null || this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox == "") {
  844. return this.tm1Toolbar.ToolbarInfo.SandboxButton.Tooltip;
  845. } else {
  846. return this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox;
  847. }
  848. }
  849. return "";
  850. },
  851. getToolbuttonImage: function(toolbarAction) {
  852. if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
  853. if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZeros)
  854. return "tm1-toolbar-suppress-zeros dijitToggleButtonChecked";
  855. else if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZerosOnRows)
  856. return "tm1-toolbar-suppress-zeros-on-rows dijitToggleButtonChecked";
  857. else if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZerosOnColumns)
  858. return "tm1-toolbar-suppress-zeros-on-columns dijitToggleButtonChecked";
  859. else {
  860. return "tm1-toolbar-suppress-zeros";
  861. }
  862. } else if (toolbarAction == "IDM_COMMIT") {
  863. if (this.tm1Toolbar.ToolbarInfo.CommitSandboxButton.IsEnabled) {
  864. return "tm1-toolbar-apply";
  865. } else {
  866. return "tm1-toolbar-apply disabled-toolbutton";
  867. }
  868. } else if (toolbarAction == "IDM_SAVEVIEW") {
  869. if (this.tm1Toolbar.ToolbarInfo.SaveViewButton.IsEnabled) {
  870. return "tm1-toolbar-save-view";
  871. } else {
  872. return "tm1-toolbar-save-view disabled-toolbutton";
  873. }
  874. } else if (toolbarAction == "IDM_SAVEAS") {
  875. if (this.tm1Toolbar.ToolbarInfo.SaveAsViewButton.IsEnabled) {
  876. return "tm1-toolbar-save-view-as";
  877. } else {
  878. return "tm1-toolbar-save-view-as disabled-toolbutton";
  879. }
  880. } else if (toolbarAction == "IDM_EXPORT") {
  881. if (this.tm1Toolbar.ToolbarInfo.ExportButton.IsEnabled) {
  882. return "tm1-toolbar-export";
  883. } else {
  884. return "tm1-toolbar-export disabled-toolbutton";
  885. }
  886. } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
  887. return "tm1-toolbar-slice-excel2";
  888. } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
  889. return "tm1-toolbar-slice-snapshot";
  890. } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
  891. return "tm1-toolbar-slice-pdf";
  892. } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
  893. if (this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton.IsEnabled) {
  894. return "tm1-toolbar-save_data_changes";
  895. } else {
  896. return "tm1-toolbar-save_data_changes disabled-toolbutton";
  897. }
  898. } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
  899. if (this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton.IsEnabled) {
  900. return "tm1-toolbar-review_data_changes";
  901. } else {
  902. return "tm1-toolbar-review_data_changes disabled-toolbutton";
  903. }
  904. } else if (toolbarAction == "IDM_RECALCULATE") {
  905. if (this.tm1Toolbar.ToolbarInfo.RecalcButton.IsEnabled) {
  906. return "tm1-toolbar-recalculate";
  907. } else {
  908. return "tm1-toolbar-recalculate disabled-toolbutton";
  909. }
  910. } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
  911. if (this.tm1Toolbar.ToolbarInfo.AutoRecalcButton.IsEnabled) {
  912. if (this.tm1Toolbar.ToolbarInfo.AutoRecalc) {
  913. return "tm1-toolbar-recalculation dijitToggleButtonChecked";
  914. } else {
  915. return "tm1-toolbar-recalculation";
  916. }
  917. } else {
  918. if (this.tm1Toolbar.ToolbarInfo.AutoRecalc) {
  919. return "tm1-toolbar-recalculation disabled-toolbutton dijitToggleButtonChecked";
  920. } else {
  921. return "tm1-toolbar-recalculation disabled-toolbutton";
  922. }
  923. }
  924. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
  925. if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZeros.IsChecked) {
  926. return "tm1-menu-radioselection";
  927. }
  928. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
  929. if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnRows.IsChecked ||
  930. this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZeros.IsChecked) {
  931. return "tm1-menu-radioselection";
  932. }
  933. } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
  934. if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZerosOnColumns.IsChecked ||
  935. this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.MenuItemSuppressZeros.IsChecked) {
  936. return "tm1-menu-radioselection";
  937. }
  938. } else if (toolbarAction == "IDM_CHART") {
  939. if (this.tm1Toolbar.ToolbarInfo.DisplayMode == 1) {
  940. return "tm1-toolbar-chart_only dijitToggleButtonChecked";
  941. } else {
  942. return "tm1-toolbar-chart_only";
  943. }
  944. } else if (toolbarAction == "IDM_CHARTANDGRID") {
  945. if (this.tm1Toolbar.ToolbarInfo.DisplayMode == 2) {
  946. return "tm1-toolbar-chart-grid dijitToggleButtonChecked";
  947. } else {
  948. return "tm1-toolbar-chart-grid";
  949. }
  950. } else if (toolbarAction == "IDM_GRID") {
  951. if (this.tm1Toolbar.ToolbarInfo.DisplayMode == 0) {
  952. return "tm1-toolbar-grid_only dijitToggleButtonChecked";
  953. } else {
  954. return "tm1-toolbar-grid_only";
  955. }
  956. } else if (toolbarAction == "IDM_CHART-SELECT") {
  957. if (this.tm1Toolbar.ToolbarInfo.DisplayMode == 0) {
  958. return "tm1-toolbar-chart-select_type disabled-toolbutton";
  959. } else {
  960. return "tm1-toolbar-chart-select_type";
  961. }
  962. } else if (toolbarAction == "IDM_CHARTTYPE") {
  963. return "tm1-toolbar-chart-select";
  964. } else if (toolbarAction == "IDM_CHART_POINT") {
  965. return "tm1-toolbar-chart-point";
  966. } else if (toolbarAction == "IDM_CHART_BUBBLE") {
  967. return "tm1-toolbar-chart-bubble";
  968. } else if (toolbarAction == "IDM_CHART_LINE") {
  969. return "tm1-toolbar-chart-line";
  970. } else if (toolbarAction == "IDM_CHART_SPLINE") {
  971. return "tm1-toolbar-chart-spline";
  972. } else if (toolbarAction == "IDM_CHART_STEPLINE") {
  973. return "tm1-toolbar-chart-stepline";
  974. } else if (toolbarAction == "IDM_CHART_FASTLINE") {
  975. return "tm1-toolbar-chart-fastline";
  976. } else if (toolbarAction == "IDM_CHART_BAR") {
  977. return "tm1-toolbar-chart-bar";
  978. } else if (toolbarAction == "IDM_CHART_STACKEDBAR") {
  979. return "tm1-toolbar-chart-stackedbar";
  980. } else if (toolbarAction == "IDM_CHART_STACKEDBAR100") {
  981. return "tm1-toolbar-chart-stackedbar100";
  982. } else if (toolbarAction == "IDM_CHART_COLUMN") {
  983. return "tm1-toolbar-chart-column";
  984. } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN") {
  985. return "tm1-toolbar-chart-stackedcolumn";
  986. } else if (toolbarAction == "IDM_CHART_STACKEDCOLUMN100") {
  987. return "tm1-toolbar-chart-stackedcolumn100";
  988. } else if (toolbarAction == "IDM_CHART_AREA") {
  989. return "tm1-toolbar-chart-area";
  990. } else if (toolbarAction == "IDM_CHART_SPLINEAREA") {
  991. return "tm1-toolbar-chart-splinearea";
  992. } else if (toolbarAction == "IDM_CHART_STACKEDAREA") {
  993. return "tm1-toolbar-chart-stackedarea";
  994. } else if (toolbarAction == "IDM_CHART_STACKEDAREA100") {
  995. return "tm1-toolbar-chart-stackedarea100";
  996. } else if (toolbarAction == "IDM_CHART_PIE") {
  997. return "tm1-toolbar-chart-pie";
  998. } else if (toolbarAction == "IDM_CHART_DOUGHNUT") {
  999. return "tm1-toolbar-chart-doughnut";
  1000. } else if (toolbarAction == "IDM_CHART_STOCK") {
  1001. return "tm1-toolbar-chart-stock";
  1002. } else if (toolbarAction == "IDM_CHART_CANDLESTICK") {
  1003. return "tm1-toolbar-chart-candlestick";
  1004. } else if (toolbarAction == "IDM_CHART_RANGE") {
  1005. return "tm1-toolbar-chart-range";
  1006. } else if (toolbarAction == "IDM_CHART_SPLINERANGE") {
  1007. return "tm1-toolbar-chart-splinerange";
  1008. } else if (toolbarAction == "IDM_CHART_GANTT") {
  1009. return "tm1-toolbar-chart-gantt";
  1010. } else if (toolbarAction == "IDM_CHART_RANGECOLUMN") {
  1011. return "tm1-toolbar-chart-rangecolumn";
  1012. } else if (toolbarAction == "IDM_CHART_RADAR") {
  1013. return "tm1-toolbar-chart-radar";
  1014. } else if (toolbarAction == "IDM_CHART_POLAR") {
  1015. return "tm1-toolbar-chart-polar";
  1016. } else if (toolbarAction == "IDM_CHART_BOXPLOT") {
  1017. return "tm1-toolbar-chart-boxplot";
  1018. } else if (toolbarAction == "IDM_CHART_FUNNEL") {
  1019. return "tm1-toolbar-chart-funnel";
  1020. } else if (toolbarAction == "IDM_CHART_PYRAMID") {
  1021. return "tm1-toolbar-chart-pyramid";
  1022. } else if (toolbarAction == "IDM_CHARTPALETTE") {
  1023. return "tm1-toolbar-chart-color_scheme";
  1024. } else if (toolbarAction == "IDM_PALETTE_DEFAULT") {
  1025. return "tm1-toolbar-color_scheme-default";
  1026. } else if (toolbarAction == "IDM_PALETTE_STEEL") {
  1027. return "tm1-toolbar-color_scheme-light_steel_blue";
  1028. } else if (toolbarAction == "IDM_PALETTE_EARTH") {
  1029. return "tm1-toolbar-color_scheme-earth_tones";
  1030. } else if (toolbarAction == "IDM_PALETTE_GRAYS") {
  1031. return "tm1-toolbar-color_scheme--grays";
  1032. } else if (toolbarAction == "IDM_PALETTE_TRANSPARENT") {
  1033. return "tm1-toolbar-color_scheme-semi_trans";
  1034. } else if (toolbarAction == "IDM_PALETTE_EXCEL") {
  1035. return "tm1-toolbar-color_scheme-excel_like";
  1036. } else if (toolbarAction == "IDM_PALETTE_BEIGE") {
  1037. return "tm1-toolbar-color_scheme-light-beige";
  1038. } else if (toolbarAction == "IDM_PALETTE_BERRY") {
  1039. return "tm1-toolbar-color_scheme-berry";
  1040. } else if (toolbarAction == "IDM_PALETTE_CHOCOLATE") {
  1041. return "tm1-toolbar-color_scheme-chocolate";
  1042. } else if (toolbarAction == "IDM_PALETTE_FIRE") {
  1043. return "tm1-toolbar-color_scheme-fire";
  1044. } else if (toolbarAction == "IDM_PALETTE_GREEN") {
  1045. return "tm1-toolbar-color_scheme-green_blue";
  1046. } else if (toolbarAction == "IDM_SHOWLEGEND") {
  1047. return "tm1-toolbar-chart-legend";
  1048. } else if (toolbarAction == "IDM_3DVIEW") {
  1049. return "tm1-toolbar-chart-3D";
  1050. } else if (toolbarAction == "IDM_CHART_PROPERTIES") {
  1051. return "tm1-toolbar-chart-properties";
  1052. } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
  1053. if (this.tm1Toolbar.ToolbarInfo.UndoButton.IsEnabled) {
  1054. return "tm1-toolbar-sandbox-undo";
  1055. } else {
  1056. return "tm1-toolbar-sandbox-undo disabled-toolbutton";
  1057. }
  1058. } else if (toolbarAction == "IDM_RESET_DATA") {
  1059. if (this.tm1Toolbar.ToolbarInfo.ResetSandboxButton.IsEnabled) {
  1060. return "tm1-toolbar-sandbox-reset";
  1061. } else {
  1062. return "tm1-toolbar-sandbox-reset disabled-toolbutton";
  1063. }
  1064. } else if (toolbarAction == "IDM_SANDBOX") {
  1065. if (this.tm1Toolbar.ToolbarInfo.SandboxButton.IsEnabled) {
  1066. return "tm1-toolbar-sandbox-select";
  1067. } else {
  1068. return "tm1-toolbar-sandbox-select disabled-toolbutton";
  1069. }
  1070. } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
  1071. return "tm1-toolbar-sandbox-new";
  1072. } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
  1073. return "tm1-toolbar-sandbox-delete";
  1074. } else if (toolbarAction == "IDM_SANDBOX_REDO") {
  1075. if (this.tm1Toolbar.ToolbarInfo.RedoButton.IsEnabled) {
  1076. return "tm1-toolbar-sandbox-redo";
  1077. } else {
  1078. return "tm1-toolbar-sandbox-redo disabled-toolbutton";
  1079. }
  1080. } else if (toolbarAction == "IDM_SANDBOXITEMS") {
  1081. return null;
  1082. }
  1083. return "tm1-toolbar-empty";
  1084. },
  1085. onToolbarAction: function(evt) {
  1086. if (evt.payload == "IDM_RECALCULATE") {
  1087. if (this.tm1InternalToolbar == 1) {
  1088. this.recalcCubeViewer();
  1089. } else if (this.tm1Toolbar != null) {
  1090. this.tm1Toolbar.Recalc();
  1091. }
  1092. } else if (evt.payload == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
  1093. this.tm1Toolbar.ToggleRecalc();
  1094. } else if (evt.payload == "IDM_COMMIT") {
  1095. this.tm1Toolbar.CommitSandbox();
  1096. } else if (evt.payload == "IDM_SAVEVIEW") {
  1097. this.tm1Toolbar.SaveView();
  1098. } else if (evt.payload == "IDM_SAVEAS") {
  1099. this.tm1Toolbar.SaveAsView();
  1100. } else if (evt.payload == "IDM_SLICE_TO_EXCEL") {
  1101. this.tm1Toolbar.ExportSlice();
  1102. } else if (evt.payload == "IDM_SNAPSHOT_TO_EXCEL") {
  1103. this.tm1Toolbar.ExportSnapshot();
  1104. } else if (evt.payload == "IDM_EXPORT_TO_PDF") {
  1105. this.tm1Toolbar.ExportPrintToPDF();
  1106. } else if (evt.payload == "IDM_CREATE_SANDBOX") {
  1107. this.tm1Toolbar.CreateSandbox();
  1108. } else if (evt.payload == "IDM_DELETE_SANDBOX") {
  1109. this.tm1Toolbar.DeleteSandbox();
  1110. } else if (evt.payload == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
  1111. this.tm1Toolbar.SuppressZero(0);
  1112. } else if (evt.payload == "IDM_SUPPRESS_ZEROS_ROWS") {
  1113. this.tm1Toolbar.SuppressZero(1);
  1114. } else if (evt.payload == "IDM_SUPPRESS_ZEROS_COLUMNS") {
  1115. this.tm1Toolbar.SuppressZero(2);
  1116. } else if (evt.payload == "IDM_RESET") {
  1117. if (this.tm1InternalToolbar == 1) {
  1118. this.restartSession ();
  1119. } else if (this.tm1Toolbar != null) {
  1120. this.tm1Toolbar.ReloadView ();
  1121. }
  1122. } else if (evt.payload == "IDM_RESTART") {
  1123. document.cookie="ASP.NET_SessionId=;path=/";
  1124. this.refreshView();
  1125. } else if (evt.payload == "IDM_SAVEDATACHANGES") {
  1126. this.tm1Toolbar.SaveDataChanges();
  1127. } else if (evt.payload == "IDM_REVIEWDATACHANGES") {
  1128. this.tm1Toolbar.ReviewDataChanges();
  1129. } else if (evt.payload == "IDM_CHART") {
  1130. this.tm1Toolbar.ToggleViewChart(1);
  1131. } else if (evt.payload == "IDM_CHARTANDGRID") {
  1132. this.tm1Toolbar.ToggleViewChart(2);
  1133. } else if (evt.payload == "IDM_GRID") {
  1134. this.tm1Toolbar.ToggleViewChart(0);
  1135. } else if (evt.payload == "IDM_CHART_PROPERTIES") {
  1136. this.tm1Toolbar.SetToolbarChartProperties();
  1137. } else if (evt.payload == "IDM_3DVIEW") {
  1138. this.tm1Toolbar.ToggleToolbar3DChart();
  1139. } else if (evt.payload == "IDM_SHOWLEGEND") {
  1140. this.tm1Toolbar.ToggleToolbarChartLegend();
  1141. } else if (evt.payload == "IDM_CHART_POINT") {
  1142. this.tm1Toolbar.SetToolbarChartType(0);
  1143. } else if (evt.payload == "IDM_CHART_BUBBLE") {
  1144. this.tm1Toolbar.SetToolbarChartType(1);
  1145. } else if (evt.payload == "IDM_CHART_LINE") {
  1146. this.tm1Toolbar.SetToolbarChartType(2);
  1147. } else if (evt.payload == "IDM_CHART_SPLINE") {
  1148. this.tm1Toolbar.SetToolbarChartType(3);
  1149. } else if (evt.payload == "IDM_CHART_STEPLINE") {
  1150. this.tm1Toolbar.SetToolbarChartType(4);
  1151. } else if (evt.payload == "IDM_CHART_FASTLINE") {
  1152. this.tm1Toolbar.SetToolbarChartType(5);
  1153. } else if (evt.payload == "IDM_CHART_BAR") {
  1154. this.tm1Toolbar.SetToolbarChartType(6);
  1155. } else if (evt.payload == "IDM_CHART_STACKEDBAR") {
  1156. this.tm1Toolbar.SetToolbarChartType(7);
  1157. } else if (evt.payload == "IDM_CHART_STACKEDBAR100") {
  1158. this.tm1Toolbar.SetToolbarChartType(8);
  1159. } else if (evt.payload == "IDM_CHART_COLUMN") {
  1160. this.tm1Toolbar.SetToolbarChartType(9);
  1161. } else if (evt.payload == "IDM_CHART_STACKEDCOLUMN") {
  1162. this.tm1Toolbar.SetToolbarChartType(10);
  1163. } else if (evt.payload == "IDM_CHART_STACKEDCOLUMN100") {
  1164. this.tm1Toolbar.SetToolbarChartType(11);
  1165. } else if (evt.payload == "IDM_CHART_AREA") {
  1166. this.tm1Toolbar.SetToolbarChartType(12);
  1167. } else if (evt.payload == "IDM_CHART_SPLINEAREA") {
  1168. this.tm1Toolbar.SetToolbarChartType(13);
  1169. } else if (evt.payload == "IDM_CHART_STACKEDAREA") {
  1170. this.tm1Toolbar.SetToolbarChartType(14);
  1171. } else if (evt.payload == "IDM_CHART_STACKEDAREA100") {
  1172. this.tm1Toolbar.SetToolbarChartType(15);
  1173. } else if (evt.payload == "IDM_CHART_PIE") {
  1174. this.tm1Toolbar.SetToolbarChartType(16);
  1175. } else if (evt.payload == "IDM_CHART_DOUGHNUT") {
  1176. this.tm1Toolbar.SetToolbarChartType(17);
  1177. } else if (evt.payload == "IDM_CHART_STOCK") {
  1178. this.tm1Toolbar.SetToolbarChartType(18);
  1179. } else if (evt.payload == "IDM_CHART_CANDLESTICK") {
  1180. this.tm1Toolbar.SetToolbarChartType(19);
  1181. } else if (evt.payload == "IDM_CHART_RANGE") {
  1182. this.tm1Toolbar.SetToolbarChartType(20);
  1183. } else if (evt.payload == "IDM_CHART_SPLINERANGE") {
  1184. this.tm1Toolbar.SetToolbarChartType(21);
  1185. } else if (evt.payload == "IDM_CHART_GANTT") {
  1186. this.tm1Toolbar.SetToolbarChartType(22);
  1187. } else if (evt.payload == "IDM_CHART_RANGECOLUMN") {
  1188. this.tm1Toolbar.SetToolbarChartType(23);
  1189. } else if (evt.payload == "IDM_CHART_RADAR") {
  1190. this.tm1Toolbar.SetToolbarChartType(24);
  1191. } else if (evt.payload == "IDM_CHART_POLAR") {
  1192. this.tm1Toolbar.SetToolbarChartType(25);
  1193. } else if (evt.payload == "IDM_CHART_BOXPLOT") {
  1194. this.tm1Toolbar.SetToolbarChartType(26);
  1195. } else if (evt.payload == "IDM_CHART_FUNNEL") {
  1196. this.tm1Toolbar.SetToolbarChartType(27);
  1197. } else if (evt.payload == "IDM_CHART_PYRAMID") {
  1198. this.tm1Toolbar.SetToolbarChartType(28);
  1199. } else if (evt.payload == "IDM_PALETTE_DEFAULT") {
  1200. this.tm1Toolbar.SetToolbarChartColorPalette(1);
  1201. } else if (evt.payload == "IDM_PALETTE_STEEL") {
  1202. this.tm1Toolbar.SetToolbarChartColorPalette(2);
  1203. } else if (evt.payload == "IDM_PALETTE_EARTH") {
  1204. this.tm1Toolbar.SetToolbarChartColorPalette(3);
  1205. } else if (evt.payload == "IDM_PALETTE_GRAYS") {
  1206. this.tm1Toolbar.SetToolbarChartColorPalette(4);
  1207. } else if (evt.payload == "IDM_PALETTE_TRANSPARENT") {
  1208. this.tm1Toolbar.SetToolbarChartColorPalette(5);
  1209. } else if (evt.payload == "IDM_PALETTE_EXCEL") {
  1210. this.tm1Toolbar.SetToolbarChartColorPalette(6);
  1211. } else if (evt.payload == "IDM_PALETTE_BEIGE") {
  1212. this.tm1Toolbar.SetToolbarChartColorPalette(7);
  1213. } else if (evt.payload == "IDM_PALETTE_BERRY") {
  1214. this.tm1Toolbar.SetToolbarChartColorPalette(8);
  1215. } else if (evt.payload == "IDM_PALETTE_CHOCOLATE") {
  1216. this.tm1Toolbar.SetToolbarChartColorPalette(9);
  1217. } else if (evt.payload == "IDM_PALETTE_FIRE") {
  1218. this.tm1Toolbar.SetToolbarChartColorPalette(10);
  1219. } else if (evt.payload == "IDM_PALETTE_GREEN") {
  1220. this.tm1Toolbar.SetToolbarChartColorPalette(11);
  1221. } else if (evt.payload == "IDM_RESET_DATA") {
  1222. this.tm1Toolbar.ResetData();
  1223. } else if (evt.payload == "IDM_SANDBOX_UNDO") {
  1224. this.tm1Toolbar.Undo();
  1225. } else if (evt.payload == "IDM_SANDBOX_REDO") {
  1226. this.tm1Toolbar.Redo();
  1227. } else if (evt.payload.substring(0, 13) == "SANDBOXCHOICE") {
  1228. var sandBoxId = evt.payload.substring(13, evt.payload.length);
  1229. if (sandBoxId == 0) {
  1230. this.tm1Toolbar.SetActiveSandbox("[Base]");
  1231. } else {
  1232. this.tm1Toolbar.SetActiveSandbox(this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList[sandBoxId - 1]);
  1233. }
  1234. }
  1235. return;
  1236. },
  1237. handleTM1DimensionUpdate: function(iEvent) {
  1238. var filter = iEvent.payload;
  1239. this.dimensionChangeCubeViewer(filter);
  1240. return;
  1241. },
  1242. areTM1ParametersValid: function () {
  1243. var bParametersAreValid = true;
  1244. if (this.tm1ServerCubeView != "") {
  1245. var searchString = this.tm1ServerCubeView;
  1246. var separatorIndex = searchString.indexOf('$$');
  1247. this.tm1Server = searchString.substring(0, separatorIndex);
  1248. searchString = searchString.substring(separatorIndex + 2, searchString.length);
  1249. separatorIndex = searchString.indexOf('$$');
  1250. this.tm1Cube = searchString.substring(0, separatorIndex);
  1251. searchString = searchString.substring(separatorIndex + 2, searchString.length);
  1252. separatorIndex = searchString.indexOf('$$');
  1253. this.tm1CubeView = searchString;
  1254. }
  1255. if (this.tm1Cube == "") {
  1256. bParametersAreValid = false;
  1257. } else if (this.tm1Host == "") {
  1258. bParametersAreValid = false;
  1259. } else if (this.tm1Server == "") {
  1260. bParametersAreValid = false;
  1261. } else if (this.tm1CubeView == "") {
  1262. bParametersAreValid = false;
  1263. }
  1264. return bParametersAreValid == true;
  1265. },
  1266. onUnload: function(evt) { //5htp, seratonin
  1267. if (this.iframeCtrl != null) {
  1268. this.tm1Close();
  1269. this.iframeCtrl.destroy();
  1270. }
  1271. },
  1272. onWidgetSave: function(evt) {
  1273. this.iContext.iEvents.fireEvent("com.ibm.bux.widget.save.done", null, "");
  1274. if (this.tm1Toolbar != null) {
  1275. this.tm1Toolbar.SaveView();
  1276. }
  1277. },
  1278. onWidgetResize: function(evt) {
  1279. if(!this._firstVisible && this.iContext._mm.widget.widgetInstance.itemSets.buxdelayedload.widgetVisible.value == "false") {
  1280. setTimeout(dojo.hitch(this, this.onWidgetResize, evt), 10);
  1281. return;
  1282. }
  1283. if(!this.iframeCtrl) {
  1284. setTimeout(dojo.hitch(this, this.onWidgetResize, evt), 10);
  1285. return;
  1286. }
  1287. var resize = evt.payload.resize;
  1288. if (resize) {
  1289. if(resize.h < 0) {
  1290. return;
  1291. }
  1292. this.iframeCtrl.resize({
  1293. w: resize.w,
  1294. h: resize.h
  1295. });
  1296. }
  1297. if (this.iframeCtrl.resizeZone != null) {
  1298. this.tm1Height = resize.h;
  1299. this.saveTM1CubeViewerParams(this.iContext);
  1300. return;
  1301. }
  1302. },
  1303. onGetProperties : function (){
  1304. // this.getWidgetProperties();
  1305. },
  1306. getWidgetAttributes : function (){
  1307. this.tm1ServerCubeView = this.iContext.getiWidgetAttributes().getItemValue("tm1ServerCubeView");
  1308. this.tm1WebURL = this.iContext.getiWidgetAttributes().getItemValue("tm1WebURL");
  1309. this.tm1Host = this.iContext.getiWidgetAttributes().getItemValue("tm1Host");
  1310. this.tm1Server = this.iContext.getiWidgetAttributes().getItemValue("tm1Server");
  1311. this.tm1Cube = this.iContext.getiWidgetAttributes().getItemValue("tm1Cube");
  1312. this.tm1CubeView = this.iContext.getiWidgetAttributes().getItemValue("tm1CubeView");
  1313. this.tm1UserName = this.iContext.getiWidgetAttributes().getItemValue("tm1UserName");
  1314. this.tm1Password = this.iContext.getiWidgetAttributes().getItemValue("tm1Password");
  1315. this.tm1InternalToolbar = this.iContext.getiWidgetAttributes().getItemValue("TM1Toolbar");
  1316. this.tm1Height = this.iContext.getiWidgetAttributes().getItemValue("tHeight");
  1317. if (this.tm1Height == "") {
  1318. this.tm1Height = this.initialHeight;
  1319. }
  1320. },
  1321. _onCancelProperties: function() {
  1322. alert ("inOnGetProperties");
  1323. console.log ("in onGetProperties");
  1324. },
  1325. onSetProperties: function() {
  1326. alert ("inOnSetProperties2");
  1327. console.log ("in onSetProperties2");
  1328. },
  1329. onSetProperties: function(evt) {
  1330. if (evt.payload.properties) {
  1331. this.refreshView();
  1332. return;
  1333. }
  1334. },
  1335. saveTM1CubeViewerParams: function (inIContext) {
  1336. inIContext.getiWidgetAttributes().setItemValue("tm1Host", this.tm1Host);
  1337. inIContext.getiWidgetAttributes().setItemValue("tm1Server", this.tm1Server);
  1338. inIContext.getiWidgetAttributes().setItemValue("tm1Cube", this.tm1Cube);
  1339. inIContext.getiWidgetAttributes().setItemValue("tm1CubeView", this.tm1CubeView);
  1340. inIContext.getiWidgetAttributes().setItemValue("tHeight", this.tm1Height);
  1341. inIContext.getiWidgetAttributes().setItemValue("TM1Toolbar", this.tm1InternalToolbar);
  1342. return;
  1343. },
  1344. initializeiframe : function (url) {
  1345. this.iframeCtrl = new cubeViewerIFrame({
  1346. url: url,
  1347. iWidget: this
  1348. }, this.iContext.getElementById("_" + this.iContext.widgetId + "_" + "tm1CubeViewerWidgetDiv"));
  1349. this.iframeCtrl.startup(this.tm1Height);
  1350. // find out our working space
  1351. var chromeObjectId = bux.Helper.widgetIdToChromeId(this.iContext.widgetId);
  1352. var chromeObject = bux.Helper.getChromeById(chromeObjectId);
  1353. var currentSize = chromeObject.getClientBox();
  1354. this.iframeCtrl.resize(currentSize);
  1355. },
  1356. onWidgetRefresh: function(evt) // Invoked when User preferences get modified (Including locales)
  1357. {
  1358. if (this.tm1Toolbar != null) {
  1359. this.tm1Toolbar.Recalc();
  1360. }
  1361. return;
  1362. },
  1363. recalcCubeViewer : function () {
  1364. var url = this.iframeCtrl.getObjectIDURL();
  1365. var url2 = url.replace("TM1WebCubeViewer","TM1WebMain");
  1366. url2 += "&Action=Recalc";
  1367. this.iframeCtrl.setUrl(url2);
  1368. return;
  1369. },
  1370. restartSession : function () {
  1371. var url = this.iframeCtrl.getObjectIDURL();
  1372. var url2 = url.replace("TM1WebCubeViewer","TM1WebMain");
  1373. url2 += "&Action=Reload";
  1374. this.iframeCtrl.setUrl(url2);
  1375. return;
  1376. },
  1377. dimensionChangeCubeViewer : function (titleParams) {
  1378. var url = this.iframeCtrl.getObjectIDURL();
  1379. var url2 = url.replace("TM1WebCubeViewer","TM1WebMain");
  1380. url2 += "&";
  1381. url2 += titleParams;
  1382. this.iframeCtrl.setUrl(url2);
  1383. return;
  1384. },
  1385. tm1Close : function () {
  1386. if (!this.bTurnOffCallbacks) {
  1387. var url = this.iframeCtrl.getObjectIDURL();
  1388. if (url != null) {
  1389. var url2 = url.replace("TM1WebCubeViewer","TM1WebMain");
  1390. url2 += "&Action=Close";
  1391. this.iframeCtrl.setUrl(url2);
  1392. }
  1393. }
  1394. // remove callback functions to prevent memory leaks
  1395. if (COGNOS_TM1_cubeWgtToolbarFuncs != null) {
  1396. COGNOS_TM1_cubeWgtToolbarFuncs["_"+this.iContext.widgetId+"_"] = null;
  1397. delete COGNOS_TM1_cubeWgtToolbarFuncs["_"+this.iContext.widgetId+"_"];
  1398. }
  1399. if (COGNOS_TM1_cubeWgtFilterFuncs != null) {
  1400. COGNOS_TM1_cubeWgtFilterFuncs["_"+this.iContext.widgetId+"_"] = null;
  1401. delete COGNOS_TM1_cubeWgtFilterFuncs["_"+this.iContext.widgetId+"_"];
  1402. }
  1403. return;
  1404. },
  1405. determineCommonDomain: function () {
  1406. if (this.commonDomain == null) {
  1407. this.commonDomain = "";
  1408. var buxURL = document.URL;
  1409. var buxDomain = bux.Helper.extractDomain(buxURL);
  1410. var tm1WebDomain = bux.Helper.extractDomain(this.tm1WebURL);
  1411. if (buxDomain.toLowerCase() == tm1WebDomain.toLowerCase()) {
  1412. return;
  1413. } else {
  1414. this.bTurnOffCallbacks = true;
  1415. /*var buxColonIndex = buxDomain.indexOf(":");
  1416. if (buxColonIndex >= 0) {
  1417. buxDomain = buxDomain.substring(0, buxColonIndex);
  1418. }
  1419. var tm1WebColonIndex = tm1WebDomain.indexOf(":");
  1420. if (tm1WebColonIndex >= 0) {
  1421. tm1WebDomain = tm1WebDomain.substring(0, tm1WebColonIndex);
  1422. }
  1423. var buxDotIndex = buxDomain.indexOf(".");
  1424. var tm1WebDotIndex = tm1WebDomain.indexOf(".");
  1425. if (buxDotIndex >= 0 && tm1WebDotIndex >= 0) {
  1426. var buxDomainSuffix = buxDomain.substring(buxDotIndex + 1);
  1427. var tm1DomainSuffix = tm1WebDomain.substring(tm1WebDotIndex + 1);
  1428. if (buxDomainSuffix.toLowerCase() == tm1DomainSuffix.toLowerCase()) {
  1429. this.commonDomain = buxDomainSuffix;
  1430. return;
  1431. }
  1432. } */
  1433. }
  1434. }
  1435. return;
  1436. },
  1437. refreshView : function () {
  1438. // initialize javascript callback functions
  1439. // callback functions are stored in an array where the array index
  1440. // is the context widgetId
  1441. if (COGNOS_TM1_cubeWgtToolbarFuncs == null)
  1442. COGNOS_TM1_cubeWgtToolbarFuncs = new Array();
  1443. if (COGNOS_TM1_cubeWgtFilterFuncs == null)
  1444. COGNOS_TM1_cubeWgtFilterFuncs = new Array();
  1445. if (COGNOS_TM1_cubeWgtToolbarFuncs["_"+this.iContext.widgetId+"_"] == null) {
  1446. COGNOS_TM1_cubeWgtToolbarFuncs["_"+this.iContext.widgetId+"_"] = dojo.hitch(this, "createWidgetToolbar");
  1447. }
  1448. if (COGNOS_TM1_cubeWgtFilterFuncs["_"+this.iContext.widgetId+"_"] == null) {
  1449. COGNOS_TM1_cubeWgtFilterFuncs["_"+this.iContext.widgetId+"_"] = dojo.hitch(this, "fireFilterChanged");
  1450. }
  1451. var url = this.tm1WebURL;
  1452. url += "/TM1WebMain.aspx?action=OpenObject&type=Cubeviewer";
  1453. url += "&HideTabs=1&AdminHost=" + encodeURIComponent(this.tm1Host) + "&TM1server=" + encodeURIComponent(this.tm1Server) + "&value=" + encodeURIComponent(this.tm1Cube) + "$$" + encodeURIComponent(this.tm1CubeView);
  1454. this.determineCommonDomain();
  1455. if (this.bTurnOffCallbacks /*this.commonDomain != null && this.commonDomain.length > 0*/) {
  1456. this.tm1InternalToolbar = 1;
  1457. this.createBasicWidgetToolbar();
  1458. // document.domain = this.commonDomain;
  1459. // url += "&CommonDomain=";
  1460. // url += encodeURIComponent(this.commonDomain);
  1461. } else {
  1462. if (this.tm1InternalToolbar != 1) {
  1463. url += "&HideToolbar=1";
  1464. }
  1465. url += "&toolbarCallbackFunc=COGNOS_TM1_cubeWgtToolbarFuncs._"+encodeURIComponent(this.iContext.widgetId)+"_&TitleChangeCallback=COGNOS_TM1_cubeWgtFilterFuncs._"+encodeURIComponent(this.iContext.widgetId)+"_($dimName$, $subsetName$, $elemName$)";
  1466. }
  1467. if ((this.tm1UserName != null) && (this.tm1UserName != "")) {
  1468. url += "&username=";
  1469. url += encodeURIComponent(this.tm1UserName);
  1470. url += "&password=";
  1471. if ((this.tm1Password != null) && (this.tm1Password != "")) {
  1472. url += encodeURIComponent(this.tm1Password);
  1473. }
  1474. }
  1475. if (this.iframeCtrl == null) {
  1476. this.initializeiframe (url);
  1477. } else {
  1478. this.iframeCtrl.setUrl(url);
  1479. }
  1480. }
  1481. });
  1482. dojo.provide("cubeViewerIFrame");
  1483. dojo.declare("cubeViewerIFrame", dijit._Widget, {
  1484. url: null,
  1485. iWidget: null,
  1486. resizeZone: null,
  1487. iframe: null,
  1488. recalcURL: null,
  1489. constructor: function(params) {
  1490. //
  1491. },
  1492. getObjectIDURL: function () {
  1493. this.recalcURL = null;
  1494. if (this.iframe.contentDocument) {
  1495. if (this.iframe.contentDocument.URL == "about:blank") {
  1496. } else {
  1497. this.recalcURL = this.iframe.contentDocument.URL;
  1498. }
  1499. } else if (this.iframe.contentWindow) {
  1500. this.recalcURL = this.iframe.contentWindow.location.href;
  1501. }
  1502. return this.recalcURL;
  1503. },
  1504. setUrl: function(url) {
  1505. this.url = url;
  1506. if (this.iframe) {
  1507. this.iframe.src = url;
  1508. }
  1509. },
  1510. assignReturnURL: function () {
  1511. },
  1512. startup: function(inHght) {
  1513. var ref = this;
  1514. this.inherited(arguments);
  1515. this.resizeZone = this.domNode.ownerDocument.createElement("div");
  1516. this.domNode.appendChild(this.resizeZone);
  1517. var dn = (this.iframe = dojo.doc.createElement('iframe'));
  1518. var url = this.url;
  1519. var widgetParent = this.iWidget;
  1520. dn.id = this.id + "_iframe";
  1521. dn.style.border = "none";
  1522. dn.style.width = "100%";
  1523. dn.style.height = inHght + "px";
  1524. dn.frameBorder = 0;
  1525. dn.tabIndex = 0;
  1526. dn.setAttribute('src', url);
  1527. dn.setAttribute('scrolling', "no");
  1528. this.resizeZone.appendChild(dn);
  1529. if (dojo.isWebKit) { // Safari seems to always append iframe with src=about:blank
  1530. setTimeout(function() {
  1531. dn.setAttribute('src', url)
  1532. }, 0);
  1533. }
  1534. },
  1535. resize: function(size) {
  1536. dijit.layout._LayoutWidget.prototype.resize.apply(this, arguments);
  1537. },
  1538. layout: function() {
  1539. if (this.iframe.parentNode != null) {
  1540. if (this.iframe.clientHeight > 0) {
  1541. this.iframe.style.height = this.iframe.parentNode.parentNode.clientHeight + "px";
  1542. }
  1543. }
  1544. }
  1545. });