diff --git a/dspace-jspui/src/main/java/org/dspace/app/webui/components/TopCommunitiesSiteProcessor.java b/dspace-jspui/src/main/java/org/dspace/app/webui/components/TopCommunitiesSiteProcessor.java new file mode 100644 index 0000000000..5b355a7a02 --- /dev/null +++ b/dspace-jspui/src/main/java/org/dspace/app/webui/components/TopCommunitiesSiteProcessor.java @@ -0,0 +1,58 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +package org.dspace.app.webui.components; + +import java.sql.SQLException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.dspace.authorize.AuthorizeException; +import org.dspace.content.Community; +import org.dspace.core.Context; +import org.dspace.plugin.PluginException; +import org.dspace.plugin.SiteHomeProcessor; + +/** + * This class add top communities object to the request attributes to use in + * the site home page implementing the SiteHomeProcessor. + * + * @author Andrea Bollini + * + */ +public class TopCommunitiesSiteProcessor implements SiteHomeProcessor +{ + + /** + * blank constructor - does nothing. + * + */ + public TopCommunitiesSiteProcessor() + { + + } + + @Override + public void process(Context context, HttpServletRequest request, + HttpServletResponse response) throws PluginException, + AuthorizeException + { + // Get the top communities to shows in the community list + Community[] communities; + try + { + communities = Community.findAllTop(context); + } + catch (SQLException e) + { + throw new PluginException(e.getMessage(), e); + } + request.setAttribute("communities", communities); + } + +} diff --git a/dspace-jspui/src/main/webapp/index.jsp b/dspace-jspui/src/main/webapp/index.jsp index b9f9630a1e..cf9dfc5552 100644 --- a/dspace-jspui/src/main/webapp/index.jsp +++ b/dspace-jspui/src/main/webapp/index.jsp @@ -66,10 +66,6 @@ throw new ServletException(e); } - // Home page shows community list - Community[] communities = Community.findAllTop(context); - request.setAttribute("communities", communities); - // Show home page JSP JSPManager.showJSP(request, response, "/home.jsp"); } diff --git a/dspace/config/dspace.cfg b/dspace/config/dspace.cfg index c7caf59220..973bdbb8eb 100644 --- a/dspace/config/dspace.cfg +++ b/dspace/config/dspace.cfg @@ -1160,6 +1160,7 @@ plugin.sequence.org.dspace.plugin.CollectionHomeProcessor = \ # org.dspace.app.webui.components.RecentCollectionSubmissions,\ plugin.sequence.org.dspace.plugin.SiteHomeProcessor = \ + org.dspace.app.webui.components.TopCommunitiesSiteProcessor,\ org.dspace.app.webui.components.RecentSiteSubmissions,\ org.dspace.app.webui.discovery.SideBarFacetProcessor