[DE] Compare two documents

This commit is contained in:
Julia Radzhabova 2019-08-13 17:40:52 +03:00
parent dfa807f4b1
commit 9b0047189d
5 changed files with 106 additions and 7 deletions

View file

@ -74,7 +74,8 @@ define([
'reviewchange:reject': _.bind(this.onRejectClick, this),
'reviewchange:delete': _.bind(this.onDeleteClick, 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),
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
},
@ -554,6 +555,53 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.view);
},
onCompareClick: function(item) {
if (this.api) {
if (item === 'file') {
// if (this.api)
// this.api.asc_addDocument();
Common.NotificationCenter.trigger('edit:complete', this.view);
} else if (item === 'url') {
var me = this;
(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.AddDocumentUrl(checkUrl);
}
}
Common.NotificationCenter.trigger('edit:complete', me.view);
}
}
})).show();
} else if (item === 'storage') {
// if (this.toolbar.mode.canRequestInsertImage) {
// Common.Gateway.requestInsertImage();
// } else {
// (new Common.Views.SelectFileDlg({
// fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly")
// })).on('selectfile', function(obj, file){
// me.insertImage(file);
// }).show();
// }
} else if (item === 'settings') {
// show settings dialog
}
}
Common.NotificationCenter.trigger('edit:complete', this.view);
},
insertImage: function(data) {
if (data && data.url) {
this.toolbar.fireEvent('insertimage', this.toolbar);
this.api.AddImageUrl(data.url, undefined, data.token);// for loading from storage
Common.component.Analytics.trackEvent('ToolBar', 'Image');
}
},
turnDisplayMode: function(mode) {
if (this.api) {
if (mode === 'final')
@ -797,6 +845,7 @@ define([
textTableRowsDel: '<b>Table Rows Deleted<b/>',
textParaMoveTo: '<b>Moved:</b>',
textParaMoveFromUp: '<b>Moved Up:</b>',
textParaMoveFromDown: '<b>Moved Down:</b>'
textParaMoveFromDown: '<b>Moved Down:</b>',
textUrl: 'Paste a document URL'
}, Common.Controllers.ReviewChanges || {}));
});

View file

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

View file

@ -79,6 +79,10 @@ define([
'<span id="btn-change-reject" class="btn-slot text x-huge"></span>' +
'</div>' +
'<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">' +
'<span id="slot-btn-chat" class="btn-slot text x-huge"></span>' +
'</div>' +
@ -115,6 +119,14 @@ define([
me.fireEvent('reviewchange:reject', [menu, item]);
});
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) {
button.on('click', _click_turnpreview.bind(me));
});
@ -129,7 +141,7 @@ define([
});
this.btnReviewView && this.btnReviewView.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchanges:view', [menu, item]);
me.fireEvent('reviewchange:view', [menu, item]);
});
}
@ -188,6 +200,13 @@ define([
iconCls: 'review-deny'
});
this.btnCompare = new Common.UI.Button({
cls : 'btn-toolbar x-huge icon-top',
caption : this.txtCompare,
split : true,
iconCls: 'review-deny'
});
this.btnTurnOn = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-ic-review',
@ -348,6 +367,17 @@ define([
);
me.btnReject.updateHint([me.tipRejectCurrent, me.txtRejectChanges]);
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.updateHint(me.tipCompare);
me.btnAccept.setDisabled(config.isReviewOnly);
me.btnReject.setDisabled(config.isReviewOnly);
}
@ -400,6 +430,7 @@ define([
var separator_sharing = !(me.btnSharing || me.btnCoAuthMode) ? me.$el.find('.separator.sharing') : '.separator.sharing',
separator_comments = !(config.canComments && config.canCoAuthoring) ? me.$el.find('.separator.comments') : '.separator.comments',
separator_review = !(config.canReview || config.canViewReview) ? me.$el.find('.separator.review') : '.separator.review',
separator_compare = !config.canReview ? me.$el.find('.separator.compare') : '.separator.compare',
separator_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat',
separator_last;
@ -418,6 +449,11 @@ define([
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
@ -438,6 +474,7 @@ define([
if ( this.appConfig.canReview ) {
this.btnAccept.render(this.$el.find('#btn-change-accept'));
this.btnReject.render(this.$el.find('#btn-change-reject'));
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'));
@ -609,7 +646,13 @@ define([
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.'
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'
}
}()), Common.Views.ReviewChanges || {}));

View file

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

View file

@ -69,6 +69,7 @@
"Common.Controllers.ReviewChanges.textTabs": "Change tabs",
"Common.Controllers.ReviewChanges.textUnderline": "Underline",
"Common.Controllers.ReviewChanges.textWidow": "Widow control",
"Common.Controllers.ReviewChanges.textUrl": "Paste a document URL",
"Common.UI.ComboBorderSize.txtNoBorders": "No borders",
"Common.UI.ComboBorderSizeEditable.txtNoBorders": "No borders",
"Common.UI.ComboDataView.emptyComboText": "No styles",
@ -268,6 +269,12 @@
"Common.Views.ReviewChanges.txtSpelling": "Spell Checking",
"Common.Views.ReviewChanges.txtTurnon": "Track Changes",
"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.txtAccept": "Accept",
"Common.Views.ReviewChangesDialog.txtAcceptAll": "Accept All Changes",