diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 283a73b92..466007663 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -81,6 +81,7 @@ define([ 'reviewchange:preview': _.bind(this.onBtnPreviewClick, this), 'reviewchange:view': _.bind(this.onReviewViewClick, this), 'reviewchange:compare': _.bind(this.onCompareClick, this), + 'reviewchange:combine': _.bind(this.onCombineClick, this), 'lang:document': _.bind(this.onDocLanguage, this), 'collaboration:coauthmode': _.bind(this.onCoAuthMode, this), 'protect:update': _.bind(this.onChangeProtectDocument, this) @@ -718,6 +719,36 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.view); }, + onCombineClick: function(item) { + if(this.api) { + var me = this; + if (!this._state.compareSettings) { + this._state.compareSettings = new AscCommonWord.ComparisonOptions(); + this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char")); + } + if (item === 'file') { + this.api.asc_MergeDocumentFile(this._state.compareSettings); + Common.NotificationCenter.trigger('edit:complete', this.view); + } else if (item === 'url') { + (new Common.Views.ImageFromUrlDialog({ + title: me.textUrl, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + var checkUrl = value.replace(/ /g, ''); + if (!_.isEmpty(checkUrl)) { + me.api.asc_MergeDocumentUrl(checkUrl, me._state.compareSettings); + } + } + Common.NotificationCenter.trigger('edit:complete', me.view); + } + } + })).show(); + } + } + Common.NotificationCenter.trigger('edit:complete', this.view); + }, + setRevisedFile: function(data) { if (!this._state.compareSettings) { this._state.compareSettings = new AscCommonWord.ComparisonOptions(); @@ -1014,7 +1045,7 @@ define([ if (!item.asc_getView()) length++; }); - Common.Utils.lockControls(Common.enumLock.hasCoeditingUsers, length>1, {array: [this.view.btnCompare]}); + Common.Utils.lockControls(Common.enumLock.hasCoeditingUsers, length>1, {array: [this.view.btnCompare, this.view.btnCombine]}); } }, diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 1ae301987..151a08a51 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -103,6 +103,7 @@ define([ '
' + '
' + '' + + '' + '
' + '
' + '
' + @@ -142,6 +143,15 @@ define([ this.btnCompare.menu.on('item:click', function (menu, item, e) { me.fireEvent('reviewchange:compare', [item.value]); }); + + + this.btnCombine.on('click', function(e) { + me.fireEvent('reviewchange:combine', ['file']); + }); + + this.btnCombine.menu.on('item:click', function(menu, item, e) { + me.fireEvent('reviewchange:combine', [item.value]); + }); } this.btnsTurnReview.forEach(function (button) { @@ -294,6 +304,18 @@ define([ dataHintOffset: 'small' }); this.lockedControls.push(this.btnCompare); + + this.btnCombine = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + caption: this.txtCombine, + split: true, + iconCls: 'toolbar__icon combine', + lock: [_set.hasCoeditingUsers, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.docLockView, _set.docLockForms, _set.docLockComments], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnCombine); } this.btnTurnOn = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', @@ -572,6 +594,15 @@ define([ })); me.btnCompare.menu.items[2].setVisible(me.appConfig.canRequestCompareFile || me.appConfig.fileChoiceUrl && me.appConfig.fileChoiceUrl.indexOf("{documentType}")>-1); me.btnCompare.updateHint(me.tipCompare); + + + me.btnCombine.setMenu(new Common.UI.Menu({ + items: [ + {caption: me.mniFromFile, value: 'file'}, + {caption: me.mniFromUrl, value: 'url'}, + ] + })); + me.btnCombine.updateHint(me.tipCombine); } Common.Utils.lockControls(Common.enumLock.isReviewOnly, config.isReviewOnly, {array: [me.btnAccept, me.btnReject]}); @@ -707,6 +738,7 @@ define([ this.btnAccept.render(this.$el.find('#btn-change-accept')); this.btnReject.render(this.$el.find('#btn-change-reject')); this.appConfig.canFeatureComparison && this.btnCompare.render(this.$el.find('#btn-compare')); + this.appConfig.canFeatureComparison && this.btnCombine.render(this.$el.find('#btn-combine')); this.btnTurnOn.render(this.$el.find('#btn-review-on')); } this.btnPrev && this.btnPrev.render(this.$el.find('#btn-change-prev')); @@ -914,6 +946,8 @@ define([ strStrictDesc: 'Use the \'Save\' button to sync the changes you and others make.', txtCompare: 'Compare', tipCompare: 'Compare current document with another one', + txtCombine: 'Combine', + tipCombine: 'Combine current document with another one', mniFromFile: 'Document from File', mniFromUrl: 'Document from URL', mniFromStorage: 'Document from Storage', diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index be7fb5507..7facfc752 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -555,6 +555,7 @@ "Common.Views.ReviewChanges.tipCommentResolve": "Resolve comments", "Common.Views.ReviewChanges.tipCommentResolveCurrent": "Resolve current comments", "Common.Views.ReviewChanges.tipCompare": "Compare current document with another one", + "Common.Views.ReviewChanges.tipCombine": "Combine current document with another one", "Common.Views.ReviewChanges.tipHistory": "Show version history", "Common.Views.ReviewChanges.tipRejectCurrent": "Reject current change", "Common.Views.ReviewChanges.tipReview": "Track changes", @@ -580,6 +581,7 @@ "Common.Views.ReviewChanges.txtCommentResolveMy": "Resolve my comments", "Common.Views.ReviewChanges.txtCommentResolveMyCurrent": "Resolve My Current Comments", "Common.Views.ReviewChanges.txtCompare": "Compare", + "Common.Views.ReviewChanges.txtCombine": "Combine", "Common.Views.ReviewChanges.txtDocLang": "Language", "Common.Views.ReviewChanges.txtEditing": "Editing", "Common.Views.ReviewChanges.txtFinal": "All changes accepted {0}", diff --git a/apps/documenteditor/main/locale/ru.json b/apps/documenteditor/main/locale/ru.json index f2f885de6..ac16be61d 100644 --- a/apps/documenteditor/main/locale/ru.json +++ b/apps/documenteditor/main/locale/ru.json @@ -555,6 +555,7 @@ "Common.Views.ReviewChanges.tipCommentResolve": "Решить комментарии", "Common.Views.ReviewChanges.tipCommentResolveCurrent": "Решить текущие комментарии", "Common.Views.ReviewChanges.tipCompare": "Сравнить текущий документ с другим", + "Common.Views.ReviewChanges.tipCombine": "Объединить текущий документ с другим", "Common.Views.ReviewChanges.tipHistory": "Показать историю версий", "Common.Views.ReviewChanges.tipRejectCurrent": "Отклонить текущее изменение", "Common.Views.ReviewChanges.tipReview": "Отслеживать изменения", @@ -580,6 +581,7 @@ "Common.Views.ReviewChanges.txtCommentResolveMy": "Решить мои комментарии", "Common.Views.ReviewChanges.txtCommentResolveMyCurrent": "Решить мои текущие комментарии", "Common.Views.ReviewChanges.txtCompare": "Сравнить", + "Common.Views.ReviewChanges.txtCombine": "Объединить", "Common.Views.ReviewChanges.txtDocLang": "Язык", "Common.Views.ReviewChanges.txtEditing": "Редактирование", "Common.Views.ReviewChanges.txtFinal": "Все изменения приняты {0}",