roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r412865 - in /incubator/roller/branches/roller_3.0: src/org/apache/roller/ui/rendering/velocity/ web/WEB-INF/classes/ web/WEB-INF/classes/flavors/ web/WEB-INF/classes/themes/ web/WEB-INF/velocity/ web/WEB-INF/velocity/templates/ web/WEB-INF...
Date Thu, 08 Jun 2006 22:06:54 GMT
Author: agilliland
Date: Thu Jun  8 15:06:51 2006
New Revision: 412865

URL: http://svn.apache.org/viewvc?rev=412865&view=rev
Log:
relocating our velocity files to the directory /WEB-INF/velocity/*


Added:
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/atommacros.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/atommacros.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/bookmark.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/bookmark.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/comments.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/comments.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/navbar.vm
      - copied, changed from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/newsfeed.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/newsfeed.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/referer.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/referer.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/roller.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/roller.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/rssmacros.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/rssmacros.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/error-page.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/error-page.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/feeds/
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/feeds/atom.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/flavors/atom.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/feeds/rss.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/flavors/rss.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/menu/
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/menu/menu-list.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/menu-list.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/menu/menu-tabbed.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/menu-tabbed.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/navbar/
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/navbar/navbar-css.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar-css.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/navbar/navbar-horizontal.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar-horizontal.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/navbar/navbar-vertical.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar-vertical.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/planet/
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/planet/planetrss.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/planetrss.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/weblog/
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/weblog/foaf.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/flavors/foaf.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/weblog/noop_decorator.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/themes/noop_decorator.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/weblog/opml.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/flavors/opml.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/weblog/popupcomments.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/popupcomments.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/templates/weblog/rsd.vm
      - copied unchanged from r412854, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/flavors/rsd.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/user.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/user.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/weblog.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/website.vm
      - copied unchanged from r412521, incubator/roller/branches/roller_3.0/web/WEB-INF/classes/website.vm
Removed:
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/atommacros.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/bookmark.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/comments.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/error-page.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/flavors/
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/menu-list.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/menu-tabbed.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar-css.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar-horizontal.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar-vertical.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/newsfeed.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/planetrss.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/popupcomments.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/referer.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/roller.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/rssmacros.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/themes/noop_decorator.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/user.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/weblog.vm
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/website.vm
Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FlavorServlet.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FoafServlet.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageHelper.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageServlet.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/RSDServlet.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/WebappResourceLoader.java

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FlavorServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FlavorServlet.java?rev=412865&r1=412864&r2=412865&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FlavorServlet.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FlavorServlet.java
Thu Jun  8 15:06:51 2006
@@ -50,9 +50,9 @@
  * <p>If there is a request parameter named "flavor", then the Velocity
  * template specified by that parameter will be used for rendering. For
  * example if the flavor is "rss092" then the template at classpath
- * "/flavors/rss092.vm" will be used for rendering.</p>
+ * "templates/feeds/rss092.vm" will be used for rendering.</p>
  *
- * <p>Otherwise, the template /flavors/rss.vm" will be used for rendering.</p>
+ * <p>Otherwise, the template templates/feeds/rss.vm" will be used for rendering.</p>
  *
  * <p>Assumes that If-Modified-Since has already been handled.</p>
  *
@@ -121,21 +121,21 @@
                     // user has defined an RSS override page, we will use that.
                     useTemplate = pageModel.getPageByName("_rss").getId();
                 else
-                    useTemplate = "/flavors/rss.vm";
+                    useTemplate = "templates/feeds/rss.vm";
             } else if (request.getServletPath().endsWith("atom")) {
                 if (pageModel.getPageByName("_atom") != null)
                     // If the request specified the "/atom" mapping and the
                     // user has defined an Atom override page, we will use that.
                     useTemplate = pageModel.getPageByName("_atom").getId();
                 else
-                    useTemplate = "/flavors/atom.vm";
+                    useTemplate = "templates/feeds/atom.vm";
             } else if (request.getParameter("flavor") != null) {
                 // If request specifies a "flavor" then use that.
                 String flavor = request.getParameter("flavor");
-                useTemplate = "/flavors/" + flavor + ".vm";
+                useTemplate = "templates/feeds/" + flavor + ".vm";
             } else {
                 // Fall through to default RSS page template.
-                useTemplate = "/flavors/rss.vm";
+                useTemplate = "templates/feeds/rss.vm";
             }
             
             outty = getTemplate(useTemplate);

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FoafServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FoafServlet.java?rev=412865&r1=412864&r2=412865&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FoafServlet.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/FoafServlet.java
Thu Jun  8 15:06:51 2006
@@ -99,7 +99,7 @@
             setupContext(ctx, rreq);
             
             response.setContentType("application/rdf+xml");
-            return getTemplate("/flavors/foaf.vm");
+            return getTemplate("templates/weblogs/foaf.vm");
             
         } catch (Exception e) {
             mLogger.error("ERROR in FoafServlet", e);

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageHelper.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageHelper.java?rev=412865&r1=412864&r2=412865&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageHelper.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageHelper.java
Thu Jun  8 15:06:51 2006
@@ -255,11 +255,11 @@
         editorTag.setPageContext(mPageContext);
         if ( vertical )
         {
-            editorTag.setView("/navbar-vertical.vm");
+            editorTag.setView("templates/navbar/navbar-vertical.vm");
         }
         else
         {
-            editorTag.setView("/navbar-horizontal.vm");
+            editorTag.setView("templates/navbar/navbar-horizontal.vm");
         }
         editorTag.setModel("editor-menu.xml");
         return editorTag.emit();

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageServlet.java?rev=412865&r1=412864&r2=412865&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageServlet.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PageServlet.java
Thu Jun  8 15:06:51 2006
@@ -68,7 +68,6 @@
         throws ServletException {
         
         super.init( config );
-        WebappResourceLoader.setServletContext( getServletContext() );
     }
     
     
@@ -118,7 +117,7 @@
                 
                 // User doesn't have one so return the default
                 if(page == null) {
-                    page = new WeblogTemplate("/popupcomments.vm", website, 
+                    page = new WeblogTemplate("templates/weblog/popupcomments.vm", website,

                             "Comments", "Comments", "dummy_link", 
                             "dummy_template", new Date());
                 }
@@ -202,7 +201,7 @@
             // it to the template author so they can debug it.
             ctx.put("displayException", parseError);
             try {
-                outty = getTemplate("error-page.vm", "UTF-8");
+                outty = getTemplate("templates/error-page.vm", "UTF-8");
             } catch (Throwable totallyUnexpected) {
                 throw new RuntimeException("ERROR parsing Velocity error page");
             }
@@ -251,7 +250,7 @@
         // couldn't find Template, load default "no-op" decorator
         if (decorator == null) {
             try {
-                decorator = getTemplate("/themes/noop_decorator.vm", "UTF-8");
+                decorator = getTemplate("/templates/weblog/noop_decorator.vm", "UTF-8");
             } catch (ResourceNotFoundException ex) {
                 // just rethrow
                 throw ex;

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java?rev=412865&r1=412864&r2=412865&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetFeedServlet.java
Thu Jun  8 15:06:51 2006
@@ -108,7 +108,7 @@
             }
             context.put("entryCount", new Integer(entryCount));            
             
-            return getTemplate("planetrss.vm");
+            return getTemplate("templates/planet/planetrss.vm");
         }
         catch (Exception e)
         {

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/RSDServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/RSDServlet.java?rev=412865&r1=412864&r2=412865&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/RSDServlet.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/RSDServlet.java
Thu Jun  8 15:06:51 2006
@@ -1,24 +1,19 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* 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.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * RSDServlet.java
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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
  *
- * Created on December 14, 2005, 6:08 PM
+ *     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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
  */
 
 package org.apache.roller.ui.rendering.velocity;
@@ -108,7 +103,7 @@
             ctx.put("absBaseURL", rollerContext.getAbsoluteContextUrl(request));
             
             // lookup our rsd template
-            template = getTemplate("/flavors/rsd.vm");
+            template = getTemplate("templates/weblog/rsd.vm");
             
             // make sure response content type is properly set
             response.setContentType("application/rsd+xml");

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/WebappResourceLoader.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/WebappResourceLoader.java?rev=412865&r1=412864&r2=412865&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/WebappResourceLoader.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/WebappResourceLoader.java
Thu Jun  8 15:06:51 2006
@@ -1,137 +1,116 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* 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.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
 package org.apache.roller.ui.rendering.velocity;
 
 import java.io.InputStream;
-
 import javax.servlet.ServletContext;
-
 import org.apache.commons.collections.ExtendedProperties;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.ui.core.RollerContext;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.resource.Resource;
 import org.apache.velocity.runtime.resource.loader.ResourceLoader;
-import org.apache.roller.ui.core.RollerContext;
+
 
 /**
- * Tries to load Velocity resources from the Webapp.
- * This class borrows heavily from
- * org.apache.velocity.tools.view.servlet.WebappLoader
- * http://cvs.apache.org/viewcvs/jakarta-velocity-
- * tools/view/src/java/org/apache/velocity/tools/view/servlet/WebappLoader.java?
- * rev=1.1.1.1&content-type=text/vnd.viewcvs-markup
- * 
- * @author Lance Lavandowska
+ * Loads Velocity resources from the webapp.
+ *
+ * All resource urls begin from the root of the webapp.  If a resource path
+ * is relative (does not begin with a /) then it is prefixed with the path
+ * /WEB-INF/velocity/, which is where Roller keeps its velocity files.
  */
-public class WebappResourceLoader extends ResourceLoader
-{
-	private static Log mLogger = 
-		LogFactory.getFactory().getInstance(WebappResourceLoader.class);
-    
-    private static ServletContext mContext = null; 
-  
-	/**
-	 * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#init(org.apache.commons.collections.ExtendedProperties)
-	 */
-	public void init(ExtendedProperties arg0)
-	{
-		rsvc.info("WebappResourceLoader : initialization starting.");
-
-		this.getContext();
-		if (mContext == null)
-		{
-			mLogger.warn("WebappResourceLoader : Unable to find ServletContext!");
-		}
-
-		rsvc.info("WebappResourceLoader : initialization complete.");
-	}
-	
-	private ServletContext getContext()
-	{
-		if (mContext == null)
-		{
-			mContext = RollerContext.getServletContext();
-		}
-		return mContext;
-	}
-	
-	public static void setServletContext(ServletContext context)
-	{
-		mContext = context;
-	}
-	
-	/**
-	 * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getResourceStream(java.lang.String)
-	 */
-	public InputStream getResourceStream(String name)
-		throws ResourceNotFoundException
-	{
-		InputStream result = null;
-        
-		if (name == null || name.length() == 0)
-		{
-			throw new ResourceNotFoundException ("No template name provided");
-		}
-        
-		try 
-		{
-			if (!name.startsWith("/"))
-				name = "/" + name;
-
-			result = getContext().getResourceAsStream( name );
-		}
-		catch( NullPointerException npe)
-		{
-			String msg = "WebappResourceLoader.getResourceStream(): " + name;
-			if (mContext == null)
-			{
-				mLogger.info("WebappResourceLoader("+name+"): ServletContext is null");
-				msg += "\n\tServletContext is null";
-			}
-			throw new ResourceNotFoundException(msg);
-		}
-		catch( Exception fnfe )
-		{
-			/*
-			 *  log and convert to a general Velocity ResourceNotFoundException
-			 */            
-			throw new ResourceNotFoundException( fnfe.getMessage() );
-		}
-        
-		return result;
-	}
-	
-	/**
-	 * Defaults to return false.
-	 * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource)
-	 */
-	public boolean isSourceModified(Resource arg0)
-	{
-		return false;
-	}
-	
-	/**
-	 * Defaults to return 0.
-	 * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
-	 */
-	public long getLastModified(Resource arg0)
-	{
-		return 0;
-	}
+public class WebappResourceLoader extends ResourceLoader {
+    
+    private static Log log = LogFactory.getLog(WebappResourceLoader.class);
+    
+    private ServletContext mContext = null;
+    
+    
+    /**
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#init(org.apache.commons.collections.ExtendedProperties)
+     */
+    public void init(ExtendedProperties config) {
+        
+        log.debug("WebappResourceLoader : initialization starting.");
+        
+        if (mContext == null) {
+            mContext = RollerContext.getServletContext();
+            log.debug("Servlet Context = "+mContext.getRealPath("/WEB-INF/velocity/"));
+        }
+        
+        log.debug(config);
+        
+        log.debug("WebappResourceLoader : initialization complete.");
+    }
+    
+    
+    /**
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getResourceStream(java.lang.String)
+     */
+    public InputStream getResourceStream(String name) 
+            throws ResourceNotFoundException {
+        
+        log.debug("Looking up resource named ... "+name);
+        
+        if (name == null || name.length() == 0) {
+            throw new ResourceNotFoundException("No template name provided");
+        }
+        
+        InputStream result = null;
+        
+        try {
+            if(!name.startsWith("/"))
+                name = "/WEB-INF/velocity/" + name;
+            
+            result = this.mContext.getResourceAsStream(name);
+            
+        } catch(Exception e) {
+            throw new ResourceNotFoundException(e.getMessage());
+        }
+        
+        if(result == null) {
+            throw new ResourceNotFoundException("Couldn't find "+name);
+        }
+        
+        return result;
+    }
+    
+    
+    /**
+     * Files loaded by this resource loader are considered static, so they are
+     * never reloaded by velocity.
+     *
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource)
+     */
+    public boolean isSourceModified(Resource arg0) {
+        return false;
+    }
+    
+    
+    /**
+     * Defaults to return 0.
+     *
+     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
+     */
+    public long getLastModified(Resource arg0) {
+        return 0;
+    }
+    
 }

Copied: incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/navbar.vm (from r412521,
incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar.vm)
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/navbar.vm?p2=incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/navbar.vm&p1=incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar.vm&r1=412521&r2=412865&rev=412865&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/classes/navbar.vm (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/navbar.vm Thu Jun  8 15:06:51
2006
@@ -24,7 +24,7 @@
  * Show Editor navbar using CSS friendly template.
  *#
 #macro( showEditorMenu )
-    $pageHelper.showMenu("editor-menu.xml", "/navbar-css.vm")
+    $pageHelper.showMenu("editor-menu.xml", "templates/navbar/navbar-css.vm")
 #end
 
 #**



Mime
View raw message