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 ms...@apache.org on 2014/11/19 17:42:25 UTC

[09/15] portals-pluto git commit: More work on portlet hub initialization. Added the configured public render parameters to the output.

More work on portlet hub initialization. Added the configured public render parameters to the output.


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/fa52b5a5
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/fa52b5a5
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/fa52b5a5

Branch: refs/heads/PortletHub
Commit: fa52b5a519452b27be2c938f08e9af8e419b4fca
Parents: bc34e25
Author: Scott Nicklous <ms...@apache.org>
Authored: Mon Nov 17 16:34:42 2014 +0100
Committer: Scott Nicklous <ms...@apache.org>
Committed: Mon Nov 17 16:34:42 2014 +0100

----------------------------------------------------------------------
 .../WEB-INF/themes/pluto-default-theme.jsp      | 54 ++++++++++++--------
 1 file changed, 34 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/fa52b5a5/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp
----------------------------------------------------------------------
diff --git a/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp b/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp
index 2ddea41..fb4c9c4 100644
--- a/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp
+++ b/pluto-portal/src/main/webapp/WEB-INF/themes/pluto-default-theme.jsp
@@ -21,6 +21,8 @@ limitations under the License.
 <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
 <%@ taglib uri="http://portals.apache.org/pluto" prefix="pluto" %>
 <%@ page import="java.util.*,javax.portlet.*,org.apache.pluto.driver.url.*" %>
+<%@ page import="org.apache.pluto.driver.config.*,org.apache.pluto.driver.*" %>
+<%@ page import="org.apache.pluto.container.*,javax.servlet.jsp.*" %>
 <% pageContext.setAttribute("now", new java.util.Date()); %>
 
 <!--
@@ -51,14 +53,9 @@ group (the left column) displays portlets with odd IDs, while the second group
                 PortalRequestContext prc = PortalRequestContext.getContext(request);
                 PortalURL pu = prc.getRequestedPortalURL(); 
                 Collection<PortalURLParameter> pups = pu.getParameters();
-                // on the URL at least, prps are not differentiated by portlet ID
-                Map<String, String[]> prps = pu.getPublicParameters();
-                StringBuffer prpnames = new StringBuffer();
-                String c0 = "";
-                for (String prp : prps.keySet()) {
-                   prpnames.append(c0 + "'" + prp + "'");
-                   c0 = ", ";
-                }
+                Map<String, String[]> pubparms = pu.getPublicParameters();
+                DriverConfiguration dc = (DriverConfiguration) prc.getServletContext()
+                      .getAttribute(AttributeKeys.DRIVER_CONFIG);
              %>
              <c:forEach var="pid" items="${currentPage.portletIds}">
                 <%
@@ -72,6 +69,21 @@ group (the left column) displays portlets with odd IDs, while the second group
                       }
                    }
                    ns.append("_");
+
+                   PortletConfig pc = null;
+                   StringBuffer prpstring = new StringBuffer();
+                   Set<String> prpnames = new HashSet<String>();
+                   String sep = "";
+                   try {
+                      pc = dc.getPortletConfig(pid);
+                      Enumeration<String> prps = pc.getPublicRenderParameterNames();
+                      while (prps.hasMoreElements()) {
+                         String prp = prps.nextElement();
+                         prpnames.add(prp);
+                         prpstring.append(sep + "'" + prp + "'");
+                         sep = ", ";
+                      }
+                   } catch (Exception e) {}
                    
                    String pm = pu.getPortletMode(pid).toString();
                    String ws = pu.getWindowState(pid).toString();
@@ -93,25 +105,27 @@ group (the left column) displays portlets with odd IDs, while the second group
                                c1 = ",\n                      ";
                             }
                          }
-                         // this is a hack, but just add all public parms for all portlets on page
-                         for (String prp : prps.keySet()) {
-                            out.write(c1 + "   '" + prp + "' : [");
-                            String c2 = "";
-                            for (String val : (String[])prps.get(prp)) {
-                               out.write(c2 + " '" + val + "'");
-                               c2 = ",";
+                         
+                         // Add the public render parameter values for this portlet
+                         
+                         for (String prp : pubparms.keySet()) {
+                            if (prpnames.contains(prp)) {
+                               out.write(c1 + "   '" + prp + "' : [");
+                               String c2 = "";
+                               for (String val : (String[])pubparms.get(prp)) {
+                                  out.write(c2 + " '" + val + "'");
+                                  c2 = ",";
+                               }
+                               out.write("]");
+                               c1 = ",\n                      ";
                             }
-                            out.write("]");
-                            c1 = ",\n                      ";
-                            
                          }
                       %>
                       }, 
                       'portletMode' : '<%=pm%>', 
                       'windowState' : '<%=ws%>'
                    },
-                   // 'pubParms' : [<%=prpnames.toString()%>],
-                   'pubParms' : ['imgName', 'color'],
+                   'pubParms' : [<%=prpstring.toString()%>],
                    'allowedPM' : ['view'],
                    'allowedWS' : ['normal'],
                    'renderData' : {