Merge pull request #1369 from ONLYOFFICE/fix/forms

Fix/forms
This commit is contained in:
Julia Radzhabova 2021-11-30 17:25:49 +03:00 committed by GitHub
commit e3e0b19b69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 146 additions and 14 deletions

View file

@ -67,6 +67,7 @@
@import "../../../../common/main/resources/less/dropdown-submenu.less"; @import "../../../../common/main/resources/less/dropdown-submenu.less";
@import "../../../../common/main/resources/less/separator.less"; @import "../../../../common/main/resources/less/separator.less";
@import "../../../../common/main/resources/less/input.less"; @import "../../../../common/main/resources/less/input.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/loadmask.less"; @import "../../../../common/main/resources/less/loadmask.less";
@import "../../../../common/main/resources/less/dataview.less"; @import "../../../../common/main/resources/less/dataview.less";
@ -78,6 +79,7 @@
@import "../../../../common/main/resources/less/calendar.less"; @import "../../../../common/main/resources/less/calendar.less";
@import "../../../../common/main/resources/less/spinner.less"; @import "../../../../common/main/resources/less/spinner.less";
@import "../../../../common/main/resources/less/checkbox.less"; @import "../../../../common/main/resources/less/checkbox.less";
@import "../../../../common/main/resources/less/opendialog.less";
@toolbarBorderColor: @border-toolbar-ie; @toolbarBorderColor: @border-toolbar-ie;
@toolbarBorderColor: @border-toolbar; @toolbarBorderColor: @border-toolbar;

View file

@ -14,6 +14,7 @@ define([
'common/main/lib/view/ImageFromUrlDialog', 'common/main/lib/view/ImageFromUrlDialog',
'common/main/lib/view/SelectFileDlg', 'common/main/lib/view/SelectFileDlg',
'common/main/lib/view/SaveAsDlg', 'common/main/lib/view/SaveAsDlg',
'common/main/lib/view/OpenDialog',
'common/forms/lib/view/modals', 'common/forms/lib/view/modals',
'documenteditor/forms/app/view/ApplicationView' 'documenteditor/forms/app/view/ApplicationView'
], function (Viewport) { ], function (Viewport) {
@ -98,7 +99,7 @@ define([
this.api.asc_registerCallback('asc_onOpenDocumentProgress', this.onOpenDocument.bind(this)); this.api.asc_registerCallback('asc_onOpenDocumentProgress', this.onOpenDocument.bind(this));
this.api.asc_registerCallback('asc_onDocumentUpdateVersion', this.onUpdateVersion.bind(this)); this.api.asc_registerCallback('asc_onDocumentUpdateVersion', this.onUpdateVersion.bind(this));
this.api.asc_registerCallback('asc_onServerVersion', this.onServerVersion.bind(this)); this.api.asc_registerCallback('asc_onServerVersion', this.onServerVersion.bind(this));
this.api.asc_registerCallback('asc_onAdvancedOptions', this.onAdvancedOptions.bind(this));
this.api.asc_registerCallback('asc_onCountPages', this.onCountPages.bind(this)); this.api.asc_registerCallback('asc_onCountPages', this.onCountPages.bind(this));
this.api.asc_registerCallback('asc_onCurrentPage', this.onCurrentPage.bind(this)); this.api.asc_registerCallback('asc_onCurrentPage', this.onCurrentPage.bind(this));
@ -236,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:
@ -253,6 +254,10 @@ define([
config.closable = false; config.closable = false;
break; break;
case Asc.c_oAscError.ID.VKeyEncrypt:
config.msg = this.errorToken;
break;
case Asc.c_oAscError.ID.KeyExpire: case Asc.c_oAscError.ID.KeyExpire:
config.msg = this.errorTokenExpire; config.msg = this.errorTokenExpire;
break; break;
@ -261,6 +266,30 @@ define([
config.msg = this.errorViewerDisconnect; config.msg = this.errorViewerDisconnect;
break; break;
case Asc.c_oAscError.ID.SessionAbsolute:
config.msg = this.errorSessionAbsolute;
break;
case Asc.c_oAscError.ID.SessionIdle:
config.msg = this.errorSessionIdle;
break;
case Asc.c_oAscError.ID.SessionToken:
config.msg = this.errorSessionToken;
break;
case Asc.c_oAscError.ID.UplImageUrl:
config.msg = this.errorBadImageUrl;
break;
case Asc.c_oAscError.ID.DataEncrypted:
config.msg = this.errorDataEncrypted;
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;
@ -292,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();
if (this.appOptions.isDesktopApp && this.appOptions.isOffline)
this.api.asc_DownloadAs();
else {
var me = this; var me = this;
setTimeout(function() { setTimeout(function() {
$('button', me.view.btnOptions.cmpEl).click(); $('button', me.view.btnOptions.cmpEl).click();
}, 10); }, 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
} }
@ -489,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');
@ -510,6 +542,10 @@ 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.isOffline || me.appOptions.canRequestSaveAs || !!me.appOptions.saveAsUrl) {
me.view.btnDownload.setCaption(me.appOptions.isOffline ? me.textSaveAsDesktop : me.textSaveAs);
me.view.btnDownload.updateHint('');
}
if (!this.appOptions.canFillForms) { if (!this.appOptions.canFillForms) {
me.view.btnPrev.setVisible(false); me.view.btnPrev.setVisible(false);
me.view.btnNext.setVisible(false); me.view.btnNext.setVisible(false);
@ -529,9 +565,13 @@ define([
}); });
me.view.btnDownload.on('click', function(){ me.view.btnDownload.on('click', function(){
if (me.appOptions.canDownload) { if (me.appOptions.canDownload) {
if (me.appOptions.isOffline)
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF));
else {
me.isFromBtnDownload = me.appOptions.canRequestSaveAs || !!me.appOptions.saveAsUrl; me.isFromBtnDownload = me.appOptions.canRequestSaveAs || !!me.appOptions.saveAsUrl;
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, me.isFromBtnDownload));
} }
}
}); });
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms);
@ -700,6 +740,42 @@ define([
} }
}, },
onAdvancedOptions: function(type, advOptions, mode, formatOptions) {
if (this._openDlg) return;
var me = this;
if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
me._openDlg = new Common.Views.OpenDialog({
title: Common.Views.OpenDialog.prototype.txtTitleProtected,
closeFile: me.appOptions.canRequestClose,
type: Common.Utils.importTextType.DRM,
warning: !(me.appOptions.isDesktopApp && me.appOptions.isOffline) && (typeof advOptions == 'string'),
warningMsg: advOptions,
validatePwd: !!me._isDRM,
handler: function (result, value) {
me.isShowOpenDialog = false;
if (result == 'ok') {
if (me.api) {
me.api.asc_setAdvancedOptions(type, value.drmOptions);
me.loadMask && me.loadMask.show();
}
} else {
Common.Gateway.requestClose();
Common.Controllers.Desktop.requestClose();
}
me._openDlg = null;
}
});
me._isDRM = true;
}
if (me._openDlg) {
this.isShowOpenDialog = true;
this.loadMask && this.loadMask.hide();
this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
me._openDlg.show();
}
},
onDocMouseMoveStart: function() { onDocMouseMoveStart: function() {
screenTip.isHidden = true; screenTip.isHidden = true;
}, },
@ -1359,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;
@ -1708,7 +1784,18 @@ define([
mniImageFromFile: 'Image from File', mniImageFromFile: 'Image from File',
mniImageFromUrl: 'Image from URL', mniImageFromUrl: 'Image from URL',
mniImageFromStorage: 'Image from Storage', mniImageFromStorage: 'Image from Storage',
txtUntitled: 'Untitled' txtUntitled: 'Untitled',
errorToken: 'The document security token is not correctly formed.<br>Please contact your Document Server administrator.',
errorSessionAbsolute: 'The document editing session has expired. Please reload the page.',
errorSessionIdle: 'The document has not been edited for quite a long time. Please reload the page.',
errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.',
errorBadImageUrl: 'Image url is incorrect',
errorDataEncrypted: 'Encrypted changes have been received, they cannot be deciphered.',
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

@ -59,6 +59,22 @@
"Common.Views.ShareDialog.textTitle": "Share Link", "Common.Views.ShareDialog.textTitle": "Share Link",
"Common.Views.ShareDialog.txtCopy": "Copy to clipboard", "Common.Views.ShareDialog.txtCopy": "Copy to clipboard",
"Common.Views.ShareDialog.warnCopy": "Browser's error! Use keyboard shortcut [Ctrl] + [C]", "Common.Views.ShareDialog.warnCopy": "Browser's error! Use keyboard shortcut [Ctrl] + [C]",
"Common.Views.ImageFromUrlDialog.textUrl": "Paste an image URL:",
"Common.Views.ImageFromUrlDialog.txtEmpty": "This field is required",
"Common.Views.ImageFromUrlDialog.txtNotUrl": "This field should be a URL in the \"http://www.example.com\" format",
"Common.Views.SelectFileDlg.textLoading": "Loading",
"Common.Views.SelectFileDlg.textTitle": "Select Data Source",
"Common.Views.SaveAsDlg.textLoading": "Loading",
"Common.Views.SaveAsDlg.textTitle": "Folder for save",
"Common.Views.OpenDialog.closeButtonText": "Close File",
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
"Common.Views.OpenDialog.txtIncorrectPwd": "Password is incorrect.",
"Common.Views.OpenDialog.txtOpenFile": "Enter a password to open the file",
"Common.Views.OpenDialog.txtPassword": "Password",
"Common.Views.OpenDialog.txtPreview": "Preview",
"Common.Views.OpenDialog.txtProtected": "Once you enter the password and open the file, the current password to the file will be reset.",
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
"DE.Controllers.ApplicationController.convertationErrorText": "Conversion failed.", "DE.Controllers.ApplicationController.convertationErrorText": "Conversion failed.",
"DE.Controllers.ApplicationController.convertationTimeoutText": "Conversion timeout exceeded.", "DE.Controllers.ApplicationController.convertationTimeoutText": "Conversion timeout exceeded.",
"DE.Controllers.ApplicationController.criticalErrorTitle": "Error", "DE.Controllers.ApplicationController.criticalErrorTitle": "Error",
@ -117,6 +133,17 @@
"DE.Controllers.ApplicationController.mniImageFromStorage": "Image from Storage", "DE.Controllers.ApplicationController.mniImageFromStorage": "Image from Storage",
"DE.Controllers.ApplicationController.mniImageFromUrl": "Image from URL", "DE.Controllers.ApplicationController.mniImageFromUrl": "Image from URL",
"DE.Controllers.ApplicationController.txtUntitled": "Untitled", "DE.Controllers.ApplicationController.txtUntitled": "Untitled",
"DE.Controllers.ApplicationController.errorToken": "The document security token is not correctly formed.<br>Please contact your Document Server administrator.",
"DE.Controllers.ApplicationController.errorSessionAbsolute": "The document editing session has expired. Please reload the page.",
"DE.Controllers.ApplicationController.errorSessionIdle": "The document has not been edited for quite a long time. 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.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.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",

View file

@ -59,6 +59,22 @@
"Common.Views.ShareDialog.textTitle": "Поделиться ссылкой", "Common.Views.ShareDialog.textTitle": "Поделиться ссылкой",
"Common.Views.ShareDialog.txtCopy": "Скопировать в буфер", "Common.Views.ShareDialog.txtCopy": "Скопировать в буфер",
"Common.Views.ShareDialog.warnCopy": "Browser's error! Use keyboard shortcut [Ctrl] + [C]", "Common.Views.ShareDialog.warnCopy": "Browser's error! Use keyboard shortcut [Ctrl] + [C]",
"Common.Views.ImageFromUrlDialog.textUrl": "Вставьте URL изображения:",
"Common.Views.ImageFromUrlDialog.txtEmpty": "Это поле обязательно для заполнения",
"Common.Views.ImageFromUrlDialog.txtNotUrl": "Это поле должно быть URL-адресом в формате \"http://www.example.com\"",
"Common.Views.OpenDialog.closeButtonText": "Закрыть файл",
"Common.Views.OpenDialog.txtEncoding": "Кодировка",
"Common.Views.OpenDialog.txtIncorrectPwd": "Указан неверный пароль.",
"Common.Views.OpenDialog.txtOpenFile": "Введите пароль для открытия файла",
"Common.Views.OpenDialog.txtPassword": "Пароль",
"Common.Views.OpenDialog.txtPreview": "Просмотр",
"Common.Views.OpenDialog.txtProtected": "Как только вы введете пароль и откроете файл, текущий пароль к файлу будет сброшен.",
"Common.Views.OpenDialog.txtTitle": "Выбрать параметры %1",
"Common.Views.OpenDialog.txtTitleProtected": "Защищенный файл",
"Common.Views.SaveAsDlg.textLoading": "Загрузка",
"Common.Views.SaveAsDlg.textTitle": "Папка для сохранения",
"Common.Views.SelectFileDlg.textLoading": "Загрузка",
"Common.Views.SelectFileDlg.textTitle": "Выбрать источник данных",
"DE.Controllers.ApplicationController.convertationErrorText": "Конвертация не удалась.", "DE.Controllers.ApplicationController.convertationErrorText": "Конвертация не удалась.",
"DE.Controllers.ApplicationController.convertationTimeoutText": "Превышено время ожидания конвертации.", "DE.Controllers.ApplicationController.convertationTimeoutText": "Превышено время ожидания конвертации.",
"DE.Controllers.ApplicationController.criticalErrorTitle": "Ошибка", "DE.Controllers.ApplicationController.criticalErrorTitle": "Ошибка",

View file

@ -322,7 +322,7 @@ define([
}); });
var menuHiddenItems = new Common.UI.Menu({ var menuHiddenItems = new Common.UI.Menu({
maxHeight: 260, maxHeight: 267,
menuAlign: 'tl-tr' menuAlign: 'tl-tr'
}).on('show:after', function () { }).on('show:after', function () {
this.scroller.update({alwaysVisibleY: true}); this.scroller.update({alwaysVisibleY: true});