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 a284f2d69..100b7b25c 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,56 +43,51 @@ 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 to " + siteName + " Contents"; + return "Index of 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()); - if (groups == null || groups.isEmpty()) { - message = "There are not yet any items in the system."; + 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)); } - 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(); - } - + 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 73657df64..6d7a1425e 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,6 +126,10 @@ 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; diff --git a/webapp/web/js/menupage/browseByVClass.js b/webapp/web/js/menupage/browseByVClass.js index acc2034a3..2fbd96624 100644 --- a/webapp/web/js/menupage/browseByVClass.js +++ b/webapp/web/js/menupage/browseByVClass.js @@ -43,7 +43,6 @@ var browseByVClass = { this.alphaIndexLinks.click(function() { uri = $('#browse-classes li a.selected').attr('data-uri'); alpha = $(this).attr('data-alpha'); - // alpha = $(this).text().substring(0, 1); browseByVClass.getIndividuals(uri, alpha); return false; }); @@ -57,7 +56,7 @@ var browseByVClass = { $('.pagination li a').click(function() { uri = $('#browse-classes li a.selected').attr('data-uri'); alpha = $('#alpha-browse-individuals li a.selected').attr('data-alpha'); - page = $(this).attr('class').substring(4,5); + page = $(this).attr('data-page'); browseByVClass.getIndividuals(uri, alpha, page); return false; }); @@ -173,11 +172,10 @@ var browseByVClass = { pagination += '

page

'; pagination += '