From fff4c1acd8f410b1d39d724b86c7c9ccaaa9ea73 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 24 Jun 2024 10:28:42 +0300 Subject: [PATCH] Fill info when refresh file --- .../main/app/controller/Main.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index d967274511..ef3e9e63a3 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -3021,6 +3021,35 @@ define([ } if (data.token) docInfo.put_Token(data.token); + + var _user = new Asc.asc_CUserInfo(); // change for guest!! + _user.put_Id(this.appOptions.user.id); + _user.put_FullName(this.appOptions.user.fullname); + _user.put_IsAnonymousUser(!!this.appOptions.user.anonymous); + docInfo.put_UserInfo(_user); + + var _options = $.extend({}, this.document.options, this.editorConfig.actionLink || {}); + docInfo.put_Options(_options); + + docInfo.put_Format(this.document.fileType); + docInfo.put_Lang(this.editorConfig.lang); + docInfo.put_Mode(this.editorConfig.mode); + docInfo.put_Permissions(this.permissions); + docInfo.put_DirectUrl(data.document && data.document.directUrl ? data.document.directUrl : this.document.directUrl); + docInfo.put_VKey(data.document && data.document.vkey ? data.document.vkey : this.document.vkey); + docInfo.put_EncryptedInfo(data.editorConfig && data.editorConfig.encryptionKeys ? data.editorConfig.encryptionKeys : this.editorConfig.encryptionKeys); + + var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); + docInfo.asc_putIsEnabledPlugins(!!enable); + + var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(this.document.fileType); + var coEditMode = (type && typeof type[1] === 'string') ? 'strict' : // offline viewer for pdf|djvu|xps|oxps + !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default + this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer + this.editorConfig.coEditing.mode || 'fast'; + docInfo.put_CoEditingMode(coEditMode); this.api.asc_refreshFile(docInfo); } },