[DE] processed permissions for review
This commit is contained in:
parent
53309aab82
commit
0cf3621991
|
@ -80,7 +80,6 @@ define([
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges');
|
this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges');
|
||||||
this.popoverChanges = new Common.Collections.ReviewChanges();
|
|
||||||
this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
|
this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
|
||||||
|
|
||||||
this._state = {posx: -1000, posy: -1000, popoverVisible: false};
|
this._state = {posx: -1000, posy: -1000, popoverVisible: false};
|
||||||
|
@ -107,12 +106,16 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
if ( mode.canReview || mode.isReviewOnly ) {
|
this.appConfig = mode;
|
||||||
|
if ( mode.canReview ) {
|
||||||
|
this.popoverChanges = new Common.Collections.ReviewChanges();
|
||||||
|
}
|
||||||
|
|
||||||
this.view = this.createView('Common.Views.ReviewChanges', {
|
this.view = this.createView('Common.Views.ReviewChanges', {
|
||||||
// store : this.collection,
|
// store : this.collection,
|
||||||
popoverChanges : this.popoverChanges
|
popoverChanges : this.popoverChanges,
|
||||||
|
mode : mode
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
@ -137,7 +140,7 @@ define([
|
||||||
|
|
||||||
this.getPopover().show(animate, lock, lockUser);
|
this.getPopover().show(animate, lock, lockUser);
|
||||||
|
|
||||||
if (!this.view.appConfig.isReviewOnly && this._state.lock !== lock) {
|
if (!this.appConfig.isReviewOnly && this._state.lock !== lock) {
|
||||||
this.view.btnAccept.setDisabled(lock==true);
|
this.view.btnAccept.setDisabled(lock==true);
|
||||||
this.view.btnReject.setDisabled(lock==true);
|
this.view.btnReject.setDisabled(lock==true);
|
||||||
this._state.lock = lock;
|
this._state.lock = lock;
|
||||||
|
@ -457,10 +460,10 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onTurnPreview: function(state) {
|
onTurnPreview: function(state) {
|
||||||
if ( this.view.appConfig.isReviewOnly ) {
|
if ( this.appConfig.isReviewOnly ) {
|
||||||
this.view.turnChanges(true);
|
this.view.turnChanges(true);
|
||||||
} else
|
} else
|
||||||
if ( this.view.appConfig.canReview ) {
|
if ( this.appConfig.canReview ) {
|
||||||
state = (state == 'on');
|
state = (state == 'on');
|
||||||
|
|
||||||
this.api.asc_SetTrackRevisions(state);
|
this.api.asc_SetTrackRevisions(state);
|
||||||
|
@ -491,7 +494,6 @@ define([
|
||||||
if ( config.canReview ) {
|
if ( config.canReview ) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
this.appConfig = config;
|
|
||||||
(new Promise(function (resolve) {
|
(new Promise(function (resolve) {
|
||||||
resolve();
|
resolve();
|
||||||
})).then(function () {
|
})).then(function () {
|
||||||
|
|
|
@ -416,11 +416,11 @@ define([
|
||||||
'<span id="slot-set-lang" class="btn-slot text x-huge"></span>' +
|
'<span id="slot-set-lang" class="btn-slot text x-huge"></span>' +
|
||||||
'<span id="slot-btn-spelling" class="btn-slot text x-huge"></span>' +
|
'<span id="slot-btn-spelling" class="btn-slot text x-huge"></span>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="separator long"/>' +
|
'<div class="separator long comments"/>' +
|
||||||
'<div class="group">' +
|
'<div class="group">' +
|
||||||
'<span class="btn-slot text x-huge slot-comment"></span>' +
|
'<span class="btn-slot text x-huge slot-comment"></span>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="separator long"/>' +
|
'<div class="separator long review"/>' +
|
||||||
'<div class="group">' +
|
'<div class="group">' +
|
||||||
'<span id="btn-review-on" class="btn-slot text x-huge"></span>' +
|
'<span id="btn-review-on" class="btn-slot text x-huge"></span>' +
|
||||||
'<span id="btn-change-prev" class="btn-slot text x-huge"></span>' +
|
'<span id="btn-change-prev" class="btn-slot text x-huge"></span>' +
|
||||||
|
@ -432,6 +432,8 @@ define([
|
||||||
|
|
||||||
function setEvents() {
|
function setEvents() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
|
if ( me.appConfig.canReview ) {
|
||||||
this.btnPrev.on('click', function (e) {
|
this.btnPrev.on('click', function (e) {
|
||||||
me.fireEvent('reviewchange:preview', [me.btnPrev, 'prev']);
|
me.fireEvent('reviewchange:preview', [me.btnPrev, 'prev']);
|
||||||
});
|
});
|
||||||
|
@ -457,15 +459,16 @@ define([
|
||||||
});
|
});
|
||||||
|
|
||||||
function _click_turnpreview(btn, e) {
|
function _click_turnpreview(btn, e) {
|
||||||
if ( me.appConfig.canReview ) {
|
if (me.appConfig.canReview) {
|
||||||
Common.NotificationCenter.trigger('reviewchanges:turn', btn.pressed ? 'on' : 'off');
|
Common.NotificationCenter.trigger('reviewchanges:turn', btn.pressed ? 'on' : 'off');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.btnsTurnReview.forEach(function(button) {
|
this.btnsTurnReview.forEach(function (button) {
|
||||||
button.on('click', _click_turnpreview.bind(me));
|
button.on('click', _click_turnpreview.bind(me));
|
||||||
Common.NotificationCenter.trigger('edit:complete', me);
|
Common.NotificationCenter.trigger('edit:complete', me);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.btnsSpelling.forEach(function(button) {
|
this.btnsSpelling.forEach(function(button) {
|
||||||
button.on('click', function (b, e) {
|
button.on('click', function (b, e) {
|
||||||
|
@ -480,7 +483,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
el: '#review-changes-panel',
|
// el: '#review-changes-panel',
|
||||||
|
|
||||||
options: {},
|
options: {},
|
||||||
|
|
||||||
|
@ -489,7 +492,9 @@ define([
|
||||||
|
|
||||||
// this.store = this.options.store;
|
// this.store = this.options.store;
|
||||||
// this.popoverChanges = this.options.popoverChanges;
|
// this.popoverChanges = this.options.popoverChanges;
|
||||||
|
this.appConfig = options.mode;
|
||||||
|
|
||||||
|
if ( this.appConfig.canReview ) {
|
||||||
this.btnPrev = new Common.UI.Button({
|
this.btnPrev = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
iconCls: 'review-prev',
|
iconCls: 'review-prev',
|
||||||
|
@ -523,6 +528,7 @@ define([
|
||||||
enableToggle: true
|
enableToggle: true
|
||||||
});
|
});
|
||||||
this.btnsTurnReview = [this.btnTurnOn];
|
this.btnsTurnReview = [this.btnTurnOn];
|
||||||
|
}
|
||||||
|
|
||||||
this.btnSetSpelling = new Common.UI.Button({
|
this.btnSetSpelling = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
|
@ -553,13 +559,10 @@ define([
|
||||||
(new Promise(function (accept, reject) {
|
(new Promise(function (accept, reject) {
|
||||||
accept();
|
accept();
|
||||||
})).then(function(){
|
})).then(function(){
|
||||||
me.appConfig = config;
|
if ( config.canReview ) {
|
||||||
|
|
||||||
me.btnPrev.updateHint(me.hintPrev);
|
me.btnPrev.updateHint(me.hintPrev);
|
||||||
me.btnNext.updateHint(me.hintNext);
|
me.btnNext.updateHint(me.hintNext);
|
||||||
me.btnTurnOn.updateHint(me.textChangesOn);
|
me.btnTurnOn.updateHint(me.textChangesOn);
|
||||||
me.btnDocLang.updateHint(me.tipSetDocLang);
|
|
||||||
me.btnSetSpelling.updateHint(me.tipSetSpelling);
|
|
||||||
|
|
||||||
me.btnAccept.setMenu(
|
me.btnAccept.setMenu(
|
||||||
new Common.UI.Menu({
|
new Common.UI.Menu({
|
||||||
|
@ -593,23 +596,40 @@ define([
|
||||||
|
|
||||||
me.btnAccept.setDisabled(config.isReviewOnly);
|
me.btnAccept.setDisabled(config.isReviewOnly);
|
||||||
me.btnReject.setDisabled(config.isReviewOnly);
|
me.btnReject.setDisabled(config.isReviewOnly);
|
||||||
|
} else {
|
||||||
|
me.$el.find('.separator.review')
|
||||||
|
.hide()
|
||||||
|
.next('.group').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !config.canComments ) {
|
||||||
|
$('.separator.comments', me.$el)
|
||||||
|
.hide()
|
||||||
|
.next('.group').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
me.btnDocLang.updateHint(me.tipSetDocLang);
|
||||||
|
me.btnSetSpelling.updateHint(me.tipSetSpelling);
|
||||||
|
|
||||||
setEvents.call(me);
|
setEvents.call(me);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getPanel: function () {
|
getPanel: function () {
|
||||||
var _html = $(_.template( template, {} ));
|
this.$el = $(_.template( template, {} ));
|
||||||
|
|
||||||
this.btnPrev.render(_html.find('#btn-change-prev'));
|
if ( this.appConfig.canReview ) {
|
||||||
this.btnNext.render(_html.find('#btn-change-next'));
|
this.btnPrev.render(this.$el.find('#btn-change-prev'));
|
||||||
this.btnAccept.render(_html.find('#btn-change-accept'));
|
this.btnNext.render(this.$el.find('#btn-change-next'));
|
||||||
this.btnReject.render(_html.find('#btn-change-reject'));
|
this.btnAccept.render(this.$el.find('#btn-change-accept'));
|
||||||
this.btnTurnOn.render(_html.find('#btn-review-on'));
|
this.btnReject.render(this.$el.find('#btn-change-reject'));
|
||||||
this.btnSetSpelling.render(_html.find('#slot-btn-spelling'));
|
this.btnTurnOn.render(this.$el.find('#btn-review-on'));
|
||||||
this.btnDocLang.render(_html.find('#slot-set-lang'));
|
}
|
||||||
|
|
||||||
return _html;
|
this.btnSetSpelling.render(this.$el.find('#slot-btn-spelling'));
|
||||||
|
this.btnDocLang.render(this.$el.find('#slot-set-lang'));
|
||||||
|
|
||||||
|
return this.$el;
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function () {
|
show: function () {
|
||||||
|
|
|
@ -43,8 +43,7 @@
|
||||||
define([
|
define([
|
||||||
'core',
|
'core',
|
||||||
'documenteditor/main/app/view/Statusbar',
|
'documenteditor/main/app/view/Statusbar',
|
||||||
'common/main/lib/util/LanguageInfo',
|
'common/main/lib/util/LanguageInfo'
|
||||||
'common/main/lib/view/ReviewChanges'
|
|
||||||
], function () {
|
], function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -89,18 +88,18 @@ define([
|
||||||
|
|
||||||
$('.statusbar #label-zoom').css('min-width', 70);
|
$('.statusbar #label-zoom').css('min-width', 70);
|
||||||
|
|
||||||
if ( cfg.canReview ) {
|
|
||||||
var review = DE.getController('Common.Controllers.ReviewChanges').getView();
|
var review = DE.getController('Common.Controllers.ReviewChanges').getView();
|
||||||
|
if ( cfg.canReview ) {
|
||||||
me.btnTurnReview = review.getButton('turn', 'statusbar');
|
me.btnTurnReview = review.getButton('turn', 'statusbar');
|
||||||
me.btnTurnReview.render( me.statusbar.$layout.find('#btn-doc-review') );
|
me.btnTurnReview.render( me.statusbar.$layout.find('#btn-doc-review') );
|
||||||
|
|
||||||
me.btnSpelling = review.getButton('spelling', 'statusbar');
|
|
||||||
me.btnSpelling.render( me.statusbar.$layout.find('#btn-doc-spell') );
|
|
||||||
} else {
|
} else {
|
||||||
me.statusbar.$el.find('.el-review').hide();
|
me.statusbar.$el.find('.el-review').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !cfg.isEdit ) {
|
if ( cfg.isEdit ) {
|
||||||
|
me.btnSpelling = review.getButton('spelling', 'statusbar');
|
||||||
|
me.btnSpelling.render( me.statusbar.$layout.find('#btn-doc-spell') );
|
||||||
|
} else {
|
||||||
me.statusbar.$el.find('.el-edit')['hide']();
|
me.statusbar.$el.find('.el-edit')['hide']();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -2742,7 +2742,8 @@ define([
|
||||||
|
|
||||||
onAppShowed: function (config) {
|
onAppShowed: function (config) {
|
||||||
var me = this;
|
var me = this;
|
||||||
if ( config.canReview ) {
|
// if ( config.canReview )
|
||||||
|
{
|
||||||
var tab = {action: 'review', caption: 'Review'};
|
var tab = {action: 'review', caption: 'Review'};
|
||||||
var $panel = DE.getController('Common.Controllers.ReviewChanges').createToolbarPanel();
|
var $panel = DE.getController('Common.Controllers.ReviewChanges').createToolbarPanel();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue