You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2006/09/06 03:46:56 UTC

svn commit: r440560 - in /portals/pluto/trunk: pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/ pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/ pluto-portal/src/main/webapp/WEB-INF/themes/ pluto-portal/src/main/webapp/WEB...

Author: ddewolf
Date: Tue Sep  5 18:46:55 2006
New Revision: 440560

URL: http://svn.apache.org/viewvc?view=rev&rev=440560
Log:
Fixing portlet maximize bug; PLUTO-232

Added:
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/IsMaximizedTag.java
Modified:
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletTag.java
    portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp
    portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/tld/pluto.tld

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java?view=diff&rev=440560&r1=440559&r2=440560
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalRequestContext.java Tue Sep  5 18:46:55 2006
@@ -81,7 +81,7 @@
      * @param request  the servlet request.
      * @return the portal environment.
      */
-    public static PortalRequestContext getPortalEnvironment(
+    public static PortalRequestContext getContext(
             HttpServletRequest request) {
         return (PortalRequestContext) request.getAttribute(REQUEST_KEY);
     }

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java?view=diff&rev=440560&r1=440559&r2=440560
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/core/PortalServletRequest.java Tue Sep  5 18:46:55 2006
@@ -41,7 +41,7 @@
         this.portletWindow = window;
 
         url =
-        PortalRequestContext.getPortalEnvironment(request).getRequestedPortalURL();
+        PortalRequestContext.getContext(request).getRequestedPortalURL();
     }
 
 

Added: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/IsMaximizedTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/IsMaximizedTag.java?view=auto&rev=440560
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/IsMaximizedTag.java (added)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/IsMaximizedTag.java Tue Sep  5 18:46:55 2006
@@ -0,0 +1,50 @@
+package org.apache.pluto.driver.tags;
+
+import org.apache.pluto.driver.core.PortalRequestContext;
+import org.apache.pluto.driver.url.PortalURL;
+
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.JspException;
+import javax.servlet.http.HttpServletRequest;
+import javax.portlet.WindowState;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ddewolf
+ * Date: Sep 4, 2006
+ * Time: 9:27:35 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class IsMaximizedTag extends TagSupport {
+
+    private String var;
+
+    public int doStartTag() throws JspException {
+        PortalRequestContext portalEnv = PortalRequestContext.getContext(
+                (HttpServletRequest) pageContext.getRequest());
+
+        PortalURL portalURL = portalEnv.getRequestedPortalURL();
+
+        // Check if someone else is maximized. If yes, don't show content.
+        Map windowStates = portalURL.getWindowStates();
+        for (Iterator it = windowStates.values().iterator(); it.hasNext();) {
+            WindowState windowState = (WindowState) it.next();
+            if (WindowState.MAXIMIZED.equals(windowState)) {
+                pageContext.setAttribute(var, Boolean.TRUE);
+                break;
+            }
+        }
+        return SKIP_BODY;
+    }
+
+    public String getVar() {
+        return var;
+    }
+
+    public void setVar(String var) {
+        this.var = var;
+    }
+
+}

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletTag.java?view=diff&rev=440560&r1=440559&r2=440560
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletTag.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/tags/PortletTag.java Tue Sep  5 18:46:55 2006
@@ -119,8 +119,8 @@
         }
         
         // Retrieve the current portal URL.
-        PortalRequestContext portalEnv = PortalRequestContext.getPortalEnvironment(
-        		(HttpServletRequest) pageContext.getRequest());
+        PortalRequestContext portalEnv = PortalRequestContext.getContext(
+                (HttpServletRequest) pageContext.getRequest());
         PortalURL portalURL = portalEnv.getRequestedPortalURL();
         
         // Create the portlet window to render.

Modified: portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp?view=diff&rev=440560&r1=440559&r2=440560
==============================================================================
--- portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp (original)
+++ portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp Tue Sep  5 18:46:55 2006
@@ -15,98 +15,114 @@
 limitations under the License.
 --%>
 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
+<%@ taglib uri="http://portals.apache.org/pluto" prefix="pluto" %>
 
 <!--
-  Portal page template for default theme used by the Pluto Portal Driver.
-  This template divides all portlets into two groups (div blocks): the first
-  group (the left column) displays portlets with odd IDs, while the second group
-  (the right column) displays portlets with even IDs.
-  -->
+Portal page template for default theme used by the Pluto Portal Driver.
+This template divides all portlets into two groups (div blocks): the first
+group (the left column) displays portlets with odd IDs, while the second group
+(the right column) displays portlets with even IDs.
+-->
 
 <html>
-  
-  <head>
+
+<head>
     <title>Pluto Portal</title>
     <style type="text/css" title="currentStyle" media="screen">
-      @import "<c:out value="${pageContext.request.contextPath}"/>/pluto.css";
+        @import "<c:out value="${pageContext.request.contextPath}"/>/pluto.css";
     </style>
     <script type="text/javascript"
             src="<c:out value="${pageContext.request.contextPath}"/>/pluto.js">
     </script>
-  </head>
+</head>
+
+<body>
+
+<div id="portal">
 
-  <body>
-  
-    <div id="portal">
-      
-      <!-- Header block: the Apache Pluto banner image and description -->
-      <div id="header">
+    <!-- Header block: the Apache Pluto banner image and description -->
+    <div id="header">
         <h1>Apache Pluto</h1>
+
         <p>An Apache Portals Project</p>
-      </div>
-	      
-      <!-- Logout link -->
-       <div id="logout">
+    </div>
+
+    <!-- Logout link -->
+    <div id="logout">
         <a href="<c:url value='/Logout'/>">Logout</a>
-       </div>
+    </div>
 
-      <!-- Navigation block: links to portal pages -->
-      <div id="navigation">
+    <!-- Navigation block: links to portal pages -->
+    <div id="navigation">
         <h2>Navigation:</h2>
         <ul>
-          <c:forEach var="page" items="${driverConfig.pages}">
-            <c:choose>
-              <c:when test="${page == currentPage}">
-                <li class="selected">
-                  <a href='<c:out value="${pageContext.request.contextPath}"/>/portal/<c:out value="${page.name}"/>'>
-                    <c:out value="${page.name}"/>
-                  </a>
-                </li>
-              </c:when>
-              <c:otherwise>
-                <li>
-                  <a href='<c:out value="${pageContext.request.contextPath}"/>/portal/<c:out value="${page.name}"/>'>
-                    <c:out value="${page.name}"/>
-                  </a>
-                </li>
-              </c:otherwise>
-            </c:choose>
-          </c:forEach>
+            <c:forEach var="page" items="${driverConfig.pages}">
+                <c:choose>
+                    <c:when test="${page == currentPage}">
+                        <li class="selected">
+                            <a href='<c:out value="${pageContext.request.contextPath}"/>/portal/<c:out value="${page.name}"/>'>
+                                <c:out value="${page.name}"/>
+                            </a>
+                        </li>
+                    </c:when>
+                    <c:otherwise>
+                        <li>
+                            <a href='<c:out value="${pageContext.request.contextPath}"/>/portal/<c:out value="${page.name}"/>'>
+                                <c:out value="${page.name}"/>
+                            </a>
+                        </li>
+                    </c:otherwise>
+                </c:choose>
+            </c:forEach>
         </ul>
-      </div>
-      
-      <!-- Content block: portlets are divided into two columns/groups -->
-      <div id="content">
-        
+    </div>
+
+    <!-- Content block: portlets are divided into two columns/groups -->
+    <div id="content">
+        <pluto:isMaximized var="isMax"/>
+
         <!-- Left column -->
-        <div id="portlets-left-column">
-          <c:forEach var="portlet" varStatus="status"
-                     items="${currentPage.portletIds}" step="2">
-            <c:set var="portlet" value="${portlet}" scope="request"/>
-            <jsp:include page="portlet-skin.jsp"/>
-          </c:forEach>
-        </div>
-        
-        <!-- Right column -->
-        <div id="portlets-right-column">
-          <c:forEach var="portlet" varStatus="status"
-                     items="${currentPage.portletIds}" begin="1" step="2">
-            <c:set var="portlet" value="${portlet}" scope="request"/>
-            <jsp:include page="portlet-skin.jsp"/>
-          </c:forEach>
-        </div>
-        
-      </div>
-      
-      <!-- Footer block: copyright -->
-      <div id="footer">
+        <c:choose>
+            <c:when test="${isMax}">
+                    <c:forEach var="portlet" varStatus="status"
+                               items="${currentPage.portletIds}">
+                        <c:set var="portlet" value="${portlet}" scope="request"/>
+                        <jsp:include page="portlet-skin.jsp"/>
+                    </c:forEach>
+             </c:when>
+
+            <c:otherwise>
+                <div id="portlets-left-column">
+                    <c:forEach var="portlet" varStatus="status"
+                               items="${currentPage.portletIds}" step="2">
+                        <c:set var="portlet" value="${portlet}" scope="request"/>
+                        <jsp:include page="portlet-skin.jsp"/>
+                    </c:forEach>
+                </div>
+
+                <!-- Right column -->
+                <div id="portlets-right-column">
+                    <c:forEach var="portlet" varStatus="status"
+                               items="${currentPage.portletIds}" begin="1" step="2">
+                        <c:set var="portlet" value="${portlet}" scope="request"/>
+                        <jsp:include page="portlet-skin.jsp"/>
+                    </c:forEach>
+                </div>
+
+            </c:otherwise>
+        </c:choose>
+
+    </div>
+
+    <!-- Footer block: copyright -->
+    <div id="footer">
         &copy; 2003-2005 Apache Software Foundation
-      </div>
-      
     </div>
-    
-  </body>
-  
+
+</div>
+
+</body>
+
 </html>
 
 

Modified: portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/tld/pluto.tld
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/tld/pluto.tld?view=diff&rev=440560&r1=440559&r2=440560
==============================================================================
--- portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/tld/pluto.tld (original)
+++ portals/pluto/trunk/pluto-portal/src/main/webapp/WEB-INF/tld/pluto.tld Tue Sep  5 18:46:55 2006
@@ -67,5 +67,16 @@
     <bodycontent>empty</bodycontent>
   </tag>
 
+    <tag>
+        <name>isMaximized</name>
+        <tagclass>org.apache.pluto.driver.tags.IsMaximizedTag</tagclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>var</name>
+            <required>true</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+    </tag>
+
 </taglib>