[DE] Show review changes in view mode. Add collaboration tab in view mode (change display mode)

This commit is contained in:
Julia Radzhabova 2018-12-18 17:27:19 +03:00
parent d2ef029e98
commit b8dc7d4017
6 changed files with 45 additions and 37 deletions

View file

@ -115,7 +115,7 @@ define([
if (api) {
this.api = api;
if (this.appConfig.canReview) {
if (this.appConfig.canReview || this.appConfig.canViewReview) {
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
}
@ -157,7 +157,7 @@ define([
this.getPopover().showReview(animate, lock, lockUser);
if (!this.appConfig.isReviewOnly && this._state.lock !== lock) {
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== lock) {
this.view.btnAccept.setDisabled(lock==true);
this.view.btnReject.setDisabled(lock==true);
if (this.dlgChanges) {
@ -207,7 +207,7 @@ define([
},
getPopover: function () {
if (this.appConfig.canReview && _.isUndefined(this.popover)) {
if ((this.appConfig.canReview || this.appConfig.canViewReview) && _.isUndefined(this.popover)) {
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
reviewStore : this.popoverChanges,
renderTo : this.sdkViewName
@ -408,7 +408,8 @@ define([
lockuser : item.get_LockUserId(),
type : item.get_Type(),
changedata : item,
scope : me.view
scope : me.view,
hint : !me.appConfig.canReview
});
arr.push(change);
@ -561,13 +562,16 @@ define([
disableEditing: function(disable) {
var app = this.getApplication();
app.getController('RightMenu').getView('RightMenu').clearSelection();
app.getController('Toolbar').DisableToolbar(disable, false, true);
app.getController('RightMenu').SetDisabled(disable, false);
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
app.getController('DocumentHolder').getView().SetDisabled(disable);
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
if (this.appConfig.canReview) {
app.getController('RightMenu').getView('RightMenu').clearSelection();
app.getController('RightMenu').SetDisabled(disable, false);
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
}
var leftMenu = app.getController('LeftMenu').leftMenu;
leftMenu.btnComments.setDisabled(disable);
@ -626,6 +630,8 @@ define([
me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150));
}
});
} else {
config.canViewReview && (config.canViewReview = me.api.asc_HaveRevisionsChanges());
}
if (me.view && me.view.btnChat) {

View file

@ -62,6 +62,7 @@ define([
lockuser : '',
type : 0,
changedata : null,
hint : false,
id : Common.UI.getId(), // internal
scope : null

View file

@ -4,6 +4,7 @@
</div>
<div class="user-date"><%=date%></div>
<div class="user-message limit-height"><%=changetext%></div>
<% if (!hint) { %>
<div class="edit-ct">
<% if (scope.appConfig.isReviewOnly) { %>
<div class="btn-delete img-commonctrl"></div>
@ -12,4 +13,5 @@
<div class="btn-reject img-commonctrl"></div>
<% } %>
</div>
<% } %>
</div>

View file

@ -126,11 +126,11 @@ define([
this.btnsTurnReview.forEach(function (button) {
button.on('click', _click_turnpreview.bind(me));
});
}
if (this.appConfig.canViewReview)
this.btnReviewView.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchanges:view', [menu, item]);
});
}
this.btnsSpelling.forEach(function(button) {
button.on('click', function (b, e) {
@ -206,7 +206,8 @@ define([
enableToggle: true
});
this.btnsTurnReview = [this.btnTurnOn];
}
if (this.appConfig.canViewReview) {
this.btnReviewView = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-reviewview',
@ -223,7 +224,7 @@ define([
});
}
if (!this.appConfig.isOffline && this.appConfig.canCoAuthoring) {
if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring) {
this.btnCoAuthMode = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-coedit',
@ -311,6 +312,10 @@ define([
);
me.btnReject.updateHint([me.tipRejectCurrent, me.txtRejectChanges]);
me.btnAccept.setDisabled(config.isReviewOnly);
me.btnReject.setDisabled(config.isReviewOnly);
}
if (me.appConfig.canViewReview) {
me.btnReviewView.setMenu(
new Common.UI.Menu({
cls: 'ppm-toolbar',
@ -345,11 +350,7 @@ define([
]
}));
me.btnReviewView.updateHint(me.tipReviewView);
me.btnAccept.setDisabled(config.isReviewOnly);
me.btnReject.setDisabled(config.isReviewOnly);
}
me.btnSharing && me.btnSharing.updateHint(me.tipSharing);
me.btnHistory && me.btnHistory.updateHint(me.tipHistory);
me.btnChat && me.btnChat.updateHint(me.txtChat + Common.Utils.String.platformKey('Alt+Q'));
@ -392,7 +393,7 @@ define([
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 ? me.$el.find('.separator.review') : '.separator.review',
separator_review = !(config.canReview || config.canViewReview) ? me.$el.find('.separator.review') : '.separator.review',
separator_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat',
separator_last;
@ -419,7 +420,7 @@ define([
if (!me.btnHistory && separator_last)
me.$el.find(separator_last).hide();
Common.NotificationCenter.trigger('tab:visible', 'review', true);
Common.NotificationCenter.trigger('tab:visible', 'review', config.isEdit || config.canViewReview);
setEvents.call(me);
});
@ -434,8 +435,8 @@ define([
this.btnAccept.render(this.$el.find('#btn-change-accept'));
this.btnReject.render(this.$el.find('#btn-change-reject'));
this.btnTurnOn.render(this.$el.find('#btn-review-on'));
this.btnReviewView.render(this.$el.find('#btn-review-view'));
}
this.btnReviewView && this.btnReviewView.render(this.$el.find('#btn-review-view'));
this.btnSharing && this.btnSharing.render(this.$el.find('#slot-btn-sharing'));
this.btnCoAuthMode && this.btnCoAuthMode.render(this.$el.find('#slot-btn-coauthmode'));

View file

@ -1105,6 +1105,7 @@ define([
(!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.canViewReview = true;
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isOffline;
this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose;
this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory;
@ -1210,21 +1211,19 @@ define([
this.contComments.setConfig({config: this.editorConfig}, this.api);
/** coauthoring end **/
if (this.appOptions.isEdit) {
var me = this,
application = this.getApplication(),
toolbarController = application.getController('Toolbar'),
rightmenuController = application.getController('RightMenu'),
fontsControllers = application.getController('Common.Controllers.Fonts'),
reviewController = application.getController('Common.Controllers.ReviewChanges');
var me = this,
application = this.getApplication(),
reviewController = application.getController('Common.Controllers.ReviewChanges');
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
if (this.appOptions.isEdit) {
var toolbarController = application.getController('Toolbar'),
rightmenuController = application.getController('RightMenu'),
fontsControllers = application.getController('Common.Controllers.Fonts');
fontsControllers && fontsControllers.setApi(me.api);
toolbarController && toolbarController.setApi(me.api);
rightmenuController && rightmenuController.setApi(me.api);
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
if (this.appOptions.canProtect)
application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);

View file

@ -2718,7 +2718,7 @@ define([
toolbar._state.previewmode = reviewmode && disable;
if (reviewmode) {
toolbar._state.previewmode && toolbar.btnSave.setDisabled(true);
toolbar._state.previewmode && toolbar.btnSave && toolbar.btnSave.setDisabled(true);
if (toolbar.needShowSynchTip) {
toolbar.needShowSynchTip = false;
@ -2768,15 +2768,14 @@ define([
me.toolbar.render(_.extend({isCompactView: compactview}, config));
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = this.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 4);
if ( config.isEdit ) {
me.toolbar.setMode(config);
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = this.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 4);
me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled'));
if ( config.isDesktopApp ) {
// hide 'print' and 'save' buttons group and next separator