[DE] Debug review tab.

This commit is contained in:
Julia Radzhabova 2017-06-15 16:35:55 +03:00
parent 8705842152
commit 04079fec8d
3 changed files with 39 additions and 22 deletions

View file

@ -93,7 +93,7 @@ define([
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
},
setConfig: function (data, api) {
this.setApi(api);
@ -106,16 +106,17 @@ define([
if (api) {
this.api = api;
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
if (this.appConfig.canReview) {
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
}
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this));
}
},
setMode: function(mode) {
this.appConfig = mode;
if ( mode.canReview ) {
this.popoverChanges = new Common.Collections.ReviewChanges();
}
this.popoverChanges = new Common.Collections.ReviewChanges();
this.view = this.createView('Common.Views.ReviewChanges', {
// store : this.collection,
@ -126,6 +127,12 @@ define([
return this;
},
SetDisabled: function() {
if (this.dlgChanges)
this.dlgChanges.close();
this.view && this.view.SetDisabled(true);
},
onApiShowChange: function (sdkchange) {
if (this.getPopover()) {
if (sdkchange && sdkchange.length>0) {
@ -501,9 +508,11 @@ define([
},
onAppReady: function (config) {
if ( config.canReview ) {
var me = this;
var me = this;
if ( me.view && Common.localStorage.getBool("de-settings-spellcheck", true) )
me.view.turnSpelling(true);
if ( config.canReview ) {
(new Promise(function (resolve) {
resolve();
})).then(function () {
@ -524,9 +533,6 @@ define([
_setReviewStatus(Common.localStorage.getBool("de-track-changes"));
}
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,
@ -541,7 +547,7 @@ define([
},
applySettings: function(menu) {
this.view.turnSpelling( Common.localStorage.getBool("de-settings-spellcheck") );
this.view && this.view.turnSpelling( Common.localStorage.getBool("de-settings-spellcheck", true) );
},
synchronizeChanges: function() {

View file

@ -603,7 +603,7 @@ define([
.next('.group').hide();
}
if ( !config.canComments ) {
if ( !config.canComments || !config.canCoAuthoring) {
$('.separator.comments', me.$el)
.hide()
.next('.group').hide();
@ -639,7 +639,7 @@ define([
},
getPopover: function (sdkViewName) {
if (_.isUndefined(this.popover)) {
if (this.appConfig.canReview && _.isUndefined(this.popover)) {
this.popover = new Common.Views.ReviewChangesPopover({
store: this.options.popoverChanges,
delegate: this,
@ -707,6 +707,19 @@ define([
}, this);
},
SetDisabled: function (state) {
this.btnsSpelling && this.btnsSpelling.forEach(function(button) {
if ( button ) {
button.setDisabled(state);
}
}, this);
this.btnsTurnReview && this.btnsTurnReview.forEach(function(button) {
if ( button ) {
button.setDisabled(state);
}
}, this);
},
textChangesOn: 'Preview changes',
txtAccept: 'Accept',
txtAcceptCurrent: 'Accept current Changes',

View file

@ -515,6 +515,7 @@ define([
app.getController('Toolbar').DisableToolbar(disable, disable);
app.getController('RightMenu').SetDisabled(disable, false);
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
}
app.getController('LeftMenu').SetDisabled(disable, true);
},
@ -750,8 +751,7 @@ define([
value = Common.localStorage.getItem("de-show-tableline");
me.api.put_ShowTableEmptyLine((value!==null) ? eval(value) : true);
value = Common.localStorage.getItem("de-settings-spellcheck");
me.api.asc_setSpellCheck(value===null || parseInt(value) == 1);
me.api.asc_setSpellCheck(Common.localStorage.getBool("de-settings-spellcheck", true));
Common.localStorage.setBool("de-settings-showsnaplines", me.api.get_ShowSnapLines());
@ -959,13 +959,13 @@ define([
this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion;
/** coauthoring end **/
this.appOptions.isOffline = this.api.asc_isOffline();
this.appOptions.isReviewOnly = this.permissions.review === true && this.permissions.edit === false;
this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights;
this.appOptions.canEdit = (this.permissions.edit !== false || this.permissions.review === true) && // can edit or review
(this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined
(!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true
this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
this.appOptions.canReview = this.permissions.review === true && this.appOptions.canLicense && this.appOptions.isEdit;
this.appOptions.isReviewOnly = this.permissions.review === true && this.permissions.edit === false;
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isDesktopApp;
this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose;
this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory;
@ -990,8 +990,7 @@ define([
}
if ( !this.appOptions.canCoAuthoring ) {
this.appOptions.canChat =
this.appOptions.canComments = false;
this.appOptions.canChat = false;
}
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
@ -1077,15 +1076,14 @@ define([
toolbarController = application.getController('Toolbar'),
rightmenuController = application.getController('RightMenu'),
fontsControllers = application.getController('Common.Controllers.Fonts'),
reviewController = (this.appOptions.isEdit) ? application.getController('Common.Controllers.ReviewChanges') : null;
reviewController = application.getController('Common.Controllers.ReviewChanges');
fontsControllers && fontsControllers.setApi(me.api);
toolbarController && toolbarController.setApi(me.api);
rightmenuController && rightmenuController.setApi(me.api);
if (reviewController)
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
var viewport = this.getApplication().getController('Viewport').getView('Viewport');