[DE forms] Fix forms in desktop editor

This commit is contained in:
Julia Radzhabova 2021-11-30 16:25:51 +03:00
parent 8c554f9f67
commit d6471159ec
2 changed files with 33 additions and 14 deletions

View file

@ -237,7 +237,7 @@ define([
break; break;
case Asc.c_oAscError.ID.EditingError: case Asc.c_oAscError.ID.EditingError:
config.msg = this.errorEditingDownloadas; config.msg = (this.appOptions.isDesktopApp && this.appOptions.isOffline) ? this.errorEditingSaveas : this.errorEditingDownloadas;
break; break;
case Asc.c_oAscError.ID.ForceSaveButton: case Asc.c_oAscError.ID.ForceSaveButton:
@ -286,6 +286,10 @@ define([
config.msg = this.errorDataEncrypted; config.msg = this.errorDataEncrypted;
break; break;
case Asc.c_oAscError.ID.ConvertationSaveError:
config.msg = (this.appOptions.isDesktopApp && this.appOptions.isOffline) ? this.saveErrorTextDesktop : this.saveErrorText;
break;
default: default:
config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id);
break; break;
@ -317,11 +321,14 @@ define([
config.callback = _.bind(function(btn){ config.callback = _.bind(function(btn){
if (id == Asc.c_oAscError.ID.Warning && btn == 'ok' && this.appOptions.canDownload) { if (id == Asc.c_oAscError.ID.Warning && btn == 'ok' && this.appOptions.canDownload) {
Common.UI.Menu.Manager.hideAll(); Common.UI.Menu.Manager.hideAll();
var me = this; if (this.appOptions.isDesktopApp && this.appOptions.isOffline)
setTimeout(function() { this.api.asc_DownloadAs();
$('button', me.view.btnOptions.cmpEl).click(); else {
}, 10); var me = this;
setTimeout(function() {
$('button', me.view.btnOptions.cmpEl).click();
}, 10);
}
} else if (id == Asc.c_oAscError.ID.EditingError) { } else if (id == Asc.c_oAscError.ID.EditingError) {
Common.NotificationCenter.trigger('api:disconnect', true); // enable download and print Common.NotificationCenter.trigger('api:disconnect', true); // enable download and print
} }
@ -514,7 +521,7 @@ define([
this.appOptions.trialMode = params.asc_getLicenseMode(); this.appOptions.trialMode = params.asc_getLicenseMode();
this.appOptions.isBeta = params.asc_getIsBeta(); this.appOptions.isBeta = params.asc_getIsBeta();
this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit);
this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm; this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm && !this.appOptions.isOffline;
var type = /^(?:(oform))$/.exec(this.document.fileType); // can fill forms only in oform format var type = /^(?:(oform))$/.exec(this.document.fileType); // can fill forms only in oform format
this.appOptions.isOFORM = !!(type && typeof type[1] === 'string'); this.appOptions.isOFORM = !!(type && typeof type[1] === 'string');
@ -535,9 +542,9 @@ define([
var me = this; var me = this;
me.view.btnSubmit.setVisible(this.appOptions.canFillForms && this.appOptions.canSubmitForms); me.view.btnSubmit.setVisible(this.appOptions.canFillForms && this.appOptions.canSubmitForms);
me.view.btnDownload.setVisible(this.appOptions.canDownload && this.appOptions.canFillForms && !this.appOptions.canSubmitForms); me.view.btnDownload.setVisible(this.appOptions.canDownload && this.appOptions.canFillForms && !this.appOptions.canSubmitForms);
if (me.appOptions.canRequestSaveAs || !!me.appOptions.saveAsUrl) { if (me.appOptions.isOffline || me.appOptions.canRequestSaveAs || !!me.appOptions.saveAsUrl) {
me.view.btnDownload.setCaption(me.textSaveAs); me.view.btnDownload.setCaption(me.appOptions.isOffline ? me.textSaveAsDesktop : me.textSaveAs);
me.view.btnDownload.updateHint(me.textSaveAs); me.view.btnDownload.updateHint('');
} }
if (!this.appOptions.canFillForms) { if (!this.appOptions.canFillForms) {
me.view.btnPrev.setVisible(false); me.view.btnPrev.setVisible(false);
@ -558,8 +565,12 @@ define([
}); });
me.view.btnDownload.on('click', function(){ me.view.btnDownload.on('click', function(){
if (me.appOptions.canDownload) { if (me.appOptions.canDownload) {
me.isFromBtnDownload = me.appOptions.canRequestSaveAs || !!me.appOptions.saveAsUrl; if (me.appOptions.isOffline)
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF, me.isFromBtnDownload)); me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF));
else {
me.isFromBtnDownload = me.appOptions.canRequestSaveAs || !!me.appOptions.saveAsUrl;
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF, me.isFromBtnDownload));
}
} }
}); });
@ -1424,7 +1435,7 @@ define([
itemsCount--; itemsCount--;
} }
if ( !this.appOptions.isOFORM || !this.appOptions.canDownload) { if ( !this.appOptions.isOFORM || !this.appOptions.canDownload || this.appOptions.isOffline) {
menuItems[3].setVisible(false); menuItems[3].setVisible(false);
menuItems[4].setVisible(false); menuItems[4].setVisible(false);
itemsCount -= 2; itemsCount -= 2;
@ -1780,7 +1791,11 @@ define([
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.', errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.',
errorBadImageUrl: 'Image url is incorrect', errorBadImageUrl: 'Image url is incorrect',
errorDataEncrypted: 'Encrypted changes have been received, they cannot be deciphered.', errorDataEncrypted: 'Encrypted changes have been received, they cannot be deciphered.',
textSaveAs: 'Save as PDF' saveErrorText: 'An error has occurred while saving the file',
saveErrorTextDesktop: 'This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.',
errorEditingSaveas: 'An error occurred during the work with the document.<br>Use the \'Save as...\' option to save the file backup copy to your computer hard drive.',
textSaveAs: 'Save as PDF',
textSaveAsDesktop: 'Save as...'
}, DE.Controllers.ApplicationController)); }, DE.Controllers.ApplicationController));

View file

@ -139,7 +139,11 @@
"DE.Controllers.ApplicationController.errorSessionToken": "The connection to the server has been interrupted. Please reload the page.", "DE.Controllers.ApplicationController.errorSessionToken": "The connection to the server has been interrupted. Please reload the page.",
"DE.Controllers.ApplicationController.errorBadImageUrl": "Image URL is incorrect", "DE.Controllers.ApplicationController.errorBadImageUrl": "Image URL is incorrect",
"DE.Controllers.ApplicationController.errorDataEncrypted": "Encrypted changes have been received, they cannot be deciphered.", "DE.Controllers.ApplicationController.errorDataEncrypted": "Encrypted changes have been received, they cannot be deciphered.",
"DE.Controllers.ApplicationController.saveErrorText": "An error has occurred while saving the file.",
"DE.Controllers.ApplicationController.saveErrorTextDesktop": "This file cannot be saved or created.<br>Possible reasons are: <br>1. The file is read-only. <br>2. The file is being edited by other users. <br>3. The disk is full or corrupted.",
"DE.Controllers.ApplicationController.errorEditingSaveas": "An error occurred during the work with the document.<br>Use the 'Save as...' option to save the file backup copy to your computer hard drive.",
"DE.Controllers.ApplicationController.textSaveAs": "Save as PDF", "DE.Controllers.ApplicationController.textSaveAs": "Save as PDF",
"DE.Controllers.ApplicationController.textSaveAsDesktop": "Save as...",
"DE.Views.ApplicationView.textClear": "Clear All Fields", "DE.Views.ApplicationView.textClear": "Clear All Fields",
"DE.Views.ApplicationView.textCopy": "Copy", "DE.Views.ApplicationView.textCopy": "Copy",
"DE.Views.ApplicationView.textCut": "Cut", "DE.Views.ApplicationView.textCut": "Cut",