weaver 2004/09/20 12:26:01
Modified: portal/src/webapp/WEB-INF/decorations/layout/html/jetspeed
decorator-top.vm
portal/src/java/org/apache/jetspeed/velocity
JetspeedPowerTool.java
portal/src/webapp/WEB-INF jetspeed_macros.vm
Added: portal/src/webapp/WEB-INF/decorations/layout/html/jetspeed
decorator.properties
Log:
Added configuration support for layout decorations
Revision Changes Path
1.18 +6 -7
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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- decorator-top.vm 17 Sep 2004 20:26:54 -0000 1.17
+++ decorator-top.vm 20 Sep 2004 19:26:01 -0000 1.18
@@ -16,19 +16,18 @@
#* Add all template constants to the current context *#
#defineConstants()
+#* Add the current layouts configuration values to the context *#
+#defineLayoutObjects()
+
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-## #set($preferedLocal =
$request.getAttribute("org.apache.jetspeed.prefered.locale"))
-#set($preferedLocale = $JS2RequestContext.locale)
<html>
<head>
<title>$jetspeed.page.getTitle($preferedLocale)</title>
-#set($cssUrls = $renderRequest.getAttribute("cssUrls"))
-#foreach($cssUrl in $cssUrls)
- <link rel="stylesheet" type="text/css" media="all" href="$cssUrl" />
-#end
+ #includeStyleSheets()
</head>
-<body class="layout-Jetspeed">
+<body class="${_layouyBaseCssClass}">
#set($myF = $jetspeed.currentFragment)
1.1
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator.properties
Index: decorator.properties
===================================================================
# Copyright 2004 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
id=jetspeed
template.type=velocity
template.extension=.vm
decorates=layout
base.css.class=layout-Jetspeed
1.28 +15 -3
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerTool.java
Index: JetspeedPowerTool.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerTool.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- JetspeedPowerTool.java 17 Sep 2004 18:33:16 -0000 1.27
+++ JetspeedPowerTool.java 20 Sep 2004 19:26:01 -0000 1.28
@@ -485,13 +485,25 @@
return getTemplate(path, templateType, templateLocator,
templateLocatorDescriptor);
}
- public Configuration getTypeConfiguration(String type, String name) throws
Exception
+ public Configuration getTypeConfiguration(String type, String name, String
location) throws Exception
{
ArgUtil.assertNotNull(String.class, type, this,
"getTypeConfiguration(String type, String name)");
ArgUtil.assertNotNull(String.class, name, this,
"getTypeConfiguration(String type, String name)");
try
{
- TemplateDescriptor locator = getTemplate(name+"/"+type+".properties",
type);
+ TemplateDescriptor locator = null;
+ if(location.equals("templates"))
+ {
+ locator = getTemplate(name+"/"+type+".properties", type);
+ }
+ else if(location.equals("decorations"))
+ {
+ locator = getDecoration(name+"/decorator.properties", type);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Location type "+location+" is
not supported by getTypeConfiguration().");
+ }
return new PropertiesConfiguration(locator.getAbsolutePath());
}
catch (TemplateLocatorException e)
1.3 +17 -1 jakarta-jetspeed-2/portal/src/webapp/WEB-INF/jetspeed_macros.vm
Index: jetspeed_macros.vm
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/jetspeed_macros.vm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jetspeed_macros.vm 17 Sep 2004 18:33:17 -0000 1.2
+++ jetspeed_macros.vm 20 Sep 2004 19:26:01 -0000 1.3
@@ -6,8 +6,24 @@
#set($BOTTOM_TO_TOP = "BottomToTop")
#end
+#macro (defineLayoutObjects)
+ #set($_layoutDecorator = $myPage.getDefaultDecorator($myFragment.getType()))
+ #set($_layoutDecoratorConfig = $jetspeed.getTypeConfiguration("layout",
"${_layoutDecorator}", "decorations"))
+ #set($_layouyBaseCssClass = $_layoutDecoratorConfig.getString("base.css.class"))
+ #set($preferedLocale = $JS2RequestContext.locale)
+#end
+
+#* Adds link for all style sheets required by the layout and portlet decorations *#
+#macro (includeStyleSheets)
+ #set($cssUrls = $renderRequest.getAttribute("cssUrls"))
+ #foreach($cssUrl in $cssUrls)
+
+ <link rel="stylesheet" type="text/css" media="all" href="$cssUrl" />
+ #end
+#end
+
#macro (defineConfig $name $type)
- #set($_navConfig =$jetspeed.getTypeConfiguration("navigation", $name))
+ #set($_navConfig =$jetspeed.getTypeConfiguration("navigation", $name,
"templates"))
#end
#* Includes a navigation component *#
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]