Added support for jsp templates, as Paul suggested,  

Every other bit is the same last patch..

Saludos ,
Ignacio J. Ortega
*** src/java/org/apache/jetspeed/util/template/JetspeedTemplateNavigation.java  Wed 
Dec 31 14:00:00 1969
--- src/java/org/apache/jetspeed/util/template/JetspeedTemplateNavigation.java  Sun 
Oct 14 03:33:22 2001
***************
*** 0 ****
--- 1,80 ----
+ /* ====================================================================
+  * The Apache Software License, Version 1.1
+  *
+  * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
+  * reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  *
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  *
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in
+  *    the documentation and/or other materials provided with the
+  *    distribution.
+  *
+  * 3. The end-user documentation included with the redistribution,
+  *    if any, must include the following acknowledgment:
+  *       "This product includes software developed by the
+  *        Apache Software Foundation (http://www.apache.org/)."
+  *    Alternately, this acknowledgment may appear in the software itself,
+  *    if and wherever such third-party acknowledgments normally appear.
+  *
+  * 4. The names "Apache" and "Apache Software Foundation" and
+  *     "Apache Jetspeed" must not be used to endorse or promote products
+  *    derived from this software without prior written permission. For
+  *    written permission, please contact [EMAIL PROTECTED]
+  *
+  * 5. Products derived from this software may not be called "Apache" or
+  *    "Apache Jetspeed", nor may "Apache" appear in their name, without
+  *    prior written permission of the Apache Software Foundation.
+  *
+  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  * ====================================================================
+  *
+  * This software consists of voluntary contributions made by many
+  * individuals on behalf of the Apache Software Foundation.  For more
+  * information on the Apache Software Foundation, please see
+  * <http://www.apache.org/>.
+  */
+ 
+ package org.apache.jetspeed.util.template;
+ 
+ import org.apache.turbine.util.template.*;
+ import org.apache.turbine.util.RunData;
+ import org.apache.jetspeed.services.TemplateLocator;
+ /**
+  * A Class that produce localized navigations.
+  *
+  *
+  * @author Ignacio J. Ortega
+  */
+ public class JetspeedTemplateNavigation extends TemplateNavigation {
+ 
+ 
+     private RunData data;
+ 
+     public JetspeedTemplateNavigation(RunData data) {
+         super(data);
+         this.data=data;
+     }
+ 
+     public TemplateNavigation setTemplate(String template) {
+         return 
+super.setTemplate(TemplateLocator.locateNavigationTemplate(data,template));
+     }
+ }
+ 

*** src/java/org/apache/jetspeed/modules/pages/JetspeedVelocityPage.java        
2001/03/07 06:44:15     1.2
--- src/java/org/apache/jetspeed/modules/pages/JetspeedVelocityPage.java        
2001/10/18 22:04:02
***************
*** 90,96 ****
          context.put("clink", new ContentTemplateLink(data));
          // the jetspeed configuration elements
          context.put("config", new JetspeedResources());
!         
          data.getTemplateInfo().setTemplateContext(VelocityService.CONTEXT, context);
      }
  }
--- 90,98 ----
          context.put("clink", new ContentTemplateLink(data));
          // the jetspeed configuration elements
          context.put("config", new JetspeedResources());
!         // New JetSpeed NAvigation Generator
!         context.put("jnavigation", new JetspeedTemplateNavigation(data));
! 
          data.getTemplateInfo().setTemplateContext(VelocityService.CONTEXT, context);
      }
  }


*** src/java/org/apache/jetspeed/services/TemplateLocator.java  2001/07/07 21:06:18    
 1.1
--- src/java/org/apache/jetspeed/services/TemplateLocator.java  2001/10/18 22:04:57
***************
*** 120,124 ****
--- 120,132 ----
          return getService().locateControllerTemplate(data, template);
      }
  
+     /**
+      * @see TemplateLocatorService#locateNavigationTemplate
+      */
+     public static String locateNavigationTemplate(RunData data, String template)
+     {
+         return getService().locateNavigationTemplate(data, template);
+     }
+ 
  
  }


*** src/java/org/apache/jetspeed/services/jsp/tags/NavigationTag.java   2001/03/07 
06:48:39     1.2
--- src/java/org/apache/jetspeed/services/jsp/tags/NavigationTag.java   2001/10/18 
22:05:11
***************
*** 58,64 ****
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  
! // Turbine Classes 
  import org.apache.turbine.modules.NavigationLoader;
  import org.apache.turbine.util.*;
  import org.apache.turbine.services.template.TemplateService;
--- 58,67 ----
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  
! // JetSpeed Classes
! import org.apache.jetspeed.services.TemplateLocator;
! 
! // Turbine Classes
  import org.apache.turbine.modules.NavigationLoader;
  import org.apache.turbine.util.*;
  import org.apache.turbine.services.template.TemplateService;
***************
*** 68,74 ****
  
  /**
   * Supporting class for the navigation tag.
!  * Includes a navigation JSP. If the respective tag parameter is set, 
   * different JSPs will be choosen, depending on whether the user has 
   * already logged in or not.
   *
--- 71,77 ----
  
  /**
   * Supporting class for the navigation tag.
!  * Includes a navigation JSP. If the respective tag parameter is set,
   * different JSPs will be choosen, depending on whether the user has 
   * already logged in or not.
   *
***************
*** 117,130 ****
          String module   = null;
  
          RunData data = (RunData)pageContext.getAttribute(JspService.RUNDATA, 
PageContext.REQUEST_SCOPE);
- 
          try
          {  
              /* LOGGED_IN */
              if ( (data != null) && (data.getUser() != null) && 
data.getUser().hasLoggedIn() && (loggedInTemplate != null) ) 
                template = loggedInTemplate;
  
!             data.getTemplateInfo().setNavigationTemplate(template);
  
              pageContext.getOut().flush();
              module = ((TemplateService)TurbineServices.getInstance().getService(
--- 120,133 ----
          String module   = null;
  
          RunData data = (RunData)pageContext.getAttribute(JspService.RUNDATA, 
PageContext.REQUEST_SCOPE);
          try
          {  
              /* LOGGED_IN */
              if ( (data != null) && (data.getUser() != null) && 
data.getUser().hasLoggedIn() && (loggedInTemplate != null) ) 
                template = loggedInTemplate;
  
!             data.getTemplateInfo().setNavigationTemplate(
!                         TemplateLocator.locateNavigationTemplate(data,template));
  
              pageContext.getOut().flush();
              module = ((TemplateService)TurbineServices.getInstance().getService(


*** src/java/org/apache/jetspeed/services/template/JetspeedTemplateLocatorService.java 
 2001/07/07 21:06:22     1.1
--- src/java/org/apache/jetspeed/services/template/JetspeedTemplateLocatorService.java 
 2001/10/18 22:05:23
***************
*** 119,124 ****
--- 119,125 ----
      private final static String DIR_PORTLETS = "/portlets";
      private final static String DIR_CONTROLS = "/controls";
      private final static String DIR_CONTROLLERS = "/controllers";
+     private final static String DIR_NAVIGATIONS = "/navigations";
      private static final String PATH_SEPARATOR = "/";
  
      // messages
***************
*** 341,346 ****
--- 342,379 ----
          }
          if (null != located)
              return DIR_CONTROLLERS + located;
+         return null;
+     }
+ 
+         /**
+      * Locate a controller template using Jetspeed template location algorithm, 
+searching by
+      * mediatype and language criteria extracted from the request state in rundata.
+      *
+      * @param data The rundata for the request.
+      * @param template The name of the template.
+      *
+      * @return The path relative to the controllers directory for the requested 
+controller template,
+      *          or null if not found.
+      */
+     public String locateNavigationTemplate(RunData data, String template)
+     {
+         String path = localizeTemplateName(data);
+ 
+         String located = locateTemplate(data, DIR_NAVIGATIONS, path, template);
+         if (null == located)
+         {
+             // Try to locate it directly on file system, perhaps it was recently 
+added
+             useNameCache = false;
+             located = locateTemplate(data, DIR_NAVIGATIONS, path, template);
+             if (null != located)
+             {
+                 // add it to the map
+                 templateMap.put( located, null );
+             }
+             useNameCache = true;
+         }
+         if (null != located)
+             return located;
          return null;
      }
  


*** src/java/org/apache/jetspeed/services/template/TemplateLocatorService.java  
2001/07/07 21:06:22     1.1
--- src/java/org/apache/jetspeed/services/template/TemplateLocatorService.java  
2001/10/18 22:05:33
***************
*** 145,148 ****
--- 145,160 ----
       */
      public String locateControllerTemplate(RunData data, String template);
  
+     /**
+      * Locate a navigation template using Jetspeed template location algorithm, 
+searching by
+      * mediatype and language criteria extracted from the request state in rundata.
+      *
+      * @param data The rundata for the request.
+      * @param template The name of the template.
+      *
+      * @return The path relative to the controllers directory for the requested 
+controller template,
+      *          or null if not found.
+      */
+     public String locateNavigationTemplate(RunData data, String template);
+ 
  }

*** webapp/WEB-INF/templates/jsp/layouts/html/default.jsp       2001/02/08 12:28:07    
 1.7
--- webapp/WEB-INF/templates/jsp/layouts/html/default.jsp       2001/10/18 22:05:59
***************
*** 18,24 ****
        <img src="<jetspeed:contentUri href="images/jetspeed-logo.gif" />">
      </td>
      <td>
!       <jetspeed:navigation  defaultTemplate="html/top_default.jsp"  
loggedInTemplate="html/top_loggedIn.jsp" />
      </td>
    </tr>
  </table>
--- 18,24 ----
        <img src="<jetspeed:contentUri href="images/jetspeed-logo.gif" />">
      </td>
      <td>
!       <jetspeed:navigation  defaultTemplate="top_default.jsp"  
loggedInTemplate="top_loggedIn.jsp" />
      </td>
    </tr>
  </table>
***************
*** 27,33 ****
    <tr>
      <td valign="top" bgcolor="#ffffff">
     
!       <jetspeed:navigation defaultTemplate="html/left.jsp" />
  
  <%-- Enable for Debugging ("Included servlet Error: 500")
  Including:<%= screenJsp %> <p>
--- 27,33 ----
    <tr>
      <td valign="top" bgcolor="#ffffff">
     
!       <jetspeed:navigation defaultTemplate="left.jsp" />
  
  <%-- Enable for Debugging ("Included servlet Error: 500")
  Including:<%= screenJsp %> <p>


*** webapp/WEB-INF/templates/vm/layouts/html/default.vm 2001/07/29 13:42:52     1.2
--- webapp/WEB-INF/templates/vm/layouts/html/default.vm 2001/10/18 22:06:12
***************
*** 7,19 ****
      <table cellspacing="0" width="100%" border="0" cellpadding="0">
        <tr>
          <td><img src="$clink.setURI("images/jetspeed-logo.gif").Absolute" /></td>
!         <td>$navigation.setTemplate("html/top.vm")</td>
        </tr>
      </table>
      <table cellspacing="0" width="100%" cellpadding="0" border="0">
        <tr>
          <td valign="top" bgcolor="#ffffff">   
!           $navigation.setTemplate("html/left.vm")
          </td>
          <td valign="top">
            $screen_placeholder 
--- 7,19 ----
      <table cellspacing="0" width="100%" border="0" cellpadding="0">
        <tr>
          <td><img src="$clink.setURI("images/jetspeed-logo.gif").Absolute" /></td>
!         <td>$jnavigation.setTemplate("top.vm")</td>
        </tr>
      </table>
      <table cellspacing="0" width="100%" cellpadding="0" border="0">
        <tr>
          <td valign="top" bgcolor="#ffffff">   
!           $jnavigation.setTemplate("left.vm")
          </td>
          <td valign="top">
            $screen_placeholder 
***************
*** 23,31 ****
      <table cellspacing="0" width="100%" cellpadding="0" border="0">
        <tr>
          <td valign="bottom" bgcolor="#ffffff">
!           $navigation.setTemplate("html/bottom.vm")
          </td>
        </tr>
      </table>
    </body>
! </html>
\ No newline at end of file
--- 23,31 ----
      <table cellspacing="0" width="100%" cellpadding="0" border="0">
        <tr>
          <td valign="bottom" bgcolor="#ffffff">
!           $jnavigation.setTemplate("bottom.vm")
          </td>
        </tr>
      </table>
    </body>
! </html>



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

Reply via email to