Cleaner tab
This commit is contained in:
parent
b7801e5a2e
commit
3a8bebbaf7
|
@ -31,10 +31,10 @@
|
|||
*
|
||||
*/
|
||||
/**
|
||||
* ReviewChanges.js
|
||||
* Transitions.js
|
||||
*
|
||||
* Created by Julia.Radzhabova on 05.08.15
|
||||
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
|
||||
* Created by Olga.Transitions on 15.07.21
|
||||
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -44,75 +44,56 @@ Common.Controllers = Common.Controllers || {};
|
|||
|
||||
define([
|
||||
'core',
|
||||
'common/main/lib/model/ReviewChange',
|
||||
'common/main/lib/collection/ReviewChanges',
|
||||
'common/main/lib/view/Transitions',
|
||||
'common/main/lib/view/ReviewPopover',
|
||||
'common/main/lib/view/LanguageDialog',
|
||||
'common/main/lib/view/OptionsDialog'
|
||||
], function () {
|
||||
'use strict';
|
||||
|
||||
Common.Controllers.Transitions = Backbone.Controller.extend(_.extend({
|
||||
models : [],
|
||||
collections : [
|
||||
'Common.Collections.ReviewChanges'
|
||||
],
|
||||
views : [
|
||||
'Common.Views.Transitions',
|
||||
'Common.Views.ReviewPopover'
|
||||
'Common.Views.Transitions'
|
||||
],
|
||||
sdkViewName : '#id_main',
|
||||
|
||||
initialize: function () {
|
||||
|
||||
this.addListeners({
|
||||
'FileMenu': {
|
||||
/*'FileMenu': {
|
||||
'settings:apply': this.applySettings.bind(this)
|
||||
},
|
||||
'LeftMenu': {
|
||||
'comments:show': _.bind(this.commentsShowHide, this, 'show'),
|
||||
'comments:hide': _.bind(this.commentsShowHide, this, 'hide')
|
||||
},
|
||||
},*/
|
||||
|
||||
'Common.Views.Transitions': {
|
||||
'transit:accept': _.bind(this.onAcceptClick, this),
|
||||
'transit:reject': _.bind(this.onRejectClick, this),
|
||||
'transit:delete': _.bind(this.onDeleteClick, this),
|
||||
'transit:preview': _.bind(this.onBtnPreviewClick, this),
|
||||
'transit:view': _.bind(this.onReviewViewClick, this),
|
||||
'transit:compare': _.bind(this.onCompareClick, this),
|
||||
'lang:document': _.bind(this.onDocLanguage, this),
|
||||
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
|
||||
//'transit:accept': _.bind(this.onAcceptClick, this),
|
||||
//'transit:reject': _.bind(this.onRejectClick, this),
|
||||
//'transit:delete': _.bind(this.onDeleteClick, this),
|
||||
//'transit:preview': _.bind(this.onBtnPreviewClick, this),
|
||||
//'transit:view': _.bind(this.onReviewViewClick, this),
|
||||
//'transit:compare': _.bind(this.onCompareClick, this),
|
||||
//'lang:document': _.bind(this.onDocLanguage, this)
|
||||
/*,
|
||||
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)*/
|
||||
},
|
||||
'Common.Views.ReviewChangesDialog': {
|
||||
'transit:accept': _.bind(this.onAcceptClick, this),
|
||||
'transit:reject': _.bind(this.onRejectClick, this),
|
||||
'transit:preview': _.bind(this.onBtnPreviewClick, this)
|
||||
//'transit:accept': _.bind(this.onAcceptClick, this),
|
||||
//'transit:reject': _.bind(this.onRejectClick, this),
|
||||
//'transit:preview': _.bind(this.onBtnPreviewClick, this)
|
||||
},
|
||||
'Common.Views.ReviewPopover': {
|
||||
'transit:accept': _.bind(this.onAcceptClick, this),
|
||||
'transit:reject': _.bind(this.onRejectClick, this),
|
||||
'transit:delete': _.bind(this.onDeleteClick, this),
|
||||
'transit:goto': _.bind(this.onGotoClick, this)
|
||||
//'transit:accept': _.bind(this.onAcceptClick, this),
|
||||
//'transit:reject': _.bind(this.onRejectClick, this),
|
||||
//'transit:delete': _.bind(this.onDeleteClick, this),
|
||||
//'transit:goto': _.bind(this.onGotoClick, this)
|
||||
}
|
||||
});
|
||||
},
|
||||
onLaunch: function () {
|
||||
this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges');
|
||||
this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
|
||||
|
||||
//this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges');
|
||||
this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null /*new AscCommon.CComparisonPr()*/};
|
||||
|
||||
Common.NotificationCenter.on('transitions: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.onCoAuthoringDisconnect, this));
|
||||
Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this));
|
||||
Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this));
|
||||
|
||||
this.userCollection.on('reset', _.bind(this.onUpdateUsers, this));
|
||||
this.userCollection.on('add', _.bind(this.onUpdateUsers, this));
|
||||
},
|
||||
},
|
||||
setConfig: function (data, api) {
|
||||
this.setApi(api);
|
||||
|
||||
|
@ -126,18 +107,18 @@ define([
|
|||
if (api) {
|
||||
this.api = api;
|
||||
|
||||
if (this.appConfig.canReview || this.appConfig.canViewReview) {
|
||||
/*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));
|
||||
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this));
|
||||
this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this));
|
||||
}
|
||||
if (this.appConfig.canReview)
|
||||
this.api.asc_registerCallback('asc_onOnTrackRevisionsChange', _.bind(this.onApiTrackRevisionsChange, this));
|
||||
this.api.asc_registerCallback('asc_onAcceptChangesBeforeCompare',_.bind(this.onAcceptChangesBeforeCompare, this));
|
||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
||||
this.api.asc_registerCallback('asc_onOnTrackRevisionsChange', _.bind(this.onApiTrackRevisionsChange, this));*/
|
||||
//this.api.asc_registerCallback('asc_onAcceptChangesBeforeCompare',_.bind(this.onAcceptChangesBeforeCompare, this));
|
||||
//this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
||||
|
||||
Common.Gateway.on('setrevisedfile', _.bind(this.setRevisedFile, this));
|
||||
// Common.Gateway.on('setrevisedfile', _.bind(this.setRevisedFile, this));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -146,12 +127,7 @@ define([
|
|||
this.popoverChanges = new Common.Collections.ReviewChanges();
|
||||
this.view = this.createView('Common.Views.Transitions', { mode: mode });
|
||||
|
||||
if (!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length || this.appConfig.canRequestSharingSettings) {
|
||||
Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
|
||||
Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
|
||||
}
|
||||
|
||||
return this;
|
||||
return this;
|
||||
},
|
||||
|
||||
loadDocument: function(data) {
|
||||
|
@ -162,602 +138,7 @@ define([
|
|||
if (this.dlgChanges)
|
||||
this.dlgChanges.close();
|
||||
this.view && this.view.SetDisabled(state, this.langs);
|
||||
this.setPreviewMode(state);
|
||||
},
|
||||
|
||||
setPreviewMode: function(mode) { //disable accept/reject in popover
|
||||
if (this.viewmode === mode) return;
|
||||
this.viewmode = mode;
|
||||
if (mode)
|
||||
this.prevcanReview = this.appConfig.canReview;
|
||||
this.appConfig.canReview = (mode) ? false : this.prevcanReview;
|
||||
var me = this;
|
||||
this.popoverChanges && this.popoverChanges.each(function (model) {
|
||||
model.set('hint', !me.appConfig.canReview);
|
||||
});
|
||||
},
|
||||
|
||||
onApiShowChange: function (sdkchange) {
|
||||
if (this.getPopover()) {
|
||||
if (sdkchange && sdkchange.length>0) {
|
||||
var i = 0,
|
||||
changes = this.readSDKChange(sdkchange),
|
||||
posX = sdkchange[0].get_X(),
|
||||
posY = sdkchange[0].get_Y(),
|
||||
animate = ( Math.abs(this._state.posx-posX)>0.001 || Math.abs(this._state.posy-posY)>0.001) || (sdkchange.length !== this._state.changes_length),
|
||||
lock = (sdkchange[0].get_LockUserId()!==null),
|
||||
lockUser = this.getUserName(sdkchange[0].get_LockUserId()),
|
||||
editable = changes[0].get('editable');
|
||||
|
||||
this.getPopover().hideTips();
|
||||
this.popoverChanges.reset(changes);
|
||||
|
||||
if (animate) {
|
||||
if ( this.getPopover().isVisible() ) this.getPopover().hide();
|
||||
this.getPopover().setLeftTop(posX, posY);
|
||||
}
|
||||
|
||||
this.getPopover().showReview(animate, lock, lockUser);
|
||||
|
||||
var btnlock = lock || !editable;
|
||||
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== btnlock) {
|
||||
this.view.btnAccept.setDisabled(btnlock);
|
||||
this.view.btnReject.setDisabled(btnlock);
|
||||
if (this.dlgChanges) {
|
||||
this.dlgChanges.btnAccept.setDisabled(btnlock);
|
||||
this.dlgChanges.btnReject.setDisabled(btnlock);
|
||||
}
|
||||
this._state.lock = btnlock;
|
||||
}
|
||||
this._state.posx = posX;
|
||||
this._state.posy = posY;
|
||||
this._state.changes_length = sdkchange.length;
|
||||
this._state.popoverVisible = true;
|
||||
} else if (this._state.popoverVisible){
|
||||
this._state.posx = this._state.posy = -1000;
|
||||
this._state.changes_length = 0;
|
||||
this._state.popoverVisible = false;
|
||||
this.getPopover().hideTips();
|
||||
this.popoverChanges.reset();
|
||||
this.getPopover().hideReview();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onApiUpdateChangePosition: function (posX, posY) {
|
||||
var i, useAnimation = false,
|
||||
change = null,
|
||||
text = undefined,
|
||||
saveTxtId = '',
|
||||
saveTxtReplyId = '';
|
||||
|
||||
if (this.getPopover()) {
|
||||
if (posY < 0 || this.getPopover().sdkBounds.height < posY) {
|
||||
this.getPopover().hide();
|
||||
} else if (this.popoverChanges.length>0) {
|
||||
if (!this.getPopover().isVisible())
|
||||
this.getPopover().show(false);
|
||||
this.getPopover().setLeftTop(posX, posY);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
findChange: function (uid, id) {
|
||||
if (_.isUndefined(uid)) {
|
||||
return this.collection.findWhere({id: id});
|
||||
}
|
||||
|
||||
return this.collection.findWhere({uid: uid});
|
||||
},
|
||||
|
||||
getPopover: function () {
|
||||
if ((this.appConfig.canReview || this.appConfig.canViewReview) && _.isUndefined(this.popover)) {
|
||||
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
||||
reviewStore : this.popoverChanges,
|
||||
renderTo : this.sdkViewName
|
||||
});
|
||||
this.popover.setReviewStore(this.popoverChanges);
|
||||
}
|
||||
return this.popover;
|
||||
},
|
||||
|
||||
// helpers
|
||||
|
||||
readSDKChange: function (data) {
|
||||
var me = this, arr = [];
|
||||
_.each(data, function(item) {
|
||||
var changetext = '', proptext = '',
|
||||
value = item.get_Value(),
|
||||
movetype = item.get_MoveType(),
|
||||
settings = false;
|
||||
switch (item.get_Type()) {
|
||||
case Asc.c_oAscRevisionsChangeType.TextAdd:
|
||||
changetext = (movetype==Asc.c_oAscRevisionsMove.NoMove) ? me.textInserted : me.textParaMoveTo;
|
||||
if (typeof value == 'object') {
|
||||
_.each(value, function(obj) {
|
||||
if (typeof obj === 'string')
|
||||
changetext += (' ' + Common.Utils.String.htmlEncode(obj));
|
||||
else {
|
||||
switch (obj) {
|
||||
case 0:
|
||||
changetext += (' <' + me.textImage + '>');
|
||||
break;
|
||||
case 1:
|
||||
changetext += (' <' + me.textShape + '>');
|
||||
break;
|
||||
case 2:
|
||||
changetext += (' <' + me.textChart + '>');
|
||||
break;
|
||||
case 3:
|
||||
changetext += (' <' + me.textEquation + '>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (typeof value === 'string') {
|
||||
changetext += (' ' + Common.Utils.String.htmlEncode(value));
|
||||
}
|
||||
break;
|
||||
case Asc.c_oAscRevisionsChangeType.TextRem:
|
||||
changetext = (movetype==Asc.c_oAscRevisionsMove.NoMove) ? me.textDeleted : (item.is_MovedDown() ? me.textParaMoveFromDown : me.textParaMoveFromUp);
|
||||
if (typeof value == 'object') {
|
||||
_.each(value, function(obj) {
|
||||
if (typeof obj === 'string')
|
||||
changetext += (' ' + Common.Utils.String.htmlEncode(obj));
|
||||
else {
|
||||
switch (obj) {
|
||||
case 0:
|
||||
changetext += (' <' + me.textImage + '>');
|
||||
break;
|
||||
case 1:
|
||||
changetext += (' <' + me.textShape + '>');
|
||||
break;
|
||||
case 2:
|
||||
changetext += (' <' + me.textChart + '>');
|
||||
break;
|
||||
case 3:
|
||||
changetext += (' <' + me.textEquation + '>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (typeof value === 'string') {
|
||||
changetext += (' ' + Common.Utils.String.htmlEncode(value));
|
||||
}
|
||||
break;
|
||||
case Asc.c_oAscRevisionsChangeType.ParaAdd:
|
||||
changetext = me.textParaInserted;
|
||||
break;
|
||||
case Asc.c_oAscRevisionsChangeType.ParaRem:
|
||||
changetext = me.textParaDeleted;
|
||||
break;
|
||||
case Asc.c_oAscRevisionsChangeType.TextPr:
|
||||
changetext = '<b>' + me.textFormatted;
|
||||
if (value.Get_Bold() !== undefined)
|
||||
proptext += ((value.Get_Bold() ? '' : me.textNot) + me.textBold + ', ');
|
||||
if (value.Get_Italic() !== undefined)
|
||||
proptext += ((value.Get_Italic() ? '' : me.textNot) + me.textItalic + ', ');
|
||||
if (value.Get_Underline() !== undefined)
|
||||
proptext += ((value.Get_Underline() ? '' : me.textNot) + me.textUnderline + ', ');
|
||||
if (value.Get_Strikeout() !== undefined)
|
||||
proptext += ((value.Get_Strikeout() ? '' : me.textNot) + me.textStrikeout + ', ');
|
||||
if (value.Get_DStrikeout() !== undefined)
|
||||
proptext += ((value.Get_DStrikeout() ? '' : me.textNot) + me.textDStrikeout + ', ');
|
||||
if (value.Get_Caps() !== undefined)
|
||||
proptext += ((value.Get_Caps() ? '' : me.textNot) + me.textCaps + ', ');
|
||||
if (value.Get_SmallCaps() !== undefined)
|
||||
proptext += ((value.Get_SmallCaps() ? '' : me.textNot) + me.textSmallCaps + ', ');
|
||||
if (value.Get_VertAlign() !== undefined)
|
||||
proptext += (((value.Get_VertAlign()==1) ? me.textSuperScript : ((value.Get_VertAlign()==2) ? me.textSubScript : me.textBaseline)) + ', ');
|
||||
if (value.Get_Color() !== undefined)
|
||||
proptext += (me.textColor + ', ');
|
||||
if (value.Get_Highlight() !== undefined)
|
||||
proptext += (me.textHighlight + ', ');
|
||||
if (value.Get_Shd() !== undefined)
|
||||
proptext += (me.textShd + ', ');
|
||||
if (value.Get_FontFamily() !== undefined)
|
||||
proptext += (value.Get_FontFamily() + ', ');
|
||||
if (value.Get_FontSize() !== undefined)
|
||||
proptext += (value.Get_FontSize() + ', ');
|
||||
if (value.Get_Spacing() !== undefined)
|
||||
proptext += (me.textSpacing + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Spacing()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
||||
if (value.Get_Position() !== undefined)
|
||||
proptext += (me.textPosition + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Position()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
||||
if (value.Get_Lang() !== undefined)
|
||||
proptext += (Common.util.LanguageInfo.getLocalLanguageName(value.Get_Lang())[1] + ', ');
|
||||
|
||||
if (!_.isEmpty(proptext)) {
|
||||
changetext += ': ';
|
||||
proptext = proptext.substring(0, proptext.length-2);
|
||||
}
|
||||
changetext += '</b>';
|
||||
changetext += proptext;
|
||||
break;
|
||||
case Asc.c_oAscRevisionsChangeType.ParaPr:
|
||||
changetext = '<b>' + me.textParaFormatted;
|
||||
if (value.Get_ContextualSpacing())
|
||||
proptext += ((value.Get_ContextualSpacing() ? me.textContextual : me.textNoContextual) + ', ');
|
||||
if (value.Get_IndLeft() !== undefined)
|
||||
proptext += (me.textIndentLeft + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndLeft()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
||||
if (value.Get_IndRight() !== undefined)
|
||||
proptext += (me.textIndentRight + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndRight()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
||||
if (value.Get_IndFirstLine() !== undefined)
|
||||
proptext += (me.textFirstLine + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndFirstLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
||||
if (value.Get_Jc() !== undefined) {
|
||||
switch (value.Get_Jc()) {
|
||||
case 0:
|
||||
proptext += (me.textRight + ', ');
|
||||
break;
|
||||
case 1:
|
||||
proptext += (me.textLeft + ', ');
|
||||
break;
|
||||
case 2:
|
||||
proptext += (me.textCenter + ', ');
|
||||
break;
|
||||
case 3:
|
||||
proptext += (me.textJustify + ', ');
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
if (value.Get_KeepLines() !== undefined)
|
||||
proptext += ((value.Get_KeepLines() ? me.textKeepLines : me.textNoKeepLines) + ', ');
|
||||
if (value.Get_KeepNext())
|
||||
proptext += ((value.Get_KeepNext() ? me.textKeepNext : me.textNoKeepNext) + ', ');
|
||||
if (value.Get_PageBreakBefore())
|
||||
proptext += ((value.Get_PageBreakBefore() ? me.textBreakBefore : me.textNoBreakBefore) + ', ');
|
||||
if (value.Get_SpacingLineRule() !== undefined && value.Get_SpacingLine() !== undefined) {
|
||||
proptext += me.textLineSpacing;
|
||||
proptext += (((value.Get_SpacingLineRule() == c_paragraphLinerule.LINERULE_LEAST) ? me.textAtLeast : ((value.Get_SpacingLineRule() == c_paragraphLinerule.LINERULE_AUTO) ? me.textMultiple : me.textExact)) + ' ');
|
||||
proptext += (((value.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO) ? value.Get_SpacingLine() : Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName()) + ', ');
|
||||
}
|
||||
if (value.Get_SpacingBeforeAutoSpacing())
|
||||
proptext += (me.textSpacingBefore + ' ' + me.textAuto +', ');
|
||||
else if (value.Get_SpacingBefore() !== undefined)
|
||||
proptext += (me.textSpacingBefore + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingBefore()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
||||
if (value.Get_SpacingAfterAutoSpacing())
|
||||
proptext += (me.textSpacingAfter + ' ' + me.textAuto +', ');
|
||||
else if (value.Get_SpacingAfter() !== undefined)
|
||||
proptext += (me.textSpacingAfter + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingAfter()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
||||
if (value.Get_WidowControl())
|
||||
proptext += ((value.Get_WidowControl() ? me.textWidow : me.textNoWidow) + ', ');
|
||||
if (value.Get_Tabs() !== undefined)
|
||||
proptext += (me.textTabs + ', ');
|
||||
if (value.Get_NumPr() !== undefined)
|
||||
proptext += (me.textNum + ', ');
|
||||
if (value.Get_PStyle() !== undefined) {
|
||||
var style = me.api.asc_GetStyleNameById(value.Get_PStyle());
|
||||
if (!_.isEmpty(style)) proptext += (style + ', ');
|
||||
}
|
||||
|
||||
if (!_.isEmpty(proptext)) {
|
||||
changetext += ': ';
|
||||
proptext = proptext.substring(0, proptext.length-2);
|
||||
}
|
||||
changetext += '</b>';
|
||||
changetext += proptext;
|
||||
break;
|
||||
case Asc.c_oAscRevisionsChangeType.TablePr:
|
||||
changetext = me.textTableChanged;
|
||||
break;
|
||||
case Asc.c_oAscRevisionsChangeType.RowsAdd:
|
||||
changetext = me.textTableRowsAdd;
|
||||
break;
|
||||
case Asc.c_oAscRevisionsChangeType.RowsRem:
|
||||
changetext = me.textTableRowsDel;
|
||||
break;
|
||||
}
|
||||
var date = (item.get_DateTime() == '') ? new Date() : new Date(item.get_DateTime()),
|
||||
user = me.userCollection.findOriginalUser(item.get_UserId()),
|
||||
change = new Common.Models.ReviewChange({
|
||||
uid : Common.UI.getId(),
|
||||
userid : item.get_UserId(),
|
||||
username : item.get_UserName(),
|
||||
usercolor : (user) ? user.get('color') : null,
|
||||
date : me.dateToLocaleTimeString(date),
|
||||
changetext : changetext,
|
||||
id : Common.UI.getId(),
|
||||
lock : (item.get_LockUserId()!==null),
|
||||
lockuser : me.getUserName(item.get_LockUserId()),
|
||||
type : item.get_Type(),
|
||||
changedata : item,
|
||||
scope : me.view,
|
||||
hint : !me.appConfig.canReview,
|
||||
goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom),
|
||||
editable : me.appConfig.isReviewOnly && (item.get_UserId() == me.currentUserId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || AscCommon.UserInfoParser.canEditReview(item.get_UserName()))
|
||||
});
|
||||
|
||||
arr.push(change);
|
||||
});
|
||||
return arr;
|
||||
},
|
||||
|
||||
getUserName: function(id){
|
||||
if (this.userCollection && id!==null){
|
||||
var rec = this.userCollection.findUser(id);
|
||||
if (rec) return AscCommon.UserInfoParser.getParsedName(rec.get('username'));
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
dateToLocaleTimeString: function (date) {
|
||||
function format(date) {
|
||||
var strTime,
|
||||
hours = date.getHours(),
|
||||
minutes = date.getMinutes(),
|
||||
ampm = hours >= 12 ? 'pm' : 'am';
|
||||
|
||||
hours = hours % 12;
|
||||
hours = hours ? hours : 12; // the hour '0' should be '12'
|
||||
minutes = minutes < 10 ? '0'+minutes : minutes;
|
||||
strTime = hours + ':' + minutes + ' ' + ampm;
|
||||
|
||||
return strTime;
|
||||
}
|
||||
|
||||
// MM/dd/yyyy hh:mm AM
|
||||
return (date.getMonth() + 1) + '/' + (date.getDate()) + '/' + date.getFullYear() + ' ' + format(date);
|
||||
},
|
||||
|
||||
onBtnPreviewClick: function(btn, opts){
|
||||
switch (opts) {
|
||||
case 'prev': this.api.asc_GetPrevRevisionsChange(); break;
|
||||
case 'next': this.api.asc_GetNextRevisionsChange(); break;
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onAcceptClick: function(menu, item, e) {
|
||||
if (this.api) {
|
||||
if (item) {
|
||||
if (item.value === 'all') {
|
||||
this.api.asc_AcceptAllChanges();
|
||||
} else {
|
||||
this.api.asc_AcceptChanges();
|
||||
}
|
||||
} else {
|
||||
this.api.asc_AcceptChanges(menu);
|
||||
}
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onRejectClick: function(menu, item, e) {
|
||||
if (this.api) {
|
||||
if (item) {
|
||||
if (item.value === 'all') {
|
||||
this.api.asc_RejectAllChanges();
|
||||
} else {
|
||||
this.api.asc_RejectChanges();
|
||||
}
|
||||
} else {
|
||||
this.api.asc_RejectChanges(menu);
|
||||
}
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onDeleteClick: function(change) {
|
||||
if (this.api) {
|
||||
this.api.asc_RejectChanges(change);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onGotoClick: function(change) {
|
||||
if (this.api) {
|
||||
this.api.asc_FollowRevisionMove(change);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onTurnPreview: function(state, global, fromApi) {
|
||||
if ( this.appConfig.isReviewOnly ) {
|
||||
this.view.turnChanges(true);
|
||||
} else
|
||||
if ( this.appConfig.canReview ) {
|
||||
state = (state=='off') ? false : state; // support of prev. version (on/off)
|
||||
if (!!global) {
|
||||
this.api.asc_SetLocalTrackRevisions(null);
|
||||
this.api.asc_SetGlobalTrackRevisions(!!state);
|
||||
} else
|
||||
this.api.asc_SetLocalTrackRevisions(!!state);
|
||||
}
|
||||
},
|
||||
|
||||
onApiTrackRevisionsChange: function(localFlag, globalFlag, userId) {
|
||||
if ( this.appConfig.isReviewOnly ) {
|
||||
this.view.turnChanges(true);
|
||||
} else
|
||||
if ( this.appConfig.canReview ) {
|
||||
var global = (localFlag===null),
|
||||
state = global ? globalFlag : localFlag;
|
||||
Common.Utils.InternalSettings.set(this.view.appPrefix + "track-changes", (state ? 0 : 1) + (global ? 2 : 0));
|
||||
this.view.turnChanges(state, global);
|
||||
if (userId && this.userCollection) {
|
||||
var rec = this.userCollection.findOriginalUser(userId);
|
||||
rec && this.showTips(Common.Utils.String.format(globalFlag ? this.textOnGlobal : this.textOffGlobal, AscCommon.UserInfoParser.getParsedName(rec.get('username'))));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onTurnSpelling: function (state) {
|
||||
state = (state == 'on');
|
||||
this.view.turnSpelling(state);
|
||||
|
||||
Common.localStorage.setItem(this.view.appPrefix + "settings-spellcheck", state ? 1 : 0);
|
||||
this.api.asc_setSpellCheck(state);
|
||||
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-spellcheck", state);
|
||||
},
|
||||
|
||||
onReviewViewClick: function(menu, item, e) {
|
||||
this.turnDisplayMode(item.value);
|
||||
!this.appConfig.canReview && Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value);
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
onCompareClick: function(item) {
|
||||
if (this.api) {
|
||||
var me = this;
|
||||
if (!this._state.compareSettings) {
|
||||
this._state.compareSettings = new AscCommonWord.ComparisonOptions();
|
||||
this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"));
|
||||
}
|
||||
if (item === 'file') {
|
||||
if (this.api)
|
||||
this.api.asc_CompareDocumentFile(this._state.compareSettings);
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
} else if (item === 'url') {
|
||||
(new Common.Views.ImageFromUrlDialog({
|
||||
title: me.textUrl,
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok') {
|
||||
if (me.api) {
|
||||
var checkUrl = value.replace(/ /g, '');
|
||||
if (!_.isEmpty(checkUrl)) {
|
||||
me.api.asc_CompareDocumentUrl(checkUrl, me._state.compareSettings);
|
||||
}
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.view);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
} else if (item === 'storage') {
|
||||
if (this.appConfig.canRequestCompareFile) {
|
||||
Common.Gateway.requestCompareFile();
|
||||
} else {
|
||||
(new Common.Views.SelectFileDlg({
|
||||
fileChoiceUrl: this.appConfig.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "DocumentsOnly")
|
||||
})).on('selectfile', function(obj, file){
|
||||
me.setRevisedFile(file, me._state.compareSettings);
|
||||
}).show();
|
||||
}
|
||||
} else if (item === 'settings') {
|
||||
var value = me._state.compareSettings ? me._state.compareSettings.getWords() : true;
|
||||
(new Common.Views.OptionsDialog({
|
||||
title: me.textTitleComparison,
|
||||
items: [
|
||||
{caption: me.textChar, value: false, checked: (value===false)},
|
||||
{caption: me.textWord, value: true, checked: (value!==false)}
|
||||
],
|
||||
label: me.textShow,
|
||||
handler: function (dlg, result) {
|
||||
if (result=='ok') {
|
||||
me._state.compareSettings = new AscCommonWord.ComparisonOptions();
|
||||
me._state.compareSettings.putWords(dlg.getSettings());
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||
}
|
||||
})).show();
|
||||
}
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
},
|
||||
|
||||
setRevisedFile: function(data) {
|
||||
if (!this._state.compareSettings) {
|
||||
this._state.compareSettings = new AscCommonWord.ComparisonOptions();
|
||||
this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"));
|
||||
}
|
||||
if (data && data.url) {
|
||||
this.api.asc_CompareDocumentUrl(data.url, this._state.compareSettings, data.token);// for loading from storage
|
||||
}
|
||||
},
|
||||
|
||||
onAcceptChangesBeforeCompare: function(callback) {
|
||||
var me = this;
|
||||
Common.UI.warning({
|
||||
width: 550,
|
||||
msg: this.textAcceptBeforeCompare,
|
||||
buttons: ['yes', 'no'],
|
||||
primary: 'yes',
|
||||
callback: function(result) {
|
||||
_.defer(function() {
|
||||
if (callback) callback(result=='yes');
|
||||
});
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
turnDisplayMode: function(mode) {
|
||||
if (this.api) {
|
||||
if (mode === 'final')
|
||||
this.api.asc_BeginViewModeInReview(true);
|
||||
else if (mode === 'original')
|
||||
this.api.asc_BeginViewModeInReview(false);
|
||||
else
|
||||
this.api.asc_EndViewModeInReview();
|
||||
}
|
||||
this.disableEditing(mode == 'final' || mode == 'original');
|
||||
this._state.previewMode = (mode == 'final' || mode == 'original');
|
||||
},
|
||||
|
||||
isPreviewChangesMode: function() {
|
||||
return this._state.previewMode;
|
||||
},
|
||||
|
||||
onCoAuthMode: function(menu, item, e) {
|
||||
Common.localStorage.setItem(this.view.appPrefix + "settings-coauthmode", item.value);
|
||||
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-coauthmode", item.value);
|
||||
|
||||
if (this.api) {
|
||||
this.api.asc_SetFastCollaborative(item.value==1);
|
||||
|
||||
if (this.api.SetCollaborativeMarksShowType) {
|
||||
var value = Common.localStorage.getItem(item.value ? this.view.appPrefix + "settings-showchanges-fast" : this.view.appPrefix + "settings-showchanges-strict");
|
||||
if (value !== null)
|
||||
this.api.SetCollaborativeMarksShowType(value == 'all' ? Asc.c_oAscCollaborativeMarksShowType.All :
|
||||
value == 'none' ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges);
|
||||
else
|
||||
this.api.SetCollaborativeMarksShowType(item.value ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges);
|
||||
}
|
||||
|
||||
value = Common.localStorage.getItem(this.view.appPrefix + "settings-autosave");
|
||||
if (value===null && this.appConfig.customization && this.appConfig.customization.autosave===false)
|
||||
value = 0;
|
||||
value = (!item.value && value!==null) ? parseInt(value) : 1;
|
||||
|
||||
Common.localStorage.setItem(this.view.appPrefix + "settings-autosave", value);
|
||||
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-autosave", value);
|
||||
this.api.asc_setAutoSaveGap(value);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||
this.view.fireEvent('settings:apply', [this]);
|
||||
},
|
||||
|
||||
disableEditing: function(disable) {
|
||||
Common.NotificationCenter.trigger('editing:disable', disable, {
|
||||
viewMode: false,
|
||||
reviewMode: true,
|
||||
fillFormwMode: false,
|
||||
allowMerge: false,
|
||||
allowSignature: false,
|
||||
allowProtect: false,
|
||||
rightMenu: {clear: true, disable: true},
|
||||
statusBar: true,
|
||||
leftMenu: {disable: false, previewMode: true},
|
||||
fileMenu: {protect: true},
|
||||
navigation: {disable: false, previewMode: true},
|
||||
comments: {disable: false, previewMode: true},
|
||||
chat: false,
|
||||
review: false,
|
||||
viewport: false,
|
||||
documentHolder: true,
|
||||
toolbar: true,
|
||||
plugins: true
|
||||
}, 'review');
|
||||
|
||||
if (this.view) {
|
||||
this.view.$el.find('.no-group-mask.review').css('opacity', 1);
|
||||
|
||||
this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(disable || !this.langs || this.langs.length<1);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
//this.setPreviewMode(state);
|
||||
},
|
||||
|
||||
createToolbarPanel: function() {
|
||||
|
@ -774,7 +155,7 @@ define([
|
|||
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", !(config.customization && config.customization.spellcheck===false)))
|
||||
me.view.turnSpelling(true);
|
||||
|
||||
if ( config.canReview ) {
|
||||
/*if ( config.canReview ) {
|
||||
(new Promise(function (resolve) {
|
||||
resolve();
|
||||
})).then(function () {
|
||||
|
@ -784,7 +165,7 @@ define([
|
|||
// Common.Utils.InternalSettings.set(me.view.appPrefix + "track-changes", (state ? 0 : 1) + (global ? 2 : 0));
|
||||
// };
|
||||
|
||||
var trackChanges = typeof (me.appConfig.customization) == 'object' ? me.appConfig.customization.trackChanges : undefined;
|
||||
/*var trackChanges = typeof (me.appConfig.customization) == 'object' ? me.appConfig.customization.trackChanges : undefined;
|
||||
if (config.isReviewOnly || trackChanges!==undefined)
|
||||
me.api.asc_SetLocalTrackRevisions(config.isReviewOnly || trackChanges===true);
|
||||
else
|
||||
|
@ -803,7 +184,7 @@ define([
|
|||
me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150));
|
||||
}
|
||||
});
|
||||
} else if (config.canViewReview) {
|
||||
}*/ /*else if (config.canViewReview) {
|
||||
config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users
|
||||
if (config.canViewReview) {
|
||||
var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode");
|
||||
|
@ -812,221 +193,21 @@ define([
|
|||
me.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val); // load display mode only in viewer
|
||||
me.view.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (me.view && me.view.btnChat) {
|
||||
/* if (me.view && me.view.btnChat) {
|
||||
me.getApplication().getController('LeftMenu').leftMenu.btnChat.on('toggle', function(btn, state){
|
||||
if (state !== me.view.btnChat.pressed)
|
||||
me.view.turnChat(state);
|
||||
});
|
||||
}
|
||||
}*/
|
||||
if (me.view) {
|
||||
me.view.btnCommentRemove && me.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true));
|
||||
me.view.btnCommentResolve && me.view.btnCommentResolve.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true));
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
showTips: function(strings) {
|
||||
var me = this;
|
||||
if (!strings.length) return;
|
||||
if (typeof(strings)!='object') strings = [strings];
|
||||
|
||||
function showNextTip() {
|
||||
var str_tip = strings.shift();
|
||||
if (str_tip) {
|
||||
me.tooltip.setTitle(str_tip);
|
||||
me.tooltip.show();
|
||||
me.tipTimeout = setTimeout(function () {
|
||||
me.tooltip.hide();
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.tooltip) {
|
||||
this.tooltip = new Common.UI.Tooltip({
|
||||
owner: this.getApplication().getController('Toolbar').getView(),
|
||||
hideonclick: true,
|
||||
placement: 'bottom',
|
||||
cls: 'main-info',
|
||||
offset: 30
|
||||
});
|
||||
this.tooltip.on('tooltip:hide', function(cmp){
|
||||
if (cmp==me.tooltip) {
|
||||
clearTimeout(me.tipTimeout);
|
||||
setTimeout(showNextTip, 300);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
showNextTip();
|
||||
},
|
||||
|
||||
applySettings: function(menu) {
|
||||
this.view && this.view.turnSpelling( Common.localStorage.getBool(this.view.appPrefix + "settings-spellcheck", true) );
|
||||
this.view && this.view.turnCoAuthMode( Common.localStorage.getBool(this.view.appPrefix + "settings-coauthmode", true) );
|
||||
},
|
||||
|
||||
synchronizeChanges: function() {
|
||||
if ( this.appConfig && this.appConfig.canReview ) {
|
||||
this.view.markChanges( this.api.asc_HaveRevisionsChanges() );
|
||||
}
|
||||
},
|
||||
|
||||
setLanguages: function (array) {
|
||||
this.langs = array;
|
||||
this.view && this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(this.langs.length<1);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
onDocLanguage: function() {
|
||||
var me = this;
|
||||
(new Common.Views.LanguageDialog({
|
||||
languages: me.langs,
|
||||
current: me.api.asc_getDefaultLanguage(),
|
||||
handler: function(result, value) {
|
||||
if (result=='ok') {
|
||||
var record = _.findWhere(me.langs, {'value':value});
|
||||
record && me.api.asc_setDefaultLanguage(record.code);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
},
|
||||
|
||||
onLostEditRights: function() {
|
||||
this._readonlyRights = true;
|
||||
this.view && this.view.onLostEditRights();
|
||||
},
|
||||
|
||||
changeAccessRights: function(btn,event,opts) {
|
||||
if (this._docAccessDlg || this._readonlyRights) return;
|
||||
|
||||
if (this.appConfig.canRequestSharingSettings) {
|
||||
Common.Gateway.requestSharingSettings();
|
||||
} else {
|
||||
var me = this;
|
||||
me._docAccessDlg = new Common.Views.DocumentAccessDialog({
|
||||
settingsurl: this.appConfig.sharingSettingsUrl
|
||||
});
|
||||
me._docAccessDlg.on('accessrights', function(obj, rights){
|
||||
me.setSharingSettings({sharingSettings: rights});
|
||||
}).on('close', function(obj){
|
||||
me._docAccessDlg = undefined;
|
||||
});
|
||||
|
||||
me._docAccessDlg.show();
|
||||
}
|
||||
},
|
||||
|
||||
setSharingSettings: function(data) {
|
||||
if (data) {
|
||||
this.document.info.sharingSettings = data.sharingSettings;
|
||||
Common.NotificationCenter.trigger('collaboration:sharingupdate', data.sharingSettings);
|
||||
Common.NotificationCenter.trigger('mentions:clearusers', this);
|
||||
}
|
||||
},
|
||||
|
||||
onCoAuthoringDisconnect: function() {
|
||||
this.SetDisabled(true);
|
||||
},
|
||||
|
||||
onUpdateUsers: function() {
|
||||
var users = this.userCollection;
|
||||
this.popoverChanges && this.popoverChanges.each(function (model) {
|
||||
var user = users.findOriginalUser(model.get('userid'));
|
||||
model.set('usercolor', (user) ? user.get('color') : null);
|
||||
});
|
||||
},
|
||||
|
||||
onAuthParticipantsChanged: function(users) {
|
||||
if (this.view && this.view.btnCompare) {
|
||||
var length = 0;
|
||||
_.each(users, function(item){
|
||||
if (!item.asc_getView())
|
||||
length++;
|
||||
});
|
||||
this.view.btnCompare.setDisabled(length>1 || this.viewmode);
|
||||
}
|
||||
},
|
||||
|
||||
commentsShowHide: function(mode) {
|
||||
if (!this.view) return;
|
||||
var value = Common.Utils.InternalSettings.get(this.view.appPrefix + "settings-livecomment");
|
||||
(value!==undefined) && this.view.btnCommentRemove && this.view.btnCommentRemove.setDisabled(mode != 'show' && !value);
|
||||
(value!==undefined) && this.view.btnCommentResolve && this.view.btnCommentResolve.setDisabled(mode != 'show' && !value);
|
||||
},
|
||||
|
||||
textInserted: '<b>Inserted:</b>',
|
||||
textDeleted: '<b>Deleted:</b>',
|
||||
textParaInserted: '<b>Paragraph Inserted</b> ',
|
||||
textParaDeleted: '<b>Paragraph Deleted</b> ',
|
||||
textFormatted: 'Formatted',
|
||||
textParaFormatted: 'Paragraph Formatted',
|
||||
textNot: 'Not ',
|
||||
textBold: 'Bold',
|
||||
textItalic: 'Italic',
|
||||
textStrikeout: 'Strikeout',
|
||||
textUnderline: 'Underline',
|
||||
textColor: 'Font color',
|
||||
textBaseline: 'Baseline',
|
||||
textSuperScript: 'Superscript',
|
||||
textSubScript: 'Subscript',
|
||||
textHighlight: 'Highlight color',
|
||||
textSpacing: 'Spacing',
|
||||
textDStrikeout: 'Double strikeout',
|
||||
textCaps: 'All caps',
|
||||
textSmallCaps: 'Small caps',
|
||||
textPosition: 'Position',
|
||||
textFontSize: 'Font size',
|
||||
textShd: 'Background color',
|
||||
textContextual: 'Don\'t add interval between paragraphs of the same style',
|
||||
textNoContextual: 'Add interval between paragraphs of the same style',
|
||||
textIndentLeft: 'Indent left',
|
||||
textIndentRight: 'Indent right',
|
||||
textFirstLine: 'First line',
|
||||
textRight: 'Align right',
|
||||
textLeft: 'Align left',
|
||||
textCenter: 'Align center',
|
||||
textJustify: 'Align justify',
|
||||
textBreakBefore: 'Page break before',
|
||||
textKeepNext: 'Keep with next',
|
||||
textKeepLines: 'Keep lines together',
|
||||
textNoBreakBefore: 'No page break before',
|
||||
textNoKeepNext: 'Don\'t keep with next',
|
||||
textNoKeepLines: 'Don\'t keep lines together',
|
||||
textLineSpacing: 'Line Spacing: ',
|
||||
textMultiple: 'multiple',
|
||||
textAtLeast: 'at least',
|
||||
textExact: 'exactly',
|
||||
textSpacingBefore: 'Spacing before',
|
||||
textSpacingAfter: 'Spacing after',
|
||||
textAuto: 'auto',
|
||||
textWidow: 'Widow control',
|
||||
textNoWidow: 'No widow control',
|
||||
textTabs: 'Change tabs',
|
||||
textNum: 'Change numbering',
|
||||
textEquation: 'Equation',
|
||||
textImage: 'Image',
|
||||
textChart: 'Chart',
|
||||
textShape: 'Shape',
|
||||
textTableChanged: '<b>Table Settings Changed</b>',
|
||||
textTableRowsAdd: '<b>Table Rows Added</b>',
|
||||
textTableRowsDel: '<b>Table Rows Deleted</b>',
|
||||
textParaMoveTo: '<b>Moved:</b>',
|
||||
textParaMoveFromUp: '<b>Moved Up:</b>',
|
||||
textParaMoveFromDown: '<b>Moved Down:</b>',
|
||||
textUrl: 'Paste a document URL',
|
||||
textAcceptBeforeCompare: 'In order to compare documents all the tracked changes in them will be considered to have been accepted. Do you want to continue?',
|
||||
textTitleComparison: 'Comparison Settings',
|
||||
textShow: 'Show changes at',
|
||||
textChar: 'Character level',
|
||||
textWord: 'Word level',
|
||||
textOnGlobal: '{0} enabled Track Changes for everyone.',
|
||||
textOffGlobal: '{0} disabled Track Changes for everyone.',
|
||||
textOn: '{0} is now using Track Changes.',
|
||||
textOff: '{0} is no longer using Track Changes.'
|
||||
|
||||
}, Common.Controllers.Transitions || {}));
|
||||
});
|
|
@ -35,8 +35,8 @@
|
|||
*
|
||||
* View
|
||||
*
|
||||
* Created by Julia.Radzhabova on 05.08.15
|
||||
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
|
||||
* Created by Olga.Sharova on 15.07.21
|
||||
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -57,141 +57,19 @@ define([
|
|||
Common.Views.Transitions = Common.UI.BaseView.extend(_.extend((function(){
|
||||
var template =
|
||||
'<section id="transitions-panel" class="panel" data-tab="transit">' +
|
||||
'<div class="group no-group-mask review">' +
|
||||
'<span id="slot-btn-sharing" class="btn-slot text x-huge"></span>' +
|
||||
'<span id="slot-btn-coauthmode" class="btn-slot text x-huge"></span>' +
|
||||
'</div>' +
|
||||
'<div class="separator long sharing"></div>' +
|
||||
//'<div class="separator long sharing"></div>' +
|
||||
'<div class="group">' +
|
||||
'<span class="btn-slot text x-huge slot-comment"></span>' +
|
||||
'<span class="btn-slot text x-huge" id="slot-comment-remove"></span>' +
|
||||
'<span class="btn-slot text x-huge" id="slot-comment-resolve"></span>' +
|
||||
'</div>' +
|
||||
'<div class="separator long comments"></div>' +
|
||||
'<div class="group">' +
|
||||
'<span id="btn-review-on" class="btn-slot text x-huge"></span>' +
|
||||
'</div>' +
|
||||
'<div class="group no-group-mask review" style="padding-left: 0;">' +
|
||||
'<span id="btn-review-view" class="btn-slot text x-huge"></span>' +
|
||||
'</div>' +
|
||||
'<div class="group move-changes" style="padding-left: 0;">' +
|
||||
'<span id="btn-change-prev" class="btn-slot text x-huge"></span>' +
|
||||
'<span id="btn-change-next" class="btn-slot text x-huge"></span>' +
|
||||
'<span id="btn-change-accept" class="btn-slot text x-huge"></span>' +
|
||||
'<span id="btn-change-reject" class="btn-slot text x-huge"></span>' +
|
||||
'</div>' +
|
||||
'<div class="separator long review"></div>' +
|
||||
'<div class="group">' +
|
||||
'<span id="btn-compare" class="btn-slot text x-huge"></span>' +
|
||||
'</div>' +
|
||||
'<div class="separator long compare"></div>' +
|
||||
/*'<div class="group no-group-mask review form-view">' +
|
||||
'<span id="slot-btn-chat" class="btn-slot text x-huge"></span>' +
|
||||
'</div>' +*/
|
||||
/*'<div class="separator long chat"></div>' +
|
||||
'<div class="group no-group-mask review form-view">' +
|
||||
'<span id="slot-btn-history" class="btn-slot text x-huge"></span>' +
|
||||
'</div>' +*/
|
||||
|
||||
|
||||
'</section>';
|
||||
|
||||
function setEvents() {
|
||||
var me = this;
|
||||
|
||||
if ( me.appConfig.canReview ) {
|
||||
this.btnAccept.on('click', function (e) {
|
||||
me.fireEvent('transit:accept', [me.btnAccept, 'current']);
|
||||
});
|
||||
|
||||
this.btnAccept.menu && this.btnAccept.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('transit:accept', [menu, item]);
|
||||
});
|
||||
|
||||
this.btnReject.on('click', function (e) {
|
||||
me.fireEvent('transit:reject', [me.btnReject, 'current']);
|
||||
});
|
||||
|
||||
this.btnReject.menu && this.btnReject.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('transit:reject', [menu, item]);
|
||||
});
|
||||
|
||||
if (me.appConfig.canFeatureComparison) {
|
||||
this.btnCompare.on('click', function (e) {
|
||||
me.fireEvent('transit:compare', ['file']);
|
||||
});
|
||||
|
||||
this.btnCompare.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('transit:compare', [item.value]);
|
||||
});
|
||||
}
|
||||
|
||||
this.btnsTurnReview.forEach(function (button) {
|
||||
button.on('click', function (btn, e) {
|
||||
Common.NotificationCenter.trigger('transitions:turn', btn.pressed);
|
||||
Common.NotificationCenter.trigger('edit:complete');
|
||||
});
|
||||
!me.appConfig.isReviewOnly && button.menu.on('item:toggle', function (menu, item, state, e) {
|
||||
if (!!state) {
|
||||
if (item.value==2) // ON track changes for everyone
|
||||
Common.UI.warning({
|
||||
title: me.textWarnTrackChangesTitle,
|
||||
msg: me.textWarnTrackChanges,
|
||||
maxwidth: 600,
|
||||
buttons: [{
|
||||
value: 'enable',
|
||||
caption: me.textEnable
|
||||
}, 'cancel'],
|
||||
primary: 'enable',
|
||||
callback: function(btn){
|
||||
if (btn == 'enable') {
|
||||
Common.NotificationCenter.trigger('transitions:turn', item.value==0 || item.value==2, item.value>1);
|
||||
} else {
|
||||
var old = Common.Utils.InternalSettings.get(me.appPrefix + "track-changes");
|
||||
me.turnChanges(old==0 || old==2, old>1);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete');
|
||||
}
|
||||
});
|
||||
else
|
||||
Common.NotificationCenter.trigger('transitions:turn', item.value==0 || item.value==2, item.value>1);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (this.appConfig.canViewReview) {
|
||||
this.btnPrev.on('click', function (e) {
|
||||
me.fireEvent('transit:preview', [me.btnPrev, 'prev']);
|
||||
});
|
||||
|
||||
this.btnNext.on('click', function (e) {
|
||||
me.fireEvent('transit:preview', [me.btnNext, 'next']);
|
||||
});
|
||||
|
||||
this.btnReviewView && this.btnReviewView.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('transit:view', [menu, item]);
|
||||
});
|
||||
}
|
||||
|
||||
this.btnsSpelling.forEach(function(button) {
|
||||
button.on('click', function (b, e) {
|
||||
Common.NotificationCenter.trigger('spelling:turn', b.pressed ? 'on' : 'off');
|
||||
Common.NotificationCenter.trigger('edit:complete', me);
|
||||
});
|
||||
});
|
||||
|
||||
this.btnsDocLang.forEach(function(button) {
|
||||
button.on('click', function (b, e) {
|
||||
me.fireEvent('lang:document', this);
|
||||
});
|
||||
});
|
||||
|
||||
this.btnSharing && this.btnSharing.on('click', function (btn, e) {
|
||||
Common.NotificationCenter.trigger('collaboration:sharing');
|
||||
});
|
||||
|
||||
this.btnCoAuthMode && this.btnCoAuthMode.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('collaboration:coauthmode', [menu, item]);
|
||||
});
|
||||
|
||||
if (this.btnCommentRemove) {
|
||||
this.btnCommentRemove.on('click', function (e) {
|
||||
me.fireEvent('comment:removeComments', ['current']);
|
||||
|
@ -224,130 +102,19 @@ define([
|
|||
var filter = Common.localStorage.getKeysFilter();
|
||||
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
|
||||
|
||||
if ( this.appConfig.canReview ) {
|
||||
this.btnAccept = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.txtAccept,
|
||||
split: !this.appConfig.canUseReviewPermissions,
|
||||
iconCls: 'toolbar__icon btn-review-save'
|
||||
});
|
||||
this.btnCommentRemove = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.txtCommentRemove,
|
||||
split: true,
|
||||
iconCls: 'toolbar__icon btn-rem-comment'
|
||||
});
|
||||
this.btnCommentResolve = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.txtCommentResolve,
|
||||
split: true,
|
||||
iconCls: 'toolbar__icon btn-resolve-all'
|
||||
});
|
||||
|
||||
this.btnReject = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.txtReject,
|
||||
split: !this.appConfig.canUseReviewPermissions,
|
||||
iconCls: 'toolbar__icon btn-review-deny'
|
||||
});
|
||||
|
||||
if (this.appConfig.canFeatureComparison)
|
||||
this.btnCompare = new Common.UI.Button({
|
||||
cls : 'btn-toolbar x-huge icon-top',
|
||||
caption : this.txtCompare,
|
||||
split : true,
|
||||
iconCls: 'toolbar__icon btn-compare'
|
||||
});
|
||||
|
||||
this.btnTurnOn = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-ic-review',
|
||||
caption: this.txtTurnon,
|
||||
split: !this.appConfig.isReviewOnly,
|
||||
enableToggle: true
|
||||
});
|
||||
this.btnsTurnReview = [this.btnTurnOn];
|
||||
}
|
||||
if (this.appConfig.canViewReview) {
|
||||
this.btnPrev = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-review-prev',
|
||||
caption: this.txtPrev
|
||||
});
|
||||
|
||||
this.btnNext = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-review-next',
|
||||
caption: this.txtNext
|
||||
});
|
||||
|
||||
if (!this.appConfig.isRestrictedEdit) {// hide Display mode option for fillForms and commenting mode
|
||||
var menuTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><%= caption %></div>' +
|
||||
'<% if (options.description !== null) { %><label style="display: block;color: #a5a5a5;cursor: pointer;white-space: normal;"><%= options.description %></label>' +
|
||||
'<% } %></a>');
|
||||
|
||||
this.btnReviewView = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-ic-reviewview',
|
||||
caption: this.txtView,
|
||||
menu: new Common.UI.Menu({
|
||||
cls: 'ppm-toolbar',
|
||||
items: [
|
||||
{
|
||||
caption: this.txtMarkupCap,
|
||||
checkable: true,
|
||||
toggleGroup: 'menuReviewView',
|
||||
checked: true,
|
||||
value: 'markup',
|
||||
template: menuTemplate,
|
||||
description: this.txtMarkup
|
||||
},
|
||||
{
|
||||
caption: this.txtFinalCap,
|
||||
checkable: true,
|
||||
toggleGroup: 'menuReviewView',
|
||||
checked: false,
|
||||
template: menuTemplate,
|
||||
description: this.txtFinal,
|
||||
value: 'final'
|
||||
},
|
||||
{
|
||||
caption: this.txtOriginalCap,
|
||||
checkable: true,
|
||||
toggleGroup: 'menuReviewView',
|
||||
checked: false,
|
||||
template: menuTemplate,
|
||||
description: this.txtOriginal,
|
||||
value: 'original'
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ((!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length || this.appConfig.canRequestSharingSettings) && this._readonlyRights!==true) {
|
||||
this.btnSharing = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-ic-sharing',
|
||||
caption: this.txtSharing
|
||||
});
|
||||
}
|
||||
|
||||
if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring && this.appConfig.canChangeCoAuthoring) {
|
||||
this.btnCoAuthMode = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
iconCls: 'toolbar__icon btn-ic-coedit',
|
||||
caption: this.txtCoAuthMode,
|
||||
menu: true
|
||||
});
|
||||
}
|
||||
|
||||
this.btnsSpelling = [];
|
||||
this.btnsDocLang = [];
|
||||
|
||||
if ( this.appConfig.canCoAuthoring && this.appConfig.canComments ) {
|
||||
this.btnCommentRemove = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.txtCommentRemove,
|
||||
split: true,
|
||||
iconCls: 'toolbar__icon btn-rem-comment'
|
||||
});
|
||||
this.btnCommentResolve = new Common.UI.Button({
|
||||
cls: 'btn-toolbar x-huge icon-top',
|
||||
caption: this.txtCommentResolve,
|
||||
split: true,
|
||||
iconCls: 'toolbar__icon btn-resolve-all'
|
||||
});
|
||||
}
|
||||
|
||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||
},
|
||||
|
@ -364,134 +131,6 @@ define([
|
|||
(new Promise(function (accept, reject) {
|
||||
accept();
|
||||
})).then(function(){
|
||||
var menuTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><%= caption %></div>' +
|
||||
'<% if (options.description !== null) { %><label style="display: block;color: #a5a5a5;cursor: pointer;white-space: normal;"><%= options.description %></label>' +
|
||||
'<% } %></a>');
|
||||
|
||||
if ( config.canReview ) {
|
||||
var idx = Common.Utils.InternalSettings.get(me.appPrefix + "track-changes");
|
||||
!config.isReviewOnly && me.btnTurnOn.setMenu(
|
||||
new Common.UI.Menu({items: [
|
||||
{
|
||||
caption: me.txtOn,
|
||||
value: 0,
|
||||
checkable: true,
|
||||
checked: idx==0,
|
||||
toggleGroup: 'menuTurnReviewTlb'
|
||||
},
|
||||
{
|
||||
caption: me.txtOff,
|
||||
value: 1,
|
||||
checkable: true,
|
||||
checked: idx==1,
|
||||
toggleGroup: 'menuTurnReviewTlb'
|
||||
},
|
||||
{
|
||||
caption: me.txtOnGlobal,
|
||||
value: 2,
|
||||
checkable: true,
|
||||
checked: idx==2,
|
||||
toggleGroup: 'menuTurnReviewTlb'
|
||||
},
|
||||
{
|
||||
caption: me.txtOffGlobal,
|
||||
value: 3,
|
||||
checkable: true,
|
||||
checked: idx==3,
|
||||
toggleGroup: 'menuTurnReviewTlb'
|
||||
}
|
||||
]})
|
||||
);
|
||||
me.btnTurnOn.updateHint(me.tipReview);
|
||||
|
||||
if (!me.appConfig.canUseReviewPermissions) {
|
||||
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.updateHint([me.tipAcceptCurrent, me.txtAcceptChanges]);
|
||||
me.btnReject.updateHint([me.tipRejectCurrent, me.txtRejectChanges]);
|
||||
|
||||
if (config.canFeatureComparison) {
|
||||
me.btnCompare.setMenu(new Common.UI.Menu({
|
||||
items: [
|
||||
{caption: me.mniFromFile, value: 'file'},
|
||||
{caption: me.mniFromUrl, value: 'url'},
|
||||
{caption: me.mniFromStorage, value: 'storage'}
|
||||
// ,{caption: '--'},
|
||||
// {caption: me.mniSettings, value: 'settings'}
|
||||
]
|
||||
}));
|
||||
me.btnCompare.menu.items[2].setVisible(me.appConfig.canRequestCompareFile || me.appConfig.fileChoiceUrl && me.appConfig.fileChoiceUrl.indexOf("{documentType}")>-1);
|
||||
me.btnCompare.updateHint(me.tipCompare);
|
||||
}
|
||||
|
||||
me.btnAccept.setDisabled(config.isReviewOnly);
|
||||
me.btnReject.setDisabled(config.isReviewOnly);
|
||||
}
|
||||
if (me.appConfig.canViewReview) {
|
||||
me.btnPrev.updateHint(me.hintPrev);
|
||||
me.btnNext.updateHint(me.hintNext);
|
||||
|
||||
me.btnReviewView && me.btnReviewView.updateHint(me.tipReviewView);
|
||||
}
|
||||
me.btnSharing && me.btnSharing.updateHint(me.tipSharing);
|
||||
me.btnChat && me.btnChat.updateHint(me.txtChat + Common.Utils.String.platformKey('Alt+Q'));
|
||||
|
||||
if (me.btnCoAuthMode) {
|
||||
me.btnCoAuthMode.setMenu(
|
||||
new Common.UI.Menu({
|
||||
cls: 'ppm-toolbar',
|
||||
style: 'max-width: 220px;',
|
||||
items: [
|
||||
{
|
||||
caption: me.strFast,
|
||||
checkable: true,
|
||||
toggleGroup: 'menuCoauthMode',
|
||||
checked: true,
|
||||
template: menuTemplate,
|
||||
description: me.strFastDesc,
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
caption: me.strStrict,
|
||||
checkable: true,
|
||||
toggleGroup: 'menuCoauthMode',
|
||||
checked: false,
|
||||
template: menuTemplate,
|
||||
description: me.strStrictDesc,
|
||||
value: 0
|
||||
}
|
||||
]
|
||||
}));
|
||||
me.btnCoAuthMode.updateHint(me.tipCoAuthMode);
|
||||
me.turnCoAuthMode(Common.Utils.InternalSettings.get(me.appPrefix + "settings-coauthmode"));
|
||||
}
|
||||
|
||||
if (me.btnCommentRemove) {
|
||||
var items = [
|
||||
|
@ -537,61 +176,12 @@ define([
|
|||
me.btnCommentResolve.updateHint([me.tipCommentResolveCurrent, me.tipCommentResolve]);
|
||||
}
|
||||
|
||||
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 || config.canViewReview) ? me.$el.find('.separator.review') : '.separator.review',
|
||||
separator_compare = !(config.canReview && config.canFeatureComparison) ? me.$el.find('.separator.compare') : '.separator.compare',
|
||||
separator_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat',
|
||||
separator_last;
|
||||
|
||||
if (typeof separator_sharing == 'object')
|
||||
separator_sharing.hide().prev('.group').hide();
|
||||
else
|
||||
separator_last = separator_sharing;
|
||||
|
||||
if (typeof separator_comments == 'object')
|
||||
separator_comments.hide().prev('.group').hide();
|
||||
else
|
||||
separator_last = separator_comments;
|
||||
|
||||
if (typeof separator_review == 'object')
|
||||
separator_review.hide().prevUntil('.separator.comments').hide();
|
||||
else
|
||||
separator_last = separator_review;
|
||||
|
||||
if (typeof separator_compare == 'object')
|
||||
separator_compare.hide().prev('.group').hide();
|
||||
else
|
||||
separator_last = separator_compare;
|
||||
|
||||
if (typeof separator_chat == 'object')
|
||||
separator_chat.hide().prev('.group').hide();
|
||||
else
|
||||
separator_last = separator_chat;
|
||||
|
||||
|
||||
|
||||
Common.NotificationCenter.trigger('tab:visible', 'review', config.isEdit || config.canViewReview || config.canCoAuthoring && config.canComments);
|
||||
|
||||
setEvents.call(me);
|
||||
setEvents.call(me);
|
||||
});
|
||||
},
|
||||
|
||||
getPanel: function () {
|
||||
this.$el = $(_.template(template)( {} ));
|
||||
|
||||
if ( this.appConfig.canReview ) {
|
||||
this.btnAccept.render(this.$el.find('#btn-change-accept'));
|
||||
this.btnReject.render(this.$el.find('#btn-change-reject'));
|
||||
this.appConfig.canFeatureComparison && this.btnCompare.render(this.$el.find('#btn-compare'));
|
||||
this.btnTurnOn.render(this.$el.find('#btn-review-on'));
|
||||
}
|
||||
this.btnPrev && this.btnPrev.render(this.$el.find('#btn-change-prev'));
|
||||
this.btnNext && this.btnNext.render(this.$el.find('#btn-change-next'));
|
||||
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'));
|
||||
this.btnCommentRemove && this.btnCommentRemove.render(this.$el.find('#slot-comment-remove'));
|
||||
this.btnCommentResolve && this.btnCommentResolve.render(this.$el.find('#slot-comment-resolve'));
|
||||
|
||||
|
@ -611,7 +201,7 @@ define([
|
|||
hintAnchor : 'top',
|
||||
hint : this.tipReview,
|
||||
split : !this.appConfig.isReviewOnly,
|
||||
enableToggle: true,
|
||||
enableToggle: true/*,
|
||||
menu: this.appConfig.isReviewOnly ? false : new Common.UI.Menu({
|
||||
menuAlign: 'bl-tl',
|
||||
style: 'margin-top:-5px;',
|
||||
|
@ -640,10 +230,10 @@ define([
|
|||
checkable: true,
|
||||
toggleGroup: 'menuTurnReviewStb'
|
||||
}
|
||||
]})
|
||||
]})*/
|
||||
});
|
||||
|
||||
this.btnsTurnReview.push(button);
|
||||
// this.btnsTurnReview.push(button);
|
||||
|
||||
return button;
|
||||
} else
|
||||
|
@ -655,7 +245,7 @@ define([
|
|||
hint: this.tipSetSpelling,
|
||||
enableToggle: true
|
||||
});
|
||||
this.btnsSpelling.push(button);
|
||||
//this.btnsSpelling.push(button);
|
||||
|
||||
return button;
|
||||
} else if (type == 'doclang' && parent == 'statusbar' ) {
|
||||
|
@ -666,136 +256,28 @@ define([
|
|||
hint: this.tipSetDocLang,
|
||||
disabled: true
|
||||
});
|
||||
this.btnsDocLang.push(button);
|
||||
//this.btnsDocLang.push(button);
|
||||
|
||||
return button;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getUserName: function (username) {
|
||||
return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username));
|
||||
},
|
||||
|
||||
turnChanges: function(state, global) {
|
||||
this.btnsTurnReview.forEach(function(button) {
|
||||
if ( button && button.pressed != state ) {
|
||||
button.toggle(state, true);
|
||||
}
|
||||
if (button.menu) {
|
||||
button.menu.items[0].setChecked(state && !global, true);
|
||||
button.menu.items[1].setChecked(!state && !global, true);
|
||||
button.menu.items[2].setChecked(state && !!global, true);
|
||||
button.menu.items[3].setChecked(!state && !!global, true);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
markChanges: function(status) {
|
||||
this.btnsTurnReview.forEach(function(button) {
|
||||
if ( button ) {
|
||||
var _icon_el = $('.icon', button.cmpEl);
|
||||
_icon_el[status ? 'addClass' : 'removeClass']('btn-ic-changes');
|
||||
}
|
||||
}, this);
|
||||
|
||||
},
|
||||
|
||||
turnSpelling: function (state) {
|
||||
this.btnsSpelling.forEach(function(button) {
|
||||
if ( button && button.pressed != state ) {
|
||||
button.toggle(state, true);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
turnCoAuthMode: function (fast) {
|
||||
if (this.btnCoAuthMode) {
|
||||
this.btnCoAuthMode.menu.items[0].setChecked(fast, true);
|
||||
this.btnCoAuthMode.menu.items[1].setChecked(!fast, true);
|
||||
}
|
||||
},
|
||||
|
||||
turnDisplayMode: function(mode) {
|
||||
if (this.btnReviewView) {
|
||||
this.btnReviewView.menu.items[0].setChecked(mode=='markup', true);
|
||||
this.btnReviewView.menu.items[1].setChecked(mode=='final', true);
|
||||
this.btnReviewView.menu.items[2].setChecked(mode=='original', true);
|
||||
}
|
||||
},
|
||||
|
||||
SetDisabled: function (state, langs) {
|
||||
this.btnsSpelling && this.btnsSpelling.forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
}
|
||||
}, this);
|
||||
this.btnsDocLang && this.btnsDocLang.forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state || langs && langs.length<1);
|
||||
}
|
||||
}, this);
|
||||
this.btnsTurnReview && this.btnsTurnReview.forEach(function(button) {
|
||||
if ( button ) {
|
||||
button.setDisabled(state);
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.btnCommentRemove && this.btnCommentRemove.setDisabled(state || !Common.Utils.InternalSettings.get(this.appPrefix + "settings-livecomment"));
|
||||
this.btnCommentResolve && this.btnCommentResolve.setDisabled(state || !Common.Utils.InternalSettings.get(this.appPrefix + "settings-livecomment"));
|
||||
},
|
||||
|
||||
onLostEditRights: function() {
|
||||
this._readonlyRights = true;
|
||||
if (!this.rendered)
|
||||
return;
|
||||
|
||||
this.btnSharing && this.btnSharing.setDisabled(true);
|
||||
},
|
||||
|
||||
txtAccept: 'Accept',
|
||||
txtAcceptCurrent: 'Accept current Changes',
|
||||
txtAcceptAll: 'Accept all Changes',
|
||||
txtReject: 'Reject',
|
||||
txtRejectCurrent: 'Reject current Changes',
|
||||
txtRejectAll: 'Reject all Changes',
|
||||
hintNext: 'To Next Change',
|
||||
hintPrev: 'To Previous Change',
|
||||
txtPrev: 'Previous',
|
||||
txtNext: 'Next',
|
||||
txtTurnon: 'Turn On',
|
||||
txtSpelling: 'Spell checking',
|
||||
txtDocLang: 'Language',
|
||||
tipSetDocLang: 'Set Document Language',
|
||||
tipSetSpelling: 'Spell checking',
|
||||
tipReview: 'Review',
|
||||
txtAcceptChanges: 'Accept Changes',
|
||||
txtRejectChanges: 'Reject Changes',
|
||||
txtView: 'Display Mode',
|
||||
txtMarkup: 'Text with changes (Editing)',
|
||||
txtFinal: 'All changes like accept (Preview)',
|
||||
txtOriginal: 'Text without changes (Preview)',
|
||||
tipReviewView: 'Select the way you want the changes to be displayed',
|
||||
tipAcceptCurrent: 'Accept current changes',
|
||||
tipRejectCurrent: 'Reject current changes',
|
||||
txtSharing: 'Sharing',
|
||||
tipSharing: 'Manage document access rights',
|
||||
txtCoAuthMode: 'Co-editing Mode',
|
||||
tipCoAuthMode: 'Set co-editing mode',
|
||||
strFast: 'Fast',
|
||||
strStrict: 'Strict',
|
||||
txtHistory: 'Version History',
|
||||
tipHistory: 'Show version history',
|
||||
txtChat: 'Chat',
|
||||
txtMarkupCap: 'Markup',
|
||||
txtFinalCap: 'Final',
|
||||
txtOriginalCap: 'Original',
|
||||
strFastDesc: 'Real-time co-editing. All changes are saved automatically.',
|
||||
strStrictDesc: 'Use the \'Save\' button to sync the changes you and others make.',
|
||||
txtCompare: 'Compare',
|
||||
tipCompare: 'Compare current document with another one',
|
||||
mniFromFile: 'Document from File',
|
||||
mniFromUrl: 'Document from URL',
|
||||
mniFromStorage: 'Document from Storage',
|
||||
mniSettings: 'Comparison Settings',
|
||||
txtCommentRemove: 'Remove',
|
||||
tipCommentRemCurrent: 'Remove current comments',
|
||||
tipCommentRem: 'Remove comments',
|
||||
|
@ -809,145 +291,8 @@ define([
|
|||
txtCommentResolveCurrent: 'Resolve Current Comments',
|
||||
txtCommentResolveMyCurrent: 'Resolve My Current Comments',
|
||||
txtCommentResolveMy: 'Resolve My Comments',
|
||||
txtCommentResolveAll: 'Resolve All Comments',
|
||||
txtOnGlobal: 'ON for me and everyone',
|
||||
txtOffGlobal: 'OFF for me and everyone',
|
||||
txtOn: 'ON for me',
|
||||
txtOff: 'OFF for me',
|
||||
textWarnTrackChangesTitle: 'Enable Track Changes for everyone?',
|
||||
textWarnTrackChanges: 'Track Changes will be switched ON for all users with full access. The next time anyone opens the doc, Track Changes will remain enabled.',
|
||||
textEnable: 'Enable'
|
||||
txtCommentResolveAll: 'Resolve All Comments'
|
||||
}
|
||||
}()), Common.Views.Transitions || {}));
|
||||
|
||||
Common.Views.ReviewChangesDialog = Common.UI.Window.extend(_.extend({
|
||||
options: {
|
||||
width : 330,
|
||||
height : 90,
|
||||
title : 'Review Changes',
|
||||
modal : false,
|
||||
cls : 'review-changes modal-dlg',
|
||||
alias : 'Common.Views.ReviewChangesDialog'
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
_.extend(this.options, {
|
||||
title : this.textTitle
|
||||
}, options || {});
|
||||
|
||||
this.template = [
|
||||
'<div class="box">',
|
||||
'<div class="input-row">',
|
||||
'<div id="id-review-button-prev" style=""></div>',
|
||||
'<div id="id-review-button-next" style=""></div>',
|
||||
'<div id="id-review-button-accept" style=""></div>',
|
||||
'<div id="id-review-button-reject" style="margin-right: 0;"></div>',
|
||||
'</div>',
|
||||
'</div>'
|
||||
].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 : this.mode.canUseReviewPermissions ? false : 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 : this.mode.canUseReviewPermissions ? false : 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('transit:preview', [me.btnPrev, 'prev']);
|
||||
});
|
||||
|
||||
this.btnNext.on('click', function (e) {
|
||||
me.fireEvent('transit:preview', [me.btnNext, 'next']);
|
||||
});
|
||||
|
||||
this.btnAccept.on('click', function (e) {
|
||||
me.fireEvent('transit:accept', [me.btnAccept, 'current']);
|
||||
});
|
||||
|
||||
this.btnAccept.menu && this.btnAccept.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('transit:accept', [menu, item]);
|
||||
});
|
||||
|
||||
this.btnReject.on('click', function (e) {
|
||||
me.fireEvent('transit:reject', [me.btnReject, 'current']);
|
||||
});
|
||||
|
||||
this.btnReject.menu && this.btnReject.menu.on('item:click', function (menu, item, e) {
|
||||
me.fireEvent('transit: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 || {}));
|
||||
});
|
||||
});
|
|
@ -96,10 +96,10 @@ define([
|
|||
},
|
||||
'Common.Views.ReviewChanges': {
|
||||
'settings:apply': _.bind(this.applySettings, this)
|
||||
},
|
||||
}/*,
|
||||
'Common.Views.Transitions': {
|
||||
'settings:apply': _.bind(this.applySettings, this)
|
||||
}
|
||||
}*/
|
||||
});
|
||||
|
||||
var me = this,
|
||||
|
|
Loading…
Reference in a new issue