diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js index e097848f9..2e9a4e3ee 100644 --- a/apps/common/main/lib/component/Button.js +++ b/apps/common/main/lib/component/Button.js @@ -710,7 +710,7 @@ define([ this.caption = caption; if (this.rendered) { - var captionNode = this.cmpEl.find('button:first > .caption').addBack().filter('button > .caption'); + var captionNode = this.cmpEl.find('.caption'); if (captionNode.length > 0) { captionNode.text(caption); diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index 7d541f276..59eca43c1 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -126,6 +126,9 @@ define([ 'comment:closeEditing': _.bind(this.closeEditing, this), 'comment:disableHint': _.bind(this.disableHint, this), 'comment:addDummyComment': _.bind(this.onAddDummyComment, this) + }, + 'Common.Views.ReviewChanges': { + 'comment:removeComments': _.bind(this.onRemoveComments, this) } }); @@ -180,7 +183,7 @@ define([ this.api.asc_registerCallback('asc_onAddComments', _.bind(this.onApiAddComments, this)); this.api.asc_registerCallback('asc_onRemoveComment', _.bind(this.onApiRemoveComment, this)); this.api.asc_registerCallback('asc_onChangeComments', _.bind(this.onChangeComments, this)); - this.api.asc_registerCallback('asc_onRemoveComments', _.bind(this.onRemoveComments, this)); + this.api.asc_registerCallback('asc_onRemoveComments', _.bind(this.onApiRemoveComments, this)); this.api.asc_registerCallback('asc_onChangeCommentData', _.bind(this.onApiChangeCommentData, this)); this.api.asc_registerCallback('asc_onLockComment', _.bind(this.onApiLockComment, this)); this.api.asc_registerCallback('asc_onUnLockComment', _.bind(this.onApiUnLockComment, this)); @@ -233,6 +236,11 @@ define([ this.api.asc_removeComment(id); } }, + onRemoveComments: function (type) { + if (this.api) { + this.api.asc_RemoveAllComments(type=='my' || !this.mode.canEditComments, type=='current');// 1 param = true if remove only my comments, 2 param - remove current comments + } + }, onResolveComment: function (uid) { var t = this, reply = null, @@ -725,7 +733,7 @@ define([ this.updateComments(true); }, - onRemoveComments: function (data) { + onApiRemoveComments: function (data) { for (var i = 0; i < data.length; ++i) { this.onApiRemoveComment(data[i], true); } diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 713d32d30..52901cea5 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -69,6 +69,10 @@ define([ 'FileMenu': { 'settings:apply': this.applySettings.bind(this) }, + 'LeftMenu': { + 'comments:show': _.bind(this.commentsShowHide, this, 'show'), + 'comments:hide': _.bind(this.commentsShowHide, this, 'hide') + }, 'Common.Views.ReviewChanges': { 'reviewchange:accept': _.bind(this.onAcceptClick, this), 'reviewchange:reject': _.bind(this.onRejectClick, this), @@ -695,7 +699,9 @@ define([ if (state !== me.view.btnChat.pressed) me.view.turnChat(state); }); - + } + if (me.view && me.view.btnCommentRemove) { + me.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true)); } }, @@ -774,6 +780,12 @@ define([ }); }, + commentsShowHide: function(mode) { + if (!this.view) return; + var value = Common.Utils.InternalSettings.get(this.view.appPrefix + "settings-livecomment"); + (value!==undefined) && this.view.btnCommentRemove && this.view.btnCommentRemove.setDisabled(mode != 'show' && !value); + }, + textInserted: 'Inserted:', textDeleted: 'Deleted:', textParaInserted: 'Paragraph Inserted ', diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 2325f1b31..8f8ad705a 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -64,6 +64,7 @@ define([ '
' + '
' + '' + + '' + '
' + '
' + '
' + @@ -161,6 +162,16 @@ define([ this.btnChat && this.btnChat.on('click', function (btn, e) { me.fireEvent('collaboration:chat', [btn.pressed]); }); + + if (this.btnCommentRemove) { + this.btnCommentRemove.on('click', function (e) { + me.fireEvent('comment:removeComments', ['current']); + }); + + this.btnCommentRemove.menu.on('item:click', function (menu, item, e) { + me.fireEvent('comment:removeComments', [item.value]); + }); + } } return { @@ -291,6 +302,15 @@ define([ }); } + if ( this.appConfig.canCoAuthoring && this.appConfig.canComments ) { + this.btnCommentRemove = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + caption: this.txtCommentRemove, + split: true, + iconCls: 'btn-rem-comment' + }); + } + var filter = Common.localStorage.getKeysFilter(); this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : ''; @@ -397,6 +417,28 @@ define([ me.turnCoAuthMode((value===null || parseInt(value) == 1) && !(config.isDesktopApp && config.isOffline) && config.canCoAuthoring); } + if (me.btnCommentRemove) { + var items = [ + { + caption: config.canEditComments ? me.txtCommentRemCurrent : me.txtCommentRemMyCurrent, + value: 'current' + }, + { + caption: me.txtCommentRemMy, + value: 'my' + } + ]; + if (config.canEditComments) + items.push({ + caption: me.txtCommentRemAll, + value: 'all' + }); + me.btnCommentRemove.setMenu( + new Common.UI.Menu({items: items}) + ); + me.btnCommentRemove.updateHint([me.tipCommentRemCurrent, me.tipCommentRem]); + } + 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', @@ -448,6 +490,7 @@ define([ this.btnCoAuthMode && this.btnCoAuthMode.render(this.$el.find('#slot-btn-coauthmode')); this.btnHistory && this.btnHistory.render(this.$el.find('#slot-btn-history')); this.btnChat && this.btnChat.render(this.$el.find('#slot-btn-chat')); + this.btnCommentRemove && this.btnCommentRemove.render(this.$el.find('#slot-comment-remove')); return this.$el; }, @@ -561,6 +604,7 @@ define([ } }, this); this.btnChat && this.btnChat.setDisabled(state); + this.btnCommentRemove && this.btnCommentRemove.setDisabled(state); }, onLostEditRights: function() { @@ -609,7 +653,14 @@ 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.', + txtCommentRemove: 'Remove', + tipCommentRemCurrent: 'Remove current comments', + tipCommentRem: 'Remove comments', + txtCommentRemCurrent: 'Remove Current Comments', + txtCommentRemMyCurrent: 'Remove My Current Comments', + txtCommentRemMy: 'Remove My Comments', + txtCommentRemAll: 'Remove All Comments' } }()), Common.Views.ReviewChanges || {})); diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 074fc78fc..16ddef848 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -533,7 +533,8 @@ .button-normal-icon(btn-caption, 76, @toolbar-big-icon-size); .button-normal-icon(btn-calculation, 80, @toolbar-big-icon-size); .button-normal-icon(btn-scale, 81, @toolbar-big-icon-size); -.button-normal-icon(btn-symbol, 84, @toolbar-big-icon-size); +.button-normal-icon(btn-rem-comment, 83, @toolbar-big-icon-size); +.button-normal-icon(btn-symbol, 84, @toolbar-big-icon-size); [applang=ru] { .btn-toolbar { diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index d8d17f7f6..6ebac79fd 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -467,6 +467,7 @@ define([ if (this.mode.canViewComments && this.leftMenu.panelComments.isVisible()) value = resolved = true; (value) ? this.api.asc_showComments(resolved) : this.api.asc_hideComments(); + this.getApplication().getController('Common.Controllers.ReviewChanges').commentsShowHide(value ? 'show' : 'hide'); /** coauthoring end **/ value = Common.localStorage.getItem("de-settings-fontrender"); diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index ed898d49c..7f5f5bdd7 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -2914,6 +2914,8 @@ define([ btn.on('click', function (btn, e) { Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); }); + if (btn.cmpEl.closest('#review-changes-panel').length>0) + btn.setCaption(me.toolbar.capBtnAddComment); }, this); } } diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 70ab3fc48..e3746bc6a 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -2335,6 +2335,7 @@ define([ textEditWatermark: 'Custom Watermark', textRemWatermark: 'Remove Watermark', tipWatermark: 'Edit watermark', + capBtnAddComment: 'Add Comment', capBtnInsSymbol: 'Symbol', tipInsertSymbol: 'Insert symbol' } diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 50c07692a..26fdd5d98 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -253,6 +253,13 @@ "Common.Views.ReviewChanges.txtSpelling": "Spell Checking", "Common.Views.ReviewChanges.txtTurnon": "Track Changes", "Common.Views.ReviewChanges.txtView": "Display Mode", + "Common.Views.ReviewChanges.txtCommentRemove": "Remove", + "Common.Views.ReviewChanges.tipCommentRemCurrent": "Remove current comments", + "Common.Views.ReviewChanges.tipCommentRem": "Remove comments", + "Common.Views.ReviewChanges.txtCommentRemCurrent": "Remove Current Comments", + "Common.Views.ReviewChanges.txtCommentRemMyCurrent": "Remove My Current Comments", + "Common.Views.ReviewChanges.txtCommentRemMy": "Remove My Comments", + "Common.Views.ReviewChanges.txtCommentRemAll": "Remove All Comments", "Common.Views.ReviewChangesDialog.textTitle": "Review Changes", "Common.Views.ReviewChangesDialog.txtAccept": "Accept", "Common.Views.ReviewChangesDialog.txtAcceptAll": "Accept All Changes", @@ -2056,6 +2063,7 @@ "DE.Views.TextArtSettings.textTemplate": "Template", "DE.Views.TextArtSettings.textTransform": "Transform", "DE.Views.TextArtSettings.txtNoBorders": "No Line", + "DE.Views.Toolbar.capBtnAddComment": "Add Comment", "DE.Views.Toolbar.capBtnBlankPage": "Blank Page", "DE.Views.Toolbar.capBtnColumns": "Columns", "DE.Views.Toolbar.capBtnComment": "Comment", diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 4bff6451a..e5f0f9509 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -2188,6 +2188,8 @@ define([ btn.on('click', function (btn, e) { Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); }); + if (btn.cmpEl.closest('#review-changes-panel').length>0) + btn.setCaption(me.toolbar.capBtnAddComment); }, this); this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment }); } diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index a5cb95d6b..37e238ecd 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1688,6 +1688,7 @@ define([ capBtnSlideNum: 'Slide Number', capBtnDateTime: 'Date & Time', textListSettings: 'List Settings', + capBtnAddComment: 'Add Comment', capBtnInsSymbol: 'Symbol', tipInsertSymbol: 'Insert symbol' } diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 5ad8010bb..a4a1b287e 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -184,6 +184,13 @@ "Common.Views.ReviewChanges.txtSpelling": "Spell Checking", "Common.Views.ReviewChanges.txtTurnon": "Track Changes", "Common.Views.ReviewChanges.txtView": "Display Mode", + "Common.Views.ReviewChanges.txtCommentRemove": "Remove", + "Common.Views.ReviewChanges.tipCommentRemCurrent": "Remove current comments", + "Common.Views.ReviewChanges.tipCommentRem": "Remove comments", + "Common.Views.ReviewChanges.txtCommentRemCurrent": "Remove Current Comments", + "Common.Views.ReviewChanges.txtCommentRemMyCurrent": "Remove My Current Comments", + "Common.Views.ReviewChanges.txtCommentRemMy": "Remove My Comments", + "Common.Views.ReviewChanges.txtCommentRemAll": "Remove All Comments", "Common.Views.ReviewPopover.textAdd": "Add", "Common.Views.ReviewPopover.textAddReply": "Add Reply", "Common.Views.ReviewPopover.textCancel": "Cancel", @@ -1672,6 +1679,7 @@ "PE.Views.TextArtSettings.txtPapyrus": "Papyrus", "PE.Views.TextArtSettings.txtWood": "Wood", "PE.Views.Toolbar.capAddSlide": "Add Slide", + "PE.Views.Toolbar.capBtnAddComment": "Add Comment", "PE.Views.Toolbar.capBtnComment": "Comment", "PE.Views.Toolbar.capBtnDateTime": "Date & Time", "PE.Views.Toolbar.capBtnInsHeader": "Header/Footer", diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 4b1221e53..c18f73f3c 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -367,6 +367,7 @@ define([ if (this.mode.canViewComments && this.leftMenu.panelComments.isVisible()) value = resolved = true; (value) ? this.api.asc_showComments(resolved) : this.api.asc_hideComments(); + this.getApplication().getController('Common.Controllers.ReviewChanges').commentsShowHide(value ? 'show' : 'hide'); value = Common.localStorage.getBool("sse-settings-r1c1"); Common.Utils.InternalSettings.set("sse-settings-r1c1", value); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 1c6b65022..38f3a4009 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3258,6 +3258,8 @@ define([ btn.on('click', function (btn, e) { Common.NotificationCenter.trigger('app:comment:add', 'toolbar', me.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType() != Asc.c_oAscSelectionType.RangeCells); }); + if (btn.cmpEl.closest('#review-changes-panel').length>0) + btn.setCaption(me.toolbar.capBtnAddComment); }, this); } } diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 80741de00..769be62ab 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -2531,6 +2531,7 @@ define([ textHeight: 'Height', textWidth: 'Width', textMorePages: 'More pages', + capBtnAddComment: 'Add Comment', capBtnInsSymbol: 'Symbol', tipInsertSymbol: 'Insert symbol' }, SSE.Views.Toolbar || {})); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 56a78e04e..0cf9d42f1 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -178,6 +178,13 @@ "Common.Views.ReviewChanges.txtSpelling": "Spell Checking", "Common.Views.ReviewChanges.txtTurnon": "Track Changes", "Common.Views.ReviewChanges.txtView": "Display Mode", + "Common.Views.ReviewChanges.txtCommentRemove": "Remove", + "Common.Views.ReviewChanges.tipCommentRemCurrent": "Remove current comments", + "Common.Views.ReviewChanges.tipCommentRem": "Remove comments", + "Common.Views.ReviewChanges.txtCommentRemCurrent": "Remove Current Comments", + "Common.Views.ReviewChanges.txtCommentRemMyCurrent": "Remove My Current Comments", + "Common.Views.ReviewChanges.txtCommentRemMy": "Remove My Comments", + "Common.Views.ReviewChanges.txtCommentRemAll": "Remove All Comments", "Common.Views.ReviewPopover.textAdd": "Add", "Common.Views.ReviewPopover.textAddReply": "Add Reply", "Common.Views.ReviewPopover.textCancel": "Cancel", @@ -2206,6 +2213,7 @@ "SSE.Views.TextArtSettings.txtNoBorders": "No Line", "SSE.Views.TextArtSettings.txtPapyrus": "Papyrus", "SSE.Views.TextArtSettings.txtWood": "Wood", + "SSE.Views.Toolbar.capBtnAddComment": "Add Comment", "SSE.Views.Toolbar.capBtnComment": "Comment", "SSE.Views.Toolbar.capBtnInsHeader": "Header/Footer", "SSE.Views.Toolbar.capBtnMargins": "Margins",