Jeremy,

I agree with 1) , in this case we should choose the request attribute over session



Begin forwarded message:

From: [EMAIL PROTECTED]
Date: July 20, 2004 2:38:08 PM PDT
To: [EMAIL PROTECTED]
Subject: cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl PortletAggregatorImpl.java PageAggregatorImpl.java
Reply-To: "Jetspeed Developers List" <[EMAIL PROTECTED]>


jford       2004/07/20 14:38:08

Modified: portal/src/java/org/apache/jetspeed/aggregator/impl
PortletAggregatorImpl.java PageAggregatorImpl.java
Log:
Implemented changes described by decorations document


  Two notes:
  1) Use of session attribute - Could request attribute be used instead
  2) Hard coded directories and media type needs to be resolved

  PR: JS2-89
  Submitted by: Enrique Lara

Revision Changes Path
1.4 +31 -2 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/ impl/PortletAggregatorImpl.java


Index: PortletAggregatorImpl.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/ aggregator/impl/PortletAggregatorImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PortletAggregatorImpl.java 20 Jul 2004 13:48:08 -0000 1.3
+++ PortletAggregatorImpl.java 20 Jul 2004 21:38:08 -0000 1.4
@@ -15,6 +15,9 @@
*/
package org.apache.jetspeed.aggregator.impl;


+import java.util.HashSet;
+import java.util.Set;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jetspeed.PortalReservedParameters;
@@ -57,7 +60,33 @@
{
entity = (String)context.getAttribute(PortalReservedParameters.PORTLET_ENTITY);
}
- fragment.setId(entity);
+ fragment.setId(entity);
+
+
+ if(fragment.getDecorator() != null)
+ {
+ log.debug("decorator=" + fragment.getDecorator());
+ addStyle(context, fragment.getDecorator(), "portlet");
+ }
+ else
+ {
+ log.debug("no decorator for portlet:" + fragment.getId());
+ }
+
renderer.renderNow(fragment, context);
+ }
+
+ private void addStyle(RequestContext context, String decoratorName, String decoratorType)
+ {
+ log.debug("addStyle: decoratorName=" + decoratorName + ", decoratorType=" + decoratorType );
+ Set cssUrls = (Set) context.getSessionAttribute("cssUrls");
+
+ if (cssUrls == null)
+ {
+ cssUrls = new HashSet();
+ context.setSessionAttribute("cssUrls", cssUrls);
+ }
+
+ cssUrls.add("/WEB-INF/decorations/" + decoratorType + "/html/" + decoratorName + "/css/styles.css");
}
}




1.9 +36 -1 jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/ impl/PageAggregatorImpl.java

Index: PageAggregatorImpl.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/ aggregator/impl/PageAggregatorImpl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PageAggregatorImpl.java 20 Jul 2004 13:48:08 -0000 1.8
+++ PageAggregatorImpl.java 20 Jul 2004 21:38:08 -0000 1.9
@@ -16,8 +16,10 @@
package org.apache.jetspeed.aggregator.impl;


   import java.util.ArrayList;
  +import java.util.HashSet;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.Set;
   import java.util.Stack;

import org.apache.commons.logging.Log;
@@ -124,6 +126,14 @@
{
contentPathes.set(0, currentFragment.getType() + "/html/" + layoutDecorator);
}
+
+
+ if(layoutDecorator != null)
+ {
+ addStyle(context, layoutDecorator, "layout");
+ addStyle(context, layoutDecorator, "portlet");
+ }
+
////////////////////////////////////////////////////////////////////// /////////////////////////


if (checkAccess(context, (currentFragment.getAcl() != null) ? currentFragment.getAcl() : acl, "render"))
@@ -189,6 +199,17 @@
ContentDispatcher dispatcher = renderer.getDispatcher(context, false);
dispatcher.sync(currentFragment);
}
+
+ if(currentFragment.getDecorator() != null)
+ {
+ log.debug("decorator=" + currentFragment.getDecorator());
+ addStyle(context, currentFragment.getDecorator(), "portlet");
+ }
+ else
+ {
+ log.debug("no decorator for portlet:" + currentFragment.getId());
+ }
+
}
catch (Exception e)
{
@@ -233,5 +254,19 @@
// This methid needs to be moved a secuity module.
// Does nothing right now
return true;
+ }
+
+
+ private void addStyle(RequestContext context, String decoratorName, String decoratorType)
+ {
+ Set cssUrls = (Set) context.getSessionAttribute("cssUrls");
+
+ if (cssUrls == null)
+ {
+ cssUrls = new HashSet();
+ context.setSessionAttribute("cssUrls", cssUrls);
+ }
+
+ cssUrls.add("/WEB-INF/decorations/" + decoratorType + "/html/" + decoratorName + "/css/styles.css");
}
}





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



-- David Sean Taylor Bluesunrise Software [EMAIL PROTECTED] [office] +01 707 773-4646 [mobile] +01 707 529 9194



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to