*** 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 apache@apache.org.
+ *
+ * 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
+ * .
+ */
+
+ 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/11/01 16:23:45
***************
*** 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/11/01 16:24:01
***************
*** 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/11/01 16:24:10
***************
*** 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/11/01 16:24:20
***************
*** 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/11/01 16:24:29
***************
*** 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/11/01 16:24:59
***************
*** 18,24 ****
">
!
|
--- 18,24 ----
">
!
|
***************
*** 27,33 ****
|
!
<%-- Enable for Debugging ("Included servlet Error: 500")
Including:<%= screenJsp %>
--- 27,33 ----
|
|
!
<%-- Enable for Debugging ("Included servlet Error: 500")
Including:<%= screenJsp %>
*** 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/11/01 16:25:08
***************
*** 7,19 ****
 |
! $navigation.setTemplate("html/top.vm") |
|
! $navigation.setTemplate("html/left.vm")
|
$screen_placeholder
--- 7,19 ----
 |
! $jnavigation.setTemplate("top.vm") |
|
! $jnavigation.setTemplate("left.vm")
|
$screen_placeholder
***************
*** 23,31 ****
|
! $navigation.setTemplate("html/bottom.vm")
|
| | |