Skip to content

Commit

Permalink
Enabling basic use of different template
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Bollini committed Sep 30, 2013
1 parent 9236955 commit de04222
Showing 1 changed file with 19 additions and 6 deletions.
Expand Up @@ -21,6 +21,7 @@
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
import javax.servlet.jsp.tagext.TagSupport;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dspace.content.Collection;
import org.dspace.content.Community;
Expand Down Expand Up @@ -112,22 +113,34 @@ public class LayoutTag extends TagSupport
/** Syndication feed "autodiscovery" link data */
private String feedData;

private String templatePath;

public LayoutTag()
{
super();
String template = ConfigurationManager.getProperty("jspui", "template.name");
if (StringUtils.isNotBlank(template)
&& !"default".equalsIgnoreCase(template))
{
templatePath = "/layout/" + template + "/";
}
else
{
templatePath = "/layout/";
}
}

public int doStartTag() throws JspException
{
ServletRequest request = pageContext.getRequest();

// header file
String header = "/layout/header-default.jsp";
String header = templatePath + "header-default.jsp";

// Choose default style unless one is specified
if (style != null)
{
header = "/layout/header-" + style.toLowerCase() + ".jsp";
header = templatePath + "header-" + style.toLowerCase() + ".jsp";
}

// Sort out location bar
Expand Down Expand Up @@ -246,7 +259,7 @@ else if (locbar.equalsIgnoreCase("nolink"))
}
else
{
request.setAttribute("dspace.layout.navbar", "/layout/navbar-"
request.setAttribute("dspace.layout.navbar", templatePath + "navbar-"
+ navbar + ".jsp");
}

Expand Down Expand Up @@ -364,12 +377,12 @@ else if(collLinks)
public int doEndTag() throws JspException
{
// Footer file to use
String footer = "/layout/footer-default.jsp";
String footer = templatePath + "footer-default.jsp";

// Choose default flavour unless one is specified
if (style != null)
{
footer = "/layout/footer-" + style.toLowerCase() + ".jsp";
footer = templatePath + "footer-" + style.toLowerCase() + ".jsp";
}

try
Expand Down

0 comments on commit de04222

Please sign in to comment.