2016-04-01 13:17:09 +00:00
|
|
|
/*
|
|
|
|
*
|
2019-01-17 13:05:03 +00:00
|
|
|
* (c) Copyright Ascensio System SIA 2010-2019
|
2016-04-01 13:17:09 +00:00
|
|
|
*
|
|
|
|
* This program is a free software product. You can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
|
|
|
* version 3 as published by the Free Software Foundation. In accordance with
|
|
|
|
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
|
|
|
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
|
|
|
* of any third-party rights.
|
|
|
|
*
|
|
|
|
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
|
|
|
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
*
|
2019-01-17 13:00:34 +00:00
|
|
|
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
|
|
|
* street, Riga, Latvia, EU, LV-1050.
|
2016-04-01 13:17:09 +00:00
|
|
|
*
|
|
|
|
* The interactive user interfaces in modified source and object code versions
|
|
|
|
* of the Program must display Appropriate Legal Notices, as required under
|
|
|
|
* Section 5 of the GNU AGPL version 3.
|
|
|
|
*
|
|
|
|
* Pursuant to Section 7(b) of the License you must retain the original Product
|
|
|
|
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
|
|
|
* grant you any rights under trademark law for use of our trademarks.
|
|
|
|
*
|
|
|
|
* All the Product's GUI elements, including illustrations and icon sets, as
|
|
|
|
* well as technical writing content are licensed under the terms of the
|
|
|
|
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
|
|
|
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
|
|
|
*
|
|
|
|
*/
|
2016-03-11 00:48:53 +00:00
|
|
|
/**
|
|
|
|
* ReviewChanges.js
|
|
|
|
*
|
|
|
|
* Created by Julia.Radzhabova on 05.08.15
|
2018-03-01 12:16:38 +00:00
|
|
|
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
|
2016-03-11 00:48:53 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (Common === undefined)
|
|
|
|
var Common = {};
|
|
|
|
Common.Controllers = Common.Controllers || {};
|
|
|
|
|
|
|
|
define([
|
|
|
|
'core',
|
|
|
|
'common/main/lib/model/ReviewChange',
|
|
|
|
'common/main/lib/collection/ReviewChanges',
|
2017-04-26 08:34:55 +00:00
|
|
|
'common/main/lib/view/ReviewChanges',
|
2018-06-07 14:09:54 +00:00
|
|
|
'common/main/lib/view/ReviewPopover',
|
2017-04-26 08:34:55 +00:00
|
|
|
'common/main/lib/view/LanguageDialog'
|
2016-03-11 00:48:53 +00:00
|
|
|
], function () {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
Common.Controllers.ReviewChanges = Backbone.Controller.extend(_.extend({
|
|
|
|
models : [],
|
|
|
|
collections : [
|
|
|
|
'Common.Collections.ReviewChanges'
|
|
|
|
],
|
|
|
|
views : [
|
|
|
|
'Common.Views.ReviewChanges',
|
2018-06-07 14:09:54 +00:00
|
|
|
'Common.Views.ReviewPopover'
|
2016-03-11 00:48:53 +00:00
|
|
|
],
|
|
|
|
sdkViewName : '#id_main',
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
|
|
|
|
this.addListeners({
|
2017-04-04 15:22:02 +00:00
|
|
|
'FileMenu': {
|
|
|
|
'settings:apply': this.applySettings.bind(this)
|
|
|
|
},
|
2019-10-29 14:08:47 +00:00
|
|
|
'LeftMenu': {
|
|
|
|
'comments:show': _.bind(this.commentsShowHide, this, 'show'),
|
|
|
|
'comments:hide': _.bind(this.commentsShowHide, this, 'hide')
|
|
|
|
},
|
2016-03-11 00:48:53 +00:00
|
|
|
'Common.Views.ReviewChanges': {
|
|
|
|
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
|
|
|
'reviewchange:reject': _.bind(this.onRejectClick, this),
|
2017-02-27 12:04:18 +00:00
|
|
|
'reviewchange:delete': _.bind(this.onDeleteClick, this),
|
2017-04-04 15:22:02 +00:00
|
|
|
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this),
|
2017-08-23 14:49:56 +00:00
|
|
|
'reviewchanges:view': _.bind(this.onReviewViewClick, this),
|
2017-10-07 13:06:51 +00:00
|
|
|
'lang:document': _.bind(this.onDocLanguage, this),
|
|
|
|
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
|
2017-06-09 14:30:52 +00:00
|
|
|
},
|
|
|
|
'Common.Views.ReviewChangesDialog': {
|
|
|
|
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
|
|
|
'reviewchange:reject': _.bind(this.onRejectClick, this),
|
|
|
|
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this)
|
2018-06-07 14:09:54 +00:00
|
|
|
},
|
|
|
|
'Common.Views.ReviewPopover': {
|
|
|
|
'reviewchange:accept': _.bind(this.onAcceptClick, this),
|
|
|
|
'reviewchange:reject': _.bind(this.onRejectClick, this),
|
2019-04-12 14:55:08 +00:00
|
|
|
'reviewchange:delete': _.bind(this.onDeleteClick, this),
|
|
|
|
'reviewchange:goto': _.bind(this.onGotoClick, this)
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onLaunch: function () {
|
|
|
|
this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges');
|
|
|
|
this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
|
|
|
|
|
2017-08-25 09:25:54 +00:00
|
|
|
this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false};
|
2017-03-29 11:19:57 +00:00
|
|
|
|
|
|
|
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
|
2017-04-04 15:22:02 +00:00
|
|
|
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
|
2017-03-29 11:19:57 +00:00
|
|
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
2017-11-23 13:29:05 +00:00
|
|
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
2019-10-09 10:23:40 +00:00
|
|
|
Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this));
|
|
|
|
Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this));
|
2018-06-04 11:45:22 +00:00
|
|
|
|
|
|
|
this.userCollection.on('reset', _.bind(this.onUpdateUsers, this));
|
|
|
|
this.userCollection.on('add', _.bind(this.onUpdateUsers, this));
|
2016-03-11 00:48:53 +00:00
|
|
|
},
|
|
|
|
setConfig: function (data, api) {
|
|
|
|
this.setApi(api);
|
|
|
|
|
|
|
|
if (data) {
|
2019-04-26 14:10:34 +00:00
|
|
|
this.currentUserId = data.config.user.id;
|
2016-03-11 00:48:53 +00:00
|
|
|
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
|
|
|
|
}
|
2019-10-09 10:23:40 +00:00
|
|
|
return this;
|
2016-03-11 00:48:53 +00:00
|
|
|
},
|
|
|
|
setApi: function (api) {
|
|
|
|
if (api) {
|
|
|
|
this.api = api;
|
|
|
|
|
2018-12-18 14:27:19 +00:00
|
|
|
if (this.appConfig.canReview || this.appConfig.canViewReview) {
|
2017-06-15 13:35:55 +00:00
|
|
|
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
|
|
|
|
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
|
|
|
|
}
|
2017-11-23 13:29:05 +00:00
|
|
|
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setMode: function(mode) {
|
2017-04-05 09:11:15 +00:00
|
|
|
this.appConfig = mode;
|
2017-06-15 13:35:55 +00:00
|
|
|
this.popoverChanges = new Common.Collections.ReviewChanges();
|
2018-06-07 14:09:54 +00:00
|
|
|
this.view = this.createView('Common.Views.ReviewChanges', { mode: mode });
|
2017-04-05 09:11:15 +00:00
|
|
|
|
2019-10-09 10:23:40 +00:00
|
|
|
!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
|
|
|
|
!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
|
|
|
|
|
2016-03-11 00:48:53 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2019-10-09 10:23:40 +00:00
|
|
|
loadDocument: function(data) {
|
|
|
|
this.document = data.doc;
|
|
|
|
},
|
|
|
|
|
2017-08-23 14:49:56 +00:00
|
|
|
SetDisabled: function(state) {
|
2017-06-15 13:35:55 +00:00
|
|
|
if (this.dlgChanges)
|
|
|
|
this.dlgChanges.close();
|
2017-10-09 12:03:50 +00:00
|
|
|
this.view && this.view.SetDisabled(state, this.langs);
|
2019-02-04 13:43:25 +00:00
|
|
|
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);
|
|
|
|
});
|
2017-06-15 13:35:55 +00:00
|
|
|
},
|
|
|
|
|
2016-03-11 00:48:53 +00:00
|
|
|
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(),
|
2017-08-10 10:07:18 +00:00
|
|
|
animate = ( Math.abs(this._state.posx-posX)>0.001 || Math.abs(this._state.posy-posY)>0.001) || (sdkchange.length !== this._state.changes_length),
|
2016-03-11 00:48:53 +00:00
|
|
|
lock = (sdkchange[0].get_LockUserId()!==null),
|
|
|
|
lockUser = this.getUserName(sdkchange[0].get_LockUserId());
|
|
|
|
|
2019-05-16 11:17:18 +00:00
|
|
|
this.getPopover().hideTips();
|
2016-03-11 00:48:53 +00:00
|
|
|
this.popoverChanges.reset(changes);
|
|
|
|
|
|
|
|
if (animate) {
|
|
|
|
if ( this.getPopover().isVisible() ) this.getPopover().hide();
|
2018-06-07 14:09:54 +00:00
|
|
|
this.getPopover().setLeftTop(posX, posY);
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
|
2018-06-07 14:09:54 +00:00
|
|
|
this.getPopover().showReview(animate, lock, lockUser);
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2018-12-18 14:27:19 +00:00
|
|
|
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== lock) {
|
2016-03-11 00:48:53 +00:00
|
|
|
this.view.btnAccept.setDisabled(lock==true);
|
|
|
|
this.view.btnReject.setDisabled(lock==true);
|
2017-06-09 14:30:52 +00:00
|
|
|
if (this.dlgChanges) {
|
|
|
|
this.dlgChanges.btnAccept.setDisabled(lock==true);
|
|
|
|
this.dlgChanges.btnReject.setDisabled(lock==true);
|
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
this._state.lock = lock;
|
|
|
|
}
|
|
|
|
this._state.posx = posX;
|
|
|
|
this._state.posy = posY;
|
2017-08-10 10:07:18 +00:00
|
|
|
this._state.changes_length = sdkchange.length;
|
2016-03-11 00:48:53 +00:00
|
|
|
this._state.popoverVisible = true;
|
|
|
|
} else if (this._state.popoverVisible){
|
|
|
|
this._state.posx = this._state.posy = -1000;
|
2017-08-10 10:07:18 +00:00
|
|
|
this._state.changes_length = 0;
|
2016-03-11 00:48:53 +00:00
|
|
|
this._state.popoverVisible = false;
|
2019-04-16 10:13:49 +00:00
|
|
|
this.getPopover().hideTips();
|
2016-03-11 00:48:53 +00:00
|
|
|
this.popoverChanges.reset();
|
2018-06-07 14:09:54 +00:00
|
|
|
this.getPopover().hideReview();
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
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);
|
2018-06-07 14:09:54 +00:00
|
|
|
this.getPopover().setLeftTop(posX, posY);
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
findChange: function (uid, id) {
|
|
|
|
if (_.isUndefined(uid)) {
|
|
|
|
return this.collection.findWhere({id: id});
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.collection.findWhere({uid: uid});
|
|
|
|
},
|
|
|
|
|
|
|
|
getPopover: function () {
|
2018-12-18 14:27:19 +00:00
|
|
|
if ((this.appConfig.canReview || this.appConfig.canViewReview) && _.isUndefined(this.popover)) {
|
2018-06-07 14:09:54 +00:00
|
|
|
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
|
|
|
reviewStore : this.popoverChanges,
|
|
|
|
renderTo : this.sdkViewName
|
|
|
|
});
|
|
|
|
this.popover.setReviewStore(this.popoverChanges);
|
|
|
|
}
|
|
|
|
return this.popover;
|
2016-03-11 00:48:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// helpers
|
|
|
|
|
|
|
|
readSDKChange: function (data) {
|
|
|
|
var me = this, arr = [];
|
|
|
|
_.each(data, function(item) {
|
|
|
|
var changetext = '', proptext = '',
|
|
|
|
value = item.get_Value(),
|
2019-04-12 14:55:08 +00:00
|
|
|
movetype = item.get_MoveType(),
|
2016-03-11 00:48:53 +00:00
|
|
|
settings = false;
|
|
|
|
switch (item.get_Type()) {
|
2016-04-05 11:52:34 +00:00
|
|
|
case Asc.c_oAscRevisionsChangeType.TextAdd:
|
2019-04-12 14:55:08 +00:00
|
|
|
changetext = (movetype==Asc.c_oAscRevisionsMove.NoMove) ? me.textInserted : me.textParaMoveTo;
|
2016-03-11 00:48:53 +00:00
|
|
|
if (typeof value == 'object') {
|
|
|
|
_.each(value, function(obj) {
|
|
|
|
if (typeof obj === 'string')
|
2016-09-15 13:29:34 +00:00
|
|
|
changetext += (' ' + Common.Utils.String.htmlEncode(obj));
|
2016-03-11 00:48:53 +00:00
|
|
|
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') {
|
2016-09-15 13:29:34 +00:00
|
|
|
changetext += (' ' + Common.Utils.String.htmlEncode(value));
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-04-05 11:52:34 +00:00
|
|
|
case Asc.c_oAscRevisionsChangeType.TextRem:
|
2019-04-12 14:55:08 +00:00
|
|
|
changetext = (movetype==Asc.c_oAscRevisionsMove.NoMove) ? me.textDeleted : (item.is_MovedDown() ? me.textParaMoveFromDown : me.textParaMoveFromUp);
|
2016-03-11 00:48:53 +00:00
|
|
|
if (typeof value == 'object') {
|
|
|
|
_.each(value, function(obj) {
|
|
|
|
if (typeof obj === 'string')
|
2016-09-15 13:29:34 +00:00
|
|
|
changetext += (' ' + Common.Utils.String.htmlEncode(obj));
|
2016-03-11 00:48:53 +00:00
|
|
|
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') {
|
2016-09-15 13:29:34 +00:00
|
|
|
changetext += (' ' + Common.Utils.String.htmlEncode(value));
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-04-05 11:52:34 +00:00
|
|
|
case Asc.c_oAscRevisionsChangeType.ParaAdd:
|
2016-03-11 00:48:53 +00:00
|
|
|
changetext = me.textParaInserted;
|
|
|
|
break;
|
2016-04-05 11:52:34 +00:00
|
|
|
case Asc.c_oAscRevisionsChangeType.ParaRem:
|
2016-03-11 00:48:53 +00:00
|
|
|
changetext = me.textParaDeleted;
|
|
|
|
break;
|
2016-04-05 11:52:34 +00:00
|
|
|
case Asc.c_oAscRevisionsChangeType.TextPr:
|
2016-03-11 00:48:53 +00:00
|
|
|
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)
|
2016-04-06 13:38:54 +00:00
|
|
|
proptext += (me.textSpacing + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Spacing()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
2016-03-11 00:48:53 +00:00
|
|
|
if (value.Get_Position() !== undefined)
|
2016-04-06 13:38:54 +00:00
|
|
|
proptext += (me.textPosition + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Position()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
2016-03-11 00:48:53 +00:00
|
|
|
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;
|
2016-04-05 11:52:34 +00:00
|
|
|
case Asc.c_oAscRevisionsChangeType.ParaPr:
|
2016-03-11 00:48:53 +00:00
|
|
|
changetext = '<b>' + me.textParaFormatted;
|
|
|
|
if (value.Get_ContextualSpacing())
|
|
|
|
proptext += ((value.Get_ContextualSpacing() ? me.textContextual : me.textNoContextual) + ', ');
|
|
|
|
if (value.Get_IndLeft() !== undefined)
|
2016-04-06 13:38:54 +00:00
|
|
|
proptext += (me.textIndentLeft + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndLeft()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
2016-03-11 00:48:53 +00:00
|
|
|
if (value.Get_IndRight() !== undefined)
|
2016-04-06 13:38:54 +00:00
|
|
|
proptext += (me.textIndentRight + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndRight()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
2016-03-11 00:48:53 +00:00
|
|
|
if (value.Get_IndFirstLine() !== undefined)
|
2016-04-06 13:38:54 +00:00
|
|
|
proptext += (me.textFirstLine + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndFirstLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
2016-03-11 00:48:53 +00:00
|
|
|
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)) + ' ');
|
2016-04-06 13:38:54 +00:00
|
|
|
proptext += (((value.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO) ? value.Get_SpacingLine() : Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName()) + ', ');
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
if (value.Get_SpacingBeforeAutoSpacing())
|
|
|
|
proptext += (me.textSpacingBefore + ' ' + me.textAuto +', ');
|
|
|
|
else if (value.Get_SpacingBefore() !== undefined)
|
2016-04-06 13:38:54 +00:00
|
|
|
proptext += (me.textSpacingBefore + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingBefore()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
2016-03-11 00:48:53 +00:00
|
|
|
if (value.Get_SpacingAfterAutoSpacing())
|
|
|
|
proptext += (me.textSpacingAfter + ' ' + me.textAuto +', ');
|
|
|
|
else if (value.Get_SpacingAfter() !== undefined)
|
2016-04-06 13:38:54 +00:00
|
|
|
proptext += (me.textSpacingAfter + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingAfter()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', ');
|
2016-03-11 00:48:53 +00:00
|
|
|
if (value.Get_WidowControl())
|
|
|
|
proptext += ((value.Get_WidowControl() ? me.textWidow : me.textNoWidow) + ', ');
|
|
|
|
if (value.Get_Tabs() !== undefined)
|
|
|
|
proptext += proptext += (me.textTabs + ', ');
|
|
|
|
if (value.Get_NumPr() !== undefined)
|
|
|
|
proptext += 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;
|
2019-04-03 14:01:32 +00:00
|
|
|
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;
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
var date = (item.get_DateTime() == '') ? new Date() : new Date(item.get_DateTime()),
|
2018-06-04 11:45:22 +00:00
|
|
|
user = me.userCollection.findOriginalUser(item.get_UserId()),
|
2016-03-11 00:48:53 +00:00
|
|
|
change = new Common.Models.ReviewChange({
|
|
|
|
uid : Common.UI.getId(),
|
|
|
|
userid : item.get_UserId(),
|
|
|
|
username : item.get_UserName(),
|
2018-06-04 11:45:22 +00:00
|
|
|
usercolor : (user) ? user.get('color') : null,
|
2016-03-11 00:48:53 +00:00
|
|
|
date : me.dateToLocaleTimeString(date),
|
|
|
|
changetext : changetext,
|
|
|
|
id : Common.UI.getId(),
|
|
|
|
lock : (item.get_LockUserId()!==null),
|
2019-03-25 14:21:27 +00:00
|
|
|
lockuser : me.getUserName(item.get_LockUserId()),
|
2016-03-11 00:48:53 +00:00
|
|
|
type : item.get_Type(),
|
|
|
|
changedata : item,
|
2018-12-18 14:27:19 +00:00
|
|
|
scope : me.view,
|
2019-04-12 14:55:08 +00:00
|
|
|
hint : !me.appConfig.canReview,
|
2019-04-26 14:10:34 +00:00
|
|
|
goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom),
|
|
|
|
editable : (item.get_UserId() == me.currentUserId)
|
2016-03-11 00:48:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
arr.push(change);
|
|
|
|
});
|
|
|
|
return arr;
|
|
|
|
},
|
|
|
|
|
|
|
|
getUserName: function(id){
|
|
|
|
if (this.userCollection && id!==null){
|
|
|
|
var rec = this.userCollection.findUser(id);
|
|
|
|
if (rec) return 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);
|
|
|
|
},
|
|
|
|
|
2017-03-29 09:33:20 +00:00
|
|
|
onBtnPreviewClick: function(btn, opts){
|
|
|
|
switch (opts) {
|
|
|
|
case 'prev': this.api.asc_GetPrevRevisionsChange(); break;
|
|
|
|
case 'next': this.api.asc_GetNextRevisionsChange(); break;
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
2017-02-27 12:04:18 +00:00
|
|
|
|
2016-03-11 00:48:53 +00:00
|
|
|
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);
|
|
|
|
},
|
|
|
|
|
2019-04-12 14:55:08 +00:00
|
|
|
onGotoClick: function(change) {
|
|
|
|
if (this.api) {
|
|
|
|
this.api.asc_FollowRevisionMove(change);
|
|
|
|
}
|
|
|
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
|
|
|
},
|
|
|
|
|
2017-03-29 11:19:57 +00:00
|
|
|
onTurnPreview: function(state) {
|
2017-04-05 09:11:15 +00:00
|
|
|
if ( this.appConfig.isReviewOnly ) {
|
2017-03-29 11:19:57 +00:00
|
|
|
this.view.turnChanges(true);
|
|
|
|
} else
|
2017-04-05 09:11:15 +00:00
|
|
|
if ( this.appConfig.canReview ) {
|
2017-03-29 11:19:57 +00:00
|
|
|
state = (state == 'on');
|
|
|
|
|
|
|
|
this.api.asc_SetTrackRevisions(state);
|
2018-09-12 11:52:13 +00:00
|
|
|
Common.localStorage.setItem(this.view.appPrefix + "track-changes-" + (this.appConfig.fileKey || ''), state ? 1 : 0);
|
2017-03-29 11:19:57 +00:00
|
|
|
|
|
|
|
this.view.turnChanges(state);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-04-04 15:22:02 +00:00
|
|
|
onTurnSpelling: function (state) {
|
|
|
|
state = (state == 'on');
|
|
|
|
this.view.turnSpelling(state);
|
|
|
|
|
2017-10-12 09:05:55 +00:00
|
|
|
Common.localStorage.setItem(this.view.appPrefix + "settings-spellcheck", state ? 1 : 0);
|
2017-04-04 15:22:02 +00:00
|
|
|
this.api.asc_setSpellCheck(state);
|
2019-07-15 13:22:34 +00:00
|
|
|
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-spellcheck", state);
|
2017-04-04 15:22:02 +00:00
|
|
|
},
|
|
|
|
|
2017-08-23 14:49:56 +00:00
|
|
|
onReviewViewClick: function(menu, item, e) {
|
2019-01-15 11:12:09 +00:00
|
|
|
this.turnDisplayMode(item.value);
|
|
|
|
!this.appConfig.canReview && Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value);
|
|
|
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
|
|
|
},
|
|
|
|
|
|
|
|
turnDisplayMode: function(mode) {
|
2017-08-23 14:49:56 +00:00
|
|
|
if (this.api) {
|
2019-01-15 11:12:09 +00:00
|
|
|
if (mode === 'final')
|
2017-08-23 14:49:56 +00:00
|
|
|
this.api.asc_BeginViewModeInReview(true);
|
2019-01-15 11:12:09 +00:00
|
|
|
else if (mode === 'original')
|
2017-08-23 14:49:56 +00:00
|
|
|
this.api.asc_BeginViewModeInReview(false);
|
|
|
|
else
|
|
|
|
this.api.asc_EndViewModeInReview();
|
|
|
|
}
|
2019-01-15 11:12:09 +00:00
|
|
|
this.disableEditing(mode == 'final' || mode == 'original');
|
|
|
|
this._state.previewMode = (mode == 'final' || mode == 'original');
|
2017-08-23 14:49:56 +00:00
|
|
|
},
|
|
|
|
|
2017-08-25 09:25:54 +00:00
|
|
|
isPreviewChangesMode: function() {
|
|
|
|
return this._state.previewMode;
|
|
|
|
},
|
|
|
|
|
2017-10-07 13:06:51 +00:00
|
|
|
onCoAuthMode: function(menu, item, e) {
|
2017-10-12 09:05:55 +00:00
|
|
|
Common.localStorage.setItem(this.view.appPrefix + "settings-coauthmode", item.value);
|
2017-11-07 12:00:11 +00:00
|
|
|
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-coauthmode", item.value);
|
2017-10-07 13:06:51 +00:00
|
|
|
|
|
|
|
if (this.api) {
|
|
|
|
this.api.asc_SetFastCollaborative(item.value==1);
|
|
|
|
|
2017-10-12 10:43:23 +00:00
|
|
|
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);
|
|
|
|
}
|
2017-10-07 13:06:51 +00:00
|
|
|
|
2017-10-12 09:05:55 +00:00
|
|
|
value = Common.localStorage.getItem(this.view.appPrefix + "settings-autosave");
|
2017-10-07 13:06:51 +00:00
|
|
|
if (value===null && this.appConfig.customization && this.appConfig.customization.autosave===false)
|
|
|
|
value = 0;
|
|
|
|
value = (!item.value && value!==null) ? parseInt(value) : 1;
|
|
|
|
|
2017-10-12 09:05:55 +00:00
|
|
|
Common.localStorage.setItem(this.view.appPrefix + "settings-autosave", value);
|
2017-11-07 12:00:11 +00:00
|
|
|
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-autosave", value);
|
2017-10-07 13:06:51 +00:00
|
|
|
this.api.asc_setAutoSaveGap(value);
|
|
|
|
}
|
|
|
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
2017-11-24 06:31:34 +00:00
|
|
|
this.view.fireEvent('settings:apply', [this]);
|
2017-10-07 13:06:51 +00:00
|
|
|
},
|
|
|
|
|
2017-08-23 14:49:56 +00:00
|
|
|
disableEditing: function(disable) {
|
|
|
|
var app = this.getApplication();
|
|
|
|
app.getController('Toolbar').DisableToolbar(disable, false, true);
|
2017-08-23 20:22:33 +00:00
|
|
|
app.getController('DocumentHolder').getView().SetDisabled(disable);
|
2018-12-18 14:27:19 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2017-08-23 20:32:27 +00:00
|
|
|
|
2017-09-01 12:25:31 +00:00
|
|
|
var comments = app.getController('Common.Controllers.Comments');
|
|
|
|
if (comments)
|
|
|
|
comments.setPreviewMode(disable);
|
2017-08-23 14:49:56 +00:00
|
|
|
|
2019-02-13 09:57:02 +00:00
|
|
|
var leftMenu = app.getController('LeftMenu');
|
2019-08-23 08:42:21 +00:00
|
|
|
leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
|
2019-02-13 09:57:02 +00:00
|
|
|
leftMenu.setPreviewMode(disable);
|
2017-11-17 07:26:06 +00:00
|
|
|
|
2017-08-23 14:49:56 +00:00
|
|
|
if (this.view) {
|
|
|
|
this.view.$el.find('.no-group-mask').css('opacity', 1);
|
2017-10-09 12:03:50 +00:00
|
|
|
|
|
|
|
this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
|
|
|
|
if ( button ) {
|
2019-03-06 07:33:38 +00:00
|
|
|
button.setDisabled(disable || !this.langs || this.langs.length<1);
|
2017-10-09 12:03:50 +00:00
|
|
|
}
|
|
|
|
}, this);
|
2017-08-23 14:49:56 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-03-29 11:19:57 +00:00
|
|
|
createToolbarPanel: function() {
|
|
|
|
return this.view.getPanel();
|
|
|
|
},
|
2017-03-29 09:33:20 +00:00
|
|
|
|
|
|
|
getView: function(name) {
|
|
|
|
return !name && this.view ?
|
|
|
|
this.view : Backbone.Controller.prototype.getView.call(this, name);
|
|
|
|
},
|
2017-03-29 11:19:57 +00:00
|
|
|
|
|
|
|
onAppReady: function (config) {
|
2017-06-15 13:35:55 +00:00
|
|
|
var me = this;
|
2019-09-04 12:37:57 +00:00
|
|
|
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", !(config.customization && config.customization.spellcheck===false)))
|
2017-06-15 13:35:55 +00:00
|
|
|
me.view.turnSpelling(true);
|
2017-03-29 11:19:57 +00:00
|
|
|
|
2017-06-15 13:35:55 +00:00
|
|
|
if ( config.canReview ) {
|
2017-03-29 11:19:57 +00:00
|
|
|
(new Promise(function (resolve) {
|
|
|
|
resolve();
|
|
|
|
})).then(function () {
|
|
|
|
function _setReviewStatus(state) {
|
|
|
|
me.view.turnChanges(state);
|
|
|
|
me.api.asc_SetTrackRevisions(state);
|
|
|
|
};
|
|
|
|
|
2018-09-12 11:52:13 +00:00
|
|
|
var state = config.isReviewOnly || Common.localStorage.getBool(me.view.appPrefix + "track-changes-" + (config.fileKey || ''));
|
2018-09-12 13:32:34 +00:00
|
|
|
me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true);
|
2018-09-12 11:52:13 +00:00
|
|
|
_setReviewStatus(state);
|
2017-04-04 15:22:02 +00:00
|
|
|
|
2017-06-09 14:30:52 +00:00
|
|
|
if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) {
|
|
|
|
me.dlgChanges = (new Common.Views.ReviewChangesDialog({
|
|
|
|
popoverChanges : me.popoverChanges,
|
|
|
|
mode : me.appConfig
|
|
|
|
}));
|
|
|
|
var sdk = $('#editor_sdk'),
|
|
|
|
offset = sdk.offset();
|
|
|
|
me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150));
|
|
|
|
}
|
2017-03-29 11:19:57 +00:00
|
|
|
});
|
2019-01-15 11:12:09 +00:00
|
|
|
} else if (config.canViewReview) {
|
2019-08-23 14:23:44 +00:00
|
|
|
config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users
|
2019-06-13 14:37:56 +00:00
|
|
|
if (config.canViewReview) {
|
|
|
|
var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode");
|
|
|
|
if (val===null)
|
|
|
|
val = me.appConfig.customization && /^(original|final|markup)$/i.test(me.appConfig.customization.reviewDisplay) ? me.appConfig.customization.reviewDisplay.toLocaleLowerCase() : 'original';
|
2019-08-23 14:23:44 +00:00
|
|
|
me.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val); // load display mode only in viewer
|
|
|
|
me.view.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val);
|
2019-06-13 14:37:56 +00:00
|
|
|
}
|
2017-03-29 11:19:57 +00:00
|
|
|
}
|
2017-10-10 12:14:27 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
2019-10-29 14:08:47 +00:00
|
|
|
}
|
|
|
|
if (me.view && me.view.btnCommentRemove) {
|
|
|
|
me.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true));
|
2017-10-10 12:14:27 +00:00
|
|
|
}
|
2017-03-29 11:19:57 +00:00
|
|
|
},
|
|
|
|
|
2017-04-04 15:22:02 +00:00
|
|
|
applySettings: function(menu) {
|
2017-10-12 09:05:55 +00:00
|
|
|
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) );
|
2017-04-04 15:22:02 +00:00
|
|
|
},
|
|
|
|
|
2017-03-29 11:19:57 +00:00
|
|
|
synchronizeChanges: function() {
|
2017-08-25 06:39:04 +00:00
|
|
|
if ( this.appConfig && this.appConfig.canReview ) {
|
2017-03-29 11:19:57 +00:00
|
|
|
this.view.markChanges( this.api.asc_HaveRevisionsChanges() );
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-04-04 15:22:02 +00:00
|
|
|
setLanguages: function (array) {
|
|
|
|
this.langs = array;
|
2017-10-09 12:03:50 +00:00
|
|
|
this.view && this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
|
|
|
|
if ( button ) {
|
|
|
|
button.setDisabled(this.langs.length<1);
|
|
|
|
}
|
|
|
|
}, this);
|
2017-04-04 15:22:02 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onDocLanguage: function() {
|
|
|
|
var me = this;
|
2017-04-26 08:34:55 +00:00
|
|
|
(new Common.Views.LanguageDialog({
|
2019-01-28 13:51:07 +00:00
|
|
|
languages: me.langs,
|
2017-04-04 15:22:02 +00:00
|
|
|
current: me.api.asc_getDefaultLanguage(),
|
2019-01-28 13:51:07 +00:00
|
|
|
handler: function(result, value) {
|
2017-04-04 15:22:02 +00:00
|
|
|
if (result=='ok') {
|
2019-01-28 13:51:07 +00:00
|
|
|
var record = _.findWhere(me.langs, {'value':value});
|
2017-04-04 15:22:02 +00:00
|
|
|
record && me.api.asc_setDefaultLanguage(record.code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})).show();
|
|
|
|
},
|
|
|
|
|
2017-10-07 13:06:51 +00:00
|
|
|
onLostEditRights: function() {
|
2019-10-09 10:23:40 +00:00
|
|
|
this._readonlyRights = true;
|
2017-10-07 13:06:51 +00:00
|
|
|
this.view && this.view.onLostEditRights();
|
|
|
|
},
|
|
|
|
|
2019-10-09 10:23:40 +00:00
|
|
|
changeAccessRights: function(btn,event,opts) {
|
|
|
|
if (this._docAccessDlg || this._readonlyRights) return;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-11-23 13:29:05 +00:00
|
|
|
onCoAuthoringDisconnect: function() {
|
2017-11-22 12:20:51 +00:00
|
|
|
this.SetDisabled(true);
|
|
|
|
},
|
|
|
|
|
2018-06-04 11:45:22 +00:00
|
|
|
onUpdateUsers: function() {
|
|
|
|
var users = this.userCollection;
|
2018-06-05 08:54:49 +00:00
|
|
|
this.popoverChanges && this.popoverChanges.each(function (model) {
|
2018-06-04 11:45:22 +00:00
|
|
|
var user = users.findOriginalUser(model.get('userid'));
|
|
|
|
model.set('usercolor', (user) ? user.get('color') : null);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-10-29 14:08:47 +00:00
|
|
|
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);
|
|
|
|
},
|
|
|
|
|
2016-03-11 00:48:53 +00:00
|
|
|
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',
|
2019-04-03 14:01:32 +00:00
|
|
|
textShape: 'Shape',
|
|
|
|
textTableChanged: '<b>Table Settings Changed</b>',
|
|
|
|
textTableRowsAdd: '<b>Table Rows Added<b/>',
|
2019-04-12 14:55:08 +00:00
|
|
|
textTableRowsDel: '<b>Table Rows Deleted<b/>',
|
|
|
|
textParaMoveTo: '<b>Moved:</b>',
|
|
|
|
textParaMoveFromUp: '<b>Moved Up:</b>',
|
|
|
|
textParaMoveFromDown: '<b>Moved Down:</b>'
|
2016-03-11 00:48:53 +00:00
|
|
|
}, Common.Controllers.ReviewChanges || {}));
|
|
|
|
});
|