diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index 9c5ef6561..e17d015f5 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -231,7 +231,7 @@ define([ return this; }, - show: function(panel) { + show: function(panel, opts) { if (this.isVisible() && panel===undefined || !this.mode) return; if ( !this.rendered ) @@ -241,7 +241,7 @@ define([ if (!panel) panel = this.active || defPanel; this.$el.show(); - this.selectMenu(panel, defPanel); + this.selectMenu(panel, opts, defPanel); this.api && this.api.asc_enableKeyEvents(false); @@ -364,7 +364,7 @@ define([ this.document = data.doc; }, - selectMenu: function(menu, defMenu) { + selectMenu: function(menu, opts, defMenu) { if ( menu ) { var item = this._getMenuItem(menu), panel = this.panels[menu]; @@ -377,7 +377,7 @@ define([ item.$el.addClass('active'); this.$el.find('.content-box:visible').hide(); - panel.show(); + panel.show(opts); this.active = menu; } diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index c7bd22e8e..7c17a1431 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -1252,6 +1252,7 @@ define([ this.menu = options.menu; this.urlPref = 'resources/help/en/'; + this.openUrl = null; this.en_data = [ {"src": "ProgramInterface/ProgramInterface.htm", "name": "Introducing Presentation Editor user interface", "headername": "Program Interface"}, @@ -1315,7 +1316,7 @@ define([ }); this.viewHelpPicker.on('item:select', function(dataview, itemview, record) { - me.iFrame.src = me.urlPref + record.get('src'); + me.onSelectItem(record.get('src')); }); this.iFrame = document.createElement('iframe'); @@ -1361,9 +1362,14 @@ define([ } }, success: function () { - var rec = store.at(0); - me.viewHelpPicker.selectRecord(rec); - me.iFrame.src = me.urlPref + rec.get('src'); + var rec = me.openUrl ? store.find(function(record){ + return (me.openUrl.indexOf(record.get('src'))>=0); + }) : store.at(0); + if (rec) { + me.viewHelpPicker.selectRecord(rec, true); + me.viewHelpPicker.scrollToRecord(rec); + } + me.onSelectItem(me.openUrl ? me.openUrl : rec.get('src')); } }; store.url = 'resources/help/' + lang + '/Contents.json'; @@ -1372,12 +1378,29 @@ define([ } }, - show: function () { + show: function (url) { Common.UI.BaseView.prototype.show.call(this); if (!this._scrollerInited) { this.viewHelpPicker.scroller.update(); this._scrollerInited = true; } + if (url) { + if (this.viewHelpPicker.store.length>0) { + var rec = this.viewHelpPicker.store.find(function(record){ + return (url.indexOf(record.get('src'))>=0); + }); + if (rec) { + this.viewHelpPicker.selectRecord(rec, true); + this.viewHelpPicker.scrollToRecord(rec); + } + this.onSelectItem(url); + } else + this.openUrl = url; + } + }, + + onSelectItem: function(src) { + this.iFrame.src = this.urlPref + src; } }); diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index b47ddeb81..72a5c7435 100644 --- a/apps/presentationeditor/main/app/view/LeftMenu.js +++ b/apps/presentationeditor/main/app/view/LeftMenu.js @@ -318,10 +318,10 @@ define([ this.btnPlugins.setDisabled(disable); }, - showMenu: function(menu) { + showMenu: function(menu, opts) { var re = /^(\w+):?(\w*)$/.exec(menu); if ( re[1] == 'file' ) { - this.menuFile.show(re[2].length ? re[2] : undefined); + this.menuFile.show(re[2].length ? re[2] : undefined, opts); } else { /** coauthoring begin **/ if (menu == 'chat') { diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index 698bc13f5..1e0173764 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -221,7 +221,7 @@ define([ return this; }, - show: function(panel) { + show: function(panel, opts) { if (this.isVisible() && panel===undefined || !this.mode) return; if ( !this.rendered ) @@ -231,7 +231,7 @@ define([ if (!panel) panel = this.active || defPanel; this.$el.show(); - this.selectMenu(panel, defPanel); + this.selectMenu(panel, opts, defPanel); this.api.asc_enableKeyEvents(false); @@ -352,7 +352,7 @@ define([ this.document = data.doc; }, - selectMenu: function(menu, defMenu) { + selectMenu: function(menu, opts, defMenu) { if ( menu ) { var item = this._getMenuItem(menu), panel = this.panels[menu]; @@ -365,7 +365,7 @@ define([ item.$el.addClass('active'); this.$el.find('.content-box:visible').hide(); - panel.show(); + panel.show(opts); this.active = menu; } diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 04a4ab069..64cc4df5b 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -2056,6 +2056,7 @@ define([ this.menu = options.menu; this.urlPref = 'resources/help/en/'; + this.openUrl = null; this.en_data = [ {"src": "ProgramInterface/ProgramInterface.htm", "name": "Introducing Spreadsheet Editor user interface", "headername": "Program Interface"}, @@ -2121,7 +2122,7 @@ define([ }); this.viewHelpPicker.on('item:select', function(dataview, itemview, record) { - me.iFrame.src = me.urlPref + record.get('src'); + me.onSelectItem(record.get('src')); }); this.iFrame = document.createElement('iframe'); @@ -2167,9 +2168,14 @@ define([ } }, success: function () { - var rec = store.at(0); - me.viewHelpPicker.selectRecord(rec); - me.iFrame.src = me.urlPref + rec.get('src'); + var rec = me.openUrl ? store.find(function(record){ + return (me.openUrl.indexOf(record.get('src'))>=0); + }) : store.at(0); + if (rec) { + me.viewHelpPicker.selectRecord(rec, true); + me.viewHelpPicker.scrollToRecord(rec); + } + me.onSelectItem(me.openUrl ? me.openUrl : rec.get('src')); } }; store.url = 'resources/help/' + lang + '/Contents.json'; @@ -2178,12 +2184,29 @@ define([ } }, - show: function () { + show: function (url) { Common.UI.BaseView.prototype.show.call(this); if (!this._scrollerInited) { this.viewHelpPicker.scroller.update(); this._scrollerInited = true; } + if (url) { + if (this.viewHelpPicker.store.length>0) { + var rec = this.viewHelpPicker.store.find(function(record){ + return (url.indexOf(record.get('src'))>=0); + }); + if (rec) { + this.viewHelpPicker.selectRecord(rec, true); + this.viewHelpPicker.scrollToRecord(rec); + } + this.onSelectItem(url); + } else + this.openUrl = url; + } + }, + + onSelectItem: function(src) { + this.iFrame.src = this.urlPref + src; } }); diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index 16778fbce..d3a37fbb5 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -307,10 +307,10 @@ define([ this.btnSpellcheck.setDisabled(false); }, - showMenu: function(menu) { + showMenu: function(menu, opts) { var re = /^(\w+):?(\w*)$/.exec(menu); if ( re[1] == 'file' ) { - this.menuFile.show(re[2].length ? re[2] : undefined); + this.menuFile.show(re[2].length ? re[2] : undefined, opts); } else { /** coauthoring begin **/ if (menu == 'chat') {