[DE forms] Open protected files

This commit is contained in:
Julia Radzhabova 2021-11-30 13:44:18 +03:00
parent ef18d41964
commit fda8076ec7
4 changed files with 73 additions and 2 deletions

View file

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

View file

@ -14,6 +14,7 @@ define([
'common/main/lib/view/ImageFromUrlDialog',
'common/main/lib/view/SelectFileDlg',
'common/main/lib/view/SaveAsDlg',
'common/main/lib/view/OpenDialog',
'common/forms/lib/view/modals',
'documenteditor/forms/app/view/ApplicationView'
], function (Viewport) {
@ -98,7 +99,7 @@ define([
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_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_onCurrentPage', this.onCurrentPage.bind(this));
@ -724,6 +725,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() {
screenTip.isHidden = true;
},

View file

@ -59,6 +59,22 @@
"Common.Views.ShareDialog.textTitle": "Share Link",
"Common.Views.ShareDialog.txtCopy": "Copy to clipboard",
"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.convertationTimeoutText": "Conversion timeout exceeded.",
"DE.Controllers.ApplicationController.criticalErrorTitle": "Error",

View file

@ -59,6 +59,22 @@
"Common.Views.ShareDialog.textTitle": "Поделиться ссылкой",
"Common.Views.ShareDialog.txtCopy": "Скопировать в буфер",
"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.convertationTimeoutText": "Превышено время ожидания конвертации.",
"DE.Controllers.ApplicationController.criticalErrorTitle": "Ошибка",