From 7e1f1ebc5b4d758c1596223423a321b2650044be Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 5 Oct 2016 17:08:53 +0300 Subject: [PATCH 01/29] [DE] Check build versions for editor and revisions in versions history. --- .../main/app/controller/Main.js | 63 ++++++++++--------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index ce7988140..48363b3b7 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -421,39 +421,41 @@ define([ var changes = version.changes, change, i; if (changes && changes.length>0) { - arrVersions[arrVersions.length-1].set('changeid', changes.length-1); arrVersions[arrVersions.length-1].set('docIdPrev', docIdPrev); - arrVersions[arrVersions.length-1].set('hasChanges', changes.length>1); - for (i=changes.length-2; i>=0; i--) { - change = changes[i]; + if (version.buildVersion && version.buildVersion == this.appOptions.buildVersion) { + arrVersions[arrVersions.length-1].set('changeid', changes.length-1); + arrVersions[arrVersions.length-1].set('hasChanges', changes.length>1); + for (i=changes.length-2; i>=0; i--) { + change = changes[i]; - user = usersStore.findUser(change.user.id); - if (!user) { - user = new Common.Models.User({ - id : change.user.id, - username : change.user.name, - colorval : Asc.c_oAscArrUserColors[usersCnt], - color : this.generateUserColor(Asc.c_oAscArrUserColors[usersCnt++]) - }); - usersStore.add(user); + user = usersStore.findUser(change.user.id); + if (!user) { + user = new Common.Models.User({ + id : change.user.id, + username : change.user.name, + colorval : Asc.c_oAscArrUserColors[usersCnt], + color : this.generateUserColor(Asc.c_oAscArrUserColors[usersCnt++]) + }); + usersStore.add(user); + } + + arrVersions.push(new Common.Models.HistoryVersion({ + version: version.versionGroup, + revision: version.version, + changeid: i, + userid : change.user.id, + username : change.user.name, + usercolor: user.get('color'), + created: change.created, + docId: version.key, + docIdPrev: docIdPrev, + selected: false, + canRestore: this.appOptions.canHistoryRestore, + isRevision: false, + isVisible: true + })); + arrColors.push(user.get('colorval')); } - - arrVersions.push(new Common.Models.HistoryVersion({ - version: version.versionGroup, - revision: version.version, - changeid: i, - userid : change.user.id, - username : change.user.name, - usercolor: user.get('color'), - created: change.created, - docId: version.key, - docIdPrev: docIdPrev, - selected: false, - canRestore: this.appOptions.canHistoryRestore, - isRevision: false, - isVisible: true - })); - arrColors.push(user.get('colorval')); } } else if (ver==0 && versions.length==1) { arrVersions[arrVersions.length-1].set('docId', version.key + '1'); @@ -972,6 +974,7 @@ define([ this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit; this.appOptions.canPrint = (this.permissions.print !== false); this.appOptions.canRename = !!this.permissions.rename; + this.appOptions.buildVersion = params.asc_getBuildVersion(); var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType); this.appOptions.canDownloadOrigin = !this.appOptions.nativeApp && this.permissions.download !== false && (type && typeof type[1] === 'string'); From 65afc4894ceab87cbe33d2a089227c6b70794459 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 7 Oct 2016 16:31:11 +0300 Subject: [PATCH 02/29] [PE] Delay rendering controls in Chart Settings on the right panel. --- .../main/app/view/ChartSettings.js | 293 +++++++++--------- 1 file changed, 150 insertions(+), 143 deletions(-) diff --git a/apps/presentationeditor/main/app/view/ChartSettings.js b/apps/presentationeditor/main/app/view/ChartSettings.js index 9a8df02d2..5a3a49866 100644 --- a/apps/presentationeditor/main/app/view/ChartSettings.js +++ b/apps/presentationeditor/main/app/view/ChartSettings.js @@ -62,7 +62,6 @@ define([ }, initialize: function () { - var me = this; this._initSettings = true; this._state = { @@ -83,148 +82,6 @@ define([ this._originalProps = null; this.render(); - - this.btnChartType = new Common.UI.Button({ - cls : 'btn-large-dataview', - iconCls : 'item-chartlist bar-normal', - menu : new Common.UI.Menu({ - style: 'width: 560px;', - items: [ - { template: _.template('') } - ] - }) - }); - this.btnChartType.on('render:after', function(btn) { - me.mnuChartTypePicker = new Common.UI.DataView({ - el: $('#id-chart-menu-type'), - parentMenu: btn.menu, - restoreHeight: 411, - groups: new Common.UI.DataViewGroupStore([ - { id: 'menu-chart-group-bar', caption: me.textColumn }, - { id: 'menu-chart-group-line', caption: me.textLine }, - { id: 'menu-chart-group-pie', caption: me.textPie }, - { id: 'menu-chart-group-hbar', caption: me.textBar }, - { id: 'menu-chart-group-area', caption: me.textArea }, - { id: 'menu-chart-group-scatter', caption: me.textPoint }, - { id: 'menu-chart-group-stock', caption: me.textStock } - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal', selected: true}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} - ]), - itemTemplate: _.template('
') - }); - }); - this.btnChartType.render($('#chart-button-type')); - this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType)); - this.lockedControls.push(this.btnChartType); - - this.btnChartStyle = new Common.UI.Button({ - cls : 'btn-large-dataview', - iconCls : 'item-wrap', - menu : new Common.UI.Menu({ - menuAlign: 'tr-br', - items: [ - { template: _.template('
') } - ] - }) - }); - this.btnChartStyle.on('render:after', function(btn) { - me.mnuChartStylePicker = new Common.UI.DataView({ - el: $('#id-chart-menu-style'), - style: 'max-height: 411px;', - parentMenu: btn.menu, - store: new Common.UI.DataViewStore(), - itemTemplate: _.template('
') - }); - - if (me.btnChartStyle.menu) { - me.btnChartStyle.menu.on('show:after', function () { - me.mnuChartStylePicker.scroller.update({alwaysVisibleY: true}); - }); - } - }); - this.btnChartStyle.render($('#chart-button-style')); - this.mnuChartStylePicker.on('item:click', _.bind(this.onSelectStyle, this, this.btnChartStyle)); - this.lockedControls.push(this.btnChartStyle); - - this.btnEditData = new Common.UI.Button({ - el: $('#chart-button-edit-data') - }); - this.btnEditData.on('click', _.bind(this.setEditData, this)); - this.lockedControls.push(this.btnEditData); - - this.spnWidth = new Common.UI.MetricSpinner({ - el: $('#chart-spin-width'), - step: .1, - width: 78, - defaultUnit : "cm", - value: '3 cm', - maxValue: 55.88, - minValue: 0 - }); - this.spinners.push(this.spnWidth); - this.lockedControls.push(this.spnWidth); - - this.spnHeight = new Common.UI.MetricSpinner({ - el: $('#chart-spin-height'), - step: .1, - width: 78, - defaultUnit : "cm", - value: '3 cm', - maxValue: 55.88, - minValue: 0 - }); - this.spinners.push(this.spnHeight); - this.lockedControls.push(this.spnHeight); - - this.spnWidth.on('change', _.bind(this.onWidthChange, this)); - this.spnHeight.on('change', _.bind(this.onHeightChange, this)); - - this.btnRatio = new Common.UI.Button({ - cls: 'btn-toolbar', - iconCls: 'advanced-btn-ratio', - style: 'margin-bottom: 1px;', - enableToggle: true, - hint: this.textKeepRatio - }); - this.btnRatio.render($('#chart-button-ratio')) ; - this.lockedControls.push(this.btnRatio); - - this.btnRatio.on('click', _.bind(function(btn, e) { - if (btn.pressed && this.spnHeight.getNumberValue()>0) { - this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); - } - if (this.api) { - var props = new Asc.CAscChartProp(); - props.asc_putLockAspect(btn.pressed); - this.api.ChartApply(props); - } - this.fireEvent('editcomplete', this); - }, this)); }, render: function () { @@ -333,7 +190,125 @@ define([ } }, + createDelayedControls: function() { + var me = this; + this.btnChartType = new Common.UI.Button({ + cls : 'btn-large-dataview', + iconCls : 'item-chartlist bar-normal', + menu : new Common.UI.Menu({ + style: 'width: 560px;', + items: [ + { template: _.template('') } + ] + }) + }); + this.btnChartType.on('render:after', function(btn) { + me.mnuChartTypePicker = new Common.UI.DataView({ + el: $('#id-chart-menu-type'), + parentMenu: btn.menu, + restoreHeight: 411, + groups: new Common.UI.DataViewGroupStore([ + { id: 'menu-chart-group-bar', caption: me.textColumn }, + { id: 'menu-chart-group-line', caption: me.textLine }, + { id: 'menu-chart-group-pie', caption: me.textPie }, + { id: 'menu-chart-group-hbar', caption: me.textBar }, + { id: 'menu-chart-group-area', caption: me.textArea }, + { id: 'menu-chart-group-scatter', caption: me.textPoint }, + { id: 'menu-chart-group-stock', caption: me.textStock } + ]), + store: new Common.UI.DataViewStore([ + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal', selected: true}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, + { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, + { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, + { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, + { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, + { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, + { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, + { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} + ]), + itemTemplate: _.template('
') + }); + }); + this.btnChartType.render($('#chart-button-type')); + this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType)); + this.lockedControls.push(this.btnChartType); + + this.btnEditData = new Common.UI.Button({ + el: $('#chart-button-edit-data') + }); + this.btnEditData.on('click', _.bind(this.setEditData, this)); + this.lockedControls.push(this.btnEditData); + + this.spnWidth = new Common.UI.MetricSpinner({ + el: $('#chart-spin-width'), + step: .1, + width: 78, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spinners.push(this.spnWidth); + this.lockedControls.push(this.spnWidth); + + this.spnHeight = new Common.UI.MetricSpinner({ + el: $('#chart-spin-height'), + step: .1, + width: 78, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spinners.push(this.spnHeight); + this.lockedControls.push(this.spnHeight); + + this.spnWidth.on('change', _.bind(this.onWidthChange, this)); + this.spnHeight.on('change', _.bind(this.onHeightChange, this)); + + this.btnRatio = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'advanced-btn-ratio', + style: 'margin-bottom: 1px;', + enableToggle: true, + hint: this.textKeepRatio + }); + this.btnRatio.render($('#chart-button-ratio')) ; + this.lockedControls.push(this.btnRatio); + + this.btnRatio.on('click', _.bind(function(btn, e) { + if (btn.pressed && this.spnHeight.getNumberValue()>0) { + this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); + } + if (this.api) { + var props = new Asc.CAscChartProp(); + props.asc_putLockAspect(btn.pressed); + this.api.ChartApply(props); + } + this.fireEvent('editcomplete', this); + }, this)); + + }, + createDelayedElements: function() { + this.createDelayedControls(); this.updateMetricUnit(); }, @@ -415,6 +390,36 @@ define([ updateChartStyles: function(styles) { var me = this; + + if (!this.btnChartStyle) { + this.btnChartStyle = new Common.UI.Button({ + cls : 'btn-large-dataview', + iconCls : 'item-wrap', + menu : new Common.UI.Menu({ + menuAlign: 'tr-br', + items: [ + { template: _.template('
') } + ] + }) + }); + this.btnChartStyle.render($('#chart-button-style')); + this.lockedControls.push(this.btnChartStyle); + this.mnuChartStylePicker = new Common.UI.DataView({ + el: $('#id-chart-menu-style'), + style: 'max-height: 411px;', + parentMenu: this.btnChartStyle.menu, + store: new Common.UI.DataViewStore(), + itemTemplate: _.template('
') + }); + + if (this.btnChartStyle.menu) { + this.btnChartStyle.menu.on('show:after', function () { + me.mnuChartStylePicker.scroller.update({alwaysVisibleY: true}); + }); + } + this.mnuChartStylePicker.on('item:click', _.bind(this.onSelectStyle, this, this.btnChartStyle)); + } + if (styles && styles.length>0){ var stylesStore = this.mnuChartStylePicker.store; if (stylesStore) { @@ -493,6 +498,8 @@ define([ }, disableControls: function(disable) { + if (this._initSettings) return; + if (this._state.DisabledControls!==disable) { this._state.DisabledControls = disable; _.each(this.lockedControls, function(item) { From c4da0e12d8debf6b7732d550282fef74060dd853 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 7 Oct 2016 16:37:18 +0300 Subject: [PATCH 03/29] [DE] Field "serverVersion" is added to revision in versions history. --- apps/documenteditor/main/app/controller/Main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 48363b3b7..ebbf8210a 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -422,7 +422,7 @@ define([ var changes = version.changes, change, i; if (changes && changes.length>0) { arrVersions[arrVersions.length-1].set('docIdPrev', docIdPrev); - if (version.buildVersion && version.buildVersion == this.appOptions.buildVersion) { + if (!_.isEmpty(version.serverVersion) && version.serverVersion == this.appOptions.buildVersion) { arrVersions[arrVersions.length-1].set('changeid', changes.length-1); arrVersions[arrVersions.length-1].set('hasChanges', changes.length>1); for (i=changes.length-2; i>=0; i--) { From 80cbaaa6ba6e033d6b9b9643f386654d614530b0 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 10 Oct 2016 16:13:38 +0300 Subject: [PATCH 04/29] [SSE] Fix Bug 33195. --- apps/spreadsheeteditor/main/app/controller/Main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index c6e57cea0..5f64f6fdb 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1708,7 +1708,7 @@ define([ var app = this.getApplication(), filemenu = app.getController('LeftMenu').getView('LeftMenu').getMenu('file'); app.getController('Viewport').getView('Common.Views.Header').setDocumentCaption(meta.title); - this.updateWindowTitle(true); + this.updateWindowTitle(this.api.asc_isDocumentModified(), true); this.appOptions.spreadsheet.title = meta.title; filemenu.loadDocument({doc:this.appOptions.spreadsheet}); filemenu.panels['info'].updateInfo(this.appOptions.spreadsheet); From 50a5653fb4229182c265ea5bda1db3900dfe5e2c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 11 Oct 2016 13:29:21 +0300 Subject: [PATCH 05/29] [PE] Delay rendering controls on the right panel. --- .../main/app/view/ImageSettings.js | 50 +-- .../main/app/view/ParagraphSettings.js | 156 +++---- .../main/app/view/TableSettings.js | 382 +++++++++--------- 3 files changed, 305 insertions(+), 283 deletions(-) diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js index 5310720f2..ff78c2dbf 100644 --- a/apps/presentationeditor/main/app/view/ImageSettings.js +++ b/apps/presentationeditor/main/app/view/ImageSettings.js @@ -64,7 +64,6 @@ define([ }, initialize: function () { - var me = this; this._initSettings = true; this._state = { @@ -83,7 +82,29 @@ define([ this.labelWidth = $(this.el).find('#image-label-width'); this.labelHeight = $(this.el).find('#image-label-height'); + }, + render: function () { + var el = $(this.el); + el.html(this.template({ + scope: this + })); + }, + + setApi: function(api) { + this.api = api; + return this; + }, + + updateMetricUnit: function() { + var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + + value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + }, + + createDelayedControls: function() { this.btnOriginalSize = new Common.UI.Button({ el: $('#image-button-original-size') }); @@ -103,7 +124,7 @@ define([ el: $('#image-button-edit-object') }); this.lockedControls.push(this.btnEditObject); - + this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this)); this.btnInsertFromFile.on('click', _.bind(function(btn){ if (this.api) this.api.ChangeImageFromFile(); @@ -114,33 +135,14 @@ define([ if (this.api) this.api.asc_pluginRun(this._originalProps.asc_getPluginGuid(), 0, this._originalProps.asc_getPluginData()); this.fireEvent('editcomplete', this); }, this)); - $(this.el).on('click', '#image-advanced-link', _.bind(this.openAdvancedSettings, this)); - }, - - render: function () { - var el = $(this.el); - el.html(this.template({ - scope: this - })); this.linkAdvanced = $('#image-advanced-link'); this.lblReplace = $('#image-lbl-replace'); - }, - - setApi: function(api) { - this.api = api; - return this; - }, - - updateMetricUnit: function() { - var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); - - value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + $(this.el).on('click', '#image-advanced-link', _.bind(this.openAdvancedSettings, this)); }, createDelayedElements: function() { + this.createDelayedControls(); this.updateMetricUnit(); }, @@ -269,6 +271,8 @@ define([ }, disableControls: function(disable) { + if (this._initSettings) return; + if (this._state.DisabledControls!==disable) { this._state.DisabledControls = disable; _.each(this.lockedControls, function(item) { diff --git a/apps/presentationeditor/main/app/view/ParagraphSettings.js b/apps/presentationeditor/main/app/view/ParagraphSettings.js index eb72ea26b..5eb386e05 100644 --- a/apps/presentationeditor/main/app/view/ParagraphSettings.js +++ b/apps/presentationeditor/main/app/view/ParagraphSettings.js @@ -64,7 +64,6 @@ define([ }, initialize: function () { - var me = this; this._initSettings = true; this._state = { @@ -79,68 +78,6 @@ define([ this._locked = false; this.render(); - - this._arrLineRule = [ - {displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, - {displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'} - ]; - - // Short Size - this.cmbLineRule = new Common.UI.ComboBox({ - el: $('#paragraph-combo-line-rule'), - cls: 'input-group-nr', - menuStyle: 'min-width: 85px;', - editable: false, - data: this._arrLineRule - }); - this.cmbLineRule.setValue(c_paragraphLinerule.LINERULE_AUTO); - this.lockedControls.push(this.cmbLineRule); - - this.numLineHeight = new Common.UI.MetricSpinner({ - el: $('#paragraph-spin-line-height'), - step: .01, - width: 85, - value: '1.5', - defaultUnit : "", - maxValue: 132, - minValue: 0.5 - }); - this.lockedControls.push(this.numLineHeight); - - this.numSpacingBefore = new Common.UI.MetricSpinner({ - el: $('#paragraph-spin-spacing-before'), - step: .1, - width: 85, - value: '0 cm', - defaultUnit : "cm", - maxValue: 55.88, - minValue: 0, - allowAuto : true, - autoText : this.txtAutoText - }); - this.spinners.push(this.numSpacingBefore); - this.lockedControls.push(this.numSpacingBefore); - - this.numSpacingAfter = new Common.UI.MetricSpinner({ - el: $('#paragraph-spin-spacing-after'), - step: .1, - width: 85, - value: '0.35 cm', - defaultUnit : "cm", - maxValue: 55.88, - minValue: 0, - allowAuto : true, - autoText : this.txtAutoText - }); - this.spinners.push(this.numSpacingAfter); - this.lockedControls.push(this.numSpacingAfter); - - this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this)); - this.numSpacingBefore.on('change', _.bind(this.onNumSpacingBeforeChange, this)); - this.numSpacingAfter.on('change', _.bind(this.onNumSpacingAfterChange, this)); - this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this)); - this.cmbLineRule.on('hide:after', _.bind(this.onHideMenus, this)); - $(this.el).on('click', '#paragraph-advanced-link', _.bind(this.openAdvancedSettings, this)); }, render: function () { @@ -200,6 +137,8 @@ define([ }, _onLineSpacing: function(value) { + if (this._initSettings) return; + var linerule = value.get_LineRule(); var line = value.get_Line(); @@ -297,21 +236,90 @@ define([ spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01); } } - var rec = this.cmbLineRule.store.at(1); - rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(), - minValue: parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)), - step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01}); + if (this.cmbLineRule) { + var rec = this.cmbLineRule.store.at(1); + rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(), + minValue: parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)), + step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01}); - if (this._state.LineRule !== null) { - var obj; - rec = this.cmbLineRule.store.findWhere((obj={}, obj['value']=this._state.LineRule, obj)); - if (!rec) rec = this.cmbLineRule.store.at(0); - this.numLineHeight.setDefaultUnit(rec.get('defaultUnit')); - this.numLineHeight.setStep(rec.get('step')); + if (this._state.LineRule !== null) { + var obj; + rec = this.cmbLineRule.store.findWhere((obj={}, obj['value']=this._state.LineRule, obj)); + if (!rec) rec = this.cmbLineRule.store.at(0); + this.numLineHeight.setDefaultUnit(rec.get('defaultUnit')); + this.numLineHeight.setStep(rec.get('step')); + } } }, + createDelayedControls: function() { + var me = this; + this._arrLineRule = [ + {displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, + {displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'} + ]; + + // Short Size + this.cmbLineRule = new Common.UI.ComboBox({ + el: $('#paragraph-combo-line-rule'), + cls: 'input-group-nr', + menuStyle: 'min-width: 85px;', + editable: false, + data: this._arrLineRule + }); + this.cmbLineRule.setValue(c_paragraphLinerule.LINERULE_AUTO); + this.lockedControls.push(this.cmbLineRule); + + this.numLineHeight = new Common.UI.MetricSpinner({ + el: $('#paragraph-spin-line-height'), + step: .01, + width: 85, + value: '1.5', + defaultUnit : "", + maxValue: 132, + minValue: 0.5 + }); + this.lockedControls.push(this.numLineHeight); + + this.numSpacingBefore = new Common.UI.MetricSpinner({ + el: $('#paragraph-spin-spacing-before'), + step: .1, + width: 85, + value: '0 cm', + defaultUnit : "cm", + maxValue: 55.88, + minValue: 0, + allowAuto : true, + autoText : this.txtAutoText + }); + this.spinners.push(this.numSpacingBefore); + this.lockedControls.push(this.numSpacingBefore); + + this.numSpacingAfter = new Common.UI.MetricSpinner({ + el: $('#paragraph-spin-spacing-after'), + step: .1, + width: 85, + value: '0.35 cm', + defaultUnit : "cm", + maxValue: 55.88, + minValue: 0, + allowAuto : true, + autoText : this.txtAutoText + }); + this.spinners.push(this.numSpacingAfter); + this.lockedControls.push(this.numSpacingAfter); + + this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this)); + this.numSpacingBefore.on('change', _.bind(this.onNumSpacingBeforeChange, this)); + this.numSpacingAfter.on('change', _.bind(this.onNumSpacingAfterChange, this)); + this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this)); + this.cmbLineRule.on('hide:after', _.bind(this.onHideMenus, this)); + $(this.el).on('click', '#paragraph-advanced-link', _.bind(this.openAdvancedSettings, this)); + + }, + createDelayedElements: function() { + this.createDelayedControls(); this.updateMetricUnit(); }, @@ -357,6 +365,8 @@ define([ }, disableControls: function(disable) { + if (this._initSettings) return; + if (this._state.DisabledControls!==disable) { this._state.DisabledControls = disable; _.each(this.lockedControls, function(item) { diff --git a/apps/presentationeditor/main/app/view/TableSettings.js b/apps/presentationeditor/main/app/view/TableSettings.js index 138a59e38..e94e5f91a 100644 --- a/apps/presentationeditor/main/app/view/TableSettings.js +++ b/apps/presentationeditor/main/app/view/TableSettings.js @@ -69,7 +69,7 @@ define([ }, initialize: function () { - var me = this; + this._initSettings = true; this._state = { TemplateId: 0, @@ -93,185 +93,6 @@ define([ this._noApply = false; this.render(); - - this.chHeader = new Common.UI.CheckBox({ - el: $('#table-checkbox-header'), - labelText: this.textHeader - }); - this.lockedControls.push(this.chHeader); - - this.chTotal = new Common.UI.CheckBox({ - el: $('#table-checkbox-total'), - labelText: this.textTotal - }); - this.lockedControls.push(this.chTotal); - - this.chBanded = new Common.UI.CheckBox({ - el: $('#table-checkbox-banded'), - labelText: this.textBanded - }); - this.lockedControls.push(this.chBanded); - - this.chFirst = new Common.UI.CheckBox({ - el: $('#table-checkbox-first'), - labelText: this.textFirst - }); - this.lockedControls.push(this.chFirst); - - this.chLast = new Common.UI.CheckBox({ - el: $('#table-checkbox-last'), - labelText: this.textLast - }); - this.lockedControls.push(this.chLast); - - this.chColBanded = new Common.UI.CheckBox({ - el: $('#table-checkbox-col-banded'), - labelText: this.textBanded - }); - this.lockedControls.push(this.chColBanded); - - this.chHeader.on('change', _.bind(this.onCheckTemplateChange, this, 0)); - this.chTotal.on('change', _.bind(this.onCheckTemplateChange, this, 1)); - this.chBanded.on('change', _.bind(this.onCheckTemplateChange, this, 2)); - this.chFirst.on('change', _.bind(this.onCheckTemplateChange, this, 3)); - this.chLast.on('change', _.bind(this.onCheckTemplateChange, this, 4)); - this.chColBanded.on('change', _.bind(this.onCheckTemplateChange, this, 5)); - - this.cmbTableTemplate = new Common.UI.ComboDataView({ - itemWidth: 70, - itemHeight: 50, - menuMaxHeight: 300, - enableKeyEvents: true, - cls: 'combo-template' - }); - this.cmbTableTemplate.render($('#table-combo-template')); - this.cmbTableTemplate.openButton.menu.cmpEl.css({ - 'min-width': 175, - 'max-width': 175 - }); - this.cmbTableTemplate.on('click', _.bind(this.onTableTemplateSelect, this)); - this.cmbTableTemplate.openButton.menu.on('show:after', function () { - me.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true}); - }); - this.lockedControls.push(this.cmbTableTemplate); - - var _arrBorderPosition = [ - ['l', 'btn-borders-small btn-position-left', 'table-button-border-left', this.tipLeft], - ['c','btn-borders-small btn-position-inner-vert', 'table-button-border-inner-vert', this.tipInnerVert], - ['r','btn-borders-small btn-position-right', 'table-button-border-right', this.tipRight], - ['t','btn-borders-small btn-position-top', 'table-button-border-top', this.tipTop], - ['m','btn-borders-small btn-position-inner-hor', 'table-button-border-inner-hor', this.tipInnerHor], - ['b', 'btn-borders-small btn-position-bottom', 'table-button-border-bottom', this.tipBottom], - ['cm', 'btn-borders-small btn-position-inner', 'table-button-border-inner', this.tipInner], - ['lrtb', 'btn-borders-small btn-position-outer', 'table-button-border-outer', this.tipOuter], - ['lrtbcm', 'btn-borders-small btn-position-all', 'table-button-border-all', this.tipAll], - ['', 'btn-borders-small btn-position-none', 'table-button-border-none', this.tipNone] - ]; - - this._btnsBorderPosition = []; - _.each(_arrBorderPosition, function(item, index, list){ - var _btn = new Common.UI.Button({ - cls: 'btn-toolbar', - iconCls: item[1], - strId :item[0], - hint: item[3] - }); - _btn.render( $('#'+item[2])) ; - _btn.on('click', _.bind(this.onBtnBordersClick, this)); - this._btnsBorderPosition.push( _btn ); - this.lockedControls.push(_btn); - }, this); - - this.cmbBorderSize = new Common.UI.ComboBorderSize({ - el: $('#table-combo-border-size'), - style: "width: 93px;" - }); - this.BorderSize = this.cmbBorderSize.store.at(2).get('value'); - this.cmbBorderSize.setValue(this.BorderSize); - this.cmbBorderSize.on('selected', _.bind(this.onBorderSizeSelect, this)); - this.lockedControls.push(this.cmbBorderSize); - - this.btnBorderColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - - this.btnBorderColor.on('render:after', function(btn) { - me.borderColor = new Common.UI.ThemeColorPalette({ - el: $('#table-border-color-menu') - }); - me.borderColor.on('select', _.bind(me.onColorsBorderSelect, me)); - }); - this.btnBorderColor.render( $('#table-border-color-btn')); - this.btnBorderColor.setColor('000000'); - $(this.el).on('click', '#table-border-color-new', _.bind(this.addNewColor, this, this.borderColor, this.btnBorderColor)); - this.lockedControls.push(this.btnBorderColor); - - this.btnBackColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - - this.btnBackColor.on('render:after', function(btn) { - me.colorsBack = new Common.UI.ThemeColorPalette({ - el: $('#table-back-color-menu'), - transparent: true - }); - me.colorsBack.on('select', _.bind(me.onColorsBackSelect, me)); - }); - this.btnBackColor.render( $('#table-back-color-btn')); - $(this.el).on('click', '#table-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); - this.lockedControls.push(this.btnBackColor); - - this.btnEdit = new Common.UI.Button({ - cls: 'btn-icon-default', - iconCls: 'btn-edit-table', - menu : new Common.UI.Menu({ - menuAlign: 'tr-br', - items: [ - { caption: this.selectRowText, value: 0 }, - { caption: this.selectColumnText, value: 1 }, - { caption: this.selectCellText, value: 2 }, - { caption: this.selectTableText, value: 3 }, - { caption: '--' }, - { caption: this.insertRowAboveText, value: 4 }, - { caption: this.insertRowBelowText, value: 5 }, - { caption: this.insertColumnLeftText, value: 6 }, - { caption: this.insertColumnRightText, value: 7 }, - { caption: '--' }, - { caption: this.deleteRowText, value: 8 }, - { caption: this.deleteColumnText, value: 9 }, - { caption: this.deleteTableText, value: 10 }, - { caption: '--' }, - { caption: this.mergeCellsText, value: 11 }, - { caption: this.splitCellsText, value: 12 } - ] - }) - }); - this.btnEdit.render( $('#table-btn-edit')) ; - this.mnuMerge = this.btnEdit.menu.items[this.btnEdit.menu.items.length-2]; - this.mnuSplit = this.btnEdit.menu.items[this.btnEdit.menu.items.length-1]; - - this.btnEdit.menu.on('show:after', _.bind( function(){ - if (this.api) { - this.mnuMerge.setDisabled(!this.api.CheckBeforeMergeCells()); - this.mnuSplit.setDisabled(!this.api.CheckBeforeSplitCells()); - } - }, this)); - this.btnEdit.menu.on('item:click', _.bind(this.onEditClick, this)); - this.lockedControls.push(this.btnEdit); - - $(this.el).on('click', '#table-advanced-link', _.bind(this.openAdvancedSettings, this)); }, onCheckTemplateChange: function(type, field, newValue, oldValue, eOpts) { @@ -398,8 +219,6 @@ define([ el.html(this.template({ scope: this })); - - this.linkAdvanced = $('#table-advanced-link'); }, setApi: function(o) { @@ -410,7 +229,135 @@ define([ return this; }, + createDelayedControls: function() { + var me = this; + + this.chHeader = new Common.UI.CheckBox({ + el: $('#table-checkbox-header'), + labelText: this.textHeader + }); + this.lockedControls.push(this.chHeader); + + this.chTotal = new Common.UI.CheckBox({ + el: $('#table-checkbox-total'), + labelText: this.textTotal + }); + this.lockedControls.push(this.chTotal); + + this.chBanded = new Common.UI.CheckBox({ + el: $('#table-checkbox-banded'), + labelText: this.textBanded + }); + this.lockedControls.push(this.chBanded); + + this.chFirst = new Common.UI.CheckBox({ + el: $('#table-checkbox-first'), + labelText: this.textFirst + }); + this.lockedControls.push(this.chFirst); + + this.chLast = new Common.UI.CheckBox({ + el: $('#table-checkbox-last'), + labelText: this.textLast + }); + this.lockedControls.push(this.chLast); + + this.chColBanded = new Common.UI.CheckBox({ + el: $('#table-checkbox-col-banded'), + labelText: this.textBanded + }); + this.lockedControls.push(this.chColBanded); + + this.chHeader.on('change', _.bind(this.onCheckTemplateChange, this, 0)); + this.chTotal.on('change', _.bind(this.onCheckTemplateChange, this, 1)); + this.chBanded.on('change', _.bind(this.onCheckTemplateChange, this, 2)); + this.chFirst.on('change', _.bind(this.onCheckTemplateChange, this, 3)); + this.chLast.on('change', _.bind(this.onCheckTemplateChange, this, 4)); + this.chColBanded.on('change', _.bind(this.onCheckTemplateChange, this, 5)); + + var _arrBorderPosition = [ + ['l', 'btn-borders-small btn-position-left', 'table-button-border-left', this.tipLeft], + ['c','btn-borders-small btn-position-inner-vert', 'table-button-border-inner-vert', this.tipInnerVert], + ['r','btn-borders-small btn-position-right', 'table-button-border-right', this.tipRight], + ['t','btn-borders-small btn-position-top', 'table-button-border-top', this.tipTop], + ['m','btn-borders-small btn-position-inner-hor', 'table-button-border-inner-hor', this.tipInnerHor], + ['b', 'btn-borders-small btn-position-bottom', 'table-button-border-bottom', this.tipBottom], + ['cm', 'btn-borders-small btn-position-inner', 'table-button-border-inner', this.tipInner], + ['lrtb', 'btn-borders-small btn-position-outer', 'table-button-border-outer', this.tipOuter], + ['lrtbcm', 'btn-borders-small btn-position-all', 'table-button-border-all', this.tipAll], + ['', 'btn-borders-small btn-position-none', 'table-button-border-none', this.tipNone] + ]; + + this._btnsBorderPosition = []; + _.each(_arrBorderPosition, function(item, index, list){ + var _btn = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: item[1], + strId :item[0], + hint: item[3] + }); + _btn.render( $('#'+item[2])) ; + _btn.on('click', _.bind(this.onBtnBordersClick, this)); + this._btnsBorderPosition.push( _btn ); + this.lockedControls.push(_btn); + }, this); + + this.cmbBorderSize = new Common.UI.ComboBorderSize({ + el: $('#table-combo-border-size'), + style: "width: 93px;" + }); + this.BorderSize = this.cmbBorderSize.store.at(2).get('value'); + this.cmbBorderSize.setValue(this.BorderSize); + this.cmbBorderSize.on('selected', _.bind(this.onBorderSizeSelect, this)); + this.lockedControls.push(this.cmbBorderSize); + + this.btnEdit = new Common.UI.Button({ + cls: 'btn-icon-default', + iconCls: 'btn-edit-table', + menu : new Common.UI.Menu({ + menuAlign: 'tr-br', + items: [ + { caption: this.selectRowText, value: 0 }, + { caption: this.selectColumnText, value: 1 }, + { caption: this.selectCellText, value: 2 }, + { caption: this.selectTableText, value: 3 }, + { caption: '--' }, + { caption: this.insertRowAboveText, value: 4 }, + { caption: this.insertRowBelowText, value: 5 }, + { caption: this.insertColumnLeftText, value: 6 }, + { caption: this.insertColumnRightText, value: 7 }, + { caption: '--' }, + { caption: this.deleteRowText, value: 8 }, + { caption: this.deleteColumnText, value: 9 }, + { caption: this.deleteTableText, value: 10 }, + { caption: '--' }, + { caption: this.mergeCellsText, value: 11 }, + { caption: this.splitCellsText, value: 12 } + ] + }) + }); + this.btnEdit.render( $('#table-btn-edit')) ; + this.mnuMerge = this.btnEdit.menu.items[this.btnEdit.menu.items.length-2]; + this.mnuSplit = this.btnEdit.menu.items[this.btnEdit.menu.items.length-1]; + + this.btnEdit.menu.on('show:after', _.bind( function(){ + if (this.api) { + this.mnuMerge.setDisabled(!this.api.CheckBeforeMergeCells()); + this.mnuSplit.setDisabled(!this.api.CheckBeforeSplitCells()); + } + }, this)); + this.btnEdit.menu.on('item:click', _.bind(this.onEditClick, this)); + this.lockedControls.push(this.btnEdit); + + this.linkAdvanced = $('#table-advanced-link'); + $(this.el).on('click', '#table-advanced-link', _.bind(this.openAdvancedSettings, this)); + }, + ChangeSettings: function(props) { + if (this._initSettings) + this.createDelayedElements(); + this._initSettings = false; + this.disableControls(this._locked); if (props ) @@ -580,19 +527,78 @@ define([ } }, + createDelayedElements: function() { + this.createDelayedControls(); + this.UpdateThemeColors(); + }, + UpdateThemeColors: function() { - if (this.colorsBack) - this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); - if (this.borderColor) { - this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); - this.btnBorderColor.setColor(this.borderColor.getColor()); + if (!this.btnBackColor) { + this.btnBorderColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnBorderColor.render( $('#table-border-color-btn')); + this.btnBorderColor.setColor('000000'); + this.lockedControls.push(this.btnBorderColor); + this.borderColor = new Common.UI.ThemeColorPalette({ + el: $('#table-border-color-menu') + }); + this.borderColor.on('select', _.bind(this.onColorsBorderSelect, this)); + $(this.el).on('click', '#table-border-color-new', _.bind(this.addNewColor, this, this.borderColor, this.btnBorderColor)); + + this.btnBackColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnBackColor.render( $('#table-back-color-btn')); + this.lockedControls.push(this.btnBackColor); + this.colorsBack = new Common.UI.ThemeColorPalette({ + el: $('#table-back-color-menu'), + transparent: true + }); + this.colorsBack.on('select', _.bind(this.onColorsBackSelect, this)); + $(this.el).on('click', '#table-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); } + this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + this.btnBorderColor.setColor(this.borderColor.getColor()); }, _onInitTemplates: function(Templates){ var self = this; this._isTemplatesChanged = true; + if (!this.cmbTableTemplate) { + this.cmbTableTemplate = new Common.UI.ComboDataView({ + itemWidth: 70, + itemHeight: 50, + menuMaxHeight: 300, + enableKeyEvents: true, + cls: 'combo-template' + }); + this.cmbTableTemplate.render($('#table-combo-template')); + this.cmbTableTemplate.openButton.menu.cmpEl.css({ + 'min-width': 175, + 'max-width': 175 + }); + this.cmbTableTemplate.on('click', _.bind(this.onTableTemplateSelect, this)); + this.cmbTableTemplate.openButton.menu.on('show:after', function () { + self.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + this.lockedControls.push(this.cmbTableTemplate); + } + var count = self.cmbTableTemplate.menuPicker.store.length; if (count>0 && count==Templates.length) { var data = self.cmbTableTemplate.menuPicker.store.models; @@ -649,6 +655,8 @@ define([ }, disableControls: function(disable) { + if (this._initSettings) return; + if (this._state.DisabledControls!==disable) { this._state.DisabledControls = disable; _.each(this.lockedControls, function(item) { From d71f63e5553df6698564ebbeb3f413de95cb594c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 11 Oct 2016 14:08:41 +0300 Subject: [PATCH 06/29] [SSE] Eix Bug 33206. --- apps/spreadsheeteditor/main/app/controller/DocumentHolder.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 88ddb8a58..828c754c1 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1312,6 +1312,7 @@ define([ item.setDisabled(isCellLocked); }); documentHolder.pmiCopy.setDisabled(false); + documentHolder.pmiFilterCells.setDisabled(isCellLocked || (filterInfo==null)); documentHolder.pmiSortCells.setDisabled(isCellLocked || (filterInfo==null)); documentHolder.pmiReapply.setDisabled(isCellLocked || (isApplyAutoFilter!==true)); if (showMenu) this.showPopupMenu(documentHolder.ssMenu, {}, event); From 1494f1f80702cf1bd4288b8471c9f98a6dab46d3 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 12 Oct 2016 12:53:32 +0300 Subject: [PATCH 07/29] ComboBox: add parameter scrollAlwaysVisible. [SSE] AutoFilterDialog: added combobox with cell values to custom filter dialog. --- apps/common/main/lib/component/ComboBox.js | 13 ++- .../main/app/view/AutoFilterDialog.js | 87 ++++++++++--------- 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index 35f3ca96f..24e147e2f 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -84,7 +84,8 @@ define([ menuCls : '', menuStyle : '', displayField: 'displayValue', - valueField : 'value' + valueField : 'value', + scrollAlwaysVisible: false }, template: _.template([ @@ -117,6 +118,7 @@ define([ this.store = me.options.store || new Common.UI.ComboBoxStore(); this.displayField = me.options.displayField; this.valueField = me.options.valueField; + this.scrollAlwaysVisible = me.options.scrollAlwaysVisible; me.rendered = me.options.rendered || false; this.lastValue = null; @@ -216,7 +218,8 @@ define([ el: $('.dropdown-menu', this.cmpEl), minScrollbarLength: 40, scrollYMarginOffset: 30, - includePadding: true + includePadding: true, + alwaysVisibleY: this.scrollAlwaysVisible }, this.options.scroller)); } @@ -239,7 +242,8 @@ define([ el: $('.dropdown-menu', this.cmpEl), minScrollbarLength: 40, scrollYMarginOffset: 30, - includePadding: true + includePadding: true, + alwaysVisibleY: this.scrollAlwaysVisible }, this.options.scroller)); } @@ -542,7 +546,8 @@ define([ el: $('.dropdown-menu', this.cmpEl), minScrollbarLength : 40, scrollYMarginOffset: 30, - includePadding : true + includePadding : true, + alwaysVisibleY: this.scrollAlwaysVisible }, this.options.scroller)); } } diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js index de1452a3e..895065774 100644 --- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js @@ -119,9 +119,10 @@ define([ this.cmbCondition1 = new Common.UI.ComboBox({ el : $('#id-search-begin-digital-combo', this.$window), - menuStyle : 'min-width: 225px;', + menuStyle : 'min-width: 225px;max-height: 135px;', cls : 'input-group-nr', data : this.conditions, + scrollAlwaysVisible: true, editable : false }); this.cmbCondition1.setValue(Asc.c_oAscCustomAutoFilter.equals); @@ -130,9 +131,10 @@ define([ this.cmbCondition2 = new Common.UI.ComboBox({ el : $('#id-search-end-digital-combo', this.$window), - menuStyle : 'min-width: 225px;', + menuStyle : 'min-width: 225px;max-height: 135px;', cls : 'input-group-nr', data : this.conditions, + scrollAlwaysVisible: true, editable : false }); this.cmbCondition2.setValue(0); @@ -150,39 +152,34 @@ define([ name : 'asc-radio-filter-tab' }); - this.txtValue1 = new Common.UI.InputField({ + this.cmbValue1 = new Common.UI.ComboBox({ el : $('#id-sd-cell-search-begin', this.$window), - template: _.template([ - '
', - '', - '
'].join('')), - allowBlank : true, - validateOnChange: true, - validation : function () { return true; } + cls : 'input-group-nr', + menuStyle : 'min-width: 225px;max-height: 135px;', + scrollAlwaysVisible: true, + data : [] }); - this.txtValue2 = new Common.UI.InputField({ + + this.cmbValue2 = new Common.UI.ComboBox({ el : $('#id-sd-cell-search-end', this.$window), - template: _.template([ - '
', - '', - '
'].join('')), - allowBlank : true, - validateOnChange: true, - validation : function () { return true; } + cls : 'input-group-nr', + menuStyle : 'min-width: 225px;max-height: 135px;', + scrollAlwaysVisible: true, + data : [] }); + var comparator = function(item1, item2) { + var n1 = item1.get('intval'), + n2 = item2.get('intval'), + isN1 = n1!==undefined, + isN2 = n2!==undefined; + if (isN1 !== isN2) return (isN1) ? -1 : 1; + !isN1 && (n1 = item1.get('value').toLowerCase()) && (n2 = item2.get('value').toLowerCase()); + if (n1==n2) return 0; + return (n2=='' || n1!=='' && n11) ? (customFilters[1].asc_getOperator() || 0) : 0); - this.txtValue1.setValue(null === customFilters[0].asc_getVal() ? '' : customFilters[0].asc_getVal()); - this.txtValue2.setValue((customFilters.length>1) ? (null === customFilters[1].asc_getVal() ? '' : customFilters[1].asc_getVal()) : ''); + this.cmbValue1.setValue(null === customFilters[0].asc_getVal() ? '' : customFilters[0].asc_getVal()); + this.cmbValue2.setValue((customFilters.length>1) ? (null === customFilters[1].asc_getVal() ? '' : customFilters[1].asc_getVal()) : ''); } } }, save: function () { if (this.api && this.properties && this.rbOr && this.rbAnd && - this.cmbCondition1 && this.cmbCondition2 && this.txtValue1 && this.txtValue2) { + this.cmbCondition1 && this.cmbCondition2 && this.cmbValue1 && this.cmbValue2) { var filterObj = this.properties.asc_getFilterObj(); filterObj.asc_setFilter(new Asc.CustomFilters()); @@ -253,10 +260,10 @@ define([ customFilter.asc_setAnd(this.rbAnd.getValue()); customFilters[0].asc_setOperator(this.cmbCondition1.getValue()); - customFilters[0].asc_setVal(this.txtValue1.getValue()); + customFilters[0].asc_setVal(this.cmbValue1.getValue()); if (this.cmbCondition2.getValue() !== 0) { customFilters[1].asc_setOperator(this.cmbCondition2.getValue() || undefined); - customFilters[1].asc_setVal(this.txtValue2.getValue()); + customFilters[1].asc_setVal(this.cmbValue2.getValue()); } this.api.asc_applyAutoFilter(this.properties); @@ -390,8 +397,8 @@ define([ var me = this; _.defer(function () { - if (me.txtValue1) { - me.txtValue1.focus(); + if (me.spnCount) { + me.spnCount.$input.focus(); } }, 500); }, From 0dd09875b825e93fd1351166177c24c6437471fc Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 12 Oct 2016 16:32:48 +0300 Subject: [PATCH 08/29] Disable download as, print, save and version history when server is disconnected. --- apps/documenteditor/main/app/controller/LeftMenu.js | 6 +++--- apps/documenteditor/main/app/controller/Main.js | 4 ++-- apps/documenteditor/main/app/controller/Toolbar.js | 6 +++--- apps/documenteditor/main/app/view/FileMenu.js | 6 ++++-- apps/documenteditor/main/app/view/Toolbar.js | 2 ++ apps/documenteditor/main/locale/de.json | 2 +- apps/documenteditor/main/locale/en.json | 4 +--- apps/documenteditor/main/locale/es.json | 2 +- apps/documenteditor/main/locale/fr.json | 2 +- apps/presentationeditor/main/app/controller/LeftMenu.js | 6 +++--- apps/presentationeditor/main/app/controller/Main.js | 4 ++-- apps/presentationeditor/main/app/controller/Toolbar.js | 6 +++--- apps/presentationeditor/main/app/view/FileMenu.js | 4 ++++ apps/presentationeditor/main/app/view/Toolbar.js | 2 +- apps/presentationeditor/main/locale/en.json | 2 +- apps/presentationeditor/main/locale/es.json | 2 +- apps/presentationeditor/main/locale/fr.json | 2 +- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 6 +++--- apps/spreadsheeteditor/main/app/controller/Main.js | 4 ++-- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 6 +++--- apps/spreadsheeteditor/main/app/view/FileMenu.js | 4 ++++ apps/spreadsheeteditor/main/app/view/Toolbar.js | 1 + apps/spreadsheeteditor/main/locale/en.json | 2 +- apps/spreadsheeteditor/main/locale/es.json | 2 +- apps/spreadsheeteditor/main/locale/fr.json | 2 +- 25 files changed, 50 insertions(+), 39 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 45b04c8c6..30626e67f 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -122,7 +122,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onReplaceAll', _.bind(this.onApiTextReplaced, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this)); /** coauthoring begin **/ if (this.mode.canCoAuthoring) { @@ -446,7 +446,7 @@ define([ } }, - onApiServerDisconnect: function() { + onApiServerDisconnect: function(disableDownload) { this.mode.isEdit = false; this.leftMenu.close(); @@ -456,7 +456,7 @@ define([ /** coauthoring end **/ this.leftMenu.btnPlugins.setDisabled(true); - this.leftMenu.getMenu('file').setMode({isDisconnected: true}); + this.leftMenu.getMenu('file').setMode({isDisconnected: true, disableDownload: !!disableDownload}); if ( this.dlgSearch ) { this.leftMenu.btnSearch.toggle(false, true); this.dlgSearch['hide'](); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index ce7988140..ce3302791 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1195,7 +1195,7 @@ define([ break; case Asc.c_oAscError.ID.CoAuthoringDisconnect: - config.msg = (this.appOptions.isEdit) ? this.errorCoAuthoringDisconnect : this.errorViewerDisconnect; + config.msg = this.errorViewerDisconnect; break; case Asc.c_oAscError.ID.ConvertationPassword: @@ -1964,7 +1964,7 @@ define([ textNoLicenseTitle: 'ONLYOFFICE open source version', warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.', textContactUs: 'Contact sales', - errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.', + errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.', warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index c2f40c4ad..a07326226 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -304,7 +304,7 @@ define([ this.api.asc_registerCallback('asc_onMarkerFormatChanged', _.bind(this.onApiStartHighlight, this)); this.api.asc_registerCallback('asc_onTextHighLight', _.bind(this.onApiHighlightColor, this)); this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this)); this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onMathTypes, this)); @@ -2592,8 +2592,8 @@ define([ }); }, - onApiCoAuthoringDisconnect: function() { - this.toolbar.setMode({isDisconnected:true}); + onApiCoAuthoringDisconnect: function(disableDownload) { + this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload}); this.editMode = false; }, diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index 7187d1305..d9a6eed04 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -215,6 +215,7 @@ define([ applyMode: function() { this.items[5][this.mode.canPrint?'show':'hide'](); this.items[6][(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); + this.items[6].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); this.items[7][this.mode.canOpenRecent?'show':'hide'](); this.items[8][this.mode.canCreateNew?'show':'hide'](); this.items[8].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide'](); @@ -261,8 +262,7 @@ define([ this.panels['help'].setLangConfig(this.mode.lang); - this.items[11][this.mode.canUseHistory?'show':'hide'](); - this.items[11].setDisabled(this.mode.isDisconnected); + this.items[11][this.mode.canUseHistory&&!this.mode.isDisconnected?'show':'hide'](); }, setMode: function(mode, delay) { @@ -271,6 +271,8 @@ define([ this.mode.canOpenRecent = this.mode.canCreateNew = false; this.mode.isDisconnected = mode.isDisconnected; this.mode.canRename = false; + this.mode.canPrint = false; + this.mode.canDownload = this.mode.canDownloadOrigin = false; } else { this.mode = mode; } diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index bb8aabb8e..dfdc84a85 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1517,6 +1517,8 @@ define([ this.cmbFontName.setDisabled(true); this.cmbFontSize.setDisabled(true); this.listStyles.setDisabled(true); + if (mode.disableDownload) + this.btnPrint.setDisabled(true); } this.mode = mode; diff --git a/apps/documenteditor/main/locale/de.json b/apps/documenteditor/main/locale/de.json index 9f54529ef..61e3cf093 100644 --- a/apps/documenteditor/main/locale/de.json +++ b/apps/documenteditor/main/locale/de.json @@ -210,7 +210,7 @@ "DE.Controllers.Main.errorUpdateVersion": "Die Dateiversion wurde geändert. Die Seite wird neu geladen.", "DE.Controllers.Main.errorUserDrop": "Kein Zugriff auf diese Datei ist möglich.", "DE.Controllers.Main.errorUsersExceed": "Die nach dem Zahlungsplan erlaubte Anzahl der Benutzer ist überschritten", - "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "DE.Controllers.Main.leavePageText": "Dieses Dokument enthält ungespeicherte Änderungen. Klicken Sie auf \"Auf dieser Seite bleiben\" und dann auf \"Speichern\", um sie zu speichern. Klicken Sie auf \"Diese Seite verlassen\", um alle nicht gespeicherten Änderungen zu verwerfen.\n", "DE.Controllers.Main.loadFontsTextText": "Daten werden geladen...", "DE.Controllers.Main.loadFontsTitleText": "Daten werden geladen", diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 93734ac68..23c72830c 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -198,8 +198,6 @@ "DE.Controllers.Main.applyChangesTextText": "Loading the changes...", "DE.Controllers.Main.applyChangesTitleText": "Loading the Changes", "del_DE.Controllers.Main.convertationErrorText": "Conversion failed.", - "DE.Controllers.Main.openErrorText": "An error has occurred while opening the file", - "DE.Controllers.Main.saveErrorText": "An error has occurred while saving the file", "DE.Controllers.Main.convertationTimeoutText": "Conversion timeout exceeded.", "DE.Controllers.Main.criticalErrorExtText": "Press \"OK\" to return to document list.", "DE.Controllers.Main.criticalErrorTitle": "Error", @@ -224,7 +222,7 @@ "DE.Controllers.Main.errorUpdateVersion": "The file version has been changed. The page will be reloaded.", "DE.Controllers.Main.errorUserDrop": "The file cannot be accessed right now.", "DE.Controllers.Main.errorUsersExceed": "The number of users allowed by the pricing plan was exceeded", - "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "DE.Controllers.Main.leavePageText": "You have unsaved changes in this document. Click \"Stay on This Page\", then \"Save\" to save them. Click \"Leave This Page\" to discard all the unsaved changes.", "DE.Controllers.Main.loadFontsTextText": "Loading data...", "DE.Controllers.Main.loadFontsTitleText": "Loading Data", diff --git a/apps/documenteditor/main/locale/es.json b/apps/documenteditor/main/locale/es.json index 7076c79d7..fc1790b27 100644 --- a/apps/documenteditor/main/locale/es.json +++ b/apps/documenteditor/main/locale/es.json @@ -210,7 +210,7 @@ "DE.Controllers.Main.errorUpdateVersion": "Se ha cambiado la versión del archivo. La página será actualizada.", "DE.Controllers.Main.errorUserDrop": "No se puede acceder al archivo ahora.", "DE.Controllers.Main.errorUsersExceed": "El número de usuarios permitido según su plan de precios fue excedido", - "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "DE.Controllers.Main.leavePageText": "Hay cambios no guardados en este documento. Haga clic en 'Permanecer en esta página', después 'Guardar' para guardarlos. Haga clic en 'Abandonar esta página' para descartar todos los cambios no guardados.", "DE.Controllers.Main.loadFontsTextText": "Cargando datos...", "DE.Controllers.Main.loadFontsTitleText": "Cargando datos", diff --git a/apps/documenteditor/main/locale/fr.json b/apps/documenteditor/main/locale/fr.json index 238e8d94f..3533035f1 100644 --- a/apps/documenteditor/main/locale/fr.json +++ b/apps/documenteditor/main/locale/fr.json @@ -210,7 +210,7 @@ "DE.Controllers.Main.errorUpdateVersion": "La version du fichier a été changée. La page sera rechargée.", "DE.Controllers.Main.errorUserDrop": "Impossible d'accéder au fichier", "DE.Controllers.Main.errorUsersExceed": "Le nombre d'utilisateurs autorisés par le plan tarifaire a été dépassé", - "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "DE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "DE.Controllers.Main.leavePageText": "Vous avez des modifications non enregistrées dans ce document. Cliquez sur 'Rester sur cette page', ensuite sur 'Enregistrer' pour enregistrer les modifications. Cliquez sur 'Quitter cette page' pour annuler toutes les modifications non enregistrées.", "DE.Controllers.Main.loadFontsTextText": "Chargement des données...", "DE.Controllers.Main.loadFontsTitleText": "Chargement des données", diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index f8794b990..7e563df19 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -119,7 +119,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onThumbnailsShow', _.bind(this.onThumbnailsShow, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this)); /** coauthoring begin **/ if (this.mode.canCoAuthoring) { @@ -344,7 +344,7 @@ define([ // this.api.asc_selectSearchingResults(false); }, - onApiServerDisconnect: function() { + onApiServerDisconnect: function(disableDownload) { this.mode.isEdit = false; this.leftMenu.close(); @@ -354,7 +354,7 @@ define([ /** coauthoring end **/ this.leftMenu.btnPlugins.setDisabled(true); - this.leftMenu.getMenu('file').setMode({isDisconnected: true}); + this.leftMenu.getMenu('file').setMode({isDisconnected: true, disableDownload: !!disableDownload}); if ( this.dlgSearch ) { this.leftMenu.btnSearch.toggle(false, true); this.dlgSearch['hide'](); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index baa3c69c8..57efa7dfc 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -963,7 +963,7 @@ define([ break; case Asc.c_oAscError.ID.CoAuthoringDisconnect: - config.msg = (this.appOptions.isEdit) ? this.errorCoAuthoringDisconnect : this.errorViewerDisconnect; + config.msg = this.errorViewerDisconnect; break; case Asc.c_oAscError.ID.ConvertationPassword: @@ -1779,7 +1779,7 @@ define([ textNoLicenseTitle: 'ONLYOFFICE open source version', warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.', textContactUs: 'Contact sales', - errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.', + errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.', warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index a7062bf86..0db6a057b 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -278,7 +278,7 @@ define([ this.api.asc_registerCallback('asc_onCanUnGroup', _.bind(this.onApiCanUnGroup, this)); this.api.asc_registerCallback('asc_onPresentationSize', _.bind(this.onApiPageSize, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); @@ -684,8 +684,8 @@ define([ this.toolbar.lockToolbar(PE.enumLock.themeLock, false, {array: [this.toolbar.btnColorSchemas]}); }, - onApiCoAuthoringDisconnect: function() { - this.toolbar.setMode({isDisconnected:true}); + onApiCoAuthoringDisconnect: function(disableDownload) { + this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload}); this.editMode = false; }, diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index 46b94f94b..da463c62d 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -212,6 +212,7 @@ define([ applyMode: function() { this.items[5][this.mode.canPrint?'show':'hide'](); this.items[6][(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); + this.items[6].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); this.items[7][this.mode.canOpenRecent?'show':'hide'](); this.items[8][this.mode.canCreateNew?'show':'hide'](); this.items[8].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide'](); @@ -258,7 +259,10 @@ define([ if (mode.isDisconnected) { this.mode.canEdit = this.mode.isEdit = false; this.mode.canOpenRecent = this.mode.canCreateNew = false; + this.mode.isDisconnected = mode.isDisconnected; this.mode.canRename = false; + this.mode.canPrint = false; + this.mode.canDownload = false; } else { this.mode = mode; } diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index f9c837390..7f2ee762c 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1287,7 +1287,7 @@ define([ this.mnuitemHideTitleBar.hide(); } - this.lockToolbar(PE.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]}); + this.lockToolbar(PE.enumLock.cantPrint, !mode.canPrint || mode.disableDownload, {array: [this.btnPrint]}); }, changeViewMode: function(item, compact) { diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index d44929f8b..7f5687b99 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -135,7 +135,7 @@ "PE.Controllers.Main.errorUpdateVersion": "The file version has been changed. The page will be reloaded.", "PE.Controllers.Main.errorUserDrop": "The file cannot be accessed right now.", "PE.Controllers.Main.errorUsersExceed": "The number of users allowed by the pricing plan was exceeded", - "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "PE.Controllers.Main.leavePageText": "You have unsaved changes in this presentation. Click \"Stay on This Page\", then \"Save\" to save them. Click \"Leave This Page\" to discard all the unsaved changes.", "PE.Controllers.Main.loadFontsTextText": "Loading data...", "PE.Controllers.Main.loadFontsTitleText": "Loading Data", diff --git a/apps/presentationeditor/main/locale/es.json b/apps/presentationeditor/main/locale/es.json index 9fbd8f50c..21a2fe207 100644 --- a/apps/presentationeditor/main/locale/es.json +++ b/apps/presentationeditor/main/locale/es.json @@ -123,7 +123,7 @@ "PE.Controllers.Main.errorUpdateVersion": "Se ha cambiado la versión del archivo. La página será actualizada.", "PE.Controllers.Main.errorUserDrop": "No se puede acceder al archivo ahora.", "PE.Controllers.Main.errorUsersExceed": "El número de usuarios permitido según su plan de precios fue excedido", - "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "PE.Controllers.Main.leavePageText": "Hay cambios no guardados en esta presentación. Pulse \"Permanecer en esta página\", después \"Guardar\" para guardadarlos. Pulse \"Abandonar esta página\" para descartar todos los cambios no guardados.", "PE.Controllers.Main.loadFontsTextText": "Cargando datos...", "PE.Controllers.Main.loadFontsTitleText": "Cargando datos", diff --git a/apps/presentationeditor/main/locale/fr.json b/apps/presentationeditor/main/locale/fr.json index 406607cd3..7201bf8a1 100644 --- a/apps/presentationeditor/main/locale/fr.json +++ b/apps/presentationeditor/main/locale/fr.json @@ -123,7 +123,7 @@ "PE.Controllers.Main.errorUpdateVersion": "La version du fichier a été changée. La page sera rechargée.", "PE.Controllers.Main.errorUserDrop": "Impossible d'accéder au fichier", "PE.Controllers.Main.errorUsersExceed": "Le nombre d'utilisateurs autorisés par le plan tarifaire a été dépassé", - "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "PE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "PE.Controllers.Main.leavePageText": "Vous avez des modifications non enregistrées dans cette présentation. Cliquez sur \"Rester sur cette page\", ensuite sur \"Enregistrer\" pour enregistrer les modifications. Cliquez sur \"Quitter cette page\" pour annuler toutes les modifications non enregistrées.", "PE.Controllers.Main.loadFontsTextText": "Chargement des données...", "PE.Controllers.Main.loadFontsTitleText": "Chargement des données", diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index e5482dcbc..3bc0df158 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -127,7 +127,7 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onRenameCellTextEnd', _.bind(this.onRenameText, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiServerDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiServerDisconnect, this)); /** coauthoring begin **/ if (this.mode.canCoAuthoring) { @@ -509,7 +509,7 @@ define([ } }, - onApiServerDisconnect: function() { + onApiServerDisconnect: function(disableDownload) { this.mode.isEdit = false; this.leftMenu.close(); @@ -519,7 +519,7 @@ define([ /** coauthoring end **/ this.leftMenu.btnPlugins.setDisabled(true); - this.leftMenu.getMenu('file').setMode({isDisconnected: true}); + this.leftMenu.getMenu('file').setMode({isDisconnected: true, disableDownload: !!disableDownload}); if ( this.dlgSearch ) { this.leftMenu.btnSearch.toggle(false, true); this.dlgSearch['hide'](); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 5f64f6fdb..ba4b3cc2b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1076,7 +1076,7 @@ define([ break; case Asc.c_oAscError.ID.CoAuthoringDisconnect: - config.msg = (this.appOptions.isEdit) ? this.errorCoAuthoringDisconnect : this.errorViewerDisconnect; + config.msg = this.errorViewerDisconnect; break; case Asc.c_oAscError.ID.ConvertationPassword: @@ -1969,7 +1969,7 @@ define([ warnNoLicense: 'You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.', textContactUs: 'Contact sales', confirmPutMergeRange: 'The source data contains merged cells.
They will be unmerged before they are pasted into the table.', - errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.', + errorViewerDisconnect: 'Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.', warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index bd2b39d10..5129c25fc 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -269,7 +269,7 @@ define([ this.api.asc_registerCallback('asc_onInitTablePictures', _.bind(this.onApiInitTableTemplates, this)); this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); @@ -1374,8 +1374,8 @@ define([ window.styles_loaded = true; }, - onApiCoAuthoringDisconnect: function() { - this.toolbar.setMode({isDisconnected:true}); + onApiCoAuthoringDisconnect: function(disableDownload) { + this.toolbar.setMode({isDisconnected:true, disableDownload: !!disableDownload}); this.editMode = false; }, diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index 69577f294..ff7b248c5 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -198,6 +198,7 @@ define([ applyMode: function() { this.items[5][this.mode.canPrint?'show':'hide'](); this.items[6][(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide'](); + this.items[6].$el.find('+.devider')[!this.mode.isDisconnected?'show':'hide'](); this.items[7][this.mode.canOpenRecent?'show':'hide'](); this.items[8][this.mode.canCreateNew?'show':'hide'](); this.items[8].$el.find('+.devider')[this.mode.canCreateNew?'show':'hide'](); @@ -242,7 +243,10 @@ define([ if (mode.isDisconnected) { this.mode.canEdit = this.mode.isEdit = false; this.mode.canOpenRecent = this.mode.canCreateNew = false; + this.mode.isDisconnected = mode.isDisconnected; this.mode.canRename = false; + this.mode.canPrint = false; + this.mode.canDownload = false; } else { this.mode = mode; } diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 5d4f096c6..d9afcc7a3 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1684,6 +1684,7 @@ define([ this.lockToolbar( SSE.enumLock.lostConnect, true ); this.lockToolbar( SSE.enumLock.lostConnect, true, {array:[this.btnEditChart,this.btnUndo,this.btnRedo,this.btnOpenDocument,this.btnNewDocument,this.btnSave]} ); + this.lockToolbar(SSE.enumLock.cantPrint, !mode.canPrint || mode.disableDownload, {array: [this.btnPrint]}); } else { this.mode = mode; diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index c5900342b..05ed1e1ee 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -173,7 +173,7 @@ "SSE.Controllers.Main.errorUpdateVersion": "The file version has been changed. The page will be reloaded.", "SSE.Controllers.Main.errorUserDrop": "The file cannot be accessed right now.", "SSE.Controllers.Main.errorUsersExceed": "The number of users allowed by the pricing plan was exceeded", - "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "SSE.Controllers.Main.errorWrongBracketsCount": "An error in the entered formula.
Wrong number of brackets is used.", "SSE.Controllers.Main.errorWrongOperator": "An error in the entered formula. Wrong operator is used.
Please correct the error or use the Esc button to cancel the formula editing.", "SSE.Controllers.Main.leavePageText": "You have unsaved changes in this spreadsheet. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.", diff --git a/apps/spreadsheeteditor/main/locale/es.json b/apps/spreadsheeteditor/main/locale/es.json index 891234a3a..edc45f3ef 100644 --- a/apps/spreadsheeteditor/main/locale/es.json +++ b/apps/spreadsheeteditor/main/locale/es.json @@ -167,7 +167,7 @@ "SSE.Controllers.Main.errorUpdateVersion": "Se ha cambiado la versión del archivo. La página será actualizada.", "SSE.Controllers.Main.errorUserDrop": "No se puede acceder al archivo ahora.", "SSE.Controllers.Main.errorUsersExceed": "El número de usuarios permitido según su plan de precios fue excedido", - "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "SSE.Controllers.Main.errorWrongBracketsCount": "Un error en la fórmula introducida.
Número incorrecto de corchetes es usado.", "SSE.Controllers.Main.errorWrongOperator": "Un error en la fórmula introducida.Operador inválido es usado.
Por favor, corrija el error o utilice el botón Esc para cancelar la edición de fórmulas.", "SSE.Controllers.Main.leavePageText": "Usted tiene cambios no guardados en esta hoja de cálculo. Haga clic en 'Permanecer en esta página', después 'Guardar' para guardarlos. Haga clic en 'Abandonar esta página' para descartar todos los cambios no guardados.", diff --git a/apps/spreadsheeteditor/main/locale/fr.json b/apps/spreadsheeteditor/main/locale/fr.json index 33baf2931..49a50d198 100644 --- a/apps/spreadsheeteditor/main/locale/fr.json +++ b/apps/spreadsheeteditor/main/locale/fr.json @@ -167,7 +167,7 @@ "SSE.Controllers.Main.errorUpdateVersion": "La version du fichier a été changée. La page sera rechargée.", "SSE.Controllers.Main.errorUserDrop": "Impossible d'accéder au fichier", "SSE.Controllers.Main.errorUsersExceed": "Le nombre d'utilisateurs autorisés par le plan tarifaire a été dépassé", - "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download until the connection is restored.", + "SSE.Controllers.Main.errorViewerDisconnect": "Connection is lost. You can still view the document,
but will not be able to download or print until the connection is restored.", "SSE.Controllers.Main.errorWrongBracketsCount": "Une erreur dans la formule entrée.
Nombre utilisé entre parenthèses est incorrect.", "SSE.Controllers.Main.errorWrongOperator": "Une erreur dans la formule entrée.
Opérateur utilisé est incorrect.
Veuillez corriger l'erreur ou utilisez le bouton Esc pour annuler l'édition de formule.", "SSE.Controllers.Main.leavePageText": "Vous avez des modifications non enregistrées dans cette feuille de calcul. Cliquez sur 'Rester sur cette page ' ensuite 'Enregistrer' pour les enregistrer. Cliquez sur 'Quitter cette page' pour annuler toutes les modifications non enregistrées.", From f59b72e9ac1a221cd726d5a1a900b9f118f39796 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 12 Oct 2016 18:38:10 +0300 Subject: [PATCH 09/29] [DE] [SSE] Init shape settings in the right panel before first opening. --- apps/documenteditor/main/app/controller/Main.js | 4 ++-- apps/documenteditor/main/app/controller/RightMenu.js | 1 + apps/documenteditor/main/app/view/ChartSettings.js | 5 ++--- apps/documenteditor/main/app/view/HeaderFooterSettings.js | 5 ++--- apps/documenteditor/main/app/view/ImageSettings.js | 5 ++--- apps/documenteditor/main/app/view/MailMergeSettings.js | 6 +++--- apps/documenteditor/main/app/view/ParagraphSettings.js | 5 ++--- apps/documenteditor/main/app/view/ShapeSettings.js | 2 +- apps/documenteditor/main/app/view/TableSettings.js | 2 +- apps/documenteditor/main/app/view/TextArtSettings.js | 2 +- apps/spreadsheeteditor/main/app/controller/Main.js | 3 ++- apps/spreadsheeteditor/main/app/controller/RightMenu.js | 1 + apps/spreadsheeteditor/main/app/view/ChartSettings.js | 5 ++--- apps/spreadsheeteditor/main/app/view/ImageSettings.js | 5 ++--- apps/spreadsheeteditor/main/app/view/ParagraphSettings.js | 5 ++--- apps/spreadsheeteditor/main/app/view/ShapeSettings.js | 2 +- apps/spreadsheeteditor/main/app/view/TableSettings.js | 6 +++--- apps/spreadsheeteditor/main/app/view/TextArtSettings.js | 2 +- 18 files changed, 31 insertions(+), 35 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index ce3302791..1171d9962 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -872,12 +872,12 @@ define([ documentHolderController.getView('DocumentHolder').createDelayedElements(); me.loadLanguages(); - rightmenuController.createDelayedElements(); - var shapes = me.api.asc_getPropertyEditorShapes(); if (shapes) me.fillAutoShapes(shapes[0], shapes[1]); + rightmenuController.createDelayedElements(); + me.updateThemeColors(); toolbarController.activateControls(); if (me.needToUpdateVersion) diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index 8508b08a1..a02320a16 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -269,6 +269,7 @@ define([ } if (this.editMode && this.api) { + this.rightmenu.shapeSettings.createDelayedElements(); var selectedElements = this.api.getSelectedElements(); if (selectedElements.length>0) { var open = Common.localStorage.getItem("de-hide-right-settings"); diff --git a/apps/documenteditor/main/app/view/ChartSettings.js b/apps/documenteditor/main/app/view/ChartSettings.js index a1d7a1ba8..1eba1e243 100644 --- a/apps/documenteditor/main/app/view/ChartSettings.js +++ b/apps/documenteditor/main/app/view/ChartSettings.js @@ -105,10 +105,8 @@ define([ }, ChangeSettings: function(props) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); @@ -307,6 +305,7 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.updateMetricUnit(); + this._initSettings = false; }, _ChartWrapStyleChanged: function(style) { diff --git a/apps/documenteditor/main/app/view/HeaderFooterSettings.js b/apps/documenteditor/main/app/view/HeaderFooterSettings.js index 233f29130..937a8be04 100644 --- a/apps/documenteditor/main/app/view/HeaderFooterSettings.js +++ b/apps/documenteditor/main/app/view/HeaderFooterSettings.js @@ -94,10 +94,8 @@ define([ }, ChangeSettings: function(prop) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); @@ -244,6 +242,7 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.updateMetricUnit(); + this._initSettings = false; }, setLocked: function (locked) { diff --git a/apps/documenteditor/main/app/view/ImageSettings.js b/apps/documenteditor/main/app/view/ImageSettings.js index 6f0cb29d5..0223fe7fd 100644 --- a/apps/documenteditor/main/app/view/ImageSettings.js +++ b/apps/documenteditor/main/app/view/ImageSettings.js @@ -182,13 +182,12 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.updateMetricUnit(); + this._initSettings = false; }, ChangeSettings: function(props) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); diff --git a/apps/documenteditor/main/app/view/MailMergeSettings.js b/apps/documenteditor/main/app/view/MailMergeSettings.js index 4ece50e2e..256669a41 100644 --- a/apps/documenteditor/main/app/view/MailMergeSettings.js +++ b/apps/documenteditor/main/app/view/MailMergeSettings.js @@ -380,13 +380,13 @@ define([ this.cmbMergeTo.setValue(this._arrMergeSrc[0].value); } } + + this._initSettings = false; }, ChangeSettings: function(props) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedControls(); - this._initSettings = false; - } this.disableInsertControls(this._locked); diff --git a/apps/documenteditor/main/app/view/ParagraphSettings.js b/apps/documenteditor/main/app/view/ParagraphSettings.js index b9ce88807..c79b66775 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettings.js +++ b/apps/documenteditor/main/app/view/ParagraphSettings.js @@ -276,10 +276,8 @@ define([ }, ChangeSettings: function(prop) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); this.hideTextOnlySettings(this.isChart); @@ -397,6 +395,7 @@ define([ createDelayedElements: function() { this.UpdateThemeColors(); this.updateMetricUnit(); + this._initSettings = false; }, openAdvancedSettings: function(e) { diff --git a/apps/documenteditor/main/app/view/ShapeSettings.js b/apps/documenteditor/main/app/view/ShapeSettings.js index 9085b782d..0e13335b9 100644 --- a/apps/documenteditor/main/app/view/ShapeSettings.js +++ b/apps/documenteditor/main/app/view/ShapeSettings.js @@ -764,7 +764,6 @@ define([ if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; if (props && props.get_ShapeProperties()) { @@ -1450,6 +1449,7 @@ define([ this.fillAutoShapes(); this.UpdateThemeColors(); + this._initSettings = false; }, onInitStandartTextures: function(texture) { diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index 2a5a4f7db..826da4c1a 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -423,12 +423,12 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.UpdateThemeColors(); + this._initSettings = false; }, ChangeSettings: function(props) { if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; this.disableControls(this._locked); diff --git a/apps/documenteditor/main/app/view/TextArtSettings.js b/apps/documenteditor/main/app/view/TextArtSettings.js index 65f6a32e8..37d395a23 100644 --- a/apps/documenteditor/main/app/view/TextArtSettings.js +++ b/apps/documenteditor/main/app/view/TextArtSettings.js @@ -515,7 +515,6 @@ define([ if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; if (props && props.get_ShapeProperties() && props.get_ShapeProperties().get_TextArtProperties()) { @@ -965,6 +964,7 @@ define([ this.createDelayedControls(); this.UpdateThemeColors(); this.fillTransform(this.api.asc_getPropertyEditorTextArts()); + this._initSettings = false; }, fillTextArt: function() { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index ba4b3cc2b..5bc7ca149 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -646,7 +646,6 @@ define([ documentHolderView.createDelayedElements(); toolbarController.createDelayedElements(); - rightmenuController.createDelayedElements(); if (!me.appOptions.isEditMailMerge && !me.appOptions.isEditDiagram) { var shapes = me.api.asc_getPropertyEditorShapes(); @@ -657,6 +656,8 @@ define([ me.updateThemeColors(); } + rightmenuController.createDelayedElements(); + me.api.asc_registerCallback('asc_onSaveUrl', _.bind(me.onSaveUrl, me)); me.api.asc_registerCallback('asc_onDocumentModifiedChanged', _.bind(me.onDocumentModifiedChanged, me)); me.api.asc_registerCallback('asc_onDocumentCanSaveChanged', _.bind(me.onDocumentCanSaveChanged, me)); diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index dc61d8f92..f318d6127 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -266,6 +266,7 @@ define([ this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onFocusObject, this)); this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onSelectionChanged, this)); this.api.asc_registerCallback('asc_doubleClickOnObject', _.bind(this.onDoubleClickOnObject, this)); + this.rightmenu.shapeSettings.createDelayedElements(); this.onSelectionChanged(this.api.asc_getCellInfo()); } }, diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 5d05d781a..d4c8f019e 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -102,10 +102,8 @@ define([ }, ChangeSettings: function(props) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); @@ -316,6 +314,7 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.updateMetricUnit(); + this._initSettings = false; }, onWidthChange: function(field, newValue, oldValue, eOpts){ diff --git a/apps/spreadsheeteditor/main/app/view/ImageSettings.js b/apps/spreadsheeteditor/main/app/view/ImageSettings.js index 8ce56786f..e2e8c4799 100644 --- a/apps/spreadsheeteditor/main/app/view/ImageSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ImageSettings.js @@ -193,13 +193,12 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.updateMetricUnit(); + this._initSettings = false; }, ChangeSettings: function(props) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); diff --git a/apps/spreadsheeteditor/main/app/view/ParagraphSettings.js b/apps/spreadsheeteditor/main/app/view/ParagraphSettings.js index 5f44e337c..d3192c21d 100644 --- a/apps/spreadsheeteditor/main/app/view/ParagraphSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ParagraphSettings.js @@ -177,10 +177,8 @@ define([ }, ChangeSettings: function(prop) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); @@ -328,6 +326,7 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.updateMetricUnit(); + this._initSettings = false; }, openAdvancedSettings: function(e) { diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index 11aa984ca..28ebe0db4 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -698,7 +698,6 @@ define([ ChangeSettings: function(props) { if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; if (this.imgprops==null) this.imgprops = new Asc.asc_CImgProperty(); @@ -1336,6 +1335,7 @@ define([ this.fillAutoShapes(); this.UpdateThemeColors(); + this._initSettings = false; }, onInitStandartTextures: function(texture) { diff --git a/apps/spreadsheeteditor/main/app/view/TableSettings.js b/apps/spreadsheeteditor/main/app/view/TableSettings.js index 8dd4b2bf8..bafa46c25 100644 --- a/apps/spreadsheeteditor/main/app/view/TableSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TableSettings.js @@ -249,13 +249,13 @@ define([ }, this)); this.btnEdit.menu.on('item:click', _.bind(this.onEditClick, this)); this.lockedControls.push(this.btnEdit); + + this._initSettings = false; }, ChangeSettings: function(props) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedControls(); - this._initSettings = false; - } this.disableControls(this._locked); diff --git a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js index 48c5c1978..914ed9caf 100644 --- a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js @@ -664,7 +664,6 @@ define([ if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; if (props && props.asc_getShapeProperties() && props.asc_getShapeProperties().get_TextArtProperties()) { @@ -1310,6 +1309,7 @@ define([ this.UpdateThemeColors(); this.fillTransform(this.api.asc_getPropertyEditorTextArts()); + this._initSettings = false; }, onInitStandartTextures: function(texture) { From ee13c7a3f3819982740645bd7dbb9fae683e40a5 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 13 Oct 2016 11:40:59 +0300 Subject: [PATCH 10/29] [DE] Fix Bug 33038. --- apps/documenteditor/main/app/controller/Main.js | 6 +++++- apps/documenteditor/main/app/controller/Toolbar.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 1171d9962..04d46adc4 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -520,7 +520,11 @@ define([ toolbarView.btnInsertShape.toggle(false, false); toolbarView.btnInsertText.toggle(false, false); } - + if (this.appOptions.isEdit && toolbarView && toolbarView.btnHighlightColor.pressed && + ( !_.isObject(arguments[1]) || arguments[1].id !== 'id-toolbar-btn-highlight')) { + this.api.SetMarkerFormat(false); + toolbarView.btnHighlightColor.toggle(false, false); + } application.getController('DocumentHolder').getView('DocumentHolder').focus(); if (this.api) { diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index a07326226..9e62acba4 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2554,7 +2554,7 @@ define([ me.api.SetMarkerFormat(true, true, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16)); } - Common.NotificationCenter.trigger('edit:complete', me.toolbar); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnHighlightColor); Common.component.Analytics.trackEvent('ToolBar', 'Highlight Color'); }, From 0817331b326529ef07037fdfeb7f305adb85ecd9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 13 Oct 2016 13:45:06 +0300 Subject: [PATCH 11/29] [SSE] Bug 33196. --- apps/spreadsheeteditor/main/app/controller/Main.js | 7 ++++++- apps/spreadsheeteditor/main/locale/en.json | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 5bc7ca149..d624294d9 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1145,6 +1145,10 @@ define([ config.msg = this.errorFrmlWrongReferences; break; + case Asc.c_oAscError.ID.CopyMultiselectAreaError: + config.msg = this.errorCopyMultiselectArea; + break; + default: config.msg = this.errorDefaultMessage.replace('%1', id); break; @@ -1974,7 +1978,8 @@ define([ warnLicenseExp: 'Your license has expired.
Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', - saveErrorText: 'An error has occurred while saving the file' + saveErrorText: 'An error has occurred while saving the file', + errorCopyMultiselectArea: 'This command cannot be used with multiple selections.
Select a single range and try again.' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 05ed1e1ee..167a1dca4 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -145,6 +145,7 @@ "SSE.Controllers.Main.errorBadImageUrl": "Image URL is incorrect", "SSE.Controllers.Main.errorCoAuthoringDisconnect": "Server connection lost. The document cannot be edited right now.", "SSE.Controllers.Main.errorConnectToServer": "The document could not be saved. Please check connection settings or contact your administrator.
When you click the 'OK' button, you will be prompted to download the document.

Find more information about connecting Document Server here", + "SSE.Controllers.Main.errorCopyMultiselectArea": "This command cannot be used with multiple selections.
Select a single range and try again.", "SSE.Controllers.Main.errorCountArg": "An error in the entered formula.
Incorrect number of arguments is used.", "SSE.Controllers.Main.errorCountArgExceed": "An error in the entered formula.
Number of arguments is exceeded.", "SSE.Controllers.Main.errorCreateDefName": "The existing named ranges cannot be edited and the new ones cannot be created
at the moment as some of them are being edited.", From 488e7d4f3237177ee6d9960be7d5004d42db5d9f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 13 Oct 2016 14:08:52 +0300 Subject: [PATCH 12/29] [DE] Align layout of history panel and file menu items. --- apps/common/main/resources/less/history.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/common/main/resources/less/history.less b/apps/common/main/resources/less/history.less index 6b5e10621..340c64b37 100644 --- a/apps/common/main/resources/less/history.less +++ b/apps/common/main/resources/less/history.less @@ -5,7 +5,7 @@ #history-header { position: absolute; - height: 45px; + height: 53px; left: 0; top: 0; right: 0; @@ -14,7 +14,7 @@ #history-btn-back { height: 27px; - margin-top: 8px; + margin-top: 15px; padding-top: 4px; padding-left: 20px; font-size: 13px; @@ -52,7 +52,7 @@ #history-list { height: 100%; overflow: hidden; - padding: 45px 0; + padding: 53px 0 45px 0; .item { display: block; From 0a4a5c9aeb84f2351b432d1a9123cc77df11ed80 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 13 Oct 2016 16:14:11 +0300 Subject: [PATCH 13/29] Highlight document name when it can be renamed (when mouse is over document caption). --- apps/common/main/resources/less/header.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/common/main/resources/less/header.less b/apps/common/main/resources/less/header.less index 16033b322..457b1a24b 100644 --- a/apps/common/main/resources/less/header.less +++ b/apps/common/main/resources/less/header.less @@ -87,7 +87,7 @@ display: inline-block; padding: 2px 8px; - &.renamed { + &.renamed:hover { background-color: @app-header-bg-color-dark; } } From 3e5fff37e8dfe175f803c4d5c7e97fcfe3cbeec2 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 14 Oct 2016 13:48:04 +0300 Subject: [PATCH 14/29] [PE] Delay rendering controls on the right panel (shape, textart settings) + init shape settings in the right panel before first opening.. --- .../main/app/controller/Main.js | 7 +- .../main/app/controller/RightMenu.js | 1 + .../main/app/view/ChartSettings.js | 5 +- .../main/app/view/ImageSettings.js | 5 +- .../main/app/view/ParagraphSettings.js | 5 +- .../main/app/view/ShapeSettings.js | 690 ++++++++-------- .../main/app/view/SlideSettings.js | 2 +- .../main/app/view/TableSettings.js | 4 +- .../main/app/view/TextArtSettings.js | 741 +++++++++--------- 9 files changed, 726 insertions(+), 734 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 57efa7dfc..8bdaffc0d 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -655,14 +655,15 @@ define([ documentHolderController.getView('DocumentHolder').createDelayedElements(); - rightmenuController.createDelayedElements(); - - me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onFocusObject, me)); me.api.asc_registerCallback('asc_onUpdateLayout', _.bind(me.fillLayoutsStore, me)); // slide layouts loading me.updateThemeColors(); var shapes = me.api.asc_getPropertyEditorShapes(); if (shapes) me.fillAutoShapes(shapes[0], shapes[1]); + rightmenuController.createDelayedElements(); + + me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onFocusObject, me)); + me.fillTextArt(me.api.asc_getTextArtPreviews()); toolbarController.activateControls(); if (me.needToUpdateVersion) diff --git a/apps/presentationeditor/main/app/controller/RightMenu.js b/apps/presentationeditor/main/app/controller/RightMenu.js index cc4919e67..bd5671df8 100644 --- a/apps/presentationeditor/main/app/controller/RightMenu.js +++ b/apps/presentationeditor/main/app/controller/RightMenu.js @@ -245,6 +245,7 @@ define([ if (this.editMode && this.api) { this.api.asc_registerCallback('asc_doubleClickOnObject', _.bind(this.onDoubleClickOnObject, this)); + this.rightmenu.shapeSettings.createDelayedElements(); var selectedElements = this.api.getSelectedElements(); if (selectedElements.length>0) { var open = Common.localStorage.getItem("pe-hide-right-settings"); diff --git a/apps/presentationeditor/main/app/view/ChartSettings.js b/apps/presentationeditor/main/app/view/ChartSettings.js index 5a3a49866..9eb840695 100644 --- a/apps/presentationeditor/main/app/view/ChartSettings.js +++ b/apps/presentationeditor/main/app/view/ChartSettings.js @@ -100,10 +100,8 @@ define([ }, ChangeSettings: function(props) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); @@ -310,6 +308,7 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.updateMetricUnit(); + this._initSettings = false; }, setEditData: function() { diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js index ff78c2dbf..f434cae89 100644 --- a/apps/presentationeditor/main/app/view/ImageSettings.js +++ b/apps/presentationeditor/main/app/view/ImageSettings.js @@ -144,13 +144,12 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.updateMetricUnit(); + this._initSettings = false; }, ChangeSettings: function(props) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); diff --git a/apps/presentationeditor/main/app/view/ParagraphSettings.js b/apps/presentationeditor/main/app/view/ParagraphSettings.js index 5eb386e05..a23d2b7da 100644 --- a/apps/presentationeditor/main/app/view/ParagraphSettings.js +++ b/apps/presentationeditor/main/app/view/ParagraphSettings.js @@ -168,10 +168,8 @@ define([ }, ChangeSettings: function(prop) { - if (this._initSettings) { + if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - } this.disableControls(this._locked); @@ -321,6 +319,7 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.updateMetricUnit(); + this._initSettings = false; }, openAdvancedSettings: function(e) { diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index 0666b4e80..dc2414d3d 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -71,7 +71,6 @@ define([ }, initialize: function () { - var me = this; this._initSettings = true; this._originalProps = null; this._noApply = true; @@ -123,349 +122,6 @@ define([ this.render(); - this._arrFillSrc = [ - {displayValue: this.textColor, value: Asc.c_oAscFill.FILL_TYPE_SOLID}, - {displayValue: this.textGradientFill, value: Asc.c_oAscFill.FILL_TYPE_GRAD}, - {displayValue: this.textImageTexture, value: Asc.c_oAscFill.FILL_TYPE_BLIP}, - {displayValue: this.textPatternFill, value: Asc.c_oAscFill.FILL_TYPE_PATT}, - {displayValue: this.textNoFill, value: Asc.c_oAscFill.FILL_TYPE_NOFILL} - ]; - - this.cmbFillSrc = new Common.UI.ComboBox({ - el: $('#shape-combo-fill-src'), - cls: 'input-group-nr', - style: 'width: 100%;', - menuStyle: 'min-width: 190px;', - editable: false, - data: this._arrFillSrc - }); - this.cmbFillSrc.setValue(this._arrFillSrc[0].value); - this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this)); - this.fillControls.push(this.cmbFillSrc); - - this.btnBackColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - - this.btnBackColor.on('render:after', function(btn) { - me.colorsBack = new Common.UI.ThemeColorPalette({ - el: $('#shape-back-color-menu'), - value: 'transparent', - transparent: true - }); - me.colorsBack.on('select', _.bind(me.onColorsBackSelect, me)); - }); - this.btnBackColor.render( $('#shape-back-color-btn')); - this.btnBackColor.setColor('transparent'); - $(this.el).on('click', '#shape-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); - this.fillControls.push(this.btnBackColor); - - this.cmbPattern = new Common.UI.ComboDataView({ - itemWidth: 28, - itemHeight: 28, - menuMaxHeight: 300, - enableKeyEvents: true, - cls: 'combo-pattern' - }); - this.cmbPattern.menuPicker.itemTemplate = this.cmbPattern.fieldPicker.itemTemplate = _.template([ - '
', - '', - '
' - ].join('')); - this.cmbPattern.render($('#shape-combo-pattern')); - this.cmbPattern.openButton.menu.cmpEl.css({ - 'min-width': 178, - 'max-width': 178 - }); - this.cmbPattern.on('click', _.bind(this.onPatternSelect, this)); - this.cmbPattern.openButton.menu.on('show:after', function () { - me.cmbPattern.menuPicker.scroller.update({alwaysVisibleY: true}); - }); - this.fillControls.push(this.cmbPattern); - - this.btnFGColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - - this.btnFGColor.on('render:after', function(btn) { - me.colorsFG = new Common.UI.ThemeColorPalette({ - el: $('#shape-foreground-color-menu'), - value: '000000' - }); - me.colorsFG.on('select', _.bind(me.onColorsFGSelect, me)); - }); - this.btnFGColor.render( $('#shape-foreground-color-btn')); - this.btnFGColor.setColor('000000'); - $(this.el).on('click', '#shape-foreground-color-new', _.bind(this.addNewColor, this, this.colorsFG, this.btnFGColor)); - this.fillControls.push(this.btnFGColor); - - this.btnBGColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - - this.btnBGColor.on('render:after', function(btn) { - me.colorsBG = new Common.UI.ThemeColorPalette({ - el: $('#shape-background-color-menu'), - value: 'ffffff' - }); - me.colorsBG.on('select', _.bind(me.onColorsBGSelect, me)); - }); - this.btnBGColor.render( $('#shape-background-color-btn')); - this.btnBGColor.setColor('ffffff'); - $(this.el).on('click', '#shape-background-color-new', _.bind(this.addNewColor, this, this.colorsBG, this.btnBGColor)); - this.fillControls.push(this.btnBGColor); - - this.btnInsertFromFile = new Common.UI.Button({ - el: $('#shape-button-from-file') - }); - this.fillControls.push(this.btnInsertFromFile); - - this.btnInsertFromUrl = new Common.UI.Button({ - el: $('#shape-button-from-url') - }); - this.fillControls.push(this.btnInsertFromUrl); - - this.btnInsertFromFile.on('click', _.bind(function(btn){ - if (this.api) this.api.ChangeShapeImageFromFile(); - this.fireEvent('editcomplete', this); - }, this)); - this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this)); - - this._arrFillType = [ - {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH}, - {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE} - ]; - - this.cmbFillType = new Common.UI.ComboBox({ - el: $('#shape-combo-fill-type'), - cls: 'input-group-nr', - menuStyle: 'min-width: 90px;', - editable: false, - data: this._arrFillType - }); - this.cmbFillType.setValue(this._arrFillType[0].value); - this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this)); - this.fillControls.push(this.cmbFillType); - - this.btnTexture = new Common.UI.ComboBox({ - el: $('#shape-combo-fill-texture'), - template: _.template([ - '' - ].join('')) - }); - this.textureMenu = new Common.UI.Menu({ - items: [ - { template: _.template('
') } - ] - }); - this.textureMenu.render($('#shape-combo-fill-texture')); - this.fillControls.push(this.btnTexture); - - this.numTransparency = new Common.UI.MetricSpinner({ - el: $('#shape-spin-transparency'), - step: 1, - width: 62, - value: '100 %', - defaultUnit : "%", - maxValue: 100, - minValue: 0 - }); - this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); - this.fillControls.push(this.numTransparency); - - this.sldrTransparency = new Common.UI.SingleSlider({ - el: $('#shape-slider-transparency'), - width: 75, - minValue: 0, - maxValue: 100, - value: 100 - }); - this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); - this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); - this.fillControls.push(this.sldrTransparency); - - this.lblTransparencyStart = $(this.el).find('#shape-lbl-transparency-start'); - this.lblTransparencyEnd = $(this.el).find('#shape-lbl-transparency-end'); - - this._arrGradType = [ - {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR}, - {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH} - ]; - - this.cmbGradType = new Common.UI.ComboBox({ - el: $('#shape-combo-grad-type'), - cls: 'input-group-nr', - menuStyle: 'min-width: 90px;', - editable: false, - data: this._arrGradType - }); - this.cmbGradType.setValue(this._arrGradType[0].value); - this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this)); - this.fillControls.push(this.cmbGradType); - - this._viewDataLinear = [ - { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' }, - { offsetx: 50, offsety: 0, type:90, subtype:4, iconcls:'gradient-top'}, - { offsetx: 100, offsety: 0, type:135, subtype:5, iconcls:'gradient-right-top'}, - { offsetx: 0, offsety: 50, type:0, subtype:6, iconcls:'gradient-left', cls: 'item-gradient-separator', selected: true}, - { offsetx: 100, offsety: 50, type:180, subtype:1, iconcls:'gradient-right'}, - { offsetx: 0, offsety: 100, type:315, subtype:2, iconcls:'gradient-left-bottom'}, - { offsetx: 50, offsety: 100, type:270, subtype:3, iconcls:'gradient-bottom'}, - { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'} - ]; - - this._viewDataRadial = [ - { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'} - ]; - - this.btnDirection = new Common.UI.Button({ - cls : 'btn-large-dataview', - iconCls : 'item-gradient gradient-left', - menu : new Common.UI.Menu({ - style: 'min-width: 60px;', - menuAlign: 'tr-br', - items: [ - { template: _.template('
') } - ] - }) - }); - this.btnDirection.on('render:after', function(btn) { - me.mnuDirectionPicker = new Common.UI.DataView({ - el: $('#id-shape-menu-direction'), - parentMenu: btn.menu, - restoreHeight: 174, - store: new Common.UI.DataViewStore(me._viewDataLinear), - itemTemplate: _.template('
') - }); - }); - this.btnDirection.render($('#shape-button-direction')); - this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection)); - this.fillControls.push(this.btnDirection); - - this.btnGradColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - this.btnGradColor.on('render:after', function(btn) { - me.colorsGrad = new Common.UI.ThemeColorPalette({ - el: $('#shape-gradient-color-menu'), - value: '000000' - }); - me.colorsGrad.on('select', _.bind(me.onColorsGradientSelect, me)); - }); - this.btnGradColor.render( $('#shape-gradient-color-btn')); - this.btnGradColor.setColor('000000'); - $(this.el).on('click', '#shape-gradient-color-new', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor)); - this.fillControls.push(this.btnGradColor); - - this.sldrGradient = new Common.UI.MultiSliderGradient({ - el: $('#shape-slider-gradient'), - width: 125, - minValue: 0, - maxValue: 100, - values: [0, 100] - }); - this.sldrGradient.on('change', _.bind(this.onGradientChange, this)); - this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this)); - this.sldrGradient.on('thumbclick', function(cmp, index){ - me.GradColor.currentIdx = index; - var color = me.GradColor.colors[me.GradColor.currentIdx]; - me.btnGradColor.setColor(color); - me.colorsGrad.select(color,false); - }); - this.sldrGradient.on('thumbdblclick', function(cmp){ - me.btnGradColor.cmpEl.find('button').dropdown('toggle'); - }); - this.fillControls.push(this.sldrGradient); - - this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ - el: $('#shape-combo-border-size'), - style: "width: 93px;", - txtNoBorders: this.txtNoBorders - }) - .on('selected', _.bind(this.onBorderSizeSelect, this)) - .on('changed:before',_.bind(this.onBorderSizeChanged, this, true)) - .on('changed:after', _.bind(this.onBorderSizeChanged, this, false)) - .on('combo:blur', _.bind(this.onComboBlur, this, false)); - this.BorderSize = this.cmbBorderSize.store.at(2).get('value'); - this.cmbBorderSize.setValue(this.BorderSize); - this.lockedControls.push(this.cmbBorderSize); - - this.btnBorderColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - - this.btnBorderColor.on('render:after', function(btn) { - me.colorsBorder = new Common.UI.ThemeColorPalette({ - el: $('#shape-border-color-menu'), - value: '000000' - }); - me.colorsBorder.on('select', _.bind(me.onColorsBorderSelect, me)); - }); - this.btnBorderColor.render( $('#shape-border-color-btn')); - this.btnBorderColor.setColor('000000'); - $(this.el).on('click', '#shape-border-color-new', _.bind(this.addNewColor, this, this.colorsBorder, this.btnBorderColor)); - this.lockedControls.push(this.btnBorderColor); - - this.cmbBorderType = new Common.UI.ComboBorderType({ - el: $('#shape-combo-border-type'), - style: "width: 93px;", - menuStyle: 'min-width: 93px;' - }).on('selected', _.bind(this.onBorderTypeSelect, this)) - .on('combo:blur', _.bind(this.onComboBlur, this, false)); - this.BorderType = Asc.c_oDashType.solid; - this.cmbBorderType.setValue(this.BorderType); - this.lockedControls.push(this.cmbBorderType); - - this.btnChangeShape = new Common.UI.Button({ - cls: 'btn-icon-default', - iconCls: 'btn-change-shape', - menu : new Common.UI.Menu({ - menuAlign: 'tr-br', - cls: 'menu-shapes', - items: [] - }) - }); - this.btnChangeShape.render( $('#shape-btn-change')) ; - this.lockedControls.push(this.btnChangeShape); - - $(this.el).on('click', '#shape-advanced-link', _.bind(this.openAdvancedSettings, this)); - this.FillColorContainer = $('#shape-panel-color-fill'); this.FillImageContainer = $('#shape-panel-image-fill'); this.FillPatternContainer = $('#shape-panel-pattern-fill'); @@ -480,8 +136,6 @@ define([ el.html(this.template({ scope: this })); - - this.linkAdvanced = $('#shape-advanced-link'); }, setApi: function(api) { @@ -1024,7 +678,6 @@ define([ ChangeSettings: function(props) { if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; if (props) { @@ -1402,7 +1055,229 @@ define([ } }, + createDelayedControls: function() { + var me = this; + + this._arrFillSrc = [ + {displayValue: this.textColor, value: Asc.c_oAscFill.FILL_TYPE_SOLID}, + {displayValue: this.textGradientFill, value: Asc.c_oAscFill.FILL_TYPE_GRAD}, + {displayValue: this.textImageTexture, value: Asc.c_oAscFill.FILL_TYPE_BLIP}, + {displayValue: this.textPatternFill, value: Asc.c_oAscFill.FILL_TYPE_PATT}, + {displayValue: this.textNoFill, value: Asc.c_oAscFill.FILL_TYPE_NOFILL} + ]; + + this.cmbFillSrc = new Common.UI.ComboBox({ + el: $('#shape-combo-fill-src'), + cls: 'input-group-nr', + style: 'width: 100%;', + menuStyle: 'min-width: 190px;', + editable: false, + data: this._arrFillSrc + }); + this.cmbFillSrc.setValue(this._arrFillSrc[0].value); + this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this)); + this.fillControls.push(this.cmbFillSrc); + + this.cmbPattern = new Common.UI.ComboDataView({ + itemWidth: 28, + itemHeight: 28, + menuMaxHeight: 300, + enableKeyEvents: true, + cls: 'combo-pattern' + }); + this.cmbPattern.menuPicker.itemTemplate = this.cmbPattern.fieldPicker.itemTemplate = _.template([ + '
', + '', + '
' + ].join('')); + this.cmbPattern.render($('#shape-combo-pattern')); + this.cmbPattern.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbPattern.on('click', _.bind(this.onPatternSelect, this)); + this.cmbPattern.openButton.menu.on('show:after', function () { + me.cmbPattern.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + this.fillControls.push(this.cmbPattern); + + this.btnInsertFromFile = new Common.UI.Button({ + el: $('#shape-button-from-file') + }); + this.fillControls.push(this.btnInsertFromFile); + + this.btnInsertFromUrl = new Common.UI.Button({ + el: $('#shape-button-from-url') + }); + this.fillControls.push(this.btnInsertFromUrl); + + this.btnInsertFromFile.on('click', _.bind(function(btn){ + if (this.api) this.api.ChangeShapeImageFromFile(); + this.fireEvent('editcomplete', this); + }, this)); + this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this)); + + this._arrFillType = [ + {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH}, + {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE} + ]; + + this.cmbFillType = new Common.UI.ComboBox({ + el: $('#shape-combo-fill-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 90px;', + editable: false, + data: this._arrFillType + }); + this.cmbFillType.setValue(this._arrFillType[0].value); + this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this)); + this.fillControls.push(this.cmbFillType); + + this.numTransparency = new Common.UI.MetricSpinner({ + el: $('#shape-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0 + }); + this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.fillControls.push(this.numTransparency); + + this.sldrTransparency = new Common.UI.SingleSlider({ + el: $('#shape-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); + this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); + this.fillControls.push(this.sldrTransparency); + + this.lblTransparencyStart = $(this.el).find('#shape-lbl-transparency-start'); + this.lblTransparencyEnd = $(this.el).find('#shape-lbl-transparency-end'); + + this._arrGradType = [ + {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR}, + {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH} + ]; + + this.cmbGradType = new Common.UI.ComboBox({ + el: $('#shape-combo-grad-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 90px;', + editable: false, + data: this._arrGradType + }); + this.cmbGradType.setValue(this._arrGradType[0].value); + this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this)); + this.fillControls.push(this.cmbGradType); + + this._viewDataLinear = [ + { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' }, + { offsetx: 50, offsety: 0, type:90, subtype:4, iconcls:'gradient-top'}, + { offsetx: 100, offsety: 0, type:135, subtype:5, iconcls:'gradient-right-top'}, + { offsetx: 0, offsety: 50, type:0, subtype:6, iconcls:'gradient-left', cls: 'item-gradient-separator', selected: true}, + { offsetx: 100, offsety: 50, type:180, subtype:1, iconcls:'gradient-right'}, + { offsetx: 0, offsety: 100, type:315, subtype:2, iconcls:'gradient-left-bottom'}, + { offsetx: 50, offsety: 100, type:270, subtype:3, iconcls:'gradient-bottom'}, + { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'} + ]; + + this._viewDataRadial = [ + { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'} + ]; + + this.btnDirection = new Common.UI.Button({ + cls : 'btn-large-dataview', + iconCls : 'item-gradient gradient-left', + menu : new Common.UI.Menu({ + style: 'min-width: 60px;', + menuAlign: 'tr-br', + items: [ + { template: _.template('
') } + ] + }) + }); + this.btnDirection.on('render:after', function(btn) { + me.mnuDirectionPicker = new Common.UI.DataView({ + el: $('#id-shape-menu-direction'), + parentMenu: btn.menu, + restoreHeight: 174, + store: new Common.UI.DataViewStore(me._viewDataLinear), + itemTemplate: _.template('
') + }); + }); + this.btnDirection.render($('#shape-button-direction')); + this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection)); + this.fillControls.push(this.btnDirection); + + this.sldrGradient = new Common.UI.MultiSliderGradient({ + el: $('#shape-slider-gradient'), + width: 125, + minValue: 0, + maxValue: 100, + values: [0, 100] + }); + this.sldrGradient.on('change', _.bind(this.onGradientChange, this)); + this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this)); + this.sldrGradient.on('thumbclick', function(cmp, index){ + me.GradColor.currentIdx = index; + var color = me.GradColor.colors[me.GradColor.currentIdx]; + me.btnGradColor.setColor(color); + me.colorsGrad.select(color,false); + }); + this.sldrGradient.on('thumbdblclick', function(cmp){ + me.btnGradColor.cmpEl.find('button').dropdown('toggle'); + }); + this.fillControls.push(this.sldrGradient); + + this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ + el: $('#shape-combo-border-size'), + style: "width: 93px;", + txtNoBorders: this.txtNoBorders + }) + .on('selected', _.bind(this.onBorderSizeSelect, this)) + .on('changed:before',_.bind(this.onBorderSizeChanged, this, true)) + .on('changed:after', _.bind(this.onBorderSizeChanged, this, false)) + .on('combo:blur', _.bind(this.onComboBlur, this, false)); + this.BorderSize = this.cmbBorderSize.store.at(2).get('value'); + this.cmbBorderSize.setValue(this.BorderSize); + this.lockedControls.push(this.cmbBorderSize); + + this.cmbBorderType = new Common.UI.ComboBorderType({ + el: $('#shape-combo-border-type'), + style: "width: 93px;", + menuStyle: 'min-width: 93px;' + }).on('selected', _.bind(this.onBorderTypeSelect, this)) + .on('combo:blur', _.bind(this.onComboBlur, this, false)); + this.BorderType = Asc.c_oDashType.solid; + this.cmbBorderType.setValue(this.BorderType); + this.lockedControls.push(this.cmbBorderType); + + this.btnChangeShape = new Common.UI.Button({ + cls: 'btn-icon-default', + iconCls: 'btn-change-shape', + menu : new Common.UI.Menu({ + menuAlign: 'tr-br', + cls: 'menu-shapes', + items: [] + }) + }); + this.btnChangeShape.render( $('#shape-btn-change')) ; + this.lockedControls.push(this.btnChangeShape); + + this.linkAdvanced = $('#shape-advanced-link'); + $(this.el).on('click', '#shape-advanced-link', _.bind(this.openAdvancedSettings, this)); + }, + createDelayedElements: function() { + this.createDelayedControls(); + var global_hatch_menu_map = [ 0,1,3,2,4, 53,5,6,7,8, @@ -1434,14 +1309,33 @@ define([ this.PatternFillType = this.patternViewData[0].type; } - this.fillAutoShapes(); this.UpdateThemeColors(); + this._initSettings = false; }, onInitStandartTextures: function(texture) { var me = this; if (texture && texture.length>0){ + if (!this.btnTexture) { + this.btnTexture = new Common.UI.ComboBox({ + el: $('#shape-combo-fill-texture'), + template: _.template([ + '' + ].join('')) + }); + this.textureMenu = new Common.UI.Menu({ + items: [ + { template: _.template('
') } + ] + }); + this.textureMenu.render($('#shape-combo-fill-texture')); + this.fillControls.push(this.btnTexture); + } var texturearray = []; _.each(texture, function(item){ texturearray.push({ @@ -1521,6 +1415,104 @@ define([ }, UpdateThemeColors: function() { + if (!this.btnBackColor) { + this.btnBackColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnBackColor.render( $('#shape-back-color-btn')); + this.btnBackColor.setColor('transparent'); + this.fillControls.push(this.btnBackColor); + this.colorsBack = new Common.UI.ThemeColorPalette({ + el: $('#shape-back-color-menu'), + value: 'transparent', + transparent: true + }); + this.colorsBack.on('select', _.bind(this.onColorsBackSelect, this)); + $(this.el).on('click', '#shape-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); + + this.btnFGColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnFGColor.render( $('#shape-foreground-color-btn')); + this.btnFGColor.setColor('000000'); + this.fillControls.push(this.btnFGColor); + this.colorsFG = new Common.UI.ThemeColorPalette({ + el: $('#shape-foreground-color-menu'), + value: '000000' + }); + this.colorsFG.on('select', _.bind(this.onColorsFGSelect, this)); + $(this.el).on('click', '#shape-foreground-color-new', _.bind(this.addNewColor, this, this.colorsFG, this.btnFGColor)); + + this.btnBGColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnBGColor.render( $('#shape-background-color-btn')); + this.btnBGColor.setColor('ffffff'); + this.fillControls.push(this.btnBGColor); + this.colorsBG = new Common.UI.ThemeColorPalette({ + el: $('#shape-background-color-menu'), + value: 'ffffff' + }); + this.colorsBG.on('select', _.bind(this.onColorsBGSelect, this)); + $(this.el).on('click', '#shape-background-color-new', _.bind(this.addNewColor, this, this.colorsBG, this.btnBGColor)); + + this.btnGradColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnGradColor.render( $('#shape-gradient-color-btn')); + this.btnGradColor.setColor('000000'); + this.fillControls.push(this.btnGradColor); + this.colorsGrad = new Common.UI.ThemeColorPalette({ + el: $('#shape-gradient-color-menu'), + value: '000000' + }); + this.colorsGrad.on('select', _.bind(this.onColorsGradientSelect, this)); + $(this.el).on('click', '#shape-gradient-color-new', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor)); + + this.btnBorderColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnBorderColor.render( $('#shape-border-color-btn')); + this.btnBorderColor.setColor('000000'); + this.lockedControls.push(this.btnBorderColor); + this.colorsBorder = new Common.UI.ThemeColorPalette({ + el: $('#shape-border-color-menu'), + value: '000000' + }); + this.colorsBorder.on('select', _.bind(this.onColorsBorderSelect, this)); + $(this.el).on('click', '#shape-border-color-new', _.bind(this.addNewColor, this, this.colorsBorder, this.btnBorderColor)); + } + this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); @@ -1560,6 +1552,8 @@ define([ }, disableControls: function(disable, disableFill) { + if (this._initSettings) return; + this.disableFillPanels(disable || disableFill); if (this._state.DisabledControls!==disable) { this._state.DisabledControls = disable; diff --git a/apps/presentationeditor/main/app/view/SlideSettings.js b/apps/presentationeditor/main/app/view/SlideSettings.js index b17dc8390..087c511fb 100644 --- a/apps/presentationeditor/main/app/view/SlideSettings.js +++ b/apps/presentationeditor/main/app/view/SlideSettings.js @@ -895,6 +895,7 @@ define([ } this.UpdateThemeColors(); + this._initSettings = false; }, onInitStandartTextures: function(texture) { @@ -1076,7 +1077,6 @@ define([ ChangeSettings: function(props) { if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; if (props) { diff --git a/apps/presentationeditor/main/app/view/TableSettings.js b/apps/presentationeditor/main/app/view/TableSettings.js index e94e5f91a..01ff9c201 100644 --- a/apps/presentationeditor/main/app/view/TableSettings.js +++ b/apps/presentationeditor/main/app/view/TableSettings.js @@ -356,8 +356,7 @@ define([ ChangeSettings: function(props) { if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; - + this.disableControls(this._locked); if (props ) @@ -530,6 +529,7 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.UpdateThemeColors(); + this._initSettings = false; }, UpdateThemeColors: function() { diff --git a/apps/presentationeditor/main/app/view/TextArtSettings.js b/apps/presentationeditor/main/app/view/TextArtSettings.js index 4621342c9..a957bec19 100644 --- a/apps/presentationeditor/main/app/view/TextArtSettings.js +++ b/apps/presentationeditor/main/app/view/TextArtSettings.js @@ -70,7 +70,6 @@ define([ }, initialize: function () { - var me = this; this._initSettings = true; this._noApply = true; this.shapeprops = null; @@ -118,373 +117,6 @@ define([ this.render(); - this.cmbTextArt = new Common.UI.ComboDataView({ - itemWidth: 50, - itemHeight: 50, - menuMaxHeight: 300, - enableKeyEvents: true, - showLast: false, - cls: 'combo-textart' - }); - this.cmbTextArt.render($('#textart-combo-template')); - this.cmbTextArt.openButton.menu.cmpEl.css({ - 'min-width': 178, - 'max-width': 178 - }); - this.cmbTextArt.on('click', _.bind(this.onTextArtSelect, this)); - this.cmbTextArt.openButton.menu.on('show:after', function () { - me.cmbTextArt.menuPicker.scroller.update({alwaysVisibleY: true}); - }); - this.lockedControls.push(this.cmbTextArt); - - this._arrFillSrc = [ - {displayValue: this.textColor, value: Asc.c_oAscFill.FILL_TYPE_SOLID}, - {displayValue: this.textGradientFill, value: Asc.c_oAscFill.FILL_TYPE_GRAD}, - {displayValue: this.textImageTexture, value: Asc.c_oAscFill.FILL_TYPE_BLIP}, - {displayValue: this.textPatternFill, value: Asc.c_oAscFill.FILL_TYPE_PATT}, - {displayValue: this.textNoFill, value: Asc.c_oAscFill.FILL_TYPE_NOFILL} - ]; - - this.cmbFillSrc = new Common.UI.ComboBox({ - el: $('#textart-combo-fill-src'), - cls: 'input-group-nr', - style: 'width: 100%;', - menuStyle: 'min-width: 190px;', - editable: false, - data: this._arrFillSrc - }); - this.cmbFillSrc.setValue(this._arrFillSrc[0].value); - this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this)); - this.lockedControls.push(this.cmbFillSrc); - - this.btnBackColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - - this.btnBackColor.on('render:after', function(btn) { - me.colorsBack = new Common.UI.ThemeColorPalette({ - el: $('#textart-back-color-menu'), - value: 'transparent', - transparent: true - }); - me.colorsBack.on('select', _.bind(me.onColorsBackSelect, me)); - }); - this.btnBackColor.render( $('#textart-back-color-btn')); - this.btnBackColor.setColor('transparent'); - $(this.el).on('click', '#textart-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); - this.lockedControls.push(this.btnBackColor); - - this.cmbPattern = new Common.UI.ComboDataView({ - itemWidth: 28, - itemHeight: 28, - menuMaxHeight: 300, - enableKeyEvents: true, - cls: 'combo-pattern' - }); - this.cmbPattern.menuPicker.itemTemplate = this.cmbPattern.fieldPicker.itemTemplate = _.template([ - '
', - '', - '
' - ].join('')); - this.cmbPattern.render($('#textart-combo-pattern')); - this.cmbPattern.openButton.menu.cmpEl.css({ - 'min-width': 178, - 'max-width': 178 - }); - this.cmbPattern.on('click', _.bind(this.onPatternSelect, this)); - this.cmbPattern.openButton.menu.on('show:after', function () { - me.cmbPattern.menuPicker.scroller.update({alwaysVisibleY: true}); - }); - - this.lockedControls.push(this.cmbPattern); - - this.btnFGColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - - this.btnFGColor.on('render:after', function(btn) { - me.colorsFG = new Common.UI.ThemeColorPalette({ - el: $('#textart-foreground-color-menu'), - value: '000000' - }); - me.colorsFG.on('select', _.bind(me.onColorsFGSelect, me)); - }); - this.btnFGColor.render( $('#textart-foreground-color-btn')); - this.btnFGColor.setColor('000000'); - $(this.el).on('click', '#textart-foreground-color-new', _.bind(this.addNewColor, this, this.colorsFG, this.btnFGColor)); - this.lockedControls.push(this.btnFGColor); - - this.btnBGColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - - this.btnBGColor.on('render:after', function(btn) { - me.colorsBG = new Common.UI.ThemeColorPalette({ - el: $('#textart-background-color-menu'), - value: 'ffffff' - }); - me.colorsBG.on('select', _.bind(me.onColorsBGSelect, me)); - }); - this.btnBGColor.render( $('#textart-background-color-btn')); - this.btnBGColor.setColor('ffffff'); - $(this.el).on('click', '#textart-background-color-new', _.bind(this.addNewColor, this, this.colorsBG, this.btnBGColor)); - this.lockedControls.push(this.btnBGColor); - - this.btnInsertFromFile = new Common.UI.Button({ - el: $('#textart-button-from-file') - }); - this.lockedControls.push(this.btnInsertFromFile); - - this.btnInsertFromUrl = new Common.UI.Button({ - el: $('#textart-button-from-url') - }); - this.lockedControls.push(this.btnInsertFromUrl); - - this.btnInsertFromFile.on('click', _.bind(function(btn){ - if (this.api) this.api.ChangeArtImageFromFile(); - this.fireEvent('editcomplete', this); - }, this)); - this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this)); - - this._arrFillType = [ - {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH}, - {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE} - ]; - - this.cmbFillType = new Common.UI.ComboBox({ - el: $('#textart-combo-fill-type'), - cls: 'input-group-nr', - menuStyle: 'min-width: 90px;', - editable: false, - data: this._arrFillType - }); - this.cmbFillType.setValue(this._arrFillType[0].value); - this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this)); - this.lockedControls.push(this.cmbFillType); - - this.btnTexture = new Common.UI.ComboBox({ - el: $('#textart-combo-fill-texture'), - template: _.template([ - '' - ].join('')) - }); - this.textureMenu = new Common.UI.Menu({ - items: [ - { template: _.template('
') } - ] - }); - this.textureMenu.render($('#textart-combo-fill-texture')); - this.lockedControls.push(this.btnTexture); - - this.numTransparency = new Common.UI.MetricSpinner({ - el: $('#textart-spin-transparency'), - step: 1, - width: 62, - value: '100 %', - defaultUnit : "%", - maxValue: 100, - minValue: 0 - }); - this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); - this.lockedControls.push(this.numTransparency); - - this.sldrTransparency = new Common.UI.SingleSlider({ - el: $('#textart-slider-transparency'), - width: 75, - minValue: 0, - maxValue: 100, - value: 100 - }); - this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); - this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); - this.lockedControls.push(this.sldrTransparency); - - this.lblTransparencyStart = $(this.el).find('#textart-lbl-transparency-start'); - this.lblTransparencyEnd = $(this.el).find('#textart-lbl-transparency-end'); - - this._arrGradType = [ - {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR}, - {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH} - ]; - - this.cmbGradType = new Common.UI.ComboBox({ - el: $('#textart-combo-grad-type'), - cls: 'input-group-nr', - menuStyle: 'min-width: 90px;', - editable: false, - data: this._arrGradType - }); - this.cmbGradType.setValue(this._arrGradType[0].value); - this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this)); - this.lockedControls.push(this.cmbGradType); - - this._viewDataLinear = [ - { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' }, - { offsetx: 50, offsety: 0, type:90, subtype:4, iconcls:'gradient-top'}, - { offsetx: 100, offsety: 0, type:135, subtype:5, iconcls:'gradient-right-top'}, - { offsetx: 0, offsety: 50, type:0, subtype:6, iconcls:'gradient-left', cls: 'item-gradient-separator', selected: true}, - { offsetx: 100, offsety: 50, type:180, subtype:1, iconcls:'gradient-right'}, - { offsetx: 0, offsety: 100, type:315, subtype:2, iconcls:'gradient-left-bottom'}, - { offsetx: 50, offsety: 100, type:270, subtype:3, iconcls:'gradient-bottom'}, - { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'} - ]; - - this._viewDataRadial = [ - { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'} - ]; - - this.btnDirection = new Common.UI.Button({ - cls : 'btn-large-dataview', - iconCls : 'item-gradient gradient-left', - menu : new Common.UI.Menu({ - style: 'min-width: 60px;', - menuAlign: 'tr-br', - items: [ - { template: _.template('
') } - ] - }) - }); - this.btnDirection.on('render:after', function(btn) { - me.mnuDirectionPicker = new Common.UI.DataView({ - el: $('#id-textart-menu-direction'), - parentMenu: btn.menu, - restoreHeight: 174, - store: new Common.UI.DataViewStore(me._viewDataLinear), - itemTemplate: _.template('
') - }); - }); - this.btnDirection.render($('#textart-button-direction')); - this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection)); - this.lockedControls.push(this.btnDirection); - - this.btnGradColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - this.btnGradColor.on('render:after', function(btn) { - me.colorsGrad = new Common.UI.ThemeColorPalette({ - el: $('#textart-gradient-color-menu'), - value: '000000' - }); - me.colorsGrad.on('select', _.bind(me.onColorsGradientSelect, me)); - }); - this.btnGradColor.render( $('#textart-gradient-color-btn')); - this.btnGradColor.setColor('000000'); - $(this.el).on('click', '#textart-gradient-color-new', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor)); - this.lockedControls.push(this.btnGradColor); - - this.sldrGradient = new Common.UI.MultiSliderGradient({ - el: $('#textart-slider-gradient'), - width: 125, - minValue: 0, - maxValue: 100, - values: [0, 100] - }); - this.sldrGradient.on('change', _.bind(this.onGradientChange, this)); - this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this)); - this.sldrGradient.on('thumbclick', function(cmp, index){ - me.GradColor.currentIdx = index; - var color = me.GradColor.colors[me.GradColor.currentIdx]; - me.btnGradColor.setColor(color); - me.colorsGrad.select(color,false); - }); - this.sldrGradient.on('thumbdblclick', function(cmp){ - me.btnGradColor.cmpEl.find('button').dropdown('toggle'); - }); - this.lockedControls.push(this.sldrGradient); - - this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ - el: $('#textart-combo-border-size'), - style: "width: 93px;", - txtNoBorders: this.txtNoBorders - }) - .on('selected', _.bind(this.onBorderSizeSelect, this)) - .on('changed:before',_.bind(this.onBorderSizeChanged, this, true)) - .on('changed:after', _.bind(this.onBorderSizeChanged, this, false)) - .on('combo:blur', _.bind(this.onComboBlur, this, false)); - this.BorderSize = this.cmbBorderSize.store.at(2).get('value'); - this.cmbBorderSize.setValue(this.BorderSize); - this.lockedControls.push(this.cmbBorderSize); - - this.btnBorderColor = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
') }, - { template: _.template('' + me.textNewColor + '') } - ] - }) - }); - this.lockedControls.push(this.btnBorderColor); - - this.btnBorderColor.on('render:after', function(btn) { - me.colorsBorder = new Common.UI.ThemeColorPalette({ - el: $('#textart-border-color-menu'), - value: '000000' - }); - me.colorsBorder.on('select', _.bind(me.onColorsBorderSelect, me)); - }); - this.btnBorderColor.render( $('#textart-border-color-btn')); - this.btnBorderColor.setColor('000000'); - $(this.el).on('click', '#textart-border-color-new', _.bind(this.addNewColor, this, this.colorsBorder, this.btnBorderColor)); - - this.cmbBorderType = new Common.UI.ComboBorderType({ - el: $('#textart-combo-border-type'), - style: "width: 93px;", - menuStyle: 'min-width: 93px;' - }).on('selected', _.bind(this.onBorderTypeSelect, this)) - .on('combo:blur', _.bind(this.onComboBlur, this, false)); - this.BorderType = Asc.c_oDashType.solid; - this.cmbBorderType.setValue(this.BorderType); - this.lockedControls.push(this.cmbBorderType); - - this.cmbTransform = new Common.UI.ComboDataView({ - itemWidth: 50, - itemHeight: 50, - menuMaxHeight: 300, - enableKeyEvents: true, - cls: 'combo-textart' - }); - this.cmbTransform.render($('#textart-combo-transform')); - this.cmbTransform.openButton.menu.cmpEl.css({ - 'min-width': 178, - 'max-width': 178 - }); - this.cmbTransform.on('click', _.bind(this.onTransformSelect, this)); - this.cmbTransform.openButton.menu.on('show:after', function () { - me.cmbTransform.menuPicker.scroller.update({alwaysVisibleY: true}); - }); - this.lockedControls.push(this.cmbTransform); - this.FillColorContainer = $('#textart-panel-color-fill'); this.FillImageContainer = $('#textart-panel-image-fill'); this.FillPatternContainer = $('#textart-panel-pattern-fill'); @@ -1029,7 +661,6 @@ define([ if (this._initSettings) this.createDelayedElements(); - this._initSettings = false; if (props && props.get_TextArtProperties()) { @@ -1413,7 +1044,234 @@ define([ } }, + createDelayedControls: function() { + var me = this; + + this._arrFillSrc = [ + {displayValue: this.textColor, value: Asc.c_oAscFill.FILL_TYPE_SOLID}, + {displayValue: this.textGradientFill, value: Asc.c_oAscFill.FILL_TYPE_GRAD}, + {displayValue: this.textImageTexture, value: Asc.c_oAscFill.FILL_TYPE_BLIP}, + {displayValue: this.textPatternFill, value: Asc.c_oAscFill.FILL_TYPE_PATT}, + {displayValue: this.textNoFill, value: Asc.c_oAscFill.FILL_TYPE_NOFILL} + ]; + + this.cmbFillSrc = new Common.UI.ComboBox({ + el: $('#textart-combo-fill-src'), + cls: 'input-group-nr', + style: 'width: 100%;', + menuStyle: 'min-width: 190px;', + editable: false, + data: this._arrFillSrc + }); + this.cmbFillSrc.setValue(this._arrFillSrc[0].value); + this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this)); + this.lockedControls.push(this.cmbFillSrc); + + this.cmbPattern = new Common.UI.ComboDataView({ + itemWidth: 28, + itemHeight: 28, + menuMaxHeight: 300, + enableKeyEvents: true, + cls: 'combo-pattern' + }); + this.cmbPattern.menuPicker.itemTemplate = this.cmbPattern.fieldPicker.itemTemplate = _.template([ + '
', + '', + '
' + ].join('')); + this.cmbPattern.render($('#textart-combo-pattern')); + this.cmbPattern.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbPattern.on('click', _.bind(this.onPatternSelect, this)); + this.cmbPattern.openButton.menu.on('show:after', function () { + me.cmbPattern.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + + this.lockedControls.push(this.cmbPattern); + + this.btnInsertFromFile = new Common.UI.Button({ + el: $('#textart-button-from-file') + }); + this.lockedControls.push(this.btnInsertFromFile); + + this.btnInsertFromUrl = new Common.UI.Button({ + el: $('#textart-button-from-url') + }); + this.lockedControls.push(this.btnInsertFromUrl); + + this.btnInsertFromFile.on('click', _.bind(function(btn){ + if (this.api) this.api.ChangeArtImageFromFile(); + this.fireEvent('editcomplete', this); + }, this)); + this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this)); + + this._arrFillType = [ + {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH}, + {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE} + ]; + + this.cmbFillType = new Common.UI.ComboBox({ + el: $('#textart-combo-fill-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 90px;', + editable: false, + data: this._arrFillType + }); + this.cmbFillType.setValue(this._arrFillType[0].value); + this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this)); + this.lockedControls.push(this.cmbFillType); + + this.numTransparency = new Common.UI.MetricSpinner({ + el: $('#textart-spin-transparency'), + step: 1, + width: 62, + value: '100 %', + defaultUnit : "%", + maxValue: 100, + minValue: 0 + }); + this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.lockedControls.push(this.numTransparency); + + this.sldrTransparency = new Common.UI.SingleSlider({ + el: $('#textart-slider-transparency'), + width: 75, + minValue: 0, + maxValue: 100, + value: 100 + }); + this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this)); + this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this)); + this.lockedControls.push(this.sldrTransparency); + + this.lblTransparencyStart = $(this.el).find('#textart-lbl-transparency-start'); + this.lblTransparencyEnd = $(this.el).find('#textart-lbl-transparency-end'); + + this._arrGradType = [ + {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR}, + {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH} + ]; + + this.cmbGradType = new Common.UI.ComboBox({ + el: $('#textart-combo-grad-type'), + cls: 'input-group-nr', + menuStyle: 'min-width: 90px;', + editable: false, + data: this._arrGradType + }); + this.cmbGradType.setValue(this._arrGradType[0].value); + this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this)); + this.lockedControls.push(this.cmbGradType); + + this._viewDataLinear = [ + { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' }, + { offsetx: 50, offsety: 0, type:90, subtype:4, iconcls:'gradient-top'}, + { offsetx: 100, offsety: 0, type:135, subtype:5, iconcls:'gradient-right-top'}, + { offsetx: 0, offsety: 50, type:0, subtype:6, iconcls:'gradient-left', cls: 'item-gradient-separator', selected: true}, + { offsetx: 100, offsety: 50, type:180, subtype:1, iconcls:'gradient-right'}, + { offsetx: 0, offsety: 100, type:315, subtype:2, iconcls:'gradient-left-bottom'}, + { offsetx: 50, offsety: 100, type:270, subtype:3, iconcls:'gradient-bottom'}, + { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'} + ]; + + this._viewDataRadial = [ + { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'} + ]; + + this.btnDirection = new Common.UI.Button({ + cls : 'btn-large-dataview', + iconCls : 'item-gradient gradient-left', + menu : new Common.UI.Menu({ + style: 'min-width: 60px;', + menuAlign: 'tr-br', + items: [ + { template: _.template('
') } + ] + }) + }); + this.btnDirection.on('render:after', function(btn) { + me.mnuDirectionPicker = new Common.UI.DataView({ + el: $('#id-textart-menu-direction'), + parentMenu: btn.menu, + restoreHeight: 174, + store: new Common.UI.DataViewStore(me._viewDataLinear), + itemTemplate: _.template('
') + }); + }); + this.btnDirection.render($('#textart-button-direction')); + this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection)); + this.lockedControls.push(this.btnDirection); + + this.sldrGradient = new Common.UI.MultiSliderGradient({ + el: $('#textart-slider-gradient'), + width: 125, + minValue: 0, + maxValue: 100, + values: [0, 100] + }); + this.sldrGradient.on('change', _.bind(this.onGradientChange, this)); + this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this)); + this.sldrGradient.on('thumbclick', function(cmp, index){ + me.GradColor.currentIdx = index; + var color = me.GradColor.colors[me.GradColor.currentIdx]; + me.btnGradColor.setColor(color); + me.colorsGrad.select(color,false); + }); + this.sldrGradient.on('thumbdblclick', function(cmp){ + me.btnGradColor.cmpEl.find('button').dropdown('toggle'); + }); + this.lockedControls.push(this.sldrGradient); + + this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ + el: $('#textart-combo-border-size'), + style: "width: 93px;", + txtNoBorders: this.txtNoBorders + }) + .on('selected', _.bind(this.onBorderSizeSelect, this)) + .on('changed:before',_.bind(this.onBorderSizeChanged, this, true)) + .on('changed:after', _.bind(this.onBorderSizeChanged, this, false)) + .on('combo:blur', _.bind(this.onComboBlur, this, false)); + this.BorderSize = this.cmbBorderSize.store.at(2).get('value'); + this.cmbBorderSize.setValue(this.BorderSize); + this.lockedControls.push(this.cmbBorderSize); + + this.cmbBorderType = new Common.UI.ComboBorderType({ + el: $('#textart-combo-border-type'), + style: "width: 93px;", + menuStyle: 'min-width: 93px;' + }).on('selected', _.bind(this.onBorderTypeSelect, this)) + .on('combo:blur', _.bind(this.onComboBlur, this, false)); + this.BorderType = Asc.c_oDashType.solid; + this.cmbBorderType.setValue(this.BorderType); + this.lockedControls.push(this.cmbBorderType); + + this.cmbTransform = new Common.UI.ComboDataView({ + itemWidth: 50, + itemHeight: 50, + menuMaxHeight: 300, + enableKeyEvents: true, + cls: 'combo-textart' + }); + this.cmbTransform.render($('#textart-combo-transform')); + this.cmbTransform.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbTransform.on('click', _.bind(this.onTransformSelect, this)); + this.cmbTransform.openButton.menu.on('show:after', function () { + me.cmbTransform.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + this.lockedControls.push(this.cmbTransform); + + }, + createDelayedElements: function() { + this.createDelayedControls(); + var global_hatch_menu_map = [ 0,1,3,2,4, 53,5,6,7,8, @@ -1446,11 +1304,31 @@ define([ } this.UpdateThemeColors(); this.fillTransform(this.api.asc_getPropertyEditorTextArts()); + this._initSettings = false; }, onInitStandartTextures: function(texture) { var me = this; if (texture && texture.length>0){ + if (!this.btnTexture) { + this.btnTexture = new Common.UI.ComboBox({ + el: $('#textart-combo-fill-texture'), + template: _.template([ + '' + ].join('')) + }); + this.textureMenu = new Common.UI.Menu({ + items: [ + { template: _.template('
') } + ] + }); + this.textureMenu.render($('#textart-combo-fill-texture')); + this.lockedControls.push(this.btnTexture); + } var texturearray = []; _.each(texture, function(item){ texturearray.push({ @@ -1493,8 +1371,29 @@ define([ }, fillTextArt: function() { - var me = this, - models = this.application.getCollection('Common.Collections.TextArt').models, + var me = this; + if (!this.cmbTextArt) { + this.cmbTextArt = new Common.UI.ComboDataView({ + itemWidth: 50, + itemHeight: 50, + menuMaxHeight: 300, + enableKeyEvents: true, + showLast: false, + cls: 'combo-textart' + }); + this.cmbTextArt.render($('#textart-combo-template')); + this.cmbTextArt.openButton.menu.cmpEl.css({ + 'min-width': 178, + 'max-width': 178 + }); + this.cmbTextArt.on('click', _.bind(this.onTextArtSelect, this)); + this.cmbTextArt.openButton.menu.on('show:after', function () { + me.cmbTextArt.menuPicker.scroller.update({alwaysVisibleY: true}); + }); + this.lockedControls.push(this.cmbTextArt); + } + + var models = this.application.getCollection('Common.Collections.TextArt').models, count = this.cmbTextArt.menuPicker.store.length; if (count>0 && count==models.length) { var data = this.cmbTextArt.menuPicker.store.models; @@ -1552,6 +1451,104 @@ define([ }, UpdateThemeColors: function() { + if (!this.btnBackColor) { + this.btnBackColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnBackColor.render( $('#textart-back-color-btn')); + this.btnBackColor.setColor('transparent'); + this.lockedControls.push(this.btnBackColor); + this.colorsBack = new Common.UI.ThemeColorPalette({ + el: $('#textart-back-color-menu'), + value: 'transparent', + transparent: true + }); + this.colorsBack.on('select', _.bind(this.onColorsBackSelect, this)); + $(this.el).on('click', '#textart-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); + + this.btnFGColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnFGColor.render( $('#textart-foreground-color-btn')); + this.btnFGColor.setColor('000000'); + this.lockedControls.push(this.btnFGColor); + this.colorsFG = new Common.UI.ThemeColorPalette({ + el: $('#textart-foreground-color-menu'), + value: '000000' + }); + this.colorsFG.on('select', _.bind(this.onColorsFGSelect, this)); + $(this.el).on('click', '#textart-foreground-color-new', _.bind(this.addNewColor, this, this.colorsFG, this.btnFGColor)); + + this.btnBGColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnBGColor.render( $('#textart-background-color-btn')); + this.btnBGColor.setColor('ffffff'); + this.lockedControls.push(this.btnBGColor); + this.colorsBG = new Common.UI.ThemeColorPalette({ + el: $('#textart-background-color-menu'), + value: 'ffffff' + }); + this.colorsBG.on('select', _.bind(this.onColorsBGSelect, this)); + $(this.el).on('click', '#textart-background-color-new', _.bind(this.addNewColor, this, this.colorsBG, this.btnBGColor)); + + this.btnGradColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnGradColor.render( $('#textart-gradient-color-btn')); + this.btnGradColor.setColor('000000'); + this.lockedControls.push(this.btnGradColor); + this.colorsGrad = new Common.UI.ThemeColorPalette({ + el: $('#textart-gradient-color-menu'), + value: '000000' + }); + this.colorsGrad.on('select', _.bind(this.onColorsGradientSelect, this)); + $(this.el).on('click', '#textart-gradient-color-new', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor)); + + this.btnBorderColor = new Common.UI.ColorButton({ + style: "width:45px;", + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnBorderColor.render( $('#textart-border-color-btn')); + this.btnBorderColor.setColor('000000'); + this.lockedControls.push(this.btnBorderColor); + this.colorsBorder = new Common.UI.ThemeColorPalette({ + el: $('#textart-border-color-menu'), + value: '000000' + }); + this.colorsBorder.on('select', _.bind(this.onColorsBorderSelect, this)); + $(this.el).on('click', '#textart-border-color-new', _.bind(this.addNewColor, this, this.colorsBorder, this.btnBorderColor)); + } + this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); @@ -1580,6 +1577,8 @@ define([ }, disableControls: function(disable) { + if (this._initSettings) return; + if (this._state.DisabledControls!==disable) { this._state.DisabledControls = disable; _.each(this.lockedControls, function(item) { From b303c38d948721755b9903a9cb57f542982fd3de Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 14 Oct 2016 16:58:57 +0300 Subject: [PATCH 15/29] Fixed bug: change focus from text field or textarea to another text field or textarea (e.g. click to fiedls in the search dialog in replace mode). --- apps/documenteditor/main/app/controller/Main.js | 6 ++++-- .../main/app/controller/Main.js | 6 ++++-- .../spreadsheeteditor/main/app/controller/Main.js | 15 +++++++++------ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 04d46adc4..1cf8eb4c8 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -163,8 +163,10 @@ define([ $(document.body).on('blur', 'input, textarea', function(e) { if (!me.isModalShowed) { - if (!/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* When focus in combobox goes from input to it's menu button or menu items */ - || !e.relatedTarget) { + if (!e.relatedTarget || + !/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* Check if focus in combobox goes from input to it's menu button or menu items */ + && (e.relatedTarget.localName != 'input' || !/form-control/.test(e.relatedTarget.className)) /* Check if focus goes to text input with class "form-control" */ + && (e.relatedTarget.localName != 'textarea' || /area_id/.test(e.relatedTarget.id))) /* Check if focus goes to textarea, but not to "area_id" */ { me.api.asc_enableKeyEvents(true); if (/msg-reply/.test(e.target.className)) me.dontCloseDummyComment = false; diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 57efa7dfc..7ab6de464 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -151,8 +151,10 @@ define([ $(document.body).on('blur', 'input, textarea', function(e) { if (!me.isModalShowed) { - if (!/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* When focus in combobox goes from input to it's menu button or menu items */ - || !e.relatedTarget) { + if (!e.relatedTarget || + !/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* Check if focus in combobox goes from input to it's menu button or menu items */ + && (e.relatedTarget.localName != 'input' || !/form-control/.test(e.relatedTarget.className)) /* Check if focus goes to text input with class "form-control" */ + && (e.relatedTarget.localName != 'textarea' || /area_id/.test(e.relatedTarget.id))) /* Check if focus goes to textarea, but not to "area_id" */ { me.api.asc_enableKeyEvents(true); if (/msg-reply/.test(e.target.className)) me.dontCloseDummyComment = false; diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index d624294d9..6af7965da 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -159,12 +159,15 @@ define([ $(document.body).on('blur', 'input, textarea', function(e) { if (this.isAppDisabled === true) return; - if (!me.isModalShowed && !(me.loadMask && me.loadMask.isVisible()) && - (!/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* When focus in combobox goes from input to it's menu button or menu items */ - || !e.relatedTarget)) { - me.api.asc_enableKeyEvents(true); - if (/msg-reply/.test(e.target.className)) - me.dontCloseDummyComment = false; + if (!me.isModalShowed && !(me.loadMask && me.loadMask.isVisible())) { + if (!e.relatedTarget || + !/area_id/.test(e.target.id) && $(e.target).parent().find(e.relatedTarget).length<1 /* Check if focus in combobox goes from input to it's menu button or menu items */ + && (e.relatedTarget.localName != 'input' || !/form-control/.test(e.relatedTarget.className)) /* Check if focus goes to text input with class "form-control" */ + && (e.relatedTarget.localName != 'textarea' || /area_id/.test(e.relatedTarget.id))) /* Check if focus goes to textarea, but not to "area_id" */ { + me.api.asc_enableKeyEvents(true); + if (/msg-reply/.test(e.target.className)) + me.dontCloseDummyComment = false; + } } }).on('dragover', function(e) { var event = e.originalEvent; From 963202b919794d9585ee8849e89d43bb23307a98 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 14 Oct 2016 17:00:48 +0300 Subject: [PATCH 16/29] Fix layout in the status bar panel with users count in co-authoring mode. --- apps/documenteditor/main/resources/less/statusbar.less | 2 +- apps/presentationeditor/main/resources/less/statusbar.less | 2 +- apps/spreadsheeteditor/main/resources/less/statusbar.less | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/resources/less/statusbar.less b/apps/documenteditor/main/resources/less/statusbar.less index e1141e93a..2afce7d10 100644 --- a/apps/documenteditor/main/resources/less/statusbar.less +++ b/apps/documenteditor/main/resources/less/statusbar.less @@ -169,7 +169,7 @@ font-size: 12px; > label { - white-space: initial; + white-space: normal; } #status-users-list { diff --git a/apps/presentationeditor/main/resources/less/statusbar.less b/apps/presentationeditor/main/resources/less/statusbar.less index 089c307d3..351ff2a28 100644 --- a/apps/presentationeditor/main/resources/less/statusbar.less +++ b/apps/presentationeditor/main/resources/less/statusbar.less @@ -118,7 +118,7 @@ font-size: 12px; > label { - white-space: initial; + white-space: normal; } #status-users-list { diff --git a/apps/spreadsheeteditor/main/resources/less/statusbar.less b/apps/spreadsheeteditor/main/resources/less/statusbar.less index 3d0794171..e681ad4af 100644 --- a/apps/spreadsheeteditor/main/resources/less/statusbar.less +++ b/apps/spreadsheeteditor/main/resources/less/statusbar.less @@ -66,7 +66,7 @@ right: 0; > label { - white-space: initial; + white-space: normal; } #status-users-list { From 5aa30fba44413efdefb1b8033c59f7a0b7ca4918 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 17 Oct 2016 15:21:35 +0300 Subject: [PATCH 17/29] [SSE] Change size of cell styles. --- apps/spreadsheeteditor/main/app/view/Toolbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index d9afcc7a3..5944678ab 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -598,7 +598,7 @@ define([ me.listStyles = new Common.UI.ComboDataView({ cls : 'combo-styles', enableKeyEvents : true, - itemWidth : 104, + itemWidth : 112, itemHeight : 38, hint : this.tipCellStyle, menuMaxHeight : 226, From bfc91dc91ffe9cc872a4154efe29bb4978418ecf Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 18 Oct 2016 11:26:16 +0300 Subject: [PATCH 18/29] [DE] Optimization of right panel. --- apps/documenteditor/main/app/controller/RightMenu.js | 7 ++++--- apps/documenteditor/main/app/view/RightMenu.js | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index a02320a16..c20fdca49 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -167,14 +167,15 @@ define([ this._settings[Common.Utils.documentSettingsType.MailMerge].locked = !can_add_table || in_equation; } - var lastactive = -1, currentactive, priorityactive = -1; + var lastactive = -1, currentactive, priorityactive = -1, + activePane = this.rightmenu.GetActivePane(); for (i=0; i .active').removeClass('active'); target_pane.addClass("active"); @@ -271,7 +271,7 @@ define([ }, GetActivePane: function() { - return (this.minimizedMode) ? null : $(".settings-panel.active")[0].id; + return (this.minimizedMode) ? null : this.$el.find(".settings-panel.active")[0].id; }, clearSelection: function() { From a7e603ca5f028f286ab29da088544be95a5e605e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 18 Oct 2016 11:58:27 +0300 Subject: [PATCH 19/29] [PE] [SSE] Optimization of right panel. --- apps/presentationeditor/main/app/controller/RightMenu.js | 7 ++++--- apps/presentationeditor/main/app/view/RightMenu.js | 2 +- apps/spreadsheeteditor/main/app/controller/RightMenu.js | 7 ++++--- apps/spreadsheeteditor/main/app/view/RightMenu.js | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/RightMenu.js b/apps/presentationeditor/main/app/controller/RightMenu.js index cc4919e67..f26d27389 100644 --- a/apps/presentationeditor/main/app/controller/RightMenu.js +++ b/apps/presentationeditor/main/app/controller/RightMenu.js @@ -148,14 +148,15 @@ define([ } } - var lastactive = -1, currentactive, priorityactive = -1; + var lastactive = -1, currentactive, priorityactive = -1, + activePane = this.rightmenu.GetActivePane(); for (i=0; i Date: Wed, 19 Oct 2016 14:16:46 +0300 Subject: [PATCH 20/29] Optimization for mouse click to document: replace heavy bootstrap function clearMenus. Elements with data-toggle=dropdown must have class dropdown-toggle. --- apps/common/main/lib/extend/Bootstrap.js | 15 ++++++++++++--- .../main/app/template/StatusBar.template | 2 +- apps/documenteditor/main/app/view/Statusbar.js | 1 + .../main/app/template/StatusBar.template | 2 +- .../main/app/view/DocumentPreview.js | 2 +- .../presentationeditor/main/app/view/Statusbar.js | 1 + apps/spreadsheeteditor/main/app/view/Statusbar.js | 3 ++- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/apps/common/main/lib/extend/Bootstrap.js b/apps/common/main/lib/extend/Bootstrap.js index c9afd2e37..68d393da6 100755 --- a/apps/common/main/lib/extend/Bootstrap.js +++ b/apps/common/main/lib/extend/Bootstrap.js @@ -186,6 +186,16 @@ function getParent($this) { return $parent && $parent.length ? $parent : $this.parent(); } +function clearMenus() { + $('.dropdown-toggle').each(function (e) { + var $parent = ($(this)).parent(); + if (!$parent.hasClass('open')) return; + $parent.trigger(e = $.Event('hide.bs.dropdown')); + if (e.isDefaultPrevented()) return; + $parent.removeClass('open').trigger('hidden.bs.dropdown'); + }) +} + $(document) .off('keydown.bs.dropdown.data-api') .on('keydown.bs.dropdown.data-api', '[data-toggle=dropdown], [role=menu]' , onDropDownKeyDown); @@ -206,9 +216,8 @@ $(document) } function onDropDownClick(e) { - if ((e.which == 1 || e.which == undefined) && !!clickDefHandler) { - clickDefHandler(e); - } + if (e.which == 1 || e.which == undefined) + clearMenus(); } if (!!clickDefHandler) { diff --git a/apps/documenteditor/main/app/template/StatusBar.template b/apps/documenteditor/main/app/template/StatusBar.template index a2bc061a9..d46ad1658 100644 --- a/apps/documenteditor/main/app/template/StatusBar.template +++ b/apps/documenteditor/main/app/template/StatusBar.template @@ -1,7 +1,7 @@
- +