Open test app in edit or view mode

This commit is contained in:
Julia Radzhabova 2022-11-18 22:33:43 +03:00
parent db812fa94e
commit f53450ee2e
3 changed files with 14 additions and 4 deletions

View file

@ -124,17 +124,16 @@ DE.ApplicationController = new(function(){
} }
function onEditorPermissions(params) { function onEditorPermissions(params) {
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();
appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit);
appOptions.canFillForms = appOptions.canLicense && (permissions.fillForms===true) && (config.mode !== 'view'); appOptions.isEdit = appOptions.canLicense && (permissions.edit !== false) && (config.mode !== 'view');
appOptions.canSubmitForms = appOptions.canLicense && (typeof (config.customization) == 'object') && !!config.customization.submitForm;
api.asc_SetFastCollaborative(true); api.asc_SetFastCollaborative(true);
api.asc_setAutoSaveGap(1); api.asc_setAutoSaveGap(1);
onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
api.asc_setViewMode(!appOptions.isEdit);
api.asc_LoadDocument(); api.asc_LoadDocument();
api.Resize(); api.Resize();
} }

View file

@ -36,6 +36,7 @@ PE.ApplicationController = new(function(){
config = {}, config = {},
docConfig = {}, docConfig = {},
permissions = {}, permissions = {},
appOptions = {},
created = false; created = false;
var LoadingDocument = -256; var LoadingDocument = -256;
@ -118,8 +119,12 @@ PE.ApplicationController = new(function(){
} }
function onEditorPermissions(params) { function onEditorPermissions(params) {
var licType = params.asc_getLicenseType();
appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit);
appOptions.isEdit = appOptions.canLicense && (permissions.edit !== false) && (config.mode !== 'view');
onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
api.asc_setViewMode(false); api.asc_setViewMode(!appOptions.isEdit);
api.asc_LoadDocument(); api.asc_LoadDocument();
api.Resize(); api.Resize();

View file

@ -36,6 +36,7 @@ SSE.ApplicationController = new(function(){
config = {}, config = {},
docConfig = {}, docConfig = {},
permissions = {}, permissions = {},
appOptions = {},
maxPages = 0, maxPages = 0,
created = false; created = false;
@ -149,10 +150,15 @@ SSE.ApplicationController = new(function(){
} }
function onEditorPermissions(params) { function onEditorPermissions(params) {
var licType = params.asc_getLicenseType();
appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit);
appOptions.isEdit = appOptions.canLicense && (permissions.edit !== false) && (config.mode !== 'view');
api.asc_SetFastCollaborative(true); api.asc_SetFastCollaborative(true);
api.asc_setAutoSaveGap(1); api.asc_setAutoSaveGap(1);
onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
api.asc_setViewMode(!appOptions.isEdit);
api.asc_LoadDocument(); api.asc_LoadDocument();
} }