12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106 |
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *|
- *| BI and PM: BUX
- *|
- *| (C) Copyright IBM Corp. 2009
- *|
- *| US Government Users Restricted Rights - Use, duplication or
- *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- *|
- *+------------------------------------------------------------------------+
- */
- // create script variables used to store TM1 callbacks
- var COGNOS_TM1_webShtWgtToolbarFuncs;
- var COGNOS_TM1_webShtWgtFltrFuncs;
- dojo.require("dojo.string");
- dojo.require("dojo._base.array");
- dojo.require("bux.i18n");
- dojo.require("bux.Helper");
- dojo.require("bux.data.UserPreferencesStore");
- dojo.provide("tm1ContentWebSheetViewerWidget");
- dojo.declare("tm1ContentWebSheetViewerWidget", null, {
- iframeCtrl: null,
- _paramgizmo_id: null,
- returnURL: null,
- initialHeight: 286,
- xmlhttp: null,
- commonDomain: null,
- bTurnOffCallbacks: false,
- tm1Toolbar: null,
- _currentRole: null,
- // ====== DefaultSize Support - Start ========
- _defaultWidth:700,
- _defaultHeight:400,
- _firstRender:true,
- // ====== DefaultSize Support - End ========
- _productLocale:null,
- _tm1messages:null,
-
- onLoad: function(evt) {
- // ====== Multilingual Support - Start ========
- // Remember where we were loaded from: this is our path for future AJAX calls and .js loads
- dojo.registerModulePath("tm1ContentWebSheetViewerWidget",this.iContext.io.rewriteURI("js"));
- this.setLanguage().then(dojo.hitch(this, "continueOnLoad"));
- // ====== Multilingual Support - End ========
- },
-
- continueOnLoad: function() {
- this.getRole();
- this.createBasicWidgetToolbar();
- this.getWidgetAttributes();
- if (this.areTM1ParametersValid ()) {
- this.refreshView();
- }
- // ====== DefaultSize Support - Start ========
- //Delay the creation of some dynamic content to allow the widget to render first,
- //otherwise the dojo controlscannot properly render within its allowed real-estate.
- setTimeout(dojo.hitch(this,this.postLoadInit),1);
- // ====== DefaultSize Support - End ========
- },
-
- // ====== Multilingual Support - Start ========
- updateView: function() {
- this.setLanguage();
- },
-
- setLanguage: function() {
- // Setup Localization tables - Use the BUX preferences for locale. Use Product locale for loading strings
- var curProductLocale=bux.Helper.getUserPreference("productLocale");
- if (this._productLocale != curProductLocale)
- {
- this._productLocale = curProductLocale;
- var deferred = new dojo.Deferred();
- var self = this;
- dojo.requireLocalization("tm1ContentWebSheetViewerWidget","tm1ContentWebSheetViewerWidget_msg", curProductLocale);
- dojo.ready(function() {
- self._tm1messages = dojo.i18n.getLocalization("tm1ContentWebSheetViewerWidget", "tm1ContentWebSheetViewerWidget_msg", curProductLocale);
- deferred.resolve();
- });
-
- return deferred;
- }
- },
-
- // ====== Multilingual Support - End ========
- // ====== DefaultSize Support - Start ========
- postLoadInit: function()
- {
- // In this function, create the dynamic contents of the iWidget that are dojo objects based on dynamic HTML
-
- // call auto resize if it's the first time and is this widget was never saved.
- if (this._firstRender == true) {
- this._firstRender = false;
- var setDefaultSize = this.iContext.getiWidgetAttributes().getItemValue("setDefaultSize");
- if (setDefaultSize == "1") {
- // Next time the container dashboard loads, the default size must be ignored - as desired
- this.iContext.getiWidgetAttributes().setItemValue("setDefaultSize", "0");
- this.setPreferredSize();
- }
- }
- },
- getChrome: function() {
- var chromeObjectId = bux.Helper.widgetIdToChromeId(this.iContext.widgetId);
- var chromeObject = bux.Helper.getChromeById(chromeObjectId);
- return chromeObject;
- },
-
- setPreferredSize: function() {
- var chromeObject = this.getChrome();
- var newSize = {h: this._defaultHeight, w : this._defaultWidth};
- chromeObject.setPreferredSize(newSize);
- chromeObject.doChromeAutoResize();
- },
- // ====== DefaultSize Support - End ========
- getRole: function () {
- if( this.iContext ) {
- var userProfileItemSet = this.iContext.getItemSet("buxuserprofile", false);
- if( userProfileItemSet ){
- var role = userProfileItemSet.getItemValue("currentUserRole");
- if( role && bux.UserRole.isValidRole(role) ) {
- this._currentRole = role;
- }
- }
- }
- },
- createBasicWidgetToolbar: function () {
- if (this.bTurnOffCallbacks) {
- var toolbarItems =
- [
- {
- _root:
- [
- {separator: true },
- {name: "Restart", action: "IDM_RESTART", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESTART, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada"}
- ]
- }
- ];
- this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, toolbarItems);
- } else {
- var toolbarItems =
- [
- {
- _root:
- [
- {separator: true },
- {name: "Refresh", action: "IDM_RECALCULATE", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_REFRESH, showLabel: false, "iconClass": "bux-refresh-image"},
- {name: "Restart", action: "IDM_RESTART", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESTART, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada"}
- ]
- }
- ];
- this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, toolbarItems);
- }
- },
- createWidgetToolbar: function (inToolbar) {
- var temptoolbarItems;
- this.tm1Toolbar = inToolbar;
- var toolbarItems =
- [
- {
- _root:
- [
- {separator: true },
- {name: "Refresh", action: "IDM_RECALCULATE", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_REFRESH, showLabel: false, "iconClass": "bux-refresh-image"},
- {name: "Restart", action: "IDM_RESTART", label: this._tm1messages.MEN.TMX_MEN_BLUEDOT_RESTART, showLabel: false, "iconClass": "tutorial-toolbar-icon-canada"}
- ]
- }
- ];
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_COMMIT");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_SAVEDATACHANGES");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_REVIEWDATACHANGES");
- toolbarItems = this.addSeparator(toolbarItems);
- toolbarItems = this.addToolbuttonWithSubmenu (toolbarItems, "IDM_EXPORT");
- toolbarItems = this.addSeparator(toolbarItems);
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_RECALCULATE");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_REBUILDACTIVEFORMS");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_TOGGLE_AUTOMATICRECALCULATE");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_AUTO_FIT_COL");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_ZOOM_IN");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_ZOOM_OUT");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_ZOOM_NORMAL");
- toolbarItems = this.addSeparator(toolbarItems);
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_RESET_DATA");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_SANDBOX_UNDO");
- toolbarItems = this.addToolbutton(toolbarItems, "IDM_SANDBOX_REDO");
- toolbarItems = this.addSeparator(toolbarItems);
- toolbarItems = this.addToolbuttonWithSubmenu (toolbarItems, "IDM_SANDBOX");
- toolbarItems = this.addToolbuttonWithSubmenu (toolbarItems, "IDM_SANDBOXITEMS");
- this.iContext.iEvents.fireEvent("com.ibm.bux.widgetchrome.toolbar.init", null, toolbarItems);
- },
- addSeparator: function (toolbarItems) {
- var separator = { "separator": true };
- return toolbarItems.concat(separator);
- },
-
- addToolbutton: function (toolbarItems, toolbarAction) {
- if (this.isToolbuttonVisible(toolbarAction)) {
- return toolbarItems.concat(this.createSimpleToolbutton(toolbarAction));
- } else {
- return toolbarItems;
- }
- },
-
- addToolbuttonWithSubmenu: function (toolbarItems, toolbarAction) {
- if (this.isToolbuttonVisible(toolbarAction)) {
- return toolbarItems.concat(this.createToolbuttonWithSubmenu(toolbarAction));
- } else {
- return toolbarItems;
- }
- },
-
- createSimpleToolbutton: function (toolbarAction) {
- var toolbutton = {
- "name" : toolbarAction,
- "action" : toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction)
- }
- return toolbutton;
- },
- appendSandboxMenuChoice: function (menuItems, sandboxIndex, sandboxName, activeSandbox) {
- var toolbarAction = "SANDBOXCHOICE" + sandboxIndex;
- var toolbutton = {
- "name" : toolbarAction,
- "action" : toolbarAction,
- "label": sandboxName,
- "iconClass": (activeSandbox == sandboxName ? "tm1-menu-radioselection" : "tm1-menu-empty")
- }
- return menuItems.concat(toolbutton);
- },
- createToolbuttonWithSubmenu: function (toolbarAction) {
- var menuitems = null;
- if (toolbarAction == "IDM_EXPORT") {
- var menuItems = [];
- menuItems = this.addToolbutton(menuItems, "IDM_SLICE_TO_EXCEL");
- menuItems = this.addToolbutton(menuItems, "IDM_SNAPSHOT_TO_EXCEL");
- menuItems = this.addToolbutton(menuItems, "IDM_EXPORT_TO_PDF");
- var toolbutton = {
- "name" : toolbarAction,
- "action" : toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items" : menuItems
- }
- return toolbutton;
- } else if (toolbarAction == "IDM_SANDBOX") {
- var menuItems = [];
- menuItems = this.addToolbutton(menuItems, "IDM_CREATE_SANDBOX");
- menuItems = this.addToolbutton(menuItems, "IDM_DELETE_SANDBOX");
- var toolbutton = {
- "name" : toolbarAction,
- "action" : toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items" : menuItems
- }
- return toolbutton;
- } else if (toolbarAction == "IDM_SANDBOXITEMS") {
- var menuItems = [];
- menuItems = this.appendSandboxMenuChoice(menuItems, 0, "[Base]", this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox);
- if (this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList.length > 0) {
- for (i=0; i<this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList.length; i++) {
- menuItems = this.appendSandboxMenuChoice(menuItems, i+1, this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList[i], this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox);
- }
- }
- var toolbutton = {
- "name" : toolbarAction,
- "action" : toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items" : menuItems
- }
- return toolbutton;
- }
-
- var toolbutton = {
- "name" : toolbarAction,
- "action" : toolbarAction,
- "label": this.getToolbuttonTooltip(toolbarAction),
- "iconClass": this.getToolbuttonImage(toolbarAction),
- "disabled": this.isToolbuttonDisabled(toolbarAction),
- "items" : menuitems
- }
- return toolbutton;
- },
- getSandboxName: function(sandboxId) {
- if (sandboxId == 1) {
- return "[Base]";
- } else {
- return this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList[sandboxId - 1];
- }
- },
-
- getSandboxCheck: function (sandboxId) {
- if (this.getSandboxName(sandboxId) == this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox) {
- return "tm1-toolbar-apply";
- } else {
- return "tm1-toolbar-empty";
- }
- },
-
- getToolbuttonIsDisabled: function(toolbarAction) {
- if (toolbarAction == "IDM_CHART-SELECT") {
- if (this.tm1Toolbar.ToolbarInfo.DisplayMode == 0) {
- return true;
- } else {
- return false;
- }
- } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
- if (this.tm1Toolbar.ToolbarInfo.UndoButton.IsEnabled) {
- return true;
- } else {
- return false;
- }
- } else if (toolbarAction == "IDM_SANDBOX_REDO") {
- if (this.tm1Toolbar.ToolbarInfo.RedoButton.IsEnabled) {
- return true;
- } else {
- return false;
- }
- }
-
- return false;
- },
-
- isToolbuttonVisible: function(toolbarAction) {
- if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
- return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton != null && this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.IsAdded;
- } else if (toolbarAction == "IDM_COMMIT") {
- return this.tm1Toolbar.ToolbarInfo.CommitSandboxButton != null && this.tm1Toolbar.ToolbarInfo.CommitSandboxButton.IsAdded;
- } else if (toolbarAction == "IDM_SAVEVIEW") {
- return this.tm1Toolbar.ToolbarInfo.SaveViewButton != null && this.tm1Toolbar.ToolbarInfo.SaveViewButton.IsAdded;
- } else if (toolbarAction == "IDM_SAVEAS") {
- return this.tm1Toolbar.ToolbarInfo.SaveAsViewButton != null && this.tm1Toolbar.ToolbarInfo.SaveAsViewButton.IsAdded;
- } else if (toolbarAction == "IDM_EXPORT") {
- return this.tm1Toolbar.ToolbarInfo.ExportButton != null && this.tm1Toolbar.ToolbarInfo.ExportButton.IsAdded;
- } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
- return this.tm1Toolbar.ToolbarInfo.ExportButton != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSlice != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSlice.IsAdded;
- } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
- return this.tm1Toolbar.ToolbarInfo.ExportButton != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSnapshot != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSnapshot.IsAdded;
- } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
- return this.tm1Toolbar.ToolbarInfo.ExportButton != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemExportPDF != null && this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemExportPDF.IsAdded;
- } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
- return this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton != null && this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton.IsAdded;
- } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
- return this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton != null && this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton.IsAdded;
- } else if (toolbarAction == "IDM_RECALCULATE") {
- return this.tm1Toolbar.ToolbarInfo.RecalcButton != null && this.tm1Toolbar.ToolbarInfo.RecalcButton.IsAdded;
- } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
- return this.tm1Toolbar.ToolbarInfo.AutoRecalcButton != null && this.tm1Toolbar.ToolbarInfo.AutoRecalcButton.IsAdded;
- } else if (toolbarAction == "IDM_REBUILDACTIVEFORMS") {
- return this.tm1Toolbar.ToolbarInfo.RebuildActiveFormButton != null && this.tm1Toolbar.ToolbarInfo.RebuildActiveFormButton.IsAdded;
- } else if (toolbarAction == "IDM_AUTO_FIT_COL") {
- return this.tm1Toolbar.ToolbarInfo.AutoFitButton != null && this.tm1Toolbar.ToolbarInfo.AutoFitButton.IsAdded;
- } else if (toolbarAction == "IDM_ZOOM_IN") {
- return this.tm1Toolbar.ToolbarInfo.ZoomInButton != null && this.tm1Toolbar.ToolbarInfo.ZoomInButton.IsAdded;
- } else if (toolbarAction == "IDM_ZOOM_OUT") {
- return this.tm1Toolbar.ToolbarInfo.ZoomOutButton != null && this.tm1Toolbar.ToolbarInfo.ZoomOutButton.IsAdded;
- } else if (toolbarAction == "IDM_ZOOM_NORMAL") {
- return this.tm1Toolbar.ToolbarInfo.NormalViewButton != null && this.tm1Toolbar.ToolbarInfo.NormalViewButton.IsAdded;
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZeros) {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZerosOnRows) {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZerosOnColumns) {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_RESET_DATA") {
- return this.tm1Toolbar.ToolbarInfo.ResetSandboxButton != null && this.tm1Toolbar.ToolbarInfo.ResetSandboxButton.IsAdded;
- } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
- return this.tm1Toolbar.ToolbarInfo.UndoButton != null && this.tm1Toolbar.ToolbarInfo.UndoButton.IsAdded;
- } else if (toolbarAction == "IDM_SANDBOX_REDO") {
- return this.tm1Toolbar.ToolbarInfo.RedoButton != null && this.tm1Toolbar.ToolbarInfo.RedoButton.IsAdded;
- } else if (toolbarAction == "IDM_SANDBOX") {
- return this.tm1Toolbar.ToolbarInfo.SandboxButton != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.IsAdded;
- } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
- return this.tm1Toolbar.ToolbarInfo.SandboxButton != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemCreateSandbox != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemCreateSandbox.IsAdded;
- } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
- return this.tm1Toolbar.ToolbarInfo.SandboxButton != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemDeleteSandbox != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemDeleteSandbox.IsAdded;
- } else if (toolbarAction == "IDM_SANDBOXITEMS") {
- return this.tm1Toolbar.ToolbarInfo.SandboxButton != null && this.tm1Toolbar.ToolbarInfo.SandboxButton.IsAdded;
- }
-
- return "tm1-toolbar-empty";
-
- },
- isToolbuttonDisabled: function(toolbarAction) {
- if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
- return (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_COMMIT") {
- return (this.tm1Toolbar.ToolbarInfo.CommitSandboxButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_SAVEVIEW") {
- return (this.tm1Toolbar.ToolbarInfo.SaveViewButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_SAVEAS") {
- return (this.tm1Toolbar.ToolbarInfo.SaveAsViewButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_EXPORT") {
- return (this.tm1Toolbar.ToolbarInfo.ExportButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
- return (this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSlice.IsEnabled == false);
- } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
- return (this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSnapshot.IsEnabled == false);
- } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
- return (this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemExportPDF.IsEnabled == false);
- } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
- return (this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
- return (this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_RECALCULATE") {
- return (this.tm1Toolbar.ToolbarInfo.RecalcButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
- return (this.tm1Toolbar.ToolbarInfo.AutoRecalcButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_REBUILDACTIVEFORMS") {
- return (this.tm1Toolbar.ToolbarInfo.RebuildActiveFormButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_AUTO_FIT_COL") {
- return (this.tm1Toolbar.ToolbarInfo.AutoFitButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_ZOOM_IN") {
- return (this.tm1Toolbar.ToolbarInfo.ZoomInButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_ZOOM_OUT") {
- return (this.tm1Toolbar.ToolbarInfo.ZoomOutButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_ZOOM_NORMAL") {
- return (this.tm1Toolbar.ToolbarInfo.NormalViewButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZeros) {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZerosOnRows) {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZerosOnColumns) {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_CHART") {
- return (this.tm1Toolbar.ToolbarInfo.ViewChartButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_CHARTANDGRID") {
- return (this.tm1Toolbar.ToolbarInfo.ViewChartGridButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_GRID") {
- return (this.tm1Toolbar.ToolbarInfo.ViewGridButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_CHART-SELECT") {
- return (this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_RESET_DATA") {
- return (this.tm1Toolbar.ToolbarInfo.ResetSandboxButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
- return (this.tm1Toolbar.ToolbarInfo.UndoButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_SANDBOX_REDO") {
- return (this.tm1Toolbar.ToolbarInfo.RedoButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_SANDBOX") {
- return (this.tm1Toolbar.ToolbarInfo.SandboxButton.IsEnabled == false);
- } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
- return (this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemCreateSandbox.IsEnabled == false);
- } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
- return (this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemDeleteSandbox.IsEnabled == false);
- } else if (toolbarAction == "IDM_SANDBOXITEMS") {
- return (this.tm1Toolbar.ToolbarInfo.SandboxButton.IsEnabled == false);
- }
-
- return "tm1-toolbar-empty";
-
- },
-
- getToolbuttonTooltip: function(toolbarAction) {
- if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
- return this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.CurrentSuppressZerosStateTooltip;
- } else if (toolbarAction == "IDM_COMMIT") {
- return this.tm1Toolbar.ToolbarInfo.CommitSandboxButton.Tooltip;
- } else if (toolbarAction == "IDM_SAVEVIEW") {
- return this.tm1Toolbar.ToolbarInfo.SaveViewButton.Tooltip;
- } else if (toolbarAction == "IDM_SAVEAS") {
- return this.tm1Toolbar.ToolbarInfo.SaveAsViewButton.Tooltip;
- } else if (toolbarAction == "IDM_EXPORT") {
- return this.tm1Toolbar.ToolbarInfo.ExportButton.Tooltip;
- } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
- return this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSlice.Tooltip;
- } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
- return this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemSnapshot.Tooltip;
- } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
- return this.tm1Toolbar.ToolbarInfo.ExportButton.MenuItemExportPDF.Tooltip;
- } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
- return this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton.Tooltip;
- } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
- return this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton.Tooltip;
- } else if (toolbarAction == "IDM_RECALCULATE") {
- return this.tm1Toolbar.ToolbarInfo.RecalcButton.Tooltip;
- } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
- return this.tm1Toolbar.ToolbarInfo.AutoRecalcButton.Tooltip;
- } else if (toolbarAction == "IDM_REBUILDACTIVEFORMS") {
- return this.tm1Toolbar.ToolbarInfo.RebuildActiveFormButton.Tooltip;
- } else if (toolbarAction == "IDM_AUTO_FIT_COL") {
- return this.tm1Toolbar.ToolbarInfo.AutoFitButton.Tooltip;
- } else if (toolbarAction == "IDM_ZOOM_IN") {
- return this.tm1Toolbar.ToolbarInfo.ZoomInButton.Tooltip;
- } else if (toolbarAction == "IDM_ZOOM_OUT") {
- return this.tm1Toolbar.ToolbarInfo.ZoomOutButton.Tooltip;
- } else if (toolbarAction == "IDM_ZOOM_NORMAL") {
- return this.tm1Toolbar.ToolbarInfo.NormalViewButton.Tooltip;
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS_COLUMNS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZeros) {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_ROWS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZerosOnRows) {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_SUPPRESS_ZEROS_COLUMNS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressZerosButton.SuppressZerosOnColumns) {
- return "tm1-toolbar-apply";
- }
- } else if (toolbarAction == "IDM_CHART") {
- return this.tm1Toolbar.ToolbarInfo.ViewChartButton.Tooltip;
- } else if (toolbarAction == "IDM_CHARTANDGRID") {
- return this.tm1Toolbar.ToolbarInfo.ViewChartGridButton.Tooltip;
- } else if (toolbarAction == "IDM_GRID") {
- return this.tm1Toolbar.ToolbarInfo.ViewGridButton.Tooltip;
- } else if (toolbarAction == "IDM_CHART-SELECT") {
- return this.tm1Toolbar.ToolbarInfo.ChartPropertiesButton.Tooltip;
- } else if (toolbarAction == "IDM_SANDBOX") {
- return this.tm1Toolbar.ToolbarInfo.SandboxButton.Tooltip;
- } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
- return this.tm1Toolbar.ToolbarInfo.UndoButton.Tooltip;
- } else if (toolbarAction == "IDM_SANDBOX_REDO") {
- return this.tm1Toolbar.ToolbarInfo.RedoButton.Tooltip;
- } else if (toolbarAction == "IDM_RESET_DATA") {
- return this.tm1Toolbar.ToolbarInfo.ResetSandboxButton.Tooltip;
- } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
- return this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemCreateSandbox.Tooltip;
- } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
- return this.tm1Toolbar.ToolbarInfo.SandboxButton.MenuItemDeleteSandbox.Tooltip;
- } else if (toolbarAction == "IDM_SANDBOXITEMS") {
- if (this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox == null || this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox == "") {
- return this.tm1Toolbar.ToolbarInfo.SandboxButton.Tooltip;
- } else {
- return this.tm1Toolbar.ToolbarInfo.Sandbox.ActiveSandbox;
- }
- }
-
- return "tm1-toolbar-empty";
-
- },
-
- getToolbuttonImage: function(toolbarAction) {
- if (toolbarAction == "IDM_SUPPRESS_ZEROS") {
- if (this.tm1Toolbar.ToolbarInfo.SuppressInfo.SuppressSeros)
- return "tm1-toolbar-suppress-zeros-on-both";
- else if (this.tm1Toolbar.ToolbarInfo.SuppressInfo.SuppressZerosOnRows)
- return "tm1-toolbar-suppress-zeros-on-rows";
- else if (this.tm1Toolbar.ToolbarInfo.SuppressInfo.SuppressZerosOnColumns)
- return "tm1-toolbar-suppress-zeros-on-columns";
- else {
- return "tm1-toolbar-suppress-zeros";
- }
- } else if (toolbarAction == "IDM_COMMIT") {
- if (this.tm1Toolbar.ToolbarInfo.CommitSandboxButton.IsEnabled) {
- return "tm1-toolbar-apply";
- } else {
- return "tm1-toolbar-apply disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_EXPORT") {
- if (this.tm1Toolbar.ToolbarInfo.ExportButton.IsEnabled) {
- return "tm1-toolbar-export";
- } else {
- return "tm1-toolbar-export disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_SLICE_TO_EXCEL") {
- return "tm1-toolbar-slice-excel2";
- } else if (toolbarAction == "IDM_SNAPSHOT_TO_EXCEL") {
- return "tm1-toolbar-slice-snapshot";
- } else if (toolbarAction == "IDM_EXPORT_TO_PDF") {
- return "tm1-toolbar-slice-pdf";
- } else if (toolbarAction == "IDM_SAVEDATACHANGES") {
- if (this.tm1Toolbar.ToolbarInfo.SaveDataChangesButton.IsEnabled) {
- return "tm1-toolbar-save_data_changes";
- } else {
- return "tm1-toolbar-save_data_changes disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_REVIEWDATACHANGES") {
- if (this.tm1Toolbar.ToolbarInfo.ReviewDataChangesButton.IsEnabled) {
- return "tm1-toolbar-review_data_changes";
- } else {
- return "tm1-toolbar-review_data_changes disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_RECALCULATE") {
- if (this.tm1Toolbar.ToolbarInfo.RecalcButton.IsEnabled) {
- return "tm1-toolbar-recalculate";
- } else {
- return "tm1-toolbar-recalculate disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
- if (this.tm1Toolbar.ToolbarInfo.AutoRecalcButton.IsEnabled) {
- if (this.tm1Toolbar.ToolbarInfo.AutoRecalc) {
- return "tm1-toolbar-recalculation dijitToggleButtonChecked";
- } else {
- return "tm1-toolbar-recalculation";
- }
- } else {
- if (this.tm1Toolbar.ToolbarInfo.AutoRecalc) {
- return "tm1-toolbar-recalculation disabled-toolbutton dijitToggleButtonChecked";
- } else {
- return "tm1-toolbar-recalculation disabled-toolbutton";
- }
- }
- } else if (toolbarAction == "IDM_REBUILDACTIVEFORMS") {
- if (this.tm1Toolbar.ToolbarInfo.RecalcButton.IsEnabled) {
- return "tm1-toolbar-rebuild_active_forms";
- } else {
- return "tm1-toolbar-rebuild_active_forms disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_AUTO_FIT_COL") {
- if (this.tm1Toolbar.ToolbarInfo.AutoRecalcButton.IsEnabled) {
- return "tm1-toolbar-auto-fit-col";
- } else {
- return "tm1-toolbar-auto-fit-col disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_ZOOM_IN") {
- if (this.tm1Toolbar.ToolbarInfo.ZoomInButton.IsEnabled) {
- return "tm1-toolbar-zoom-in";
- } else {
- return "tm1-toolbar-zoom-in disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_ZOOM_OUT") {
- if (this.tm1Toolbar.ToolbarInfo.ZoomOutButton.IsEnabled) {
- return "tm1-toolbar-zoom-out";
- } else {
- return "tm1-toolbar-zoom-out disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_ZOOM_NORMAL") {
- if (this.tm1Toolbar.ToolbarInfo.NormalViewButton.IsEnabled) {
- return "tm1-toolbar-zoom-normal";
- } else {
- return "tm1-toolbar-zoom-normal disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_SANDBOX_UNDO") {
- if (this.tm1Toolbar.ToolbarInfo.UndoButton.IsEnabled) {
- return "tm1-toolbar-sandbox-undo";
- } else {
- return "tm1-toolbar-sandbox-undo disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_RESET_DATA") {
- if (this.tm1Toolbar.ToolbarInfo.ResetSandboxButton.IsEnabled) {
- return "tm1-toolbar-sandbox-reset";
- } else {
- return "tm1-toolbar-sandbox-reset disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_SANDBOX") {
- if (this.tm1Toolbar.ToolbarInfo.SandboxButton.IsEnabled) {
- return "tm1-toolbar-sandbox-select";
- } else {
- return "tm1-toolbar-sandbox-select disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_SANDBOX_REDO") {
- if (this.tm1Toolbar.ToolbarInfo.RedoButton.IsEnabled) {
- return "tm1-toolbar-sandbox-redo";
- } else {
- return "tm1-toolbar-sandbox-redo disabled-toolbutton";
- }
- } else if (toolbarAction == "IDM_CREATE_SANDBOX") {
- return "tm1-toolbar-sandbox-new";
- } else if (toolbarAction == "IDM_DELETE_SANDBOX") {
- return "tm1-toolbar-sandbox-delete";
- } else if (toolbarAction == "IDM_SANDBOXITEMS") {
- return null;
- }
-
- return "tm1-toolbar-empty";
-
- },
-
- onToolbarAction: function(evt)
- {
- var toolbarAction = evt.payload;
- if (toolbarAction == "IDM_RECALCULATE") {
- if (this.tm1InternalToolbar == 1) {
- this.recalcCubeViewer();
- } else {
- this.tm1Toolbar.Recalc();
- }
- } else if (toolbarAction == "IDM_TOGGLE_AUTOMATICRECALCULATE") {
- this.tm1Toolbar.ToggleRecalc();
- } else if (toolbarAction == "IDM_REBUILDACTIVEFORMS") {
- this.tm1Toolbar.RebuildActiveForm();
- } else if (toolbarAction == "IDM_AUTO_FIT_COL") {
- this.tm1Toolbar.AutoFitToggle();
- } else if (evt.payload == "IDM_ZOOM_IN") {
- this.tm1Toolbar.WebSheetZoomIn();
- } else if (evt.payload == "IDM_ZOOM_OUT") {
- this.tm1Toolbar.WebSheetZoomOut();
- } else if (evt.payload == "IDM_ZOOM_NORMAL") {
- this.tm1Toolbar.WebSheetZoomNormal();
- } else if (evt.payload == "IDM_RESTART") {
- document.cookie="ASP.NET_SessionId=;path=/";
- this.refreshView();
- } else if (evt.payload == "IDM_SLICE_TO_EXCEL") {
- this.tm1Toolbar.ExportSlice();
- } else if (evt.payload == "IDM_SNAPSHOT_TO_EXCEL") {
- this.tm1Toolbar.ExportSnapshot();
- } else if (evt.payload == "IDM_EXPORT_TO_PDF") {
- this.tm1Toolbar.ExportPrintToPDF();
- } else if (evt.payload == "IDM_COMMIT") {
- this.tm1Toolbar.CommitSandbox();
- } else if (evt.payload == "IDM_CREATE_SANDBOX") {
- this.tm1Toolbar.CreateSandbox();
- } else if (evt.payload == "IDM_DELETE_SANDBOX") {
- this.tm1Toolbar.DeleteSandbox();
- } else if (evt.payload == "IDM_SAVEDATACHANGES") {
- this.tm1Toolbar.SaveDataChanges();
- } else if (evt.payload == "IDM_REVIEWDATACHANGES") {
- this.tm1Toolbar.ReviewDataChanges(evt);
- } else if (evt.payload == "IDM_RESET_DATA") {
- this.tm1Toolbar.ResetData();
- } else if (evt.payload == "IDM_SANDBOX_UNDO") {
- this.tm1Toolbar.Undo();
- } else if (evt.payload == "IDM_SANDBOX_REDO") {
- this.tm1Toolbar.Redo();
- } else if (evt.payload.substring(0, 13) == "SANDBOXCHOICE") {
- var sandBoxId = evt.payload.substring(13, evt.payload.length);
- if (sandBoxId == 0) {
- this.tm1Toolbar.SetActiveSandbox("[Base]");
- } else {
- this.tm1Toolbar.SetActiveSandbox(this.tm1Toolbar.ToolbarInfo.Sandbox.SandboxList[sandBoxId - 1]);
- }
- }
- return;
- },
- handleTM1DimensionUpdate: function(iEvent) {
- var filter = iEvent.payload;
- this.dimensionChangeWebsheet(filter);
- return;
- },
- dimensionChangeWebsheet : function (titleParams) {
- var url = this.iframeCtrl.getObjectIDURL();
- var url2 = url.replace("TM1WebSheet","TM1WebMain");
- url2 += "&";
- url2 += titleParams;
- this.iframeCtrl.setUrl(url2);
- return;
- },
-
- areTM1ParametersValid: function () {
- var bParametersAreValid = true;
- if (this.tm1Host == "") {
- bParametersAreValid = false;
- } else if (this.tm1Server == "") {
- bParametersAreValid = false;
- } else if (this.tm1CubeView == "") {
- bParametersAreValid = false;
- }
- return bParametersAreValid == true;
- },
- onUnload: function(evt) {
- if (this.iframeCtrl != null) {
- this.tm1Close();
- this.iframeCtrl.destroy();
- this.iframeCtrl = null;
- }
- },
- onSetVisible: function(evt) {
- if (evt.payload.isVisible) {
- if (this.tm1InternalToolbar == 1) {
- this.recalcCubeViewer();
- } else if (this.tm1Toolbar != null) {
- this.tm1Toolbar.Recalc();
- }
- }
- return;
- },
- onWidgetSave: function(evt) {
- this.iContext.iEvents.fireEvent("com.ibm.bux.widget.save.done", null, "");
- },
- onWidgetResize: function(evt) {
- var resize = evt.payload.resize;
- if (resize) {
- this.iframeCtrl.resize({
- w: resize.w,
- h: resize.h
- });
- }
- if (this.iframeCtrl.resizeZone != null) {
- if (resize.h > 0) {
- this.tm1Height = resize.h;
- this.saveTM1CubeViewerParams(this.iContext);
- }
- return;
- }
- },
- getWidgetAttributes : function (){
- this.tm1WebURL = this.iContext.getiWidgetAttributes().getItemValue("tm1WebURL");
- this.tm1Host = this.iContext.getiWidgetAttributes().getItemValue("tm1Host");
- this.tm1Server = this.iContext.getiWidgetAttributes().getItemValue("tm1Server");
- this.tm1CubeView = decodeURIComponent(this.iContext.getiWidgetAttributes().getItemValue("tm1CubeView"));
- this.tm1UserName = this.iContext.getiWidgetAttributes().getItemValue("tm1UserName");
- this.tm1Password = this.iContext.getiWidgetAttributes().getItemValue("tm1Password");
- this.tm1InternalToolbar = this.iContext.getiWidgetAttributes().getItemValue("TM1Toolbar");
- this.tm1Height = this.iContext.getiWidgetAttributes().getItemValue("tHeight");
- if (this.tm1Height == "") {
- this.tm1Height = this.initialHeight;
- }
- },
- saveTM1CubeViewerParams: function (inIContext) {
- inIContext.getiWidgetAttributes().setItemValue("tm1Host", this.tm1Host);
- inIContext.getiWidgetAttributes().setItemValue("tm1Server", this.tm1Server);
- inIContext.getiWidgetAttributes().setItemValue("tm1CubeView", encodeURIComponent(this.tm1CubeView));
- inIContext.getiWidgetAttributes().setItemValue("tHeight", this.tm1Height);
- inIContext.getiWidgetAttributes().setItemValue("tm1UserName", this.tm1UserName);
- inIContext.getiWidgetAttributes().setItemValue("tm1Password", this.tm1Password);
- inIContext.getiWidgetAttributes().setItemValue("TM1Toolbar", this.tm1InternalToolbar);
- return;
- },
-
- initializeiframe : function (url) {
- this.iframeCtrl = new webSheetViewerIFrame({
- url: url,
- iWidget: this
- }, this.iContext.getElementById("_" + this.iContext.widgetId + "_" + "tm1CubeViewerWidgetDiv"));
- if (this.tm1Height <= 0) {
- this.tm1Height = 402;
- }
- this.iframeCtrl.startup(this.tm1Height);
- // find out our working space
- var chromeObjectId = bux.Helper.widgetIdToChromeId(this.iContext.widgetId);
- var chromeObject = bux.Helper.getChromeById(chromeObjectId);
- var currentSize = chromeObject.getClientBox();
- this.iframeCtrl.resize(currentSize);
- },
- onWidgetRefresh: function(evt) // Invoked when User preferences get modified (Including locales)
- {
- this.recalcCubeViewer();
- return;
- },
-
- recalcCubeViewer : function () {
- var url = this.iframeCtrl.getObjectIDURL();
- var url2 = url.replace("TM1WebCubeViewer","TM1WebMain");
- url2 += "&Action=Recalc";
- this.iframeCtrl.setUrl(url2);
- return;
- },
-
- restartSession : function () {
- var url = this.iframeCtrl.getObjectIDURL();
- var url2 = url.replace("TM1WebCubeViewer","TM1WebMain");
- url2 += "&Action=Reload";
- this.iframeCtrl.setUrl(url2);
- return;
- },
-
- tm1Close : function () {
- if (!this.bTurnOffCallbacks) {
- var url = this.iframeCtrl.getObjectIDURL();
- var url2 = url.replace("TM1WebCubeViewer","TM1WebMain");
- url2 += "&Action=Close";
- this.iframeCtrl.setUrl(url2);
- }
- // remove callback functions to prevent memory leaks
- if (COGNOS_TM1_webShtWgtToolbarFuncs != null) {
- COGNOS_TM1_webShtWgtToolbarFuncs["_"+this.iContext.widgetId+"_"] = null;
- delete COGNOS_TM1_webShtWgtToolbarFuncs["_"+this.iContext.widgetId+"_"];
- }
-
- if (COGNOS_TM1_webShtWgtFltrFuncs != null) {
- COGNOS_TM1_webShtWgtFltrFuncs["_"+this.iContext.widgetId+"_"] = null;
- delete COGNOS_TM1_webShtWgtFltrFuncs["_"+this.iContext.widgetId+"_"];
- }
- return;
- },
- fireFilterChanged : function (dimName, subsetName, elemName) {
- // alert ("in webjsfunction");
- var extraParams = "title_";
- extraParams += dimName;
- extraParams += "=";
- extraParams += encodeURIComponent(elemName);
- this.iContext.iEvents.fireEvent("Context filter change", null, extraParams);
- return;
- },
-
- refreshDataAction : function () {
- var url = this.tm1WebURL;
- url += "/TM1WebMain.aspx?action=OpenObject&type=Cubeviewer&HideToolbar=0&HideTabs=1&TitleChangeCallback=JSFunction($dimName$, $subsetName$, $elemName$)&AdminHost=" + this.tm1Host + "&TM1server=" + this.tm1Server + "&value=" + this.tm1Cube + "$$" + this.tm1CubeView;
- if ((this.tm1UserName != null) && (this.tm1UserName != "")) {
- url += "&username=";
- url += this.tm1UserName;
- url += "&password=";
- url += this.tm1Password;
- }
- var xmlhttp;
- xmlhttp=new XMLHttpRequest();
- var _endRefreshDataAction = function () {
- xmlhttp.setRequestHeader ("Cookie", "");
- xmlhttp.setRequestHeader ("Cookie", "");
- xmlhttp.send(null);
- };
-
- if (xmlhttp!=null)
- {
- xmlhttp.open("GET",url,true);
- //setTimeout((function(obj){obj.xmlhttp.setRequestHeader ("Cookie", "");
- //obj.xmlhttp.setRequestHeader ("Cookie", "");
- //obj.xmlhttp.send(null);})(this),15000);
- setTimeout (_endRefreshDataAction, 15000);
- }
- return;
- },
- determineCommonDomain: function () {
- if (this.commonDomain == null) {
- this.commonDomain = "";
- var buxURL = document.URL;
- var buxDomain = bux.Helper.extractDomain(buxURL);
- var tm1WebDomain = bux.Helper.extractDomain(this.tm1WebURL);
- if (buxDomain.toLowerCase() == tm1WebDomain.toLowerCase()) {
- return;
- } else {
- this.bTurnOffCallbacks = true;
- /* var buxColonIndex = buxDomain.indexOf(":");
- if (buxColonIndex >= 0) {
- buxDomain = buxDomain.substring(0, buxColonIndex);
- }
- var tm1WebColonIndex = tm1WebDomain.indexOf(":");
- if (tm1WebColonIndex >= 0) {
- tm1WebDomain = tm1WebDomain.substring(0, tm1WebColonIndex);
- }
- var buxDotIndex = buxDomain.indexOf(".");
- var tm1WebDotIndex = tm1WebDomain.indexOf(".");
- if (buxDotIndex >= 0 && tm1WebDotIndex >= 0) {
- var buxDomainSuffix = buxDomain.substring(buxDotIndex + 1);
- var tm1DomainSuffix = tm1WebDomain.substring(tm1WebDotIndex + 1);
-
- if (buxDomainSuffix.toLowerCase() == tm1DomainSuffix.toLowerCase()) {
- this.commonDomain = buxDomainSuffix;
- return;
- }
- } */
- }
- }
- return;
- },
- refreshView : function () {
- // initialize javascript callback functions
- // callback functions are stored in an array where the array index
- // is the context widgetId
- if (COGNOS_TM1_webShtWgtToolbarFuncs == null)
- COGNOS_TM1_webShtWgtToolbarFuncs = new Array();
- if (COGNOS_TM1_webShtWgtFltrFuncs == null)
- COGNOS_TM1_webShtWgtFltrFuncs = new Array();
- if (COGNOS_TM1_webShtWgtToolbarFuncs["_"+this.iContext.widgetId+"_"] == null) {
- COGNOS_TM1_webShtWgtToolbarFuncs["_"+this.iContext.widgetId+"_"] = dojo.hitch(this, "createWidgetToolbar");
- }
-
- if (COGNOS_TM1_webShtWgtFltrFuncs["_"+this.iContext.widgetId+"_"] == null) {
- COGNOS_TM1_webShtWgtFltrFuncs["_"+this.iContext.widgetId+"_"] = dojo.hitch(this, "fireFilterChanged");
- }
- var url = this.tm1WebURL;
- url += "/TM1WebMain.aspx?action=OpenObject&type=Websheet&HideTabs=1&AdminHost=" + encodeURIComponent(this.tm1Host) + "&TM1server=" + encodeURIComponent(this.tm1Server) + "&value=" + encodeURIComponent(this.tm1CubeView);
- this.determineCommonDomain();
- if (this.bTurnOffCallbacks /* this.commonDomain != null && this.commonDomain.length > 0 */) {
- this.tm1InternalToolbar = 1;
- this.createBasicWidgetToolbar();
- // document.domain = this.commonDomain;
- // url += "&CommonDomain=";
- // url += encodeURIComponent(this.commonDomain);
- } else {
- if (this.tm1InternalToolbar == 1) {
- url += "&HideToolbar=0";
- } else {
- url += "&HideToolbar=1";
- }
- url += "&toolbarCallbackFunc=COGNOS_TM1_webShtWgtToolbarFuncs._"+encodeURIComponent(this.iContext.widgetId)+"_&TitleChangeCallback=COGNOS_TM1_webShtWgtFltrFuncs._"+encodeURIComponent(this.iContext.widgetId)+"_($dimName$, $subsetName$, $elemName$)";
- }
- if ((this.tm1UserName != null) && (this.tm1UserName != "")) {
- url += "&username=";
- url += encodeURIComponent(this.tm1UserName);
- url += "&password=";
- if ((this.tm1Password != null) && (this.tm1Password != "")) {
- url += encodeURIComponent(this.tm1Password);
- }
- }
- if (this.iframeCtrl == null) {
- this.initializeiframe (url);
- } else {
- this.iframeCtrl.setUrl(url);
- }
- }
-
-
- });
- dojo.provide("webSheetViewerIFrame");
- dojo.declare("webSheetViewerIFrame", dijit._Widget, {
- url: null,
- iWidget: null,
- resizeZone: null,
- iframe: null,
- recalcURL: null,
- constructor: function(params) {
- },
- getObjectIDURL: function () {
- this.recalcURL = null;
- if (this.iframe.contentDocument) {
- if (this.iframe.contentDocument.URL == "about:blank") {
- } else {
- this.recalcURL = this.iframe.contentDocument.URL;
- }
- } else if (this.iframe.contentWindow) {
- this.recalcURL = this.iframe.contentWindow.location.href;
- }
- return this.recalcURL;
- },
- setUrl: function(url) {
- this.url = url;
- if (this.iframe) {
- this.iframe.src = url;
- }
- },
- assignReturnURL: function () {
- },
- startup: function(inHght) {
- var ref = this;
- this.inherited(arguments);
- this.resizeZone = this.domNode.ownerDocument.createElement("div");
- this.domNode.appendChild(this.resizeZone);
- var dn = (this.iframe = dojo.doc.createElement('iframe'));
- var url = this.url;
- var widgetParent = this.iWidget;
- dn.id = this.id + "_iframe";
- dn.style.border = "none";
- dn.style.width = "100%";
- dn.style.height = inHght + "px";
- dn.frameBorder = 0;
- dn.tabIndex = 0;
- dn.setAttribute('src', url);
- dn.setAttribute('scrolling', "no");
- this.resizeZone.appendChild(dn);
- if (dojo.isWebKit) { // Safari seems to always append iframe with src=about:blank
- setTimeout(function() {
- dn.setAttribute('src', url)
- }, 0);
- }
- },
- resize: function(size) {
- dijit.layout._LayoutWidget.prototype.resize.apply(this, arguments);
- },
- layout: function() {
- if (this.iframe.parentNode != null) {
- if (this.iframe.clientHeight > 0) {
- this.iframe.style.height = this.iframe.parentNode.parentNode.clientHeight + "px";
- }
- }
- }
- });
|