From ebfcefc759ee6342bbee14427ff77f639ed0f480 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Thu, 3 Oct 2024 17:53:04 +0100 Subject: [PATCH] fix: Remove old way of portlet height definition - MEED-7550 - Meeds-io/meeds#2428 (#983) Prior to this change, the old height attribute defined in portlets was applied on the whole block of the portlet. This change will cancel this style application for portlets retrieved using the new layout management system so that it still be applied on old pages designed with old system but not applied on pages applied using the new layout. --- .../portal/webui/application/UIPortlet.gtmpl | 2 +- .../portal/webui/application/UIPortlet.java | 16 ---------------- .../portal/webui/util/PortalDataMapper.java | 3 --- .../webui/workspace/UIPortalApplication.java | 4 ++-- 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl b/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl index d533485898..e751f7b9bf 100644 --- a/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl +++ b/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl @@ -30,7 +30,7 @@ String windowHeight = uicomponent.getHeight(); String cssStyle = ""; - if (windowHeight != null || windowWidth != null) { + if ((windowHeight != null || windowWidth != null) && !rcontext.isMaximizePortlet()) { if (windowWidth != null) { cssStyle += "width: "+ windowWidth +";"; } diff --git a/webui/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java b/webui/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java index 5182a7a7f3..87d5f963af 100644 --- a/webui/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java +++ b/webui/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java @@ -275,22 +275,6 @@ public void setShowPortletMode(Boolean b) { showPortletMode = b; } - /** - * Used internally by portal to change current state - * if portlet is in portal or in page - */ - public void setPortletInPortal(boolean b) { - portletInPortal_ = b; - } - - /** - * Check if portlet is in portal - * @return true if portlet is in portal - */ - public boolean isPortletInPortal() { - return portletInPortal_; - } - /** * Theme is composed of map between theme name and skin name. * Theme format: {skinName}:{themeName}::{anotherSkin}:{anotherTheme}. diff --git a/webui/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java b/webui/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java index b906e54316..209e1b283b 100644 --- a/webui/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java +++ b/webui/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java @@ -133,9 +133,6 @@ public static void toUIPage(UIPage uiPage, Page model) throws Exception { List portlets = new ArrayList<>(); uiPage.findComponentOfType(portlets, UIPortlet.class); - for (UIPortlet portlet : portlets) { - portlet.setPortletInPortal(false); - } } public static void toUIPortal(UIPortal uiPortal, PortalConfig model) throws Exception { diff --git a/webui/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java b/webui/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java index 1a38263e61..62de83a741 100644 --- a/webui/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java +++ b/webui/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java @@ -1186,11 +1186,11 @@ private boolean isRefreshPage(RequestNavigationData requestNavData) { } private boolean isDraftPage() { - return ((PortalRequestContext) RequestContext.getCurrentInstance()).isDraftPage(); + return PortalRequestContext.getCurrentInstance().isDraftPage(); } public boolean isMaximizePortlet() { - return StringUtils.isNotBlank(PortalRequestContext.getCurrentInstance().getMaximizedPortletId()); + return PortalRequestContext.getCurrentInstance().isMaximizePortlet(); } public String getMaximizedPortletId() {