details: https://code.openbravo.com/erp/devel/pi/rev/1a8020d8f95f changeset: 28041:1a8020d8f95f user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Wed Nov 25 09:25:25 2015 +0100 summary: fixes issue 29025: prevents widget error in maximized view, after refreshing
After refreshing from the browser, the widget information was not being properly retrieved, causing javascript errors. Due to the lack of a infraestructure to retrieve the information for the widgets, they are not reopened after refreshing from the browser. Now tabs maximized with OBQueryListView and OBCalendarWidgetView are not recorded in the history (URL) this way they will not be reopened. diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-history-manager.js | 54 ++++++--- 1 files changed, 36 insertions(+), 18 deletions(-) diffs (84 lines): diff -r 995f3b601cd7 -r 1a8020d8f95f modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-history-manager.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-history-manager.js Tue Nov 24 16:26:17 2015 +0000 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-history-manager.js Wed Nov 25 09:25:25 2015 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2012 Openbravo SLU + * All portions are Copyright (C) 2010-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -58,7 +58,7 @@ updateHistory: function () { var state = {}, - stateStr, data, i, tabsLength, tab, tabObject; + stateStr, data, i, tabsLength, tab, tabObject, tabWidgetNumber, previousWidgetsInTab = 0; if (L.ViewManager.inStateHandling) { return; @@ -76,28 +76,46 @@ for (i = 0; i < tabsLength; i++) { tab = OB.MainView.TabSet.tabs[i]; - state.bm[i] = {}; + if (tab.viewName !== 'OBQueryListView' && tab.viewName !== 'OBCalendarWidgetView') { + state.bm[i] = {}; - // get the original tab object - tabObject = OB.MainView.TabSet.getTabObject(tab); + // get the original tab object + tabObject = OB.MainView.TabSet.getTabObject(tab); - state.bm[i] = { - viewId: tabObject.viewName - }; + state.bm[i] = { + viewId: tabObject.viewName + }; - // store the bookmark parameters - if (tabObject.pane && tabObject.pane.getBookMarkParams) { - state.bm[i].params = tabObject.pane.getBookMarkParams(); - if (!state.bm[i].params.tabTitle) { - state.bm[i].params.tabTitle = tabObject.title; + // store the bookmark parameters + if (tabObject.pane && tabObject.pane.getBookMarkParams) { + state.bm[i].params = tabObject.pane.getBookMarkParams(); + if (!state.bm[i].params.tabTitle) { + state.bm[i].params.tabTitle = tabObject.title; + } + } + + // let tabs store extra data + if (tabObject.pane && tabObject.pane.getState) { + data[i] = tabObject.pane.getState(); + } + } else { + // Not updating history in case of query-list and calendar widgets + // https://issues.openbravo.com/view.php?id=29025 + tabWidgetNumber = OB.MainView.TabSet.getTabNumber(tab); + if (tabWidgetNumber <= state.st) { + previousWidgetsInTab = previousWidgetsInTab + 1; } } + } - // let tabs store extra data - if (tabObject.pane && tabObject.pane.getState) { - data[i] = tabObject.pane.getState(); - } - } + // update the selected tab to be stored in the state + // this is because query-list and calendar widgets are not reopened after refreshing + state.st = state.st - previousWidgetsInTab; + + // remove possible undefined values from bm array + state.bm = state.bm.filter(function (elem) { + return elem !== undefined; + }); // now encode the state as a json string // which is used as a the id in the url ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits