From c79eb90e08a55fd8a8e1ac2996bf72707249f7e8 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 9 Jun 2017 17:30:52 +0300 Subject: [PATCH] [DE] Added parameter showReviewChanges to config: open review changes dialog, when showReviewChanges is true (but do not track review changes). --- apps/api/documents/api.js | 3 +- .../main/lib/controller/ReviewChanges.js | 19 +++ apps/common/main/lib/view/ReviewChanges.js | 131 +++++++++++++++++- .../main/resources/less/review-changes.less | 75 +++++----- apps/documenteditor/main/locale/en.json | 9 ++ 5 files changed, 195 insertions(+), 42 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index ba08ffde66..530e3547c1 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -115,7 +115,8 @@ statusBar: true, autosave: true, forcesave: false, - commentAuthorOnly: false + commentAuthorOnly: false, + showReviewChanges: false }, plugins: { autoStartGuid: 'asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}', diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 72a34b6747..23fe085d7f 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -76,6 +76,11 @@ define([ 'reviewchange:delete': _.bind(this.onDeleteClick, this), 'reviewchange:preview': _.bind(this.onBtnPreviewClick, this), 'lang:document': _.bind(this.onDocLanguage, this) + }, + 'Common.Views.ReviewChangesDialog': { + 'reviewchange:accept': _.bind(this.onAcceptClick, this), + 'reviewchange:reject': _.bind(this.onRejectClick, this), + 'reviewchange:preview': _.bind(this.onBtnPreviewClick, this) } }); }, @@ -144,6 +149,10 @@ define([ if (!this.appConfig.isReviewOnly && this._state.lock !== lock) { this.view.btnAccept.setDisabled(lock==true); this.view.btnReject.setDisabled(lock==true); + if (this.dlgChanges) { + this.dlgChanges.btnAccept.setDisabled(lock==true); + this.dlgChanges.btnReject.setDisabled(lock==true); + } this._state.lock = lock; } this._state.posx = posX; @@ -517,6 +526,16 @@ define([ if ( Common.localStorage.getBool("de-settings-spellcheck") ) me.view.turnSpelling(true); + + if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) { + me.dlgChanges = (new Common.Views.ReviewChangesDialog({ + popoverChanges : me.popoverChanges, + mode : me.appConfig + })); + var sdk = $('#editor_sdk'), + offset = sdk.offset(); + me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150)); + } }); } }, diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 4f02ed587c..30374c853b 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -725,5 +725,134 @@ define([ tipSetSpelling: 'Spell checking', tipReview: 'Review' } - }()), Common.Views.ReviewChanges || {})) + }()), Common.Views.ReviewChanges || {})); + + Common.Views.ReviewChangesDialog = Common.UI.Window.extend(_.extend({ + options: { + width : 283, + height : 90, + title : 'Review Changes', + modal : false, + cls : 'review-changes modal-dlg', + alias : 'Common.Views.ReviewChangesDialog' + }, + + initialize : function(options) { + _.extend(this.options, options || {}); + + this.template = [ + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
' + ].join(''); + + this.options.tpl = _.template(this.template)(this.options); + this.popoverChanges = this.options.popoverChanges; + this.mode = this.options.mode; + + Common.UI.Window.prototype.initialize.call(this, this.options); + }, + + render: function() { + Common.UI.Window.prototype.render.call(this); + + this.btnPrev = new Common.UI.Button({ + cls: 'dlg-btn iconic', + iconCls: 'img-commonctrl prev', + hint: this.txtPrev, + hintAnchor: 'top' + }); + this.btnPrev.render( this.$window.find('#id-review-button-prev')); + + this.btnNext = new Common.UI.Button({ + cls: ' dlg-btn iconic', + iconCls: 'img-commonctrl next', + hint: this.txtNext, + hintAnchor: 'top' + }); + this.btnNext.render( this.$window.find('#id-review-button-next')); + + this.btnAccept = new Common.UI.Button({ + cls : 'btn-toolbar', + caption : this.txtAccept, + split : true, + disabled : this.mode.isReviewOnly, + menu : new Common.UI.Menu({ + items: [ + this.mnuAcceptCurrent = new Common.UI.MenuItem({ + caption: this.txtAcceptCurrent, + value: 'current' + }), + this.mnuAcceptAll = new Common.UI.MenuItem({ + caption: this.txtAcceptAll, + value: 'all' + }) + ] + }) + }); + this.btnAccept.render(this.$window.find('#id-review-button-accept')); + + this.btnReject = new Common.UI.Button({ + cls : 'btn-toolbar', + caption : this.txtReject, + split : true, + disabled : this.mode.isReviewOnly, + menu : new Common.UI.Menu({ + items: [ + this.mnuRejectCurrent = new Common.UI.MenuItem({ + caption: this.txtRejectCurrent, + value: 'current' + }), + this.mnuRejectAll = new Common.UI.MenuItem({ + caption: this.txtRejectAll, + value: 'all' + }) + ] + }) + }); + this.btnReject.render(this.$window.find('#id-review-button-reject')); + + var me = this; + this.btnPrev.on('click', function (e) { + me.fireEvent('reviewchange:preview', [me.btnPrev, 'prev']); + }); + + this.btnNext.on('click', function (e) { + me.fireEvent('reviewchange:preview', [me.btnNext, 'next']); + }); + + this.btnAccept.on('click', function (e) { + me.fireEvent('reviewchange:accept', [me.btnAccept, 'current']); + }); + + this.btnAccept.menu.on('item:click', function (menu, item, e) { + me.fireEvent('reviewchange:accept', [menu, item]); + }); + + this.btnReject.on('click', function (e) { + me.fireEvent('reviewchange:reject', [me.btnReject, 'current']); + }); + + this.btnReject.menu.on('item:click', function (menu, item, e) { + me.fireEvent('reviewchange:reject', [menu, item]); + }); + + return this; + }, + + textTitle: 'Review Changes', + txtPrev: 'To previous change', + txtNext: 'To next change', + txtAccept: 'Accept', + txtAcceptCurrent: 'Accept Current Change', + txtAcceptAll: 'Accept All Changes', + txtReject: 'Reject', + txtRejectCurrent: 'Reject Current Change', + txtRejectAll: 'Reject All Changes' + }, Common.Views.ReviewChangesDialog || {})); }); \ No newline at end of file diff --git a/apps/common/main/resources/less/review-changes.less b/apps/common/main/resources/less/review-changes.less index ed327873bb..9361d71b8a 100644 --- a/apps/common/main/resources/less/review-changes.less +++ b/apps/common/main/resources/less/review-changes.less @@ -1,43 +1,38 @@ .review-changes { - //position: absolute; - //bottom: -1px; - //right: 55px; - //background: @gray-light; - //border: 1px solid @gray-dark; - //height: 35px; - //z-index: @zindex-dropdown - 1; - // - //.review-group { - // display: inline-block; - // vertical-align: middle; - // padding: 6px 0px 6px 10px; - // - // & > div, & > label { - // margin-right: 10px; - // display: inline-block; - // } - //} - // - //#id-review-label-total { - // font: bold 10px Helvetica, Arial, Verdana, sans-serif; - // color: @gray-darker; - // text-shadow: none; - // white-space: nowrap; - // cursor: pointer; - // vertical-align: middle; - //} - // - //#id-review-button-accept, - //#id-review-button-reject { - // span.caption { - // vertical-align: middle; - // font-size: 12px; - // margin: 0 6px; - // } - //} - //.separator { - // margin: 0 !important; - // height: 19px; - //} + .input-row > div { + margin-right: 10px; + + button { + height: 22px; + } + } + + #id-review-button-accept, + #id-review-button-reject { + span.caption { + vertical-align: middle; + font-size: 12px; + margin: 0 6px; + } + } + + .iconic { + width: 45px !important; + } + + .prev, .next { + width: 16px; + height: 16px; + display: inline-block; + cursor: pointer; + } + + .prev { + background-position: @search-dlg-offset-x @search-dlg-offset-y; + } + + .next { + background-position: @search-dlg-offset-x @search-dlg-offset-y - 16px; + } } diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 314b0fd3d2..b3edb0f49d 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -204,6 +204,15 @@ "Common.Views.ReviewChanges.tipReview": "Review", "Common.Views.ReviewChanges.tipSetDocLang": "Set Document Language", "Common.Views.ReviewChanges.tipSetSpelling": "Spell checking", + "Common.Views.ReviewChangesDialog.textTitle": "Review Changes", + "Common.Views.ReviewChangesDialog.txtAccept": "Accept", + "Common.Views.ReviewChangesDialog.txtAcceptAll": "Accept All Changes", + "Common.Views.ReviewChangesDialog.txtAcceptCurrent": "Accept Current Change", + "Common.Views.ReviewChangesDialog.txtNext": "To Next Change", + "Common.Views.ReviewChangesDialog.txtPrev": "To Previous Change", + "Common.Views.ReviewChangesDialog.txtReject": "Reject", + "Common.Views.ReviewChangesDialog.txtRejectAll": "Reject All Changes", + "Common.Views.ReviewChangesDialog.txtRejectCurrent": "Reject Current Change", "DE.Controllers.LeftMenu.leavePageText": "All unsaved changes in this document will be lost.
Click \"Cancel\" then \"Save\" to save them. Click \"OK\" to discard all the unsaved changes.", "DE.Controllers.LeftMenu.newDocumentTitle": "Unnamed document", "DE.Controllers.LeftMenu.notcriticalErrorTitle": "Warning",