diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index c84bf703a6..8e9c567bd7 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -58,7 +58,8 @@ remove: ["Group1", ""] // current user can remove comments made by users from Group1 and users without a group. }, userInfoGroups: ["Group1", ""], // show tooltips/cursors/info in header only for users in userInfoGroups groups. [""] - means users without group, [] - don't show any users, null/undefined/"" - show all users - protect: // default = true. show/hide protect tab or protect buttons + protect: // default = true. show/hide protect tab or protect buttons, + chat: } }, editorConfig: { @@ -181,6 +182,7 @@ header: { users: false/true // users list button save: false/true // save button + editMode: false/true // change mode button }, leftMenu: { navigation: false/true, @@ -201,12 +203,13 @@ mode: false/true // init value in de/pe change: false/true // hide/show feature in de/pe/sse } / false / true // if false/true - use as init value in de/pe. use instead of customization.spellcheck parameter + roles: false/true // hide/show Roles manager, roles settings in right panel and roles in View form button in de }, font: { name: "Arial", size: "11px"; }, - chat: true, + chat: true, // deprecated 7.1, use permissions.chat comments: true, zoom: 100, compactToolbar: false, @@ -289,6 +292,7 @@ 'onRequestReferenceSource': , // used for external links in sse. must call setReferenceSource method, 'onSaveDocument': 'save document from binary', 'onRequestStartFilling': // used in pdf-form edit mode. must call startFilling method + 'onSubmit': // send when filled form is submitted successfully } } @@ -995,7 +999,7 @@ isForm = false; if (config.document) { if (typeof config.document.fileType === 'string') - type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp))$/ + type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(oform|docxf))$/ .exec(config.document.fileType); if (config.document.permissions) @@ -1010,6 +1014,8 @@ appType = fillForms && isForm===undefined ? 'common' : 'word'; else if (config.type !== 'mobile') appType = isForm===undefined ? 'common' : isForm ? 'word' : 'pdf'; + } else if (type && typeof type[5] === 'string') { // oform|docxf + appType = 'word'; } else { if (typeof config.documentType === 'string') appType = config.documentType.toLowerCase(); @@ -1076,15 +1082,18 @@ if (config.frameEditorId) params += "&frameEditorId=" + config.frameEditorId; - var type = config.document ? /^(?:(pdf))$/.exec(config.document.fileType) : null; - if (!(type && typeof type[1] === 'string') && (config.editorConfig && config.editorConfig.mode == 'view' || + var type = config.document ? /^(?:(pdf)|(oform|docxf))$/.exec(config.document.fileType) : null, + isPdf = type && typeof type[1] === 'string', + oldForm = type && typeof type[2] === 'string'; + + if (!(isPdf || oldForm) && (config.editorConfig && config.editorConfig.mode == 'view' || config.document && config.document.permissions && (config.document.permissions.edit === false && !config.document.permissions.review ))) params += "&mode=view"; - if (type && typeof type[1] === 'string' && (config.document && config.document.permissions && config.document.permissions.edit === false || config.editorConfig && config.editorConfig.mode == 'view')) + if ((isPdf || oldForm) && (config.document && config.document.permissions && config.document.permissions.edit === false || config.editorConfig && config.editorConfig.mode == 'view')) params += "&mode=fillforms"; if (config.document) { - config.document.isForm = (type && typeof type[1] === 'string') ? config.document.isForm : false; + config.document.isForm = isPdf ? config.document.isForm : !!oldForm; (config.document.isForm===true || config.document.isForm===false) && (params += "&isForm=" + config.document.isForm); } diff --git a/apps/api/wopi/editor-wopi.ejs b/apps/api/wopi/editor-wopi.ejs index d11ff5a168..bdfaca0635 100644 --- a/apps/api/wopi/editor-wopi.ejs +++ b/apps/api/wopi/editor-wopi.ejs @@ -285,8 +285,11 @@ div { var fileType = fileInfo.BaseFileName ? fileInfo.BaseFileName.substr(fileInfo.BaseFileName.lastIndexOf('.') + 1) : ""; fileType = fileInfo.FileExtension ? fileInfo.FileExtension.substr(1) : fileType; fileType = fileType.toLowerCase(); - let permissionsEdit = !fileInfo.ReadOnly && fileInfo.UserCanWrite && queryParams.formsubmit !== "1"; - let permissionsFillForm = permissionsEdit || queryParams.formsubmit === "1"; + let customizationClose = !!(fileInfo.ClosePostMessage || fileInfo.CloseUrl); + let customizationSaveAs = fileInfo.SupportsUpdate && !fileInfo.UserCanNotWriteRelative; + let customizationFormSubmit = queryParams.formsubmit === "1"; + let permissionsEdit = !fileInfo.ReadOnly && fileInfo.UserCanWrite && !customizationFormSubmit; + let permissionsFillForm = permissionsEdit || customizationFormSubmit; var config = { "width": "100%", "height": "100%", @@ -306,6 +309,7 @@ div { "review": (fileInfo.SupportsReviewing===false) ? false : (fileInfo.UserCanReview===false ? false : fileInfo.UserCanReview), "copy": fileInfo.CopyPasteRestrictions!=="CurrentDocumentOnly" && fileInfo.CopyPasteRestrictions!=="BlockAll", "print": !fileInfo.DisablePrint && !fileInfo.HidePrintOption, + "chat": queryParams.dchat!=="1", "fillForms": permissionsFillForm }, "options": { @@ -323,6 +327,9 @@ div { }, "customization": { "about": true, + "close": { + "visible": customizationClose + }, "goback": { "url": fileInfo.BreadcrumbFolderUrl }, @@ -330,7 +337,7 @@ div { "name": fileInfo.BreadcrumbBrandName, "www": fileInfo.BreadcrumbBrandUrl }, - "chat": queryParams.dchat!=="1", + "submitForm": customizationFormSubmit && customizationSaveAs, "uiTheme": queryParams.thm==="1" ? "default-light" : (queryParams.thm==="2" ? "default-dark" : undefined) }, "coEditing": { @@ -338,16 +345,17 @@ div { "change": false }, "wopi": { - "FileNameMaxLength": fileInfo.FileNameMaxLength && fileInfo.FileNameMaxLength>0 ? fileInfo.FileNameMaxLength : 250 + "FileNameMaxLength": fileInfo.FileNameMaxLength && fileInfo.FileNameMaxLength>0 ? fileInfo.FileNameMaxLength : 250, + "WOPISrc": userAuth.wopiSrc } }, "events": { "onAppReady": onAppReady, "onDocumentStateChange": fileInfo.EditNotificationPostMessage ? onDocumentStateChange : undefined, 'onRequestEditRights': fileInfo.EditModePostMessage || fileInfo.HostEditUrl ? onRequestEditRights : undefined, - 'onRequestSaveAs': fileInfo.SupportsUpdate && !fileInfo.UserCanNotWriteRelative ? onRequestSaveAs : undefined, + 'onRequestSaveAs': customizationSaveAs ? onRequestSaveAs : undefined, "onError": onError, - "onRequestClose": fileInfo.ClosePostMessage || fileInfo.CloseUrl ? onRequestClose : undefined, + "onRequestClose": customizationClose ? onRequestClose : undefined, "onRequestRename": fileInfo.SupportsRename && fileInfo.UserCanRename ? onRequestRename : undefined, "onRequestSharingSettings": fileInfo.FileSharingPostMessage || fileInfo.FileSharingUrl ? onRequestSharingSettings : undefined, "onRequestHistory": fileInfo.FileVersionUrl || fileInfo.FileVersionPostMessage ? onRequestHistory : undefined, diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index 32da5f2281..5faee33ea8 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -413,6 +413,10 @@ if (window.Common === undefined) { }, data.buffer); }, + submitForm: function() { + _postMessage({event: 'onSubmit'}); + }, + on: function(event, handler){ var localHandler = function(event, data){ handler.call(me, data) diff --git a/apps/common/locale.js b/apps/common/locale.js index 56dc8818b2..b9de231824 100644 --- a/apps/common/locale.js +++ b/apps/common/locale.js @@ -40,7 +40,7 @@ Common.Locale = new(function() { apply = false, defLang = '{{DEFAULT_LANG}}', currentLang = defLang, - _4letterLangs = ['pt-pt', 'zh-tw']; + _4letterLangs = ['pt-pt', 'zh-tw', 'sr-cyrl']; var _applyLocalization = function(callback) { try { @@ -104,9 +104,10 @@ Common.Locale = new(function() { var _requireLang = function (l) { typeof l != 'string' && (l = null); - var lang = (l || _getUrlParameterByName('lang') || defLang); - var idx4Letters = _4letterLangs.indexOf(lang.replace('_', '-').toLowerCase()); // try to load 4 letters language - lang = (idx4Letters<0) ? lang.split(/[\-_]/)[0] : _4letterLangs[idx4Letters]; + var lang = (l || _getUrlParameterByName('lang') || defLang).toLowerCase().split(/[\-_]/); + lang = lang[0] + (lang.length>1 ? '-' + lang[1] : ''); + var idx4Letters = _4letterLangs.indexOf(lang); // try to load 4 letters language + lang = (idx4Letters<0) ? lang.split(/[\-]/)[0] : _4letterLangs[idx4Letters]; currentLang = lang; fetch('locale/' + lang + '.json') .then(function(response) { diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js index 1abe1e04e8..59cf9d1c0a 100644 --- a/apps/common/main/lib/component/Button.js +++ b/apps/common/main/lib/component/Button.js @@ -196,7 +196,7 @@ define([ ''; var templateHugeCaption = - '