diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 9fe50e74d..b1aa9de10 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -74,7 +74,8 @@ define([ 'reviewchange:reject': _.bind(this.onRejectClick, this), 'reviewchange:delete': _.bind(this.onDeleteClick, this), 'reviewchange:preview': _.bind(this.onBtnPreviewClick, this), - 'reviewchanges:view': _.bind(this.onReviewViewClick, this), + 'reviewchange:view': _.bind(this.onReviewViewClick, this), + 'reviewchange:compare': _.bind(this.onCompareClick, this), 'lang:document': _.bind(this.onDocLanguage, this), 'collaboration:coauthmode': _.bind(this.onCoAuthMode, this) }, @@ -554,6 +555,53 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.view); }, + onCompareClick: function(item) { + if (this.api) { + if (item === 'file') { + // if (this.api) + // this.api.asc_addDocument(); + Common.NotificationCenter.trigger('edit:complete', this.view); + } else if (item === 'url') { + var me = this; + (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.AddDocumentUrl(checkUrl); + } + } + Common.NotificationCenter.trigger('edit:complete', me.view); + } + } + })).show(); + } else if (item === 'storage') { + // if (this.toolbar.mode.canRequestInsertImage) { + // Common.Gateway.requestInsertImage(); + // } else { + // (new Common.Views.SelectFileDlg({ + // fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly") + // })).on('selectfile', function(obj, file){ + // me.insertImage(file); + // }).show(); + // } + } else if (item === 'settings') { + // show settings dialog + } + } + Common.NotificationCenter.trigger('edit:complete', this.view); + }, + + insertImage: function(data) { + if (data && data.url) { + this.toolbar.fireEvent('insertimage', this.toolbar); + this.api.AddImageUrl(data.url, undefined, data.token);// for loading from storage + Common.component.Analytics.trackEvent('ToolBar', 'Image'); + } + }, + turnDisplayMode: function(mode) { if (this.api) { if (mode === 'final') @@ -797,6 +845,7 @@ define([ textTableRowsDel: 'Table Rows Deleted', textParaMoveTo: 'Moved:', textParaMoveFromUp: 'Moved Up:', - textParaMoveFromDown: 'Moved Down:' + textParaMoveFromDown: 'Moved Down:', + textUrl: 'Paste a document URL' }, Common.Controllers.ReviewChanges || {})); }); \ No newline at end of file diff --git a/apps/common/main/lib/view/ImageFromUrlDialog.js b/apps/common/main/lib/view/ImageFromUrlDialog.js index 63b0ea685..9f25ef434 100644 --- a/apps/common/main/lib/view/ImageFromUrlDialog.js +++ b/apps/common/main/lib/view/ImageFromUrlDialog.js @@ -55,7 +55,7 @@ define([ this.template = [ '
', '
', - '', + '', '
', '
', '
', diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 2325f1b31..5e5f4daaf 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -79,6 +79,10 @@ define([ '' + '' + '
' + + '
' + + '' + + '
' + + '
' + '
' + '' + '
' + @@ -115,6 +119,14 @@ define([ me.fireEvent('reviewchange:reject', [menu, item]); }); + this.btnCompare.on('click', function (e) { + me.fireEvent('reviewchange:compare', ['file']); + }); + + this.btnCompare.menu.on('item:click', function (menu, item, e) { + me.fireEvent('reviewchange:compare', [item.value]); + }); + this.btnsTurnReview.forEach(function (button) { button.on('click', _click_turnpreview.bind(me)); }); @@ -129,7 +141,7 @@ define([ }); this.btnReviewView && this.btnReviewView.menu.on('item:click', function (menu, item, e) { - me.fireEvent('reviewchanges:view', [menu, item]); + me.fireEvent('reviewchange:view', [menu, item]); }); } @@ -188,6 +200,13 @@ define([ iconCls: 'review-deny' }); + this.btnCompare = new Common.UI.Button({ + cls : 'btn-toolbar x-huge icon-top', + caption : this.txtCompare, + split : true, + iconCls: 'review-deny' + }); + this.btnTurnOn = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', iconCls: 'btn-ic-review', @@ -348,6 +367,17 @@ define([ ); me.btnReject.updateHint([me.tipRejectCurrent, me.txtRejectChanges]); + me.btnCompare.setMenu(new Common.UI.Menu({ + items: [ + {caption: me.mniFromFile, value: 'file'}, + {caption: me.mniFromUrl, value: 'url'}, + {caption: me.mniFromStorage, value: 'storage'}, + {caption: '--'}, + {caption: me.mniSettings, value: 'settings'} + ] + })); + me.btnCompare.updateHint(me.tipCompare); + me.btnAccept.setDisabled(config.isReviewOnly); me.btnReject.setDisabled(config.isReviewOnly); } @@ -400,6 +430,7 @@ define([ var separator_sharing = !(me.btnSharing || me.btnCoAuthMode) ? me.$el.find('.separator.sharing') : '.separator.sharing', separator_comments = !(config.canComments && config.canCoAuthoring) ? me.$el.find('.separator.comments') : '.separator.comments', separator_review = !(config.canReview || config.canViewReview) ? me.$el.find('.separator.review') : '.separator.review', + separator_compare = !config.canReview ? me.$el.find('.separator.compare') : '.separator.compare', separator_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat', separator_last; @@ -418,6 +449,11 @@ define([ else separator_last = separator_review; + if (typeof separator_compare == 'object') + separator_compare.hide().prev('.group').hide(); + else + separator_last = separator_compare; + if (typeof separator_chat == 'object') separator_chat.hide().prev('.group').hide(); else @@ -438,6 +474,7 @@ define([ if ( this.appConfig.canReview ) { this.btnAccept.render(this.$el.find('#btn-change-accept')); this.btnReject.render(this.$el.find('#btn-change-reject')); + this.btnCompare.render(this.$el.find('#btn-compare')); this.btnTurnOn.render(this.$el.find('#btn-review-on')); } this.btnPrev && this.btnPrev.render(this.$el.find('#btn-change-prev')); @@ -609,7 +646,13 @@ define([ txtFinalCap: 'Final', txtOriginalCap: 'Original', strFastDesc: 'Real-time co-editing. All changes are saved automatically.', - strStrictDesc: 'Use the \'Save\' button to sync the changes you and others make.' + strStrictDesc: 'Use the \'Save\' button to sync the changes you and others make.', + txtCompare: 'Compare', + tipCompare: 'Compare current document with another one', + mniFromFile: 'Document from File', + mniFromUrl: 'Document from URL', + mniFromStorage: 'Document from Storage', + mniSettings: 'Comparison Settings' } }()), Common.Views.ReviewChanges || {})); diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 6a1ee4caa..9a4365729 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -2272,8 +2272,8 @@ define([ tipBack: 'Back', tipInsertShape: 'Insert Autoshape', tipInsertEquation: 'Insert Equation', - mniImageFromFile: 'Image from file', - mniImageFromUrl: 'Image from url', + mniImageFromFile: 'Image from File', + mniImageFromUrl: 'Image from URL', mniCustomTable: 'Insert Custom Table', textTitleError: 'Error', textInsertPageNumber: 'Insert page number', diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 135c39df3..e8842a041 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -69,6 +69,7 @@ "Common.Controllers.ReviewChanges.textTabs": "Change tabs", "Common.Controllers.ReviewChanges.textUnderline": "Underline", "Common.Controllers.ReviewChanges.textWidow": "Widow control", + "Common.Controllers.ReviewChanges.textUrl": "Paste a document URL", "Common.UI.ComboBorderSize.txtNoBorders": "No borders", "Common.UI.ComboBorderSizeEditable.txtNoBorders": "No borders", "Common.UI.ComboDataView.emptyComboText": "No styles", @@ -268,6 +269,12 @@ "Common.Views.ReviewChanges.txtSpelling": "Spell Checking", "Common.Views.ReviewChanges.txtTurnon": "Track Changes", "Common.Views.ReviewChanges.txtView": "Display Mode", + "Common.Views.ReviewChanges.txtCompare": "Compare", + "Common.Views.ReviewChanges.tipCompare": "Compare current document with another one", + "Common.Views.ReviewChanges.mniFromFile": "Document from File", + "Common.Views.ReviewChanges.mniFromUrl": "Document from URL", + "Common.Views.ReviewChanges.mniFromStorage": "Document from Storage", + "Common.Views.ReviewChanges.mniSettings": "Comparison Settings", "Common.Views.ReviewChangesDialog.textTitle": "Review Changes", "Common.Views.ReviewChangesDialog.txtAccept": "Accept", "Common.Views.ReviewChangesDialog.txtAcceptAll": "Accept All Changes",