Refactiring

This commit is contained in:
OVSharova 2021-09-16 16:21:51 +03:00
parent 13856835ad
commit 37c834b7e3
6 changed files with 26 additions and 34 deletions

View file

@ -86,6 +86,7 @@
@import "../../../../common/main/resources/less/combobox.less";
@import "../../../../common/main/resources/less/window.less";
@import "../../../../common/main/resources/less/spinner.less";
@import "../../../../common/main/resources/less/loadmask.less";
@import "../../../../common/main/resources/less/checkbox.less";
@import "../../../../common/main/resources/less/radiobox.less";
@import "../../../../common/main/resources/less/dataview.less";

View file

@ -86,6 +86,7 @@
@import "../../../../common/main/resources/less/combobox.less";
@import "../../../../common/main/resources/less/window.less";
@import "../../../../common/main/resources/less/spinner.less";
@import "../../../../common/main/resources/less/loadmask.less";
@import "../../../../common/main/resources/less/checkbox.less";
@import "../../../../common/main/resources/less/radiobox.less";
@import "../../../../common/main/resources/less/dataview.less";

View file

@ -86,6 +86,7 @@
@import "../../../../common/main/resources/less/combobox.less";
@import "../../../../common/main/resources/less/window.less";
@import "../../../../common/main/resources/less/spinner.less";
@import "../../../../common/main/resources/less/loadmask.less";
@import "../../../../common/main/resources/less/checkbox.less";
@import "../../../../common/main/resources/less/radiobox.less";
@import "../../../../common/main/resources/less/dataview.less";

View file

@ -94,12 +94,8 @@ DE.ApplicationController = new(function(){
docInfo.put_Permissions(_permissions);
docInfo.put_EncryptedInfo(config.encryptionKeys);
docInfo.asc_putIsEnabledMacroses(false);
docInfo.asc_putIsEnabledPlugins(false);
/* var enable = !config.customization || (config.customization.macros!==false);
docInfo.asc_putIsEnabledMacroses(!!enable);
enable = !config.customization || (config.customization.plugins!==false);
docInfo.asc_putIsEnabledPlugins(!!enable);*/
docInfo.asc_putIsEnabledMacroses(true);
docInfo.asc_putIsEnabledPlugins(true);
var type = /^(?:(pdf|djvu|xps))$/.exec(docConfig.fileType);
@ -137,12 +133,10 @@ DE.ApplicationController = new(function(){
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
//Common.Gateway.on('processmouse', onProcessMouse);
//Common.Gateway.on('downloadas', onDownloadAs);
Common.Gateway.on('processmouse', onProcessMouse);
Common.Gateway.on('downloadas', onDownloadAs);
Common.Gateway.on('requestclose', onRequestClose);
/*var downloadAs = function(format){
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
};*/
// TODO: add asc_hasRequiredFields to sdk
Common.Gateway.documentReady();
@ -279,8 +273,6 @@ DE.ApplicationController = new(function(){
function onBeforeUnload () {
common.localStorage.save();
}
// Helpers
// -------------------------
function onDocumentResize() {
api && api.Resize();
@ -314,7 +306,6 @@ DE.ApplicationController = new(function(){
if (api){
api.asc_registerCallback('asc_onError', onError);
api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady);
//api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument);
// Initialize api gateway
Common.Gateway.on('init', loadConfig);
@ -334,14 +325,11 @@ DE.ApplicationController = new(function(){
convertationErrorText : 'Conversion failed.',
downloadErrorText : 'Download failed.',
criticalErrorTitle : 'Error',
notcriticalErrorTitle : 'Warning',
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
errorFilePassProtect: 'The file is password protected and cannot be opened.',
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.',
errorUserDrop: 'The file cannot be accessed right now.',
unsupportedBrowserErrorText: 'Your browser is not supported.',
textLoadingDocument: 'Loading document',
txtClose: 'Close',
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
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.',
errorSubmit: 'Submit failed.',

View file

@ -92,6 +92,9 @@ PE.ApplicationController = new(function(){
docInfo.put_Permissions(_permissions);
docInfo.put_EncryptedInfo(config.encryptionKeys);
docInfo.asc_putIsEnabledMacroses(true);
docInfo.asc_putIsEnabledPlugins(true);
if (api) {
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
api.asc_setDocInfo(docInfo);
@ -122,8 +125,8 @@ PE.ApplicationController = new(function(){
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
//Common.Gateway.on('processmouse', onProcessMouse);
//Common.Gateway.on('downloadas', onDownloadAs);
Common.Gateway.on('processmouse', onProcessMouse);
Common.Gateway.on('downloadas', onDownloadAs);
Common.Gateway.on('requestclose', onRequestClose);
$('#editor_sdk').on('click', function(e) {

View file

@ -41,12 +41,6 @@ SSE.ApplicationController = new(function(){
var LoadingDocument = -256;
// Initialize analytics
// -------------------------
// Common.Analytics.initialize('UA-12442749-13', 'Embedded Spreadsheet Editor');
// Check browser
// -------------------------
@ -64,8 +58,6 @@ SSE.ApplicationController = new(function(){
function loadConfig(data) {
config = $.extend(config, data.config);
/*config.canBackToFolder = (config.canBackToFolder!==false) && config.customization && config.customization.goback &&
(config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose);*/
}
function loadDocument(data) {
@ -103,6 +95,9 @@ SSE.ApplicationController = new(function(){
docInfo.put_Lang(config.lang);
docInfo.put_Mode(config.mode);
docInfo.asc_putIsEnabledMacroses(true);
docInfo.asc_putIsEnabledPlugins(true);
if (api) {
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
api.asc_setDocInfo(docInfo);
@ -152,8 +147,8 @@ SSE.ApplicationController = new(function(){
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
//Common.Gateway.on('processmouse', onProcessMouse);
//Common.Gateway.on('downloadas', onDownloadAs);
Common.Gateway.on('processmouse', onProcessMouse);
Common.Gateway.on('downloadas', onDownloadAs);
Common.Gateway.on('requestclose', onRequestClose);
@ -295,6 +290,14 @@ SSE.ApplicationController = new(function(){
}
}
function onDownloadAs() {
if ( permissions.download === false) {
console.error(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
return;
}
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true));
}
function onRequestClose() {
Common.Gateway.requestClose();
}
@ -373,11 +376,6 @@ SSE.ApplicationController = new(function(){
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.',
errorUserDrop: 'The file cannot be accessed right now.',
unsupportedBrowserErrorText: 'Your browser is not supported.',
textOf: 'of',
downloadTextText: 'Downloading spreadsheet...',
waitText: 'Please, wait...',
textLoadingDocument: 'Loading spreadsheet',
txtClose: 'Close',
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
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.',
textGuest: 'Guest',