weaver 2004/07/28 06:28:04 Modified: portal/src/webapp/WEB-INF/decorations/layout/html/metal decorator-top.vm portal/src/webapp/WEB-INF/decorations/layout/html/jetspeed decorator-top.vm portal/src/java/org/apache/jetspeed/aggregator/impl PortletAggregatorImpl.java PageAggregatorImpl.java portal/src/webapp/WEB-INF/decorations/layout/html/minty-blue decorator-top.vm Log: Instead of using the #parse() approach to include additional styles, I changed the templates to us a <link> tag instead. This keeps the finally rendered code a little more readable and decreases page size. The aggregators now use a content-server resolvable (content/jetspeed/css/styles.css) url instead of the fully resolved path as the #parse() logic was using. Revision Changes Path 1.3 +5 -7 jakarta-jetspeed-2/portal/src/webapp/WEB-INF/decorations/layout/html/metal/decorator-top.vm Index: decorator-top.vm =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/decorations/layout/html/metal/decorator-top.vm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- decorator-top.vm 20 Jul 2004 21:36:31 -0000 1.2 +++ decorator-top.vm 28 Jul 2004 13:28:04 -0000 1.3 @@ -18,13 +18,11 @@ <html> <head> - <title>Welcome to Jetspeed 2</title> - <style type="text/css" media="all"> - #set($cssUrls = $renderRequest.getPortletSession().getAttribute("cssUrls")) - #foreach($cssUrl in $cssUrls) - #parse("$cssUrl") - #end - </style> + <title>Welcome to Jetspeed 2</title> +#set($cssUrls = $renderRequest.getPortletSession().getAttribute("cssUrls")) +#foreach($cssUrl in $cssUrls) + <link rel="stylesheet" type="text/css" media="all" href="$cssUrl" /> +#end </head> <body class="layout-Metal"> 1.6 +4 -6 jakarta-jetspeed-2/portal/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator-top.vm Index: decorator-top.vm =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator-top.vm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- decorator-top.vm 20 Jul 2004 21:36:31 -0000 1.5 +++ decorator-top.vm 28 Jul 2004 13:28:04 -0000 1.6 @@ -19,12 +19,10 @@ <html> <head> <title>Welcome to Jetspeed 2</title> - <style type="text/css" media="all"> - #set($cssUrls = $renderRequest.getPortletSession().getAttribute("cssUrls")) - #foreach($cssUrl in $cssUrls) - #parse("$cssUrl") - #end - </style> +#set($cssUrls = $renderRequest.getPortletSession().getAttribute("cssUrls")) +#foreach($cssUrl in $cssUrls) + <link rel="stylesheet" type="text/css" media="all" href="$cssUrl" /> +#end </head> <body class="layout-Jetspeed"> 1.5 +25 -11 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- PortletAggregatorImpl.java 20 Jul 2004 21:38:08 -0000 1.4 +++ PortletAggregatorImpl.java 28 Jul 2004 13:28:04 -0000 1.5 @@ -61,17 +61,22 @@ entity = (String)context.getAttribute(PortalReservedParameters.PORTLET_ENTITY); } fragment.setId(entity); - - - if(fragment.getDecorator() != null) - { - log.debug("decorator=" + fragment.getDecorator()); - addStyle(context, fragment.getDecorator(), "portlet"); - } - else + + String decorator = fragment.getDecorator(); + if( decorator == null) { - log.debug("no decorator for portlet:" + fragment.getId()); + decorator = context.getPage().getDefaultDecorator(fragment.getType()); + log.debug("No sepecific decorator portlet so using page default: "+decorator); } + +// { +// log.debug("decorator=" + fragment.getDecorator()); +// addStyle(context, fragment.getDecorator(), "portlet"); +// } +// else +// { +// log.debug("no decorator for portlet:" + fragment.getId()); +// } renderer.renderNow(fragment, context); } @@ -87,6 +92,15 @@ context.setSessionAttribute("cssUrls", cssUrls); } - cssUrls.add("/WEB-INF/decorations/" + decoratorType + "/html/" + decoratorName + "/css/styles.css"); + //cssUrls.add("/WEB-INF/decorations/" + decoratorType + "/html/" + decoratorName + "/css/styles.css"); + + if(decoratorType.equals(Fragment.LAYOUT)) + { + cssUrls.add("content/css/styles.css"); + } + else + { + cssUrls.add("content/"+decoratorName+"/css/styles.css"); + } } } 1.10 +17 -7 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- PageAggregatorImpl.java 20 Jul 2004 21:38:08 -0000 1.9 +++ PageAggregatorImpl.java 28 Jul 2004 13:28:04 -0000 1.10 @@ -99,6 +99,8 @@ { layoutDecorator = page.getDefaultDecorator(currentFragment.getType()); } + + String defaultPortletDecorator = page.getDefaultDecorator(Fragment.PORTLET); /////////////////////////////////////////////////////////////////////////////////////////////// //TODO: Remove hard coding of locations and use CM + TL @@ -130,10 +132,10 @@ if(layoutDecorator != null) { - addStyle(context, layoutDecorator, "layout"); - addStyle(context, layoutDecorator, "portlet"); + addStyle(context, layoutDecorator, Fragment.LAYOUT); } - + + /////////////////////////////////////////////////////////////////////////////////////////////// if (checkAccess(context, (currentFragment.getAcl() != null) ? currentFragment.getAcl() : acl, "render")) @@ -203,11 +205,12 @@ if(currentFragment.getDecorator() != null) { log.debug("decorator=" + currentFragment.getDecorator()); - addStyle(context, currentFragment.getDecorator(), "portlet"); + addStyle(context, currentFragment.getDecorator(), Fragment.PORTLET); } else { - log.debug("no decorator for portlet:" + currentFragment.getId()); + log.debug("no decorator for defined for portlet fragement," + currentFragment.getId()+". So using page default, "+defaultPortletDecorator); + addStyle(context, defaultPortletDecorator, Fragment.PORTLET); } } @@ -267,6 +270,13 @@ context.setSessionAttribute("cssUrls", cssUrls); } - cssUrls.add("/WEB-INF/decorations/" + decoratorType + "/html/" + decoratorName + "/css/styles.css"); + if(decoratorType.equals(Fragment.LAYOUT)) + { + cssUrls.add("content/css/styles.css"); + } + else + { + cssUrls.add("content/"+decoratorName+"/css/styles.css"); + } } } 1.3 +4 -6 jakarta-jetspeed-2/portal/src/webapp/WEB-INF/decorations/layout/html/minty-blue/decorator-top.vm Index: decorator-top.vm =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/decorations/layout/html/minty-blue/decorator-top.vm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- decorator-top.vm 20 Jul 2004 21:36:31 -0000 1.2 +++ decorator-top.vm 28 Jul 2004 13:28:04 -0000 1.3 @@ -19,12 +19,10 @@ <html> <head> <title>Welcome to Jetspeed 2</title> - <style type="text/css" media="all"> - #set($cssUrls = $renderRequest.getPortletSession().getAttribute("cssUrls")) - #foreach($cssUrl in $cssUrls) - #parse("$cssUrl") - #end - </style> +#set($cssUrls = $renderRequest.getPortletSession().getAttribute("cssUrls")) +#foreach($cssUrl in $cssUrls) + <link rel="stylesheet" type="text/css" media="all" href="$cssUrl" /> +#end </head> <body class="layout-MintyBlue">
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]