diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/BrowseController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/BrowseController.java index 100b7b25c..a284f2d69 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/BrowseController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/BrowseController.java @@ -43,51 +43,56 @@ import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateMo public class BrowseController extends FreemarkerHttpServlet { static final long serialVersionUID=2006030721126L; - + private static final Log log = LogFactory.getLog(BrowseController.class); - private static final String TEMPLATE_DEFAULT = "classGroups.ftl"; + private static final String TEMPLATE_DEFAULT = "classGroups.ftl"; @Override protected String getTitle(String siteName, VitroRequest vreq) { - return "Index of Contents"; + return "Index to " + siteName + " Contents"; } - + @Override protected ResponseValues processRequest(VitroRequest vreq) { - + Map body = new HashMap(); String message = null; String templateName = TEMPLATE_DEFAULT; - if ( vreq.getParameter("clearcache") != null ) //mainly for debugging - clearGroupCache(); - - int portalId = vreq.getPortalId(); - - List groups = null; - VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext()); - if ( vcgc == null ) { - log.error("Could not get VClassGroupCache"); - message = "The system is not configured correctly. Please check your logs for error messages."; - } else { - groups =vcgc.getGroups( vreq.getPortalId()); - List vcgroups = new ArrayList(groups.size()); - for (VClassGroup group : groups) { - vcgroups.add(new VClassGroupTemplateModel(group)); + if( vreq.getParameter("clearcache") != null ) //mainly for debugging + clearGroupCache(); + + int portalId = vreq.getPortalId(); + + List groups = null; + VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext()); + if( vcgc == null ){ + log.error("Could not get VClassGroupCache"); + message = "The system is not configured correctly. Please check your logs for error messages."; + }else{ + groups =vcgc.getGroups( vreq.getPortalId()); + if (groups == null || groups.isEmpty()) { + message = "There are not yet any items in the system."; } - body.put("classGroups", vcgroups); - } - - if (message != null) { - body.put("message", message); - templateName = Template.TITLED_MESSAGE.toString(); - } - + else { + List vcgroups = new ArrayList(groups.size()); + for (VClassGroup group : groups) { + vcgroups.add(new VClassGroupTemplateModel(group)); + } + body.put("classGroups", vcgroups); + } + } + + if (message != null) { + body.put("message", message); + templateName = Template.TITLED_MESSAGE.toString(); + } + return new TemplateResponseValues(templateName, body); } protected void clearGroupCache(){ VClassGroupCache.getVClassGroupCache(getServletContext()).clearGroupCache(); } -} \ No newline at end of file +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java index 6d7a1425e..73657df64 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreemarkerConfigurationLoader.java @@ -126,10 +126,6 @@ public class FreemarkerConfigurationLoader { log.error("Error setting value for url_escaping_charset."); } - // auto include setup.ftl which allows for globals to be easily defined in a template that's always included - // used primarily to setup ${bodyClasses} for now - config.addAutoInclude("pageSetup.ftl"); - config.setTemplateLoader(getTemplateLoader(config, themeDir)); return config;