diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index b1aa9de10..3eff2a871 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -96,7 +96,7 @@ define([ this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges'); 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('spelling:turn', this.onTurnSpelling.bind(this)); @@ -559,7 +559,7 @@ define([ if (this.api) { if (item === 'file') { // if (this.api) - // this.api.asc_addDocument(); + // this.api.asc_addDocument(me._state.compareSettings); Common.NotificationCenter.trigger('edit:complete', this.view); } else if (item === 'url') { var me = this; @@ -570,7 +570,7 @@ define([ if (me.api) { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - // me.api.AddDocumentUrl(checkUrl); + // me.api.AddDocumentUrl(checkUrl, me._state.compareSettings); } } Common.NotificationCenter.trigger('edit:complete', me.view); @@ -584,21 +584,29 @@ define([ // (new Common.Views.SelectFileDlg({ // fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly") // })).on('selectfile', function(obj, file){ - // me.insertImage(file); + // me.selectFile(file, me._state.compareSettings); // }).show(); // } } 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); }, - insertImage: function(data) { + selectFile: 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'); + // this.api.AddDocumentUrl(data.url, this._state.compareSettings, data.token);// for loading from storage } }, diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index f093edef4..ff10841e2 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -56,7 +56,8 @@ define([ 'documenteditor/main/app/controller/PageLayout', 'documenteditor/main/app/view/CustomColumnsDialog', 'documenteditor/main/app/view/ControlSettingsDialog', - 'documenteditor/main/app/view/WatermarkSettingsDialog' + 'documenteditor/main/app/view/WatermarkSettingsDialog', + 'documenteditor/main/app/view/CompareSettingsDialog' ], function () { 'use strict'; diff --git a/apps/documenteditor/main/app/view/CompareSettingsDialog.js b/apps/documenteditor/main/app/view/CompareSettingsDialog.js new file mode 100644 index 000000000..20fc1bc1b --- /dev/null +++ b/apps/documenteditor/main/app/view/CompareSettingsDialog.js @@ -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: [ + '
', + '
', + '
', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '' + ].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 || {})) +}); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index e8842a041..082b4f28b 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1054,6 +1054,10 @@ "DE.Views.ChartSettings.txtTight": "Tight", "DE.Views.ChartSettings.txtTitle": "Chart", "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.okButtonText": "OK", "DE.Views.ControlSettingsDialog.textAppearance": "Appearance",