[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,13 +106,17 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
if ( mode.canReview || mode.isReviewOnly ) {
|
this.appConfig = mode;
|
||||||
this.view = this.createView('Common.Views.ReviewChanges', {
|
if ( mode.canReview ) {
|
||||||
// store : this.collection,
|
this.popoverChanges = new Common.Collections.ReviewChanges();
|
||||||
popoverChanges : this.popoverChanges
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.view = this.createView('Common.Views.ReviewChanges', {
|
||||||
|
// store : this.collection,
|
||||||
|
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,40 +432,43 @@ define([
|
||||||
|
|
||||||
function setEvents() {
|
function setEvents() {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.btnPrev.on('click', function (e) {
|
|
||||||
me.fireEvent('reviewchange:preview', [me.btnPrev, 'prev']);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.btnNext.on('click', function (e) {
|
if ( me.appConfig.canReview ) {
|
||||||
me.fireEvent('reviewchange:preview', [me.btnNext, 'next']);
|
this.btnPrev.on('click', function (e) {
|
||||||
});
|
me.fireEvent('reviewchange:preview', [me.btnPrev, 'prev']);
|
||||||
|
});
|
||||||
|
|
||||||
this.btnAccept.on('click', function (e) {
|
this.btnNext.on('click', function (e) {
|
||||||
me.fireEvent('reviewchange:accept', [me.btnAccept, 'current']);
|
me.fireEvent('reviewchange:preview', [me.btnNext, 'next']);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.btnAccept.menu.on('item:click', function (menu, item, e) {
|
this.btnAccept.on('click', function (e) {
|
||||||
me.fireEvent('reviewchange:accept', [menu, item]);
|
me.fireEvent('reviewchange:accept', [me.btnAccept, 'current']);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.btnReject.on('click', function (e) {
|
this.btnAccept.menu.on('item:click', function (menu, item, e) {
|
||||||
me.fireEvent('reviewchange:reject', [me.btnReject, 'current']);
|
me.fireEvent('reviewchange:accept', [menu, item]);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.btnReject.menu.on('item:click', function (menu, item, e) {
|
this.btnReject.on('click', function (e) {
|
||||||
me.fireEvent('reviewchange:reject', [menu, item]);
|
me.fireEvent('reviewchange:reject', [me.btnReject, 'current']);
|
||||||
});
|
});
|
||||||
|
|
||||||
function _click_turnpreview(btn, e) {
|
this.btnReject.menu.on('item:click', function (menu, item, e) {
|
||||||
if ( me.appConfig.canReview ) {
|
me.fireEvent('reviewchange:reject', [menu, item]);
|
||||||
Common.NotificationCenter.trigger('reviewchanges:turn', btn.pressed ? 'on' : 'off');
|
});
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.btnsTurnReview.forEach(function(button) {
|
function _click_turnpreview(btn, e) {
|
||||||
button.on('click', _click_turnpreview.bind(me));
|
if (me.appConfig.canReview) {
|
||||||
Common.NotificationCenter.trigger('edit:complete', me);
|
Common.NotificationCenter.trigger('reviewchanges:turn', btn.pressed ? 'on' : 'off');
|
||||||
});
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.btnsTurnReview.forEach(function (button) {
|
||||||
|
button.on('click', _click_turnpreview.bind(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,40 +492,43 @@ 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;
|
||||||
|
|
||||||
this.btnPrev = new Common.UI.Button({
|
if ( this.appConfig.canReview ) {
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
this.btnPrev = new Common.UI.Button({
|
||||||
iconCls: 'review-prev',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
caption: this.txtPrev
|
iconCls: 'review-prev',
|
||||||
});
|
caption: this.txtPrev
|
||||||
|
});
|
||||||
|
|
||||||
this.btnNext = new Common.UI.Button({
|
this.btnNext = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
iconCls: 'review-next',
|
iconCls: 'review-next',
|
||||||
caption: this.txtNext
|
caption: this.txtNext
|
||||||
});
|
});
|
||||||
|
|
||||||
this.btnAccept = new Common.UI.Button({
|
this.btnAccept = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
caption: this.txtAccept,
|
caption: this.txtAccept,
|
||||||
split: true,
|
split: true,
|
||||||
iconCls: 'review-save'
|
iconCls: 'review-save'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.btnReject = new Common.UI.Button({
|
this.btnReject = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
caption: this.txtReject,
|
caption: this.txtReject,
|
||||||
split: true,
|
split: true,
|
||||||
iconCls: 'review-deny'
|
iconCls: 'review-deny'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.btnTurnOn = new Common.UI.Button({
|
this.btnTurnOn = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
iconCls: 'btn-ic-review',
|
iconCls: 'btn-ic-review',
|
||||||
caption: this.txtTurnon,
|
caption: this.txtTurnon,
|
||||||
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,63 +559,77 @@ 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.btnNext.updateHint(me.hintNext);
|
||||||
|
me.btnTurnOn.updateHint(me.textChangesOn);
|
||||||
|
|
||||||
|
me.btnAccept.setMenu(
|
||||||
|
new Common.UI.Menu({
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
caption: me.txtAcceptCurrent,
|
||||||
|
value: 'current'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: me.txtAcceptAll,
|
||||||
|
value: 'all'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
me.btnReject.setMenu(
|
||||||
|
new Common.UI.Menu({
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
caption: me.txtRejectCurrent,
|
||||||
|
value: 'current'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: me.txtRejectAll,
|
||||||
|
value: 'all'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
me.btnAccept.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.btnPrev.updateHint(me.hintPrev);
|
|
||||||
me.btnNext.updateHint(me.hintNext);
|
|
||||||
me.btnTurnOn.updateHint(me.textChangesOn);
|
|
||||||
me.btnDocLang.updateHint(me.tipSetDocLang);
|
me.btnDocLang.updateHint(me.tipSetDocLang);
|
||||||
me.btnSetSpelling.updateHint(me.tipSetSpelling);
|
me.btnSetSpelling.updateHint(me.tipSetSpelling);
|
||||||
|
|
||||||
me.btnAccept.setMenu(
|
|
||||||
new Common.UI.Menu({
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
caption: me.txtAcceptCurrent,
|
|
||||||
value: 'current'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
caption: me.txtAcceptAll,
|
|
||||||
value: 'all'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
me.btnReject.setMenu(
|
|
||||||
new Common.UI.Menu({
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
caption: me.txtRejectCurrent,
|
|
||||||
value: 'current'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
caption: me.txtRejectAll,
|
|
||||||
value: 'all'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
me.btnAccept.setDisabled(config.isReviewOnly);
|
|
||||||
me.btnReject.setDisabled(config.isReviewOnly);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
var review = DE.getController('Common.Controllers.ReviewChanges').getView();
|
||||||
if ( cfg.canReview ) {
|
if ( cfg.canReview ) {
|
||||||
var review = DE.getController('Common.Controllers.ReviewChanges').getView();
|
|
||||||
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