Merge branch 'feature/update-external-data' into develop
This commit is contained in:
commit
7672e7069d
|
@ -23,6 +23,7 @@
|
||||||
options: <advanced options>,
|
options: <advanced options>,
|
||||||
key: 'key',
|
key: 'key',
|
||||||
vkey: 'vkey',
|
vkey: 'vkey',
|
||||||
|
referenceData: 'data for external paste',
|
||||||
info: {
|
info: {
|
||||||
owner: 'owner name',
|
owner: 'owner name',
|
||||||
folder: 'path to document',
|
folder: 'path to document',
|
||||||
|
@ -263,6 +264,7 @@
|
||||||
'onRequestCompareFile': <request file to compare>,// must call setRevisedFile method
|
'onRequestCompareFile': <request file to compare>,// must call setRevisedFile method
|
||||||
'onRequestSharingSettings': <request sharing settings>,// must call setSharingSettings method
|
'onRequestSharingSettings': <request sharing settings>,// must call setSharingSettings method
|
||||||
'onRequestCreateNew': <try to create document>,
|
'onRequestCreateNew': <try to create document>,
|
||||||
|
'onRequestReferenceData': <try to refresh external data>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,6 +328,7 @@
|
||||||
_config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile;
|
_config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile;
|
||||||
_config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings;
|
_config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings;
|
||||||
_config.editorConfig.canRequestCreateNew = _config.events && !!_config.events.onRequestCreateNew;
|
_config.editorConfig.canRequestCreateNew = _config.events && !!_config.events.onRequestCreateNew;
|
||||||
|
_config.editorConfig.canRequestReferenceData = _config.events && !!_config.events.onRequestReferenceData;
|
||||||
_config.frameEditorId = placeholderId;
|
_config.frameEditorId = placeholderId;
|
||||||
_config.parentOrigin = window.location.origin;
|
_config.parentOrigin = window.location.origin;
|
||||||
|
|
||||||
|
@ -732,6 +735,13 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var _setReferenceData = function(data) {
|
||||||
|
_sendCommand({
|
||||||
|
command: 'setReferenceData',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var _serviceCommand = function(command, data) {
|
var _serviceCommand = function(command, data) {
|
||||||
_sendCommand({
|
_sendCommand({
|
||||||
command: 'internalCommand',
|
command: 'internalCommand',
|
||||||
|
@ -766,7 +776,8 @@
|
||||||
setFavorite : _setFavorite,
|
setFavorite : _setFavorite,
|
||||||
requestClose : _requestClose,
|
requestClose : _requestClose,
|
||||||
grabFocus : _grabFocus,
|
grabFocus : _grabFocus,
|
||||||
blurFocus : _blurFocus
|
blurFocus : _blurFocus,
|
||||||
|
setReferenceData : _setReferenceData
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,10 @@ if (window.Common === undefined) {
|
||||||
|
|
||||||
'grabFocus': function(data) {
|
'grabFocus': function(data) {
|
||||||
$me.trigger('grabfocus', data);
|
$me.trigger('grabfocus', data);
|
||||||
|
},
|
||||||
|
|
||||||
|
'setReferenceData': function(data) {
|
||||||
|
$me.trigger('setreferencedata', data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -347,6 +351,10 @@ if (window.Common === undefined) {
|
||||||
_postMessage({event:'onRequestCreateNew'});
|
_postMessage({event:'onRequestCreateNew'});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
requestReferenceData: function (data) {
|
||||||
|
_postMessage({event:'onRequestReferenceData', data: data});
|
||||||
|
},
|
||||||
|
|
||||||
pluginsReady: function() {
|
pluginsReady: function() {
|
||||||
_postMessage({ event: 'onPluginsReady' });
|
_postMessage({ event: 'onPluginsReady' });
|
||||||
},
|
},
|
||||||
|
|
|
@ -45,6 +45,7 @@ define([
|
||||||
'spreadsheeteditor/main/app/view/SortDialog',
|
'spreadsheeteditor/main/app/view/SortDialog',
|
||||||
'spreadsheeteditor/main/app/view/RemoveDuplicatesDialog',
|
'spreadsheeteditor/main/app/view/RemoveDuplicatesDialog',
|
||||||
'spreadsheeteditor/main/app/view/DataValidationDialog',
|
'spreadsheeteditor/main/app/view/DataValidationDialog',
|
||||||
|
'spreadsheeteditor/main/app/view/ExternalLinksDlg',
|
||||||
'common/main/lib/view/OptionsDialog'
|
'common/main/lib/view/OptionsDialog'
|
||||||
], function () {
|
], function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -96,7 +97,8 @@ define([
|
||||||
'data:sortcustom': this.onCustomSort,
|
'data:sortcustom': this.onCustomSort,
|
||||||
'data:remduplicates': this.onRemoveDuplicates,
|
'data:remduplicates': this.onRemoveDuplicates,
|
||||||
'data:datavalidation': this.onDataValidation,
|
'data:datavalidation': this.onDataValidation,
|
||||||
'data:fromtext': this.onDataFromText
|
'data:fromtext': this.onDataFromText,
|
||||||
|
'data:externallinks': this.onExternalLinks
|
||||||
},
|
},
|
||||||
'Statusbar': {
|
'Statusbar': {
|
||||||
'sheet:changed': this.onApiSheetChanged
|
'sheet:changed': this.onApiSheetChanged
|
||||||
|
@ -429,6 +431,15 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onExternalLinks: function() {
|
||||||
|
(new SSE.Views.ExternalLinksDlg({
|
||||||
|
api: this.api,
|
||||||
|
handler: function(result) {
|
||||||
|
Common.NotificationCenter.trigger('edit:complete');
|
||||||
|
}
|
||||||
|
})).show();
|
||||||
|
},
|
||||||
|
|
||||||
onWorksheetLocked: function(index,locked) {
|
onWorksheetLocked: function(index,locked) {
|
||||||
if (index == this.api.asc_getActiveWorksheetIndex()) {
|
if (index == this.api.asc_getActiveWorksheetIndex()) {
|
||||||
Common.Utils.lockControls(Common.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)});
|
Common.Utils.lockControls(Common.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)});
|
||||||
|
@ -436,7 +447,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeProtectWorkbook: function() {
|
onChangeProtectWorkbook: function() {
|
||||||
Common.Utils.lockControls(Common.enumLock.wbLock, this.api.asc_isProtectedWorkbook(), {array: [this.view.btnDataFromText]});
|
Common.Utils.lockControls(Common.enumLock.wbLock, this.api.asc_isProtectedWorkbook(), {array: [this.view.btnDataFromText, this.view.btnExternalLinks]});
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiSheetChanged: function() {
|
onApiSheetChanged: function() {
|
||||||
|
|
|
@ -119,6 +119,11 @@ define([
|
||||||
me._state = {wsLock: false, wsProps: []};
|
me._state = {wsLock: false, wsProps: []};
|
||||||
me.fastcoauthtips = [];
|
me.fastcoauthtips = [];
|
||||||
me._TtHeight = 20;
|
me._TtHeight = 20;
|
||||||
|
me.externalData = {
|
||||||
|
stackRequests: [],
|
||||||
|
stackResponse: [],
|
||||||
|
callback: undefined
|
||||||
|
};
|
||||||
/** coauthoring begin **/
|
/** coauthoring begin **/
|
||||||
this.wrapEvents = {
|
this.wrapEvents = {
|
||||||
apiHideComment: _.bind(this.onApiHideComment, this),
|
apiHideComment: _.bind(this.onApiHideComment, this),
|
||||||
|
@ -373,6 +378,10 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onShowPivotGroupDialog', _.bind(this.onShowPivotGroupDialog, this));
|
this.api.asc_registerCallback('asc_onShowPivotGroupDialog', _.bind(this.onShowPivotGroupDialog, this));
|
||||||
if (!this.permissions.isEditMailMerge && !this.permissions.isEditDiagram && !this.permissions.isEditOle)
|
if (!this.permissions.isEditMailMerge && !this.permissions.isEditDiagram && !this.permissions.isEditOle)
|
||||||
this.api.asc_registerCallback('asc_doubleClickOnTableOleObject', _.bind(this.onDoubleClickOnTableOleObject, this));
|
this.api.asc_registerCallback('asc_doubleClickOnTableOleObject', _.bind(this.onDoubleClickOnTableOleObject, this));
|
||||||
|
if (this.permissions.canRequestReferenceData) {
|
||||||
|
this.api.asc_registerCallback('asc_onUpdateExternalReference', _.bind(this.onUpdateExternalReference, this));
|
||||||
|
Common.Gateway.on('setreferencedata', _.bind(this.setReferenceData, this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this));
|
this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this));
|
||||||
this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this));
|
this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this));
|
||||||
|
@ -4211,6 +4220,51 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onUpdateExternalReference: function(arr, callback) {
|
||||||
|
if (this.permissions.isEdit && !this._isDisabled) {
|
||||||
|
var me = this;
|
||||||
|
me.externalData = {
|
||||||
|
stackRequests: [],
|
||||||
|
stackResponse: [],
|
||||||
|
callback: undefined
|
||||||
|
};
|
||||||
|
arr && arr.length>0 && arr.forEach(function(item) {
|
||||||
|
var data;
|
||||||
|
switch (item.asc_getType()) {
|
||||||
|
case Asc.c_oAscExternalReferenceType.link:
|
||||||
|
data = {link: item.asc_getData()};
|
||||||
|
break;
|
||||||
|
case Asc.c_oAscExternalReferenceType.path:
|
||||||
|
data = {path: item.asc_getData()};
|
||||||
|
break;
|
||||||
|
case Asc.c_oAscExternalReferenceType.referenceData:
|
||||||
|
data = {referenceData: item.asc_getData()};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
data && me.externalData.stackRequests.push(data);
|
||||||
|
});
|
||||||
|
me.externalData.callback = callback;
|
||||||
|
me.requestReferenceData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
requestReferenceData: function() {
|
||||||
|
if (this.externalData.stackRequests.length>0) {
|
||||||
|
var data = this.externalData.stackRequests.shift();
|
||||||
|
Common.Gateway.requestReferenceData(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setReferenceData: function(data) {
|
||||||
|
if (this.permissions.isEdit && !this._isDisabled) {
|
||||||
|
data && this.externalData.stackResponse.push(data);
|
||||||
|
if (this.externalData.stackRequests.length>0)
|
||||||
|
this.requestReferenceData();
|
||||||
|
else if (this.externalData.callback)
|
||||||
|
this.externalData.callback(this.externalData.stackResponse);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getUserName: function(id){
|
getUserName: function(id){
|
||||||
var usersStore = SSE.getCollection('Common.Collections.Users');
|
var usersStore = SSE.getCollection('Common.Collections.Users');
|
||||||
if (usersStore){
|
if (usersStore){
|
||||||
|
|
|
@ -415,6 +415,7 @@ define([
|
||||||
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
|
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
|
||||||
this.appOptions.canFeaturePivot = true;
|
this.appOptions.canFeaturePivot = true;
|
||||||
this.appOptions.canFeatureViews = true;
|
this.appOptions.canFeatureViews = true;
|
||||||
|
this.appOptions.canRequestReferenceData = this.editorConfig.canRequestReferenceData;
|
||||||
|
|
||||||
if (this.appOptions.user.guest && this.appOptions.canRenameAnonymous && !this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle)
|
if (this.appOptions.user.guest && this.appOptions.canRenameAnonymous && !this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle)
|
||||||
Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
|
Common.NotificationCenter.on('user:rename', _.bind(this.showRenameUserDialog, this));
|
||||||
|
@ -507,6 +508,7 @@ define([
|
||||||
docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys);
|
docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys);
|
||||||
docInfo.put_Lang(this.editorConfig.lang);
|
docInfo.put_Lang(this.editorConfig.lang);
|
||||||
docInfo.put_Mode(this.editorConfig.mode);
|
docInfo.put_Mode(this.editorConfig.mode);
|
||||||
|
docInfo.put_ReferenceData(data.doc.referenceData);
|
||||||
|
|
||||||
var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default
|
var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default
|
||||||
this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer
|
this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer
|
||||||
|
|
|
@ -225,6 +225,10 @@
|
||||||
<span class="btn-slot text x-huge" id="slot-btn-data-from-text"></span>
|
<span class="btn-slot text x-huge" id="slot-btn-data-from-text"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="separator long"></div>
|
<div class="separator long"></div>
|
||||||
|
<div class="group">
|
||||||
|
<span class="btn-slot text x-huge" id="slot-btn-data-external-links"></span>
|
||||||
|
</div>
|
||||||
|
<div class="separator long"></div>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<div class="elset">
|
<div class="elset">
|
||||||
<span class="btn-slot split slot-btn-setfilter"></span>
|
<span class="btn-slot split slot-btn-setfilter"></span>
|
||||||
|
|
|
@ -102,6 +102,11 @@ define([
|
||||||
me.btnCustomSort.on('click', function (b, e) {
|
me.btnCustomSort.on('click', function (b, e) {
|
||||||
me.fireEvent('data:sortcustom');
|
me.fireEvent('data:sortcustom');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
me.btnExternalLinks.on('click', function (b, e) {
|
||||||
|
me.fireEvent('data:externallinks');
|
||||||
|
});
|
||||||
|
|
||||||
me.btnDataFromText.menu ?
|
me.btnDataFromText.menu ?
|
||||||
me.btnDataFromText.menu.on('item:click', function (menu, item, e) {
|
me.btnDataFromText.menu.on('item:click', function (menu, item, e) {
|
||||||
me.fireEvent('data:fromtext', [item.value]);
|
me.fireEvent('data:fromtext', [item.value]);
|
||||||
|
@ -240,6 +245,19 @@ define([
|
||||||
});
|
});
|
||||||
this.lockedControls.push(this.btnCustomSort);
|
this.lockedControls.push(this.btnCustomSort);
|
||||||
|
|
||||||
|
this.btnExternalLinks = new Common.UI.Button({
|
||||||
|
parentEl: $host.find('#slot-btn-data-external-links'),
|
||||||
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
|
iconCls: 'toolbar__icon btn-import-data',
|
||||||
|
caption: this.capDataExternalLinks,
|
||||||
|
disabled: true,
|
||||||
|
lock: [_set.editCell, _set.sheetLock, _set.wbLock, _set.lostConnect, _set.coAuth, _set.wsLock],
|
||||||
|
dataHint: '1',
|
||||||
|
dataHintDirection: 'bottom',
|
||||||
|
dataHintOffset: 'small'
|
||||||
|
});
|
||||||
|
this.lockedControls.push(this.btnExternalLinks);
|
||||||
|
|
||||||
this.btnsSortDown = Common.Utils.injectButtons($host.find('.slot-sortdesc'), '', 'toolbar__icon btn-sort-down', '',
|
this.btnsSortDown = Common.Utils.injectButtons($host.find('.slot-sortdesc'), '', 'toolbar__icon btn-sort-down', '',
|
||||||
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.cantModifyFilter, _set.sheetLock, _set.cantSort, _set['Sort']], undefined, undefined, undefined, '1', 'top', undefined, 'D');
|
[_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.cantModifyFilter, _set.sheetLock, _set.cantSort, _set['Sort']], undefined, undefined, undefined, '1', 'top', undefined, 'D');
|
||||||
|
|
||||||
|
@ -301,6 +319,7 @@ define([
|
||||||
me.btnTextToColumns.updateHint(me.tipToColumns);
|
me.btnTextToColumns.updateHint(me.tipToColumns);
|
||||||
me.btnRemoveDuplicates.updateHint(me.tipRemDuplicates);
|
me.btnRemoveDuplicates.updateHint(me.tipRemDuplicates);
|
||||||
me.btnDataValidation.updateHint(me.tipDataValidation);
|
me.btnDataValidation.updateHint(me.tipDataValidation);
|
||||||
|
me.btnExternalLinks.updateHint(me.tipExternalLinks);
|
||||||
|
|
||||||
me.btnsSortDown.forEach( function(btn) {
|
me.btnsSortDown.forEach( function(btn) {
|
||||||
btn.updateHint(me.toolbar.txtSortAZ);
|
btn.updateHint(me.toolbar.txtSortAZ);
|
||||||
|
@ -377,7 +396,9 @@ define([
|
||||||
capDataFromText: 'From Text/CSV',
|
capDataFromText: 'From Text/CSV',
|
||||||
tipDataFromText: 'Get data from Text/CSV file',
|
tipDataFromText: 'Get data from Text/CSV file',
|
||||||
mniFromFile: 'Get Data from File',
|
mniFromFile: 'Get Data from File',
|
||||||
mniFromUrl: 'Get Data from URL'
|
mniFromUrl: 'Get Data from URL',
|
||||||
|
capDataExternalLinks: 'External Links',
|
||||||
|
tipExternalLinks: 'View other files this spreadsheet is linked to'
|
||||||
}
|
}
|
||||||
}()), SSE.Views.DataTab || {}));
|
}()), SSE.Views.DataTab || {}));
|
||||||
});
|
});
|
||||||
|
|
254
apps/spreadsheeteditor/main/app/view/ExternalLinksDlg.js
Normal file
254
apps/spreadsheeteditor/main/app/view/ExternalLinksDlg.js
Normal file
|
@ -0,0 +1,254 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* (c) Copyright Ascensio System SIA 2010-2022
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* ExternalLinksDlg.js
|
||||||
|
*
|
||||||
|
* Created by Julia.Radzhabova on 26.07.22
|
||||||
|
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
define([
|
||||||
|
'common/main/lib/view/AdvancedSettingsWindow',
|
||||||
|
'common/main/lib/component/ListView'
|
||||||
|
], function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
SSE.Views = SSE.Views || {};
|
||||||
|
|
||||||
|
SSE.Views.ExternalLinksDlg = Common.Views.AdvancedSettingsWindow.extend(_.extend({
|
||||||
|
|
||||||
|
options: {
|
||||||
|
alias: 'ExternalLinksDlg',
|
||||||
|
contentWidth: 450,
|
||||||
|
height: 294,
|
||||||
|
buttons: null
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize: function (options) {
|
||||||
|
var me = this;
|
||||||
|
_.extend(this.options, {
|
||||||
|
title: this.txtTitle,
|
||||||
|
template: [
|
||||||
|
'<div class="box" style="height:' + (me.options.height - 85) + 'px;">',
|
||||||
|
'<div class="content-panel" style="padding: 0;"><div class="inner-content">',
|
||||||
|
'<div class="settings-panel active">',
|
||||||
|
'<table cols="1" style="width: 100%;">',
|
||||||
|
'<tr>',
|
||||||
|
'<td class="padding-large">',
|
||||||
|
'<div id="external-links-btn-update" style="display: inline-block;margin-right: 5px;"></div>',
|
||||||
|
'<div id="external-links-btn-delete" style="display: inline-block;margin-right: 5px;"></div>',
|
||||||
|
// '<button type="button" class="btn btn-text-default auto sort-dialog-btn-text" id="external-links-btn-open">', me.textOpen ,'</button>',
|
||||||
|
// '<button type="button" class="btn btn-text-default auto sort-dialog-btn-text" id="external-links-btn-change">', me.textChange ,'</button>',
|
||||||
|
'</td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td class="padding-small">',
|
||||||
|
'<label class="header">', me.textSource,'</label>',
|
||||||
|
'<div id="external-links-list" class="range-tableview" style="width:100%; height: 148px;"></div>',
|
||||||
|
'</td>',
|
||||||
|
'</tr>',
|
||||||
|
'</table>',
|
||||||
|
'</div></div>',
|
||||||
|
'</div>',
|
||||||
|
'</div>',
|
||||||
|
'<div class="footer center">',
|
||||||
|
'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">' + this.closeButtonText + '</button>',
|
||||||
|
'</div>'
|
||||||
|
].join('')
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
this.api = options.api;
|
||||||
|
this.handler = options.handler;
|
||||||
|
|
||||||
|
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
|
||||||
|
},
|
||||||
|
render: function () {
|
||||||
|
Common.Views.AdvancedSettingsWindow.prototype.render.call(this);
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
this.linksList = new Common.UI.ListView({
|
||||||
|
el: $('#external-links-list', this.$window),
|
||||||
|
store: new Common.UI.DataViewStore(),
|
||||||
|
simpleAddMode: true,
|
||||||
|
tabindex: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
this.btnUpdate = new Common.UI.Button({
|
||||||
|
parentEl: $('#external-links-btn-update', this.$window),
|
||||||
|
cls: 'btn-text-split-default auto',
|
||||||
|
caption: this.textUpdate,
|
||||||
|
split: true,
|
||||||
|
menu : new Common.UI.Menu({
|
||||||
|
style: 'min-width:100px;',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
caption: this.textUpdate,
|
||||||
|
value: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.textUpdateAll,
|
||||||
|
value: 1
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
$(this.btnUpdate.cmpEl.find('button')[0]).css('min-width', '87px');
|
||||||
|
this.btnUpdate.on('click', _.bind(this.onUpdate, this));
|
||||||
|
this.btnUpdate.menu.on('item:click', _.bind(this.onUpdateMenu, this));
|
||||||
|
|
||||||
|
this.btnDelete = new Common.UI.Button({
|
||||||
|
parentEl: $('#external-links-btn-delete', this.$window),
|
||||||
|
cls: 'btn-text-split-default auto',
|
||||||
|
caption: this.textDelete,
|
||||||
|
split: true,
|
||||||
|
menu : new Common.UI.Menu({
|
||||||
|
style: 'min-width:100px;',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
caption: this.textDelete,
|
||||||
|
value: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.textDeleteAll,
|
||||||
|
value: 1
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
$(this.btnDelete.cmpEl.find('button')[0]).css('min-width', '87px');
|
||||||
|
this.btnDelete.on('click', _.bind(this.onDelete, this));
|
||||||
|
this.btnDelete.menu.on('item:click', _.bind(this.onDeleteMenu, this));
|
||||||
|
|
||||||
|
this.btnOpen = new Common.UI.Button({
|
||||||
|
el: $('#external-links-btn-open', this.$window)
|
||||||
|
});
|
||||||
|
this.btnOpen.on('click', _.bind(this.onOpen, this));
|
||||||
|
|
||||||
|
this.btnChange = new Common.UI.Button({
|
||||||
|
el: $('#external-links-btn-change', this.$window)
|
||||||
|
});
|
||||||
|
this.btnChange.on('click', _.bind(this.onChange, this));
|
||||||
|
|
||||||
|
this.afterRender();
|
||||||
|
},
|
||||||
|
|
||||||
|
afterRender: function() {
|
||||||
|
this._setDefaults();
|
||||||
|
},
|
||||||
|
|
||||||
|
getFocusedComponents: function() {
|
||||||
|
return [ this.btnUpdate, this.btnDelete, this.btnOpen, this.btnChange, this.linksList ];
|
||||||
|
},
|
||||||
|
|
||||||
|
getDefaultFocusableComponent: function () {
|
||||||
|
return this.linksList;
|
||||||
|
},
|
||||||
|
|
||||||
|
_setDefaults: function (props) {
|
||||||
|
this.refreshList();
|
||||||
|
},
|
||||||
|
|
||||||
|
refreshList: function() {
|
||||||
|
var arr = [];
|
||||||
|
var links = this.api.asc_getExternalReferences();
|
||||||
|
if (links) {
|
||||||
|
for (var i=0; i<links.length; i++) {
|
||||||
|
arr.push({
|
||||||
|
value: links[i].asc_getSource(),
|
||||||
|
idx: i,
|
||||||
|
externalRef: links[i]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.linksList.store.reset(arr);
|
||||||
|
(this.linksList.store.length>0) && this.linksList.selectByIndex(0);
|
||||||
|
this.btnUpdate.setDisabled(this.linksList.store.length<1 || !this.linksList.getSelectedRec());
|
||||||
|
this.btnDelete.setDisabled(this.linksList.store.length<1 || !this.linksList.getSelectedRec());
|
||||||
|
this.btnOpen.setDisabled(this.linksList.store.length<1 || !this.linksList.getSelectedRec());
|
||||||
|
this.btnChange.setDisabled(this.linksList.store.length<1 || !this.linksList.getSelectedRec());
|
||||||
|
},
|
||||||
|
|
||||||
|
onUpdate: function() {
|
||||||
|
var rec = this.linksList.getSelectedRec();
|
||||||
|
rec && this.api.asc_updateExternalReferences([rec.get('externalRef')]);
|
||||||
|
},
|
||||||
|
|
||||||
|
onUpdateMenu: function(menu, item) {
|
||||||
|
if (item.value == 1) {
|
||||||
|
var arr = [];
|
||||||
|
this.linksList.store.each(function(item){
|
||||||
|
arr.push(item.get('externalRef'));
|
||||||
|
}, this);
|
||||||
|
(arr.length>0) && this.api.asc_updateExternalReferences(arr);
|
||||||
|
} else
|
||||||
|
this.onUpdate();
|
||||||
|
},
|
||||||
|
|
||||||
|
onDelete: function() {
|
||||||
|
var rec = this.linksList.getSelectedRec();
|
||||||
|
rec && this.api.asc_removeExternalReferences([rec.get('externalRef')]);
|
||||||
|
this.refreshList();
|
||||||
|
},
|
||||||
|
|
||||||
|
onDeleteMenu: function(menu, item) {
|
||||||
|
if (item.value == 1) {
|
||||||
|
var arr = [];
|
||||||
|
this.linksList.store.each(function(item){
|
||||||
|
arr.push(item.get('externalRef'));
|
||||||
|
}, this);
|
||||||
|
(arr.length>0) && this.api.asc_removeExternalReferences(arr);
|
||||||
|
this.refreshList();
|
||||||
|
} else
|
||||||
|
this.onDelete();
|
||||||
|
},
|
||||||
|
|
||||||
|
onOpen: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
txtTitle: 'External Links',
|
||||||
|
textUpdate: 'Update Values',
|
||||||
|
textUpdateAll: 'Update All',
|
||||||
|
textSource: 'Source',
|
||||||
|
closeButtonText: 'Close',
|
||||||
|
textDelete: 'Break Links',
|
||||||
|
textDeleteAll: 'Break All Links',
|
||||||
|
textOpen: 'Open Source',
|
||||||
|
textChange: 'Change Source'
|
||||||
|
|
||||||
|
}, SSE.Views.ExternalLinksDlg || {}));
|
||||||
|
});
|
|
@ -32,7 +32,7 @@
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* WatchDialogDialog.js
|
* WatchDialog.js
|
||||||
*
|
*
|
||||||
* Created by Julia.Radzhabova on 24.06.22
|
* Created by Julia.Radzhabova on 24.06.22
|
||||||
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
|
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
|
||||||
|
|
|
@ -1867,6 +1867,8 @@
|
||||||
"SSE.Views.DataTab.tipRemDuplicates": "Remove duplicate rows from a sheet",
|
"SSE.Views.DataTab.tipRemDuplicates": "Remove duplicate rows from a sheet",
|
||||||
"SSE.Views.DataTab.tipToColumns": "Separate cell text into columns",
|
"SSE.Views.DataTab.tipToColumns": "Separate cell text into columns",
|
||||||
"SSE.Views.DataTab.tipUngroup": "Ungroup range of cells",
|
"SSE.Views.DataTab.tipUngroup": "Ungroup range of cells",
|
||||||
|
"SSE.Views.DataTab.capDataExternalLinks": "External Links",
|
||||||
|
"SSE.Views.DataTab.tipExternalLinks": "View other files this spreadsheet is linked to",
|
||||||
"SSE.Views.DataValidationDialog.errorFormula": "The value currently evaluates to an error. Do you want to continue?",
|
"SSE.Views.DataValidationDialog.errorFormula": "The value currently evaluates to an error. Do you want to continue?",
|
||||||
"SSE.Views.DataValidationDialog.errorInvalid": "The value you entered for the field \"{0}\" is invalid.",
|
"SSE.Views.DataValidationDialog.errorInvalid": "The value you entered for the field \"{0}\" is invalid.",
|
||||||
"SSE.Views.DataValidationDialog.errorInvalidDate": "The date you entered for the field \"{0}\" is invalid.",
|
"SSE.Views.DataValidationDialog.errorInvalidDate": "The date you entered for the field \"{0}\" is invalid.",
|
||||||
|
@ -2099,6 +2101,13 @@
|
||||||
"SSE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
"SSE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
||||||
"SSE.Views.DocumentHolder.txtWidth": "Width",
|
"SSE.Views.DocumentHolder.txtWidth": "Width",
|
||||||
"SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
|
"SSE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
|
||||||
|
"SSE.Views.ExternalLinksDlg.txtTitle": "External Links",
|
||||||
|
"SSE.Views.ExternalLinksDlg.textUpdate": "Update Values",
|
||||||
|
"SSE.Views.ExternalLinksDlg.textUpdateAll": "Update All",
|
||||||
|
"SSE.Views.ExternalLinksDlg.textSource": "Source",
|
||||||
|
"SSE.Views.ExternalLinksDlg.closeButtonText": "Close",
|
||||||
|
"SSE.Views.ExternalLinksDlg.textDelete": "Break Links",
|
||||||
|
"SSE.Views.ExternalLinksDlg.textDeleteAll": "Break All Links",
|
||||||
"SSE.Views.FieldSettingsDialog.strLayout": "Layout",
|
"SSE.Views.FieldSettingsDialog.strLayout": "Layout",
|
||||||
"SSE.Views.FieldSettingsDialog.strSubtotals": "Subtotals",
|
"SSE.Views.FieldSettingsDialog.strSubtotals": "Subtotals",
|
||||||
"SSE.Views.FieldSettingsDialog.textReport": "Report Form",
|
"SSE.Views.FieldSettingsDialog.textReport": "Report Form",
|
||||||
|
|
Loading…
Reference in a new issue