Refactiring
This commit is contained in:
parent
13856835ad
commit
37c834b7e3
|
@ -86,6 +86,7 @@
|
||||||
@import "../../../../common/main/resources/less/combobox.less";
|
@import "../../../../common/main/resources/less/combobox.less";
|
||||||
@import "../../../../common/main/resources/less/window.less";
|
@import "../../../../common/main/resources/less/window.less";
|
||||||
@import "../../../../common/main/resources/less/spinner.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/checkbox.less";
|
||||||
@import "../../../../common/main/resources/less/radiobox.less";
|
@import "../../../../common/main/resources/less/radiobox.less";
|
||||||
@import "../../../../common/main/resources/less/dataview.less";
|
@import "../../../../common/main/resources/less/dataview.less";
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
@import "../../../../common/main/resources/less/combobox.less";
|
@import "../../../../common/main/resources/less/combobox.less";
|
||||||
@import "../../../../common/main/resources/less/window.less";
|
@import "../../../../common/main/resources/less/window.less";
|
||||||
@import "../../../../common/main/resources/less/spinner.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/checkbox.less";
|
||||||
@import "../../../../common/main/resources/less/radiobox.less";
|
@import "../../../../common/main/resources/less/radiobox.less";
|
||||||
@import "../../../../common/main/resources/less/dataview.less";
|
@import "../../../../common/main/resources/less/dataview.less";
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
@import "../../../../common/main/resources/less/combobox.less";
|
@import "../../../../common/main/resources/less/combobox.less";
|
||||||
@import "../../../../common/main/resources/less/window.less";
|
@import "../../../../common/main/resources/less/window.less";
|
||||||
@import "../../../../common/main/resources/less/spinner.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/checkbox.less";
|
||||||
@import "../../../../common/main/resources/less/radiobox.less";
|
@import "../../../../common/main/resources/less/radiobox.less";
|
||||||
@import "../../../../common/main/resources/less/dataview.less";
|
@import "../../../../common/main/resources/less/dataview.less";
|
||||||
|
|
|
@ -94,12 +94,8 @@ DE.ApplicationController = new(function(){
|
||||||
docInfo.put_Permissions(_permissions);
|
docInfo.put_Permissions(_permissions);
|
||||||
docInfo.put_EncryptedInfo(config.encryptionKeys);
|
docInfo.put_EncryptedInfo(config.encryptionKeys);
|
||||||
|
|
||||||
docInfo.asc_putIsEnabledMacroses(false);
|
docInfo.asc_putIsEnabledMacroses(true);
|
||||||
docInfo.asc_putIsEnabledPlugins(false);
|
docInfo.asc_putIsEnabledPlugins(true);
|
||||||
/* var enable = !config.customization || (config.customization.macros!==false);
|
|
||||||
docInfo.asc_putIsEnabledMacroses(!!enable);
|
|
||||||
enable = !config.customization || (config.customization.plugins!==false);
|
|
||||||
docInfo.asc_putIsEnabledPlugins(!!enable);*/
|
|
||||||
|
|
||||||
|
|
||||||
var type = /^(?:(pdf|djvu|xps))$/.exec(docConfig.fileType);
|
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_onStartAction', onLongActionBegin);
|
||||||
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
|
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
|
||||||
|
|
||||||
//Common.Gateway.on('processmouse', onProcessMouse);
|
Common.Gateway.on('processmouse', onProcessMouse);
|
||||||
//Common.Gateway.on('downloadas', onDownloadAs);
|
Common.Gateway.on('downloadas', onDownloadAs);
|
||||||
Common.Gateway.on('requestclose', onRequestClose);
|
Common.Gateway.on('requestclose', onRequestClose);
|
||||||
/*var downloadAs = function(format){
|
|
||||||
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
|
||||||
};*/
|
|
||||||
|
|
||||||
// TODO: add asc_hasRequiredFields to sdk
|
// TODO: add asc_hasRequiredFields to sdk
|
||||||
Common.Gateway.documentReady();
|
Common.Gateway.documentReady();
|
||||||
|
@ -279,8 +273,6 @@ DE.ApplicationController = new(function(){
|
||||||
function onBeforeUnload () {
|
function onBeforeUnload () {
|
||||||
common.localStorage.save();
|
common.localStorage.save();
|
||||||
}
|
}
|
||||||
// Helpers
|
|
||||||
// -------------------------
|
|
||||||
|
|
||||||
function onDocumentResize() {
|
function onDocumentResize() {
|
||||||
api && api.Resize();
|
api && api.Resize();
|
||||||
|
@ -314,7 +306,6 @@ DE.ApplicationController = new(function(){
|
||||||
if (api){
|
if (api){
|
||||||
api.asc_registerCallback('asc_onError', onError);
|
api.asc_registerCallback('asc_onError', onError);
|
||||||
api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady);
|
api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady);
|
||||||
//api.asc_registerCallback('asc_onOpenDocumentProgress', onOpenDocument);
|
|
||||||
|
|
||||||
// Initialize api gateway
|
// Initialize api gateway
|
||||||
Common.Gateway.on('init', loadConfig);
|
Common.Gateway.on('init', loadConfig);
|
||||||
|
@ -334,14 +325,11 @@ DE.ApplicationController = new(function(){
|
||||||
convertationErrorText : 'Conversion failed.',
|
convertationErrorText : 'Conversion failed.',
|
||||||
downloadErrorText : 'Download failed.',
|
downloadErrorText : 'Download failed.',
|
||||||
criticalErrorTitle : 'Error',
|
criticalErrorTitle : 'Error',
|
||||||
notcriticalErrorTitle : 'Warning',
|
|
||||||
scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.',
|
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.',
|
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.',
|
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.',
|
errorUserDrop: 'The file cannot be accessed right now.',
|
||||||
unsupportedBrowserErrorText: 'Your browser is not supported.',
|
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.',
|
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.',
|
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.',
|
errorSubmit: 'Submit failed.',
|
||||||
|
|
|
@ -92,6 +92,9 @@ PE.ApplicationController = new(function(){
|
||||||
docInfo.put_Permissions(_permissions);
|
docInfo.put_Permissions(_permissions);
|
||||||
docInfo.put_EncryptedInfo(config.encryptionKeys);
|
docInfo.put_EncryptedInfo(config.encryptionKeys);
|
||||||
|
|
||||||
|
docInfo.asc_putIsEnabledMacroses(true);
|
||||||
|
docInfo.asc_putIsEnabledPlugins(true);
|
||||||
|
|
||||||
if (api) {
|
if (api) {
|
||||||
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
|
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
|
||||||
api.asc_setDocInfo(docInfo);
|
api.asc_setDocInfo(docInfo);
|
||||||
|
@ -122,8 +125,8 @@ PE.ApplicationController = new(function(){
|
||||||
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
|
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
|
||||||
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
|
api.asc_registerCallback('asc_onEndAction', onLongActionEnd);
|
||||||
|
|
||||||
//Common.Gateway.on('processmouse', onProcessMouse);
|
Common.Gateway.on('processmouse', onProcessMouse);
|
||||||
//Common.Gateway.on('downloadas', onDownloadAs);
|
Common.Gateway.on('downloadas', onDownloadAs);
|
||||||
Common.Gateway.on('requestclose', onRequestClose);
|
Common.Gateway.on('requestclose', onRequestClose);
|
||||||
|
|
||||||
$('#editor_sdk').on('click', function(e) {
|
$('#editor_sdk').on('click', function(e) {
|
||||||
|
|
|
@ -41,12 +41,6 @@ SSE.ApplicationController = new(function(){
|
||||||
|
|
||||||
var LoadingDocument = -256;
|
var LoadingDocument = -256;
|
||||||
|
|
||||||
// Initialize analytics
|
|
||||||
// -------------------------
|
|
||||||
|
|
||||||
// Common.Analytics.initialize('UA-12442749-13', 'Embedded Spreadsheet Editor');
|
|
||||||
|
|
||||||
|
|
||||||
// Check browser
|
// Check browser
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
|
@ -64,8 +58,6 @@ SSE.ApplicationController = new(function(){
|
||||||
|
|
||||||
function loadConfig(data) {
|
function loadConfig(data) {
|
||||||
config = $.extend(config, data.config);
|
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) {
|
function loadDocument(data) {
|
||||||
|
@ -103,6 +95,9 @@ SSE.ApplicationController = new(function(){
|
||||||
docInfo.put_Lang(config.lang);
|
docInfo.put_Lang(config.lang);
|
||||||
docInfo.put_Mode(config.mode);
|
docInfo.put_Mode(config.mode);
|
||||||
|
|
||||||
|
docInfo.asc_putIsEnabledMacroses(true);
|
||||||
|
docInfo.asc_putIsEnabledPlugins(true);
|
||||||
|
|
||||||
if (api) {
|
if (api) {
|
||||||
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
|
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
|
||||||
api.asc_setDocInfo(docInfo);
|
api.asc_setDocInfo(docInfo);
|
||||||
|
@ -152,8 +147,8 @@ SSE.ApplicationController = new(function(){
|
||||||
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||||
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
|
api.asc_registerCallback('asc_onStartAction', onLongActionBegin);
|
||||||
|
|
||||||
//Common.Gateway.on('processmouse', onProcessMouse);
|
Common.Gateway.on('processmouse', onProcessMouse);
|
||||||
//Common.Gateway.on('downloadas', onDownloadAs);
|
Common.Gateway.on('downloadas', onDownloadAs);
|
||||||
Common.Gateway.on('requestclose', onRequestClose);
|
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() {
|
function onRequestClose() {
|
||||||
Common.Gateway.requestClose();
|
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.',
|
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.',
|
errorUserDrop: 'The file cannot be accessed right now.',
|
||||||
unsupportedBrowserErrorText: 'Your browser is not supported.',
|
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.',
|
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.',
|
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',
|
textGuest: 'Guest',
|
||||||
|
|
Loading…
Reference in a new issue