[DE] Add settings for comparison of documents

This commit is contained in:
Julia Radzhabova 2019-08-14 11:07:24 +03:00
parent 9b0047189d
commit 8ae13a7fde
4 changed files with 177 additions and 10 deletions

View file

@ -96,7 +96,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));
@ -559,7 +559,7 @@ define([
if (this.api) { if (this.api) {
if (item === 'file') { if (item === 'file') {
// if (this.api) // if (this.api)
// this.api.asc_addDocument(); // this.api.asc_addDocument(me._state.compareSettings);
Common.NotificationCenter.trigger('edit:complete', this.view); Common.NotificationCenter.trigger('edit:complete', this.view);
} else if (item === 'url') { } else if (item === 'url') {
var me = this; var me = this;
@ -570,7 +570,7 @@ define([
if (me.api) { if (me.api) {
var checkUrl = value.replace(/ /g, ''); var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) { if (!_.isEmpty(checkUrl)) {
// me.api.AddDocumentUrl(checkUrl); // me.api.AddDocumentUrl(checkUrl, me._state.compareSettings);
} }
} }
Common.NotificationCenter.trigger('edit:complete', me.view); Common.NotificationCenter.trigger('edit:complete', me.view);
@ -584,21 +584,29 @@ define([
// (new Common.Views.SelectFileDlg({ // (new Common.Views.SelectFileDlg({
// fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly") // fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly")
// })).on('selectfile', function(obj, file){ // })).on('selectfile', function(obj, file){
// me.insertImage(file); // me.selectFile(file, me._state.compareSettings);
// }).show(); // }).show();
// } // }
} else if (item === 'settings') { } else if (item === 'settings') {
// show settings dialog var me = this;
(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); Common.NotificationCenter.trigger('edit:complete', this.view);
}, },
insertImage: function(data) { selectFile: function(data) {
if (data && data.url) { if (data && data.url) {
this.toolbar.fireEvent('insertimage', this.toolbar); // this.api.AddDocumentUrl(data.url, this._state.compareSettings, data.token);// for loading from storage
this.api.AddImageUrl(data.url, undefined, data.token);// for loading from storage
Common.component.Analytics.trackEvent('ToolBar', 'Image');
} }
}, },

View file

@ -56,7 +56,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,154 @@
/*
*
* (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>',
'<div class="footer center">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + me.okButtonText + '</button>',
'<button class="btn normal dlg-btn" result="cancel">' + me.cancelButtonText + '</button>',
'</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',
checked: true
});
this.afterRender();
},
afterRender: function() {
this._setDefaults(this.props);
},
show: function() {
Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
},
_setDefaults: function (props) {
if (props) {
// var val = props.get_ShowAt();
// val ? this.radioChar.setValue(true, true) : this.radioWord.setValue(true, true);
}
},
getSettings: function () {
// var props = new AscCommon.CComparisonPr();
// props.put_ShowAt(this.radioChar.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());
}
this.close();
},
textTitle: 'Comparison Settings',
textShow: 'Show changes at',
textChar: 'Character level',
textWord: 'Word level'
}, DE.Views.CompareSettingsDialog || {}))
});

View file

@ -1054,6 +1054,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.cancelButtonText": "Cancel", "DE.Views.ControlSettingsDialog.cancelButtonText": "Cancel",
"DE.Views.ControlSettingsDialog.okButtonText": "OK", "DE.Views.ControlSettingsDialog.okButtonText": "OK",
"DE.Views.ControlSettingsDialog.textAppearance": "Appearance", "DE.Views.ControlSettingsDialog.textAppearance": "Appearance",