From cc112454627061f95bd574a10629a0929abceaca Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 21 Sep 2021 21:45:02 +0300 Subject: [PATCH 1/4] [DE forms] Fix options button menu --- .../app/controller/ApplicationController.js | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 499254f07..38676d768 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -1062,12 +1062,34 @@ define([ }, createDelayedElements: function() { - var menuItems = this.view.btnOptions.menu.items; - var itemsCount = menuItems.length-3; + var me = this, + menuItems = this.view.btnOptions.menu.items, + itemsCount = menuItems.length-3; + var initMenu = function(menu) { + var last; + if (!menuItems[0].isVisible()) + menuItems[1].setVisible(false); + else + last = menuItems[1]; + + if (!menuItems[2].isVisible() && !menuItems[3].isVisible() && !menuItems[4].isVisible()) + menuItems[5].setVisible(false); + else + last = menuItems[5]; + + if (!menuItems[6].isVisible() && !menuItems[7].isVisible()) + menuItems[8].setVisible(false); + else + last = menuItems[8]; + + if (!menuItems[9].isVisible() && !menuItems[10].isVisible()) + last && last.setVisible(false); + + menu.off('show:after', initMenu); + }; if (!this.appOptions.canPrint) { menuItems[0].setVisible(false); - menuItems[1].setVisible(false); itemsCount--; } @@ -1079,8 +1101,6 @@ define([ if ( !this.appOptions.canFillForms || !this.appOptions.canDownload) { menuItems[3].setVisible(false); menuItems[4].setVisible(false); - menuItems[1].setVisible(false); - menuItems[5].setVisible(false); itemsCount -= 2; } @@ -1094,9 +1114,6 @@ define([ itemsCount--; } - if (itemsCount<3) - menuItems[8].setVisible(false); - if ( !this.embedConfig.embedUrl || this.appOptions.canFillForms) { menuItems[9].setVisible(false); itemsCount--; @@ -1106,11 +1123,10 @@ define([ menuItems[10].setVisible(false); itemsCount--; } - if (itemsCount<1) this.view.btnOptions.setVisible(false); - else if ((!this.embedConfig.embedUrl || this.appOptions.canFillForms) && !this.embedConfig.fullscreenUrl) - menuItems[8].setVisible(false); + + this.view.btnOptions.menu.on('show:after', initMenu); screenTip = { toolTip: new Common.UI.Tooltip({ From b4cfd54f03a1bf380400e8bdf7c6d80a853c3861 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 21 Sep 2021 21:56:36 +0300 Subject: [PATCH 2/4] [DE] Support for opening .oform files --- apps/api/documents/api.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index af24a55f2..0c6578324 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -419,7 +419,7 @@ if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') { _config.document.fileType = _config.document.fileType.toLowerCase(); - var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|docm|dot|dotm|dotx|fodt|ott|fb2|xml))$/ + var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform))$/ .exec(_config.document.fileType); if (!type) { window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it."); @@ -873,12 +873,22 @@ path_type = "main"; path += app + "/"; - path_type = (config.type === "mobile" || isSafari_mobile) - ? "mobile" - : ((app=='documenteditor') && config.document && config.document.permissions && (config.document.permissions.fillForms===true) && - (config.document.permissions.edit === false) && (config.document.permissions.review !== true) && (config.editorConfig.mode !== 'view')) - ? "forms" : (config.type === "embedded") ? "embed" - : "main"; + path_type = ""; + if (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'oform') { + if (config.document.permissions) { + (config.document.permissions.fillForms===undefined) && (config.document.permissions.fillForms = (config.document.permissions.edit !== false)); + config.document.permissions.edit = config.document.permissions.review = config.document.permissions.comment = false; + } + path_type = (config.type === "mobile" || isSafari_mobile) + ? "mobile" : config.document.permissions && (config.document.permissions.fillForms === true) && (config.editorConfig.mode !== 'view') + ? "forms" : "embed"; + } else { + path_type = (config.type === "mobile" || isSafari_mobile) + ? "mobile" : ((app==='documenteditor') && config.document && config.document.permissions && (config.document.permissions.fillForms===true) && + (config.document.permissions.edit === false) && (config.document.permissions.review !== true) && (config.editorConfig.mode !== 'view')) + ? "forms" : (config.type === "embedded") + ? "embed" : "main"; + } path += path_type; var index = "/index.html"; @@ -887,7 +897,7 @@ if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs || (config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) { index = "/index_loader.html"; - } else if (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge') + } else if (config.editorConfig.mode === 'editdiagram' || config.editorConfig.mode === 'editmerge') index = "/index_internal.html"; } From c3fd5c1b1ba1a83831ae49a852c0f30db7e39c4d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 21 Sep 2021 23:25:11 +0300 Subject: [PATCH 3/4] [DE forms] Use logo.image for forms --- apps/api/documents/api.js | 3 +-- .../forms/app/controller/ApplicationController.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 0c6578324..55caed959 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -870,10 +870,9 @@ isIE = !check(/opera/) && (check(/msie/) || check(/trident/) || check(/edge/)), isChrome = !isIE && check(/\bchrome\b/), isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0), - path_type = "main"; + path_type; path += app + "/"; - path_type = ""; if (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'oform') { if (config.document.permissions) { (config.document.permissions.fillForms===undefined) && (config.document.permissions.fillForms = (config.document.permissions.edit !== false)); diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 38676d768..cc8d62a24 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -431,8 +431,8 @@ define([ this.appOptions.customization && this.appOptions.customization.logo ) { var logo = $('#header-logo'); - if (this.appOptions.customization.logo.imageEmbedded) { - logo.html(''); + if (this.appOptions.customization.logo.image) { + logo.html(''); logo.css({'background-image': 'none', width: 'auto', height: 'auto'}); } From d46fac7eff0b1e5dec85014bc3f3aa445e97c220 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 22 Sep 2021 00:53:08 +0300 Subject: [PATCH 4/4] [DE forms] Fix header logo --- apps/documenteditor/forms/index.html | 3 ++- apps/documenteditor/forms/index.html.deploy | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/forms/index.html b/apps/documenteditor/forms/index.html index e1bd0cc0e..dd12004df 100644 --- a/apps/documenteditor/forms/index.html +++ b/apps/documenteditor/forms/index.html @@ -52,7 +52,6 @@ display: inline-block; max-width: 100px; max-height: 20px; - margin-top: 2px; opacity: 0; } .loadmask > .brendpanel .doc-title { @@ -189,6 +188,8 @@ var elem = document.querySelector('.loading-logo'); if (elem && logo) { elem.style.backgroundImage= 'none'; + elem.style.width = 'auto'; + elem.style.height = 'auto'; var img = document.querySelector('.loading-logo img'); img && img.setAttribute('src', logo); img.style.opacity = 1; diff --git a/apps/documenteditor/forms/index.html.deploy b/apps/documenteditor/forms/index.html.deploy index 3894cbdcd..d03fc8244 100644 --- a/apps/documenteditor/forms/index.html.deploy +++ b/apps/documenteditor/forms/index.html.deploy @@ -50,7 +50,6 @@ display: inline-block; max-width: 100px; max-height: 20px; - margin-top: 2px; opacity: 0; } .loadmask > .brendpanel .doc-title { @@ -174,6 +173,8 @@ var elem = document.querySelector('.loading-logo'); if (elem && logo) { elem.style.backgroundImage= 'none'; + elem.style.width = 'auto'; + elem.style.height = 'auto'; var img = document.querySelector('.loading-logo img'); img && img.setAttribute('src', logo); img.style.opacity = 1;