diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index c592dd587..a0b649635 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -189,6 +189,7 @@ _config.editorConfig.canHistoryRestore = _config.events && !!_config.events.onRequestRestore; _config.editorConfig.canSendEmailAddresses = _config.events && !!_config.events.onRequestEmailAddresses; _config.editorConfig.canRequestEditRights = _config.events && !!_config.events.onRequestEditRights; + _config.editorConfig.canRequestClose = _config.events && !!_config.events.onRequestClose; _config.frameEditorId = placeholderId; _config.events && !!_config.events.onReady && console.log("Obsolete: The onReady event is deprecated. Please use onAppReady instead."); diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index 71d36ecc1..5e06dbdd8 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -250,6 +250,10 @@ if (Common === undefined) { _postMessage({ event: 'onDocumentReady' }); }, + requestClose: function() { + _postMessage({event: 'onRequestClose'}); + }, + on: function(event, handler){ var localHandler = function(event, data){ handler.call(me, data) diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index acfec692b..e4387beaa 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -191,7 +191,10 @@ define([ event.preventDefault(); event.stopPropagation(); if (this.initConfig.closable !== false) { - this.initConfig.toolclose=='hide' ? this.hide() : this.close(); + if (this.initConfig.toolcallback) + this.initConfig.toolcallback.call(this); + else + (this.initConfig.toolclose=='hide') ? this.hide() : this.close(); } return false; } diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index f19778d6f..083b94536 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -219,7 +219,8 @@ define([ appConfig = mode; var me = this; - me.btnGoBack.updateHint(me.textBack); + if ( !me.branding.goback ) + me.btnGoBack.updateHint(me.textBack); me.btnGoBack.on('click', function (e) { Common.NotificationCenter.trigger('goback', true); }); @@ -511,11 +512,17 @@ define([ this.branding = value; - if (value && value.logo && value.logo.image) { - element = $('#header-logo'); - if ( element ) { - element.html(''); - element.css({'background-image': 'none', width: 'auto'}); + if ( value ) { + if ( value.logo && value.logo.image ) { + element = $('#header-logo'); + if (element) { + element.html(''); + element.css({'background-image': 'none', width: 'auto'}); + } + } + + if ( !!value.goback ) { + this.btnGoBack.updateHint(value.goback.text); } } }, diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index 43a8ddf7f..462f7f028 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -54,14 +54,15 @@ define([ _options = {}; _.extend(_options, { - closable: false, + closable : false, width : 250, height : (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 205 : 155, contentWidth : 390, header : true, cls : 'open-dlg', contentTemplate : '', - title : (options.type == Asc.c_oAscAdvancedOptionsID.DRM) ? t.txtTitleProtected : t.txtTitle.replace('%1', (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 'CSV' : 'TXT') + title : (options.type == Asc.c_oAscAdvancedOptionsID.DRM) ? t.txtTitleProtected : t.txtTitle.replace('%1', (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 'CSV' : 'TXT'), + toolcallback : _.bind(t.onToolClose, t) }, options); @@ -84,18 +85,21 @@ define([ '<% } %>', '', '', - '
', ' ' ].join(''); - this.handler = options.handler; - this.type = options.type; - this.codepages = options.codepages; - this.settings = options.settings; - this.validatePwd = options.validatePwd || false; + this.handler = _options.handler; + this.type = _options.type; + this.closable = _options.closable; + this.codepages = _options.codepages; + this.settings = _options.settings; + this.validatePwd = _options.validatePwd || false; _options.tpl = _.template(this.template)(_options); @@ -106,7 +110,8 @@ define([ if (this.$window) { var me = this; - this.$window.find('.tool').hide(); + if (!this.closable) + this.$window.find('.tool').hide(); this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) { this.inputPwd = new Common.UI.InputField({ @@ -120,11 +125,11 @@ define([ this.$window.find('input').on('keypress', _.bind(this.onKeyPress, this)); } else { this.initCodePages(); - this.onPrimary = function() { - me.onBtnClick(); - return false; - }; } + this.onPrimary = function() { + me._handleInput('ok'); + return false; + }; } }, @@ -141,25 +146,36 @@ define([ } }, - onBtnClick: function (event) { + onKeyPress: function(event) { + if (event.keyCode == Common.UI.Keys.RETURN) { + this._handleInput('ok'); + } else if (this.closable && event.keyCode == Common.UI.Keys.ESC) + this._handleInput('cancel'); + }, + + onBtnClick: function(event) { + this._handleInput(event.currentTarget.attributes['result'].value); + }, + + onToolClose: function() { + this._handleInput('cancel'); + }, + + _handleInput: function(state) { if (this.handler) { if (this.cmbEncoding) { var delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null, delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null; (delimiter == -1) && (delimiter = null); this.handler.call(this, this.cmbEncoding.getValue(), delimiter, delimiterChar); - } else - this.handler.call(this, this.inputPwd.getValue()); + } else { + this.handler.call(this, state, this.inputPwd.getValue()); + } } this.close(); }, - onKeyPress: function(event) { - if (event.keyCode == Common.UI.Keys.RETURN) - this.onBtnClick(); - }, - initCodePages: function () { var i, c, codepage, encodedata = [], listItems = [], length = 0; @@ -381,7 +397,8 @@ define([ txtPassword : "Password", txtTitleProtected : "Protected File", txtOther: 'Other', - txtIncorrectPwd: 'Password is incorrect.' + txtIncorrectPwd: 'Password is incorrect.', + closeButtonText: 'Close File' }, Common.Views.OpenDialog || {})); }); \ No newline at end of file diff --git a/apps/common/main/resources/img/controls/toolbarbig.png b/apps/common/main/resources/img/controls/toolbarbig.png index b9f731ba9..f589fa1c3 100644 Binary files a/apps/common/main/resources/img/controls/toolbarbig.png and b/apps/common/main/resources/img/controls/toolbarbig.png differ diff --git a/apps/common/main/resources/img/controls/toolbarbig@2x.png b/apps/common/main/resources/img/controls/toolbarbig@2x.png index a5cc606ce..26977df1a 100644 Binary files a/apps/common/main/resources/img/controls/toolbarbig@2x.png and b/apps/common/main/resources/img/controls/toolbarbig@2x.png differ diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 50d1f9741..548d4f2ca 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -316,3 +316,4 @@ .button-normal-icon(~'x-huge .btn-grand-totals', 52, @toolbar-big-icon-size); .button-normal-icon(~'x-huge .btn-contents', 53, @toolbar-big-icon-size); .button-normal-icon(btn-controls, 54, @toolbar-big-icon-size); +.button-normal-icon(~'x-huge .btn-select-pivot', 55, @toolbar-big-icon-size); diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 51e78b6db..2180cc6f9 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -610,6 +610,8 @@ define([ }, onShortcut: function(s, e) { + if (!this.mode) return; + switch (s) { case 'replace': case 'search': diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index e167c20db..4f46209dd 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -761,6 +761,12 @@ define([ title = this.loadingDocumentTitleText; text = this.loadingDocumentTextText; break; + default: + if (typeof action.id == 'string'){ + title = action.id; + text = action.id; + } + break; } if (action.type == Asc.c_oAscAsyncActionType['BlockInteraction']) { @@ -1066,6 +1072,7 @@ define([ this.appOptions.isOffline = this.api.asc_isOffline(); this.appOptions.isReviewOnly = this.permissions.review === true && this.permissions.edit === false; this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights; + this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.canEdit = (this.permissions.edit !== false || this.permissions.review === true) && // can edit or review (this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined (!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true @@ -1862,14 +1869,18 @@ define([ }); } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { me._state.openDlg = new Common.Views.OpenDialog({ + closable: me.appOptions.canRequestClose, type: type, validatePwd: !!me._state.isDRM, - handler: function (value) { + handler: function (result, value) { me.isShowOpenDialog = false; - if (me && me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value)); - me.loadMask && me.loadMask.show(); - } + if (result == 'ok') { + if (me.api) { + me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value)); + me.loadMask && me.loadMask.show(); + } + } else + Common.Gateway.requestClose(); me._state.openDlg = null; } }); diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index e8f72db52..196e1a9e0 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -260,6 +260,7 @@ define([ this.rightmenu.paragraphSettings.updateMetricUnit(); this.rightmenu.chartSettings.updateMetricUnit(); this.rightmenu.imageSettings.updateMetricUnit(); + this.rightmenu.tableSettings.updateMetricUnit(); }, createDelayedElements: function() { diff --git a/apps/documenteditor/main/app/template/ShapeSettings.template b/apps/documenteditor/main/app/template/ShapeSettings.template index e0346dc1e..4a4ff30d1 100644 --- a/apps/documenteditor/main/app/template/ShapeSettings.template +++ b/apps/documenteditor/main/app/template/ShapeSettings.template @@ -134,18 +134,18 @@