Merge pull request #272 from ONLYOFFICE/feature/compare

Feature/compare
This commit is contained in:
Julia Radzhabova 2019-11-28 14:13:19 +03:00 committed by GitHub
commit 7a80ffba90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 359 additions and 10 deletions

View file

@ -208,6 +208,7 @@
_config.editorConfig.canRequestSaveAs = _config.events && !!_config.events.onRequestSaveAs; _config.editorConfig.canRequestSaveAs = _config.events && !!_config.events.onRequestSaveAs;
_config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage; _config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage;
_config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients; _config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients;
_config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile;
_config.frameEditorId = placeholderId; _config.frameEditorId = placeholderId;
var onMouseUp = function (evt) { var onMouseUp = function (evt) {
@ -577,6 +578,13 @@
}); });
}; };
var _setRevisedFile = function(data) {
_sendCommand({
command: 'setRevisedFile',
data: data
});
};
var _processMouse = function(evt) { var _processMouse = function(evt) {
var r = iframe.getBoundingClientRect(); var r = iframe.getBoundingClientRect();
var data = { var data = {
@ -621,7 +629,8 @@
showSharingSettings : _showSharingSettings, showSharingSettings : _showSharingSettings,
setSharingSettings : _setSharingSettings, setSharingSettings : _setSharingSettings,
insertImage : _insertImage, insertImage : _insertImage,
setMailMergeRecipients: _setMailMergeRecipients setMailMergeRecipients: _setMailMergeRecipients,
setRevisedFile : _setRevisedFile
} }
}; };

View file

@ -118,6 +118,10 @@ if (Common === undefined) {
'setMailMergeRecipients': function(data) { 'setMailMergeRecipients': function(data) {
$me.trigger('setmailmergerecipients', data); $me.trigger('setmailmergerecipients', data);
},
'setRevisedFile': function(data) {
$me.trigger('setrevisedfile', data);
} }
}; };
@ -308,6 +312,10 @@ if (Common === undefined) {
_postMessage({event:'onRequestMailMergeRecipients'}) _postMessage({event:'onRequestMailMergeRecipients'})
}, },
requestCompareFile: function () {
_postMessage({event:'onRequestCompareFile'})
},
on: function(event, handler){ on: function(event, handler){
var localHandler = function(event, data){ var localHandler = function(event, data){
handler.call(me, data) handler.call(me, data)

View file

@ -78,7 +78,8 @@ define([
'reviewchange:reject': _.bind(this.onRejectClick, this), 'reviewchange:reject': _.bind(this.onRejectClick, this),
'reviewchange:delete': _.bind(this.onDeleteClick, this), 'reviewchange:delete': _.bind(this.onDeleteClick, this),
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this), 'reviewchange:preview': _.bind(this.onBtnPreviewClick, this),
'reviewchanges:view': _.bind(this.onReviewViewClick, this), 'reviewchange:view': _.bind(this.onReviewViewClick, this),
'reviewchange:compare': _.bind(this.onCompareClick, this),
'lang:document': _.bind(this.onDocLanguage, this), 'lang:document': _.bind(this.onDocLanguage, this),
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this) 'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
}, },
@ -99,7 +100,7 @@ define([
this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges'); this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges');
this.userCollection = this.getApplication().getCollection('Common.Collections.Users'); this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false}; this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null /*new AscCommon.CComparisonPr()*/};
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this)); Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this)); Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
@ -127,8 +128,13 @@ define([
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_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, 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));
} }
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_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
Common.Gateway.on('setrevisedfile', _.bind(this.setRevisedFile, this));
} }
}, },
@ -568,6 +574,84 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.view); 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') {
(new DE.Views.CompareSettingsDialog({
props: me._state.compareSettings,
handler: function(result, value) {
if (result == 'ok') {
me._state.compareSettings = value;
}
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) { turnDisplayMode: function(mode) {
if (this.api) { if (this.api) {
if (mode === 'final') if (mode === 'final')
@ -780,6 +864,17 @@ define([
}); });
}, },
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) { commentsShowHide: function(mode) {
if (!this.view) return; if (!this.view) return;
var value = Common.Utils.InternalSettings.get(this.view.appPrefix + "settings-livecomment"); var value = Common.Utils.InternalSettings.get(this.view.appPrefix + "settings-livecomment");
@ -844,6 +939,8 @@ define([
textTableRowsDel: '<b>Table Rows Deleted<b/>', textTableRowsDel: '<b>Table Rows Deleted<b/>',
textParaMoveTo: '<b>Moved:</b>', textParaMoveTo: '<b>Moved:</b>',
textParaMoveFromUp: '<b>Moved Up:</b>', textParaMoveFromUp: '<b>Moved Up:</b>',
textParaMoveFromDown: '<b>Moved Down:</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?'
}, Common.Controllers.ReviewChanges || {})); }, Common.Controllers.ReviewChanges || {}));
}); });

View file

@ -56,7 +56,7 @@ define([
this.template = [ this.template = [
'<div class="box">', '<div class="box">',
'<div class="input-row">', '<div class="input-row">',
'<label>' + this.textUrl + '</label>', '<label>' + (this.options.title || this.textUrl) + '</label>',
'</div>', '</div>',
'<div id="id-dlg-url" class="input-row"></div>', '<div id="id-dlg-url" class="input-row"></div>',
'</div>' '</div>'

View file

@ -80,6 +80,10 @@ define([
'<span id="btn-change-reject" class="btn-slot text x-huge"></span>' + '<span id="btn-change-reject" class="btn-slot text x-huge"></span>' +
'</div>' + '</div>' +
'<div class="separator long review"/>' + '<div class="separator long review"/>' +
'<div class="group">' +
'<span id="btn-compare" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long compare"/>' +
'<div class="group no-group-mask">' + '<div class="group no-group-mask">' +
'<span id="slot-btn-chat" class="btn-slot text x-huge"></span>' + '<span id="slot-btn-chat" class="btn-slot text x-huge"></span>' +
'</div>' + '</div>' +
@ -116,6 +120,16 @@ define([
me.fireEvent('reviewchange:reject', [menu, item]); me.fireEvent('reviewchange:reject', [menu, item]);
}); });
if (me.appConfig.canFeatureComparison) {
this.btnCompare.on('click', function (e) {
me.fireEvent('reviewchange:compare', ['file']);
});
this.btnCompare.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchange:compare', [item.value]);
});
}
this.btnsTurnReview.forEach(function (button) { this.btnsTurnReview.forEach(function (button) {
button.on('click', _click_turnpreview.bind(me)); button.on('click', _click_turnpreview.bind(me));
}); });
@ -130,7 +144,7 @@ define([
}); });
this.btnReviewView && this.btnReviewView.menu.on('item:click', function (menu, item, e) { this.btnReviewView && this.btnReviewView.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchanges:view', [menu, item]); me.fireEvent('reviewchange:view', [menu, item]);
}); });
} }
@ -199,6 +213,14 @@ define([
iconCls: 'review-deny' iconCls: '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: 'btn-compare'
});
this.btnTurnOn = new Common.UI.Button({ this.btnTurnOn = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-review', iconCls: 'btn-ic-review',
@ -368,6 +390,20 @@ define([
); );
me.btnReject.updateHint([me.tipRejectCurrent, me.txtRejectChanges]); 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.btnAccept.setDisabled(config.isReviewOnly);
me.btnReject.setDisabled(config.isReviewOnly); me.btnReject.setDisabled(config.isReviewOnly);
} }
@ -442,6 +478,7 @@ define([
var separator_sharing = !(me.btnSharing || me.btnCoAuthMode) ? me.$el.find('.separator.sharing') : '.separator.sharing', 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_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_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_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat',
separator_last; separator_last;
@ -460,6 +497,11 @@ define([
else else
separator_last = separator_review; 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') if (typeof separator_chat == 'object')
separator_chat.hide().prev('.group').hide(); separator_chat.hide().prev('.group').hide();
else else
@ -480,6 +522,7 @@ define([
if ( this.appConfig.canReview ) { if ( this.appConfig.canReview ) {
this.btnAccept.render(this.$el.find('#btn-change-accept')); this.btnAccept.render(this.$el.find('#btn-change-accept'));
this.btnReject.render(this.$el.find('#btn-change-reject')); 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.btnTurnOn.render(this.$el.find('#btn-review-on'));
} }
this.btnPrev && this.btnPrev.render(this.$el.find('#btn-change-prev')); this.btnPrev && this.btnPrev.render(this.$el.find('#btn-change-prev'));
@ -654,6 +697,12 @@ define([
txtOriginalCap: 'Original', txtOriginalCap: 'Original',
strFastDesc: 'Real-time co-editing. All changes are saved automatically.', strFastDesc: 'Real-time co-editing. All changes are saved automatically.',
strStrictDesc: 'Use the \'Save\' button to sync the changes you and others make.', 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', txtCommentRemove: 'Remove',
tipCommentRemCurrent: 'Remove current comments', tipCommentRemCurrent: 'Remove current comments',
tipCommentRem: 'Remove comments', tipCommentRem: 'Remove comments',

View file

@ -533,6 +533,7 @@
.button-normal-icon(btn-caption, 76, @toolbar-big-icon-size); .button-normal-icon(btn-caption, 76, @toolbar-big-icon-size);
.button-normal-icon(btn-calculation, 80, @toolbar-big-icon-size); .button-normal-icon(btn-calculation, 80, @toolbar-big-icon-size);
.button-normal-icon(btn-scale, 81, @toolbar-big-icon-size); .button-normal-icon(btn-scale, 81, @toolbar-big-icon-size);
.button-normal-icon(btn-compare, 82, @toolbar-big-icon-size);
.button-normal-icon(btn-rem-comment, 83, @toolbar-big-icon-size); .button-normal-icon(btn-rem-comment, 83, @toolbar-big-icon-size);
.button-normal-icon(btn-symbol, 84, @toolbar-big-icon-size); .button-normal-icon(btn-symbol, 84, @toolbar-big-icon-size);

View file

@ -352,8 +352,10 @@ define([
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify; this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs; this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage; this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage;
this.appOptions.canRequestCompareFile = this.editorConfig.canRequestCompareFile;
this.appOptions.canRequestMailMergeRecipients = this.editorConfig.canRequestMailMergeRecipients; this.appOptions.canRequestMailMergeRecipients = this.editorConfig.canRequestMailMergeRecipients;
this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures; this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures;
this.appOptions.canFeatureComparison = !!this.api.asc_isSupportFeature("comparison");
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header'); appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '') appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
@ -1392,6 +1394,18 @@ define([
config.msg = this.uploadImageFileCountMessage; config.msg = this.uploadImageFileCountMessage;
break; break;
case Asc.c_oAscError.ID.UplDocumentSize:
config.msg = this.uploadDocSizeMessage;
break;
case Asc.c_oAscError.ID.UplDocumentExt:
config.msg = this.uploadDocExtMessage;
break;
case Asc.c_oAscError.ID.UplDocumentFileCount:
config.msg = this.uploadDocFileCountMessage;
break;
case Asc.c_oAscError.ID.SplitCellMaxRows: case Asc.c_oAscError.ID.SplitCellMaxRows:
config.msg = this.splitMaxRowsErrorText.replace('%1', errData.get_Value()); config.msg = this.splitMaxRowsErrorText.replace('%1', errData.get_Value());
break; break;
@ -2170,7 +2184,7 @@ define([
uploadImageTextText: 'Uploading image...', uploadImageTextText: 'Uploading image...',
savePreparingText: 'Preparing to save', savePreparingText: 'Preparing to save',
savePreparingTitle: 'Preparing to save. Please wait...', savePreparingTitle: 'Preparing to save. Please wait...',
uploadImageSizeMessage: 'Maximium image size limit exceeded.', uploadImageSizeMessage: 'Maximum image size limit exceeded.',
uploadImageExtMessage: 'Unknown image format.', uploadImageExtMessage: 'Unknown image format.',
uploadImageFileCountMessage: 'No images uploaded.', uploadImageFileCountMessage: 'No images uploaded.',
reloadButtonText: 'Reload Page', reloadButtonText: 'Reload Page',
@ -2486,6 +2500,9 @@ define([
txtMainDocOnly: 'Error! Main Document Only.', txtMainDocOnly: 'Error! Main Document Only.',
txtNotValidBookmark: 'Error! Not a valid bookmark self-reference.', txtNotValidBookmark: 'Error! Not a valid bookmark self-reference.',
txtNoText: 'Error! No text of specified style in document.', txtNoText: 'Error! No text of specified style in document.',
uploadDocSizeMessage: 'Maximum document size limit exceeded.',
uploadDocExtMessage: 'Unknown document format.',
uploadDocFileCountMessage: 'No documents uploaded.',
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.' errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.'
} }
})(), DE.Controllers.Main || {})) })(), DE.Controllers.Main || {}))

View file

@ -57,7 +57,8 @@ define([
'documenteditor/main/app/controller/PageLayout', 'documenteditor/main/app/controller/PageLayout',
'documenteditor/main/app/view/CustomColumnsDialog', 'documenteditor/main/app/view/CustomColumnsDialog',
'documenteditor/main/app/view/ControlSettingsDialog', 'documenteditor/main/app/view/ControlSettingsDialog',
'documenteditor/main/app/view/WatermarkSettingsDialog' 'documenteditor/main/app/view/WatermarkSettingsDialog',
'documenteditor/main/app/view/CompareSettingsDialog'
], function () { ], function () {
'use strict'; 'use strict';

View file

@ -0,0 +1,150 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* 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
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* 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
*
*/
/**
* CompareSettingsDialog.js.js
*
* Created by Julia Radzhabova on 14.08.2019
* Copyright (c) 2019 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/util/utils',
'common/main/lib/component/CheckBox',
'common/main/lib/component/InputField',
'common/main/lib/view/AdvancedSettingsWindow'
], function () { 'use strict';
DE.Views.CompareSettingsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
contentWidth: 220,
height: 160
},
initialize : function(options) {
var me = this;
_.extend(this.options, {
title: this.textTitle,
template: [
'<div class="box" style="height:' + (me.options.height - 85) + 'px;">',
'<div class="content-panel" style="padding: 0 5px;"><div class="inner-content">',
'<div class="settings-panel active">',
'<table cols="1" style="width: 100%;">',
'<tr>',
'<td class="padding-small">',
'<label class="header">', me.textShow, '</label>',
'</td>',
'</tr>',
'<tr>',
'<td class="padding-small">',
'<div id="compare-settings-radio-char"></div>',
'</td>',
'</tr>',
'<tr>',
'<td class="padding-small">',
'<div id="compare-settings-radio-word"></div>',
'</td>',
'</tr>',
'</table>',
'</div></div>',
'</div>',
'</div>'
].join('')
}, options);
this.handler = options.handler;
this.props = options.props;
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
},
render: function() {
Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
var me = this;
this.radioChar = new Common.UI.RadioBox({
el: $('#compare-settings-radio-char'),
labelText: this.textChar,
name: 'asc-radio-compare-show'
});
this.radioWord = new Common.UI.RadioBox({
el: $('#compare-settings-radio-word'),
labelText: this.textWord,
name: 'asc-radio-compare-show'
});
this.afterRender();
},
afterRender: function() {
this._setDefaults(this.props);
},
show: function() {
Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
},
_setDefaults: function (props) {
if (props) {
var value = props.getWords();
(value==false) ? this.radioChar.setValue(true, true) : this.radioWord.setValue(true, true);
}
},
getSettings: function () {
var props = new AscCommonWord.ComparisonOptions();
props.putWords(this.radioWord.getValue());
return props;
},
onDlgBtnClick: function(event) {
var me = this;
var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event;
if (state == 'ok') {
this.handler && this.handler.call(this, state, this.getSettings());
Common.localStorage.setBool("de-compare-char", this.radioChar.getValue());
}
this.close();
},
textTitle: 'Comparison Settings',
textShow: 'Show changes at',
textChar: 'Character level',
textWord: 'Word level'
}, DE.Views.CompareSettingsDialog || {}))
});

View file

@ -2175,8 +2175,8 @@ define([
tipBack: 'Back', tipBack: 'Back',
tipInsertShape: 'Insert Autoshape', tipInsertShape: 'Insert Autoshape',
tipInsertEquation: 'Insert Equation', tipInsertEquation: 'Insert Equation',
mniImageFromFile: 'Image from file', mniImageFromFile: 'Image from File',
mniImageFromUrl: 'Image from url', mniImageFromUrl: 'Image from URL',
mniCustomTable: 'Insert Custom Table', mniCustomTable: 'Insert Custom Table',
textTitleError: 'Error', textTitleError: 'Error',
textInsertPageNumber: 'Insert page number', textInsertPageNumber: 'Insert page number',

View file

@ -69,6 +69,8 @@
"Common.Controllers.ReviewChanges.textTabs": "Change tabs", "Common.Controllers.ReviewChanges.textTabs": "Change tabs",
"Common.Controllers.ReviewChanges.textUnderline": "Underline", "Common.Controllers.ReviewChanges.textUnderline": "Underline",
"Common.Controllers.ReviewChanges.textWidow": "Widow control", "Common.Controllers.ReviewChanges.textWidow": "Widow control",
"Common.Controllers.ReviewChanges.textUrl": "Paste a document URL",
"Common.Controllers.ReviewChanges.textAcceptBeforeCompare": "In order to compare documents all the tracked changes in them will be considered to have been accepted. Do you want to continue?",
"Common.define.chartData.textArea": "Area", "Common.define.chartData.textArea": "Area",
"Common.define.chartData.textBar": "Bar", "Common.define.chartData.textBar": "Bar",
"Common.define.chartData.textCharts": "Charts", "Common.define.chartData.textCharts": "Charts",
@ -302,6 +304,12 @@
"Common.Views.ReviewChanges.txtSpelling": "Spell Checking", "Common.Views.ReviewChanges.txtSpelling": "Spell Checking",
"Common.Views.ReviewChanges.txtTurnon": "Track Changes", "Common.Views.ReviewChanges.txtTurnon": "Track Changes",
"Common.Views.ReviewChanges.txtView": "Display Mode", "Common.Views.ReviewChanges.txtView": "Display Mode",
"Common.Views.ReviewChanges.txtCompare": "Compare",
"Common.Views.ReviewChanges.tipCompare": "Compare current document with another one",
"Common.Views.ReviewChanges.mniFromFile": "Document from File",
"Common.Views.ReviewChanges.mniFromUrl": "Document from URL",
"Common.Views.ReviewChanges.mniFromStorage": "Document from Storage",
"Common.Views.ReviewChanges.mniSettings": "Comparison Settings",
"Common.Views.ReviewChangesDialog.textTitle": "Review Changes", "Common.Views.ReviewChangesDialog.textTitle": "Review Changes",
"Common.Views.ReviewChangesDialog.txtAccept": "Accept", "Common.Views.ReviewChangesDialog.txtAccept": "Accept",
"Common.Views.ReviewChangesDialog.txtAcceptAll": "Accept All Changes", "Common.Views.ReviewChangesDialog.txtAcceptAll": "Accept All Changes",
@ -691,6 +699,9 @@
"DE.Controllers.Main.txtZeroDivide": "Zero Divide", "DE.Controllers.Main.txtZeroDivide": "Zero Divide",
"DE.Controllers.Main.unknownErrorText": "Unknown error.", "DE.Controllers.Main.unknownErrorText": "Unknown error.",
"DE.Controllers.Main.unsupportedBrowserErrorText": "Your browser is not supported.", "DE.Controllers.Main.unsupportedBrowserErrorText": "Your browser is not supported.",
"DE.Controllers.Main.uploadDocSizeMessage": "Maximum document size limit exceeded.",
"DE.Controllers.Main.uploadDocExtMessage": "Unknown document format.",
"DE.Controllers.Main.uploadDocFileCountMessage": "No documents uploaded.",
"DE.Controllers.Main.uploadImageExtMessage": "Unknown image format.", "DE.Controllers.Main.uploadImageExtMessage": "Unknown image format.",
"DE.Controllers.Main.uploadImageFileCountMessage": "No images uploaded.", "DE.Controllers.Main.uploadImageFileCountMessage": "No images uploaded.",
"DE.Controllers.Main.uploadImageSizeMessage": "Maximum image size limit exceeded.", "DE.Controllers.Main.uploadImageSizeMessage": "Maximum image size limit exceeded.",
@ -1115,6 +1126,10 @@
"DE.Views.ChartSettings.txtTight": "Tight", "DE.Views.ChartSettings.txtTight": "Tight",
"DE.Views.ChartSettings.txtTitle": "Chart", "DE.Views.ChartSettings.txtTitle": "Chart",
"DE.Views.ChartSettings.txtTopAndBottom": "Top and bottom", "DE.Views.ChartSettings.txtTopAndBottom": "Top and bottom",
"DE.Views.CompareSettingsDialog.textTitle": "Comparison Settings",
"DE.Views.CompareSettingsDialog.textShow": "Show changes at",
"DE.Views.CompareSettingsDialog.textChar": "Character level",
"DE.Views.CompareSettingsDialog.textWord": "Word level",
"DE.Views.ControlSettingsDialog.textAppearance": "Appearance", "DE.Views.ControlSettingsDialog.textAppearance": "Appearance",
"DE.Views.ControlSettingsDialog.textApplyAll": "Apply to All", "DE.Views.ControlSettingsDialog.textApplyAll": "Apply to All",
"DE.Views.ControlSettingsDialog.textBox": "Bounding box", "DE.Views.ControlSettingsDialog.textBox": "Bounding box",

View file

@ -13,6 +13,7 @@ var sdk_dev_scrpipts = [
"../../../../sdkjs/common/TableId.js", "../../../../sdkjs/common/TableId.js",
"../../../../sdkjs/common/TableIdChanges.js", "../../../../sdkjs/common/TableIdChanges.js",
"../../../../sdkjs/common/macros.js", "../../../../sdkjs/common/macros.js",
"../../../../sdkjs/common/delta.js",
"../../../../sdkjs/common/NumFormat.js", "../../../../sdkjs/common/NumFormat.js",
"../../../../sdkjs/common/SerializeChart.js", "../../../../sdkjs/common/SerializeChart.js",
"../../../../sdkjs/common/AdvancedOptions.js", "../../../../sdkjs/common/AdvancedOptions.js",
@ -91,6 +92,7 @@ var sdk_dev_scrpipts = [
"../../../../sdkjs/word/Editor/GraphicObjects/WrapManager.js", "../../../../sdkjs/word/Editor/GraphicObjects/WrapManager.js",
"../../../../sdkjs/word/Editor/CollaborativeEditing.js", "../../../../sdkjs/word/Editor/CollaborativeEditing.js",
"../../../../sdkjs/word/Editor/DocumentContentElementBase.js", "../../../../sdkjs/word/Editor/DocumentContentElementBase.js",
"../../../../sdkjs/word/Editor/DocumentComparison.js",
"../../../../sdkjs/word/Editor/ParagraphContentBase.js", "../../../../sdkjs/word/Editor/ParagraphContentBase.js",
"../../../../sdkjs/word/Editor/Comments.js", "../../../../sdkjs/word/Editor/Comments.js",
"../../../../sdkjs/word/Editor/CommentsChanges.js", "../../../../sdkjs/word/Editor/CommentsChanges.js",