diff --git a/dspace-jspui/src/main/webapp/home.jsp b/dspace-jspui/src/main/webapp/home.jsp index 12fc3ce144..15e18e5bfd 100644 --- a/dspace-jspui/src/main/webapp/home.jsp +++ b/dspace-jspui/src/main/webapp/home.jsp @@ -15,12 +15,16 @@ - recent.submissions - RecetSubmissions --%> +<%@page import="org.dspace.core.factory.CoreServiceFactory"%> +<%@page import="org.dspace.core.service.NewsService"%> +<%@page import="org.dspace.content.service.CommunityService"%> +<%@page import="org.dspace.content.factory.ContentServiceFactory"%> +<%@page import="org.dspace.content.service.ItemService"%> <%@page import="org.dspace.core.Utils"%> <%@page import="org.dspace.content.Bitstream"%> <%@ page contentType="text/html;charset=UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> - <%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %> <%@ page import="java.io.File" %> @@ -33,18 +37,17 @@ <%@ page import="org.dspace.app.webui.components.RecentSubmissions" %> <%@ page import="org.dspace.content.Community" %> <%@ page import="org.dspace.core.ConfigurationManager" %> -<%@ page import="org.dspace.core.NewsServiceImpl" %> <%@ page import="org.dspace.browse.ItemCounter" %> -<%@ page import="org.dspace.content.Metadatum" %> <%@ page import="org.dspace.content.Item" %> <% - Community[] communities = (Community[]) request.getAttribute("communities"); + List communities = (List) request.getAttribute("communities"); Locale sessionLocale = UIUtil.getSessionLocale(request); Config.set(request.getSession(), Config.FMT_LOCALE, sessionLocale); - String topNews = NewsServiceImpl.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-top.html")); - String sideNews = NewsServiceImpl.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-side.html")); + NewsService newsService = CoreServiceFactory.getInstance().getNewsService(); + String topNews = newsService.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-top.html")); + String sideNews = newsService.readNewsFile(LocaleSupport.getLocalizedMessage(pageContext, "news-side.html")); boolean feedEnabled = ConfigurationManager.getBooleanProperty("webui.feed.enable"); String feedData = "NONE"; @@ -56,6 +59,8 @@ ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request)); RecentSubmissions submissions = (RecentSubmissions) request.getAttribute("recent.submissions"); + ItemService itemService = ContentServiceFactory.getInstance().getItemService(); + CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService(); %> @@ -110,23 +115,21 @@ if (submissions != null && submissions.count() > 0) boolean first = true; for (Item item : submissions.getRecentSubmissions()) { - Metadatum[] dcv = item.getMetadata("dc", "title", null, Item.ANY); - String displayTitle = "Untitled"; - if (dcv != null & dcv.length > 0) + String displayTitle = itemService.getMetadataFirstValue(item, "dc", "title", null, Item.ANY); + if (displayTitle == null) { - displayTitle = Utils.addEntities(dcv[0].value); + displayTitle = "Untitled"; } - dcv = item.getMetadata("dc", "description", "abstract", Item.ANY); - String displayAbstract = ""; - if (dcv != null & dcv.length > 0) + String displayAbstract = itemService.getMetadataFirstValue(item, "dc", "description", "abstract", Item.ANY); + if (displayAbstract == null) { - displayAbstract = Utils.addEntities(dcv[0].value); + displayAbstract = ""; } %>
"> -
<%= StringUtils.abbreviate(displayTitle, 400) %> +
<%= Utils.addEntities(StringUtils.abbreviate(displayTitle, 400)) %> See -

<%= StringUtils.abbreviate(displayAbstract, 500) %>

+

<%= Utils.addEntities(StringUtils.abbreviate(displayAbstract, 500)) %>

<% @@ -159,7 +162,7 @@ if (submissions != null && submissions.count() > 0)
<% -if (communities != null && communities.length != 0) +if (communities != null && communities.size() != 0) { %>
@@ -168,11 +171,11 @@ if (communities != null && communities.length != 0)
<% boolean showLogos = ConfigurationManager.getBooleanProperty("jspui.home-page.logos", true); - for (int i = 0; i < communities.length; i++) + for (Community com : communities) { %>
<% - Bitstream logo = communities[i].getLogo(); + Bitstream logo = com.getLogo(); if (showLogos && logo != null) { %>
Logo @@ -181,18 +184,18 @@ if (communities != null && communities.length != 0) <% } else { %>
<% } %> -

<%= communities[i].getMetadata("name") %> +

<%= com.getName() %> <% if (ConfigurationManager.getBooleanProperty("webui.strengths.show")) { %> - <%= ic.getCount(communities[i]) %> + <%= ic.getCount(com) %> <% } %>

-

<%= communities[i].getMetadata("short_description") %>

+

<%= communityService.getMetadata(com, "short_description") %>

<%