<%-- 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/ --%> <%-- - Display hierarchical list of communities and collections - - Attributes to be passed in: - communities - array of communities - collections.map - Map where a keys is a community IDs (Integers) and - the value is the array of collections in that community - subcommunities.map - Map where a keys is a community IDs (Integers) and - the value is the array of subcommunities in that community - admin_button - Boolean, show admin 'Create Top-Level Community' button --%> <%@page import="java.util.List"%> <%@page import="org.dspace.content.service.CollectionService"%> <%@page import="org.dspace.content.factory.ContentServiceFactory"%> <%@page import="org.dspace.content.service.CommunityService"%> <%@page import="org.dspace.content.Bitstream"%> <%@page import="org.apache.commons.lang.StringUtils"%> <%@ page contentType="text/html;charset=UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ page import="org.dspace.app.webui.servlet.admin.EditCommunitiesServlet" %> <%@ page import="org.dspace.app.webui.util.UIUtil" %> <%@ page import="org.dspace.browse.ItemCountException" %> <%@ page import="org.dspace.browse.ItemCounter" %> <%@ page import="org.dspace.content.Collection" %> <%@ page import="org.dspace.content.Community" %> <%@ page import="org.dspace.core.ConfigurationManager" %> <%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %> <%@ page import="java.io.IOException" %> <%@ page import="java.sql.SQLException" %> <%@ page import="java.util.Map" %> <%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %> <% List communities = (List) request.getAttribute("communities"); Map collectionMap = (Map) request.getAttribute("collections.map"); Map subcommunityMap = (Map) request.getAttribute("subcommunities.map"); Boolean admin_b = (Boolean)request.getAttribute("admin_button"); boolean admin_button = (admin_b == null ? false : admin_b.booleanValue()); ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request)); %> <%! CommunityService comServ = ContentServiceFactory.getInstance().getCommunityService(); CollectionService colServ = ContentServiceFactory.getInstance().getCollectionService(); void showCommunity(Community c, JspWriter out, HttpServletRequest request, ItemCounter ic, Map collectionMap, Map subcommunityMap) throws ItemCountException, IOException, SQLException { boolean showLogos = ConfigurationManager.getBooleanProperty("jspui.community-list.logos", true); out.println( "
  • " ); Bitstream logo = c.getLogo(); if (showLogos && logo != null) { out.println("\"community"); } out.println( "

    " + c.getName() + ""); if(ConfigurationManager.getBooleanProperty("webui.strengths.show")) { out.println(" " + ic.getCount(c) + ""); } out.println("

    "); if (StringUtils.isNotBlank(comServ.getMetadata(c, "short_description"))) { out.println(comServ.getMetadata(c, "short_description")); } out.println("
    "); // Get the collections in this community List cols = (List) collectionMap.get(c.getID().toString()); if (cols != null && cols.size() > 0) { out.println("
      "); for (int j = 0; j < cols.size(); j++) { out.println("
    • "); Bitstream logoCol = cols.get(j).getLogo(); if (showLogos && logoCol != null) { out.println("\"collection"); } out.println("

      " + cols.get(j).getName() +""); if(ConfigurationManager.getBooleanProperty("webui.strengths.show")) { out.println(" [" + ic.getCount(cols.get(j)) + "]"); } out.println("

      "); if (StringUtils.isNotBlank(colServ.getMetadata(cols.get(j), "short_description"))) { out.println(colServ.getMetadata(cols.get(j), "short_description")); } out.println("
      "); out.println("
    • "); } out.println("
    "); } // Get the sub-communities in this community List comms = (List) subcommunityMap.get(c.getID().toString()); if (comms != null && comms.size() > 0) { out.println("
      "); for (int k = 0; k < comms.size(); k++) { showCommunity(comms.get(k), out, request, ic, collectionMap, subcommunityMap); } out.println("
    "); } out.println("
    "); out.println("
  • "); } %> <% if (admin_button) { %>
    ">
    " />
    <% } %>

    <% if (communities.size() != 0) { %>
      <% for (int i = 0; i < communities.size(); i++) { showCommunity(communities.get(i), out, request, ic, collectionMap, subcommunityMap); } %>
    <% } %>