<%-- 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 list of E-people, with pagination - - Attributes: - - epeople - EPerson[] - all epeople to browse - sortby - Integer - field to sort by (constant from EPerson.java) (when show all) - first - Integer - index of first eperson to display (when show all) - multiple - if non-null, this is for selecting multiple epeople - search - String - query string for search eperson - offset - Integer - offset in a search result set --%> <%@ 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="org.apache.commons.lang.StringEscapeUtils"%> <%@ page import="org.dspace.eperson.EPerson" %> <%@ page import="org.dspace.core.Utils" %> <%@ page import="java.util.List" %> <% int PAGESIZE = 50; List epeople = (List) request.getAttribute("epeople"); int sortBy = ((Integer)request.getAttribute("sortby" )).intValue(); int first = ((Integer)request.getAttribute("first")).intValue(); boolean multiple = (request.getAttribute("multiple") != null); String search = (String) request.getAttribute("search"); if (search == null) search = ""; int offset = ((Integer)request.getAttribute("offset")).intValue(); // Make sure we won't run over end of list int last; if (search != null && !search.equals("")) { last = offset + PAGESIZE; } else { last = first + PAGESIZE; } if (last >= epeople.size()) last = epeople.size() - 1; // Index of first eperson on last page int jumpEnd = ((epeople.size() - 1) / PAGESIZE) * PAGESIZE; // Now work out values for next/prev page buttons int jumpFiveBack; if (search != null && !search.equals("")) { jumpFiveBack = offset - PAGESIZE * 5; } else { jumpFiveBack = first - PAGESIZE * 5; } if (jumpFiveBack < 0) jumpFiveBack = 0; int jumpOneBack; if (search != null && !search.equals("")) { jumpOneBack = offset - PAGESIZE; } else { jumpOneBack = first - PAGESIZE; } if (jumpOneBack < 0) jumpOneBack = 0; int jumpOneForward; if (search != null && !search.equals("")) { jumpOneForward = offset + PAGESIZE; } else { jumpOneForward = first + PAGESIZE; } if (jumpOneForward > epeople.size()) jumpOneForward = jumpEnd; int jumpFiveForward; if (search != null && !search.trim().equals("")) { jumpFiveForward = offset + PAGESIZE * 5; } else { jumpFiveForward = first + PAGESIZE * 5; } if (jumpFiveForward > epeople.size()) jumpFiveForward = jumpEnd; // What's the link? String sortByParam = "lastname"; if (sortBy == EPerson.EMAIL) sortByParam = "email"; if (sortBy == EPerson.ID) sortByParam = "id"; if (sortBy == EPerson.LANGUAGE) sortByParam = "language"; String jumpLink; if (search != null && !search.equals("")) { jumpLink = request.getContextPath() + "/tools/eperson-list?multiple=" + multiple + "&sortby=" + sortByParam + "&first="+first+"&search="+search+"&offset="; } else { jumpLink = request.getContextPath() + "/tools/eperson-list?multiple=" + multiple + "&sortby=" + sortByParam + "&first="; } String sortLink = request.getContextPath() + "/tools/eperson-list?multiple=" + multiple + "&first=" + first + "&sortby="; %> <%-- Select E-people --%> <fmt:message key="jsp.tools.eperson-list.title"/> <%--

E-people <%= first + 1 %>-<%= last + 1 %> of <%= epeople.length %>

--%>

<%= ((search != null && !search.equals(""))?offset:first) + 1 %> <%= last + 1 %> <%= epeople.size() %>

<% if (multiple) { %> <%--

Clicking on the 'Add' button next to an e-person will add that e-person to the list on the main form.

--%>

<% } %>
" /> <% if (search != null && !search.equals("")){ %> <%}%>
<%-- Controls for jumping around list--%>
<%-- Will never actually be posted, it's just so buttons will appear --%> <% if (search != null && !search.equals("")) { %> <% } else { %> <%-- --%> <% } String row = "even"; // If this is a dialogue to select a *single* e-person, we want // to clear any existing entry in the e-person list, and // to close this window when a 'select' button is clicked String clearList = (multiple ? "" : "clearEPeople();"); String closeWindow = (multiple ? "" : "window.close();"); for (int i = (search != null && !search.equals(""))?offset:first; i <= last; i++) { EPerson e = epeople.get(i); // Make sure no quotes in full name will mess up our Javascript String fullname = StringEscapeUtils.escapeXml(StringEscapeUtils.escapeJavaScript(e.getFullName())); String email = StringEscapeUtils.escapeXml(StringEscapeUtils.escapeJavaScript(e.getEmail())); %> <% row = (row.equals("odd") ? "even" : "odd"); } %>
 
  <% if (sortBy == EPerson.ID) { %><% } else { %><% } %> <% if (sortBy == EPerson.EMAIL) { %><% } else { %><% } %><%= sortBy == EPerson.LASTNAME ? "Last Name ↑" : "Last Name" %><% if (sortBy == EPerson.LASTNAME) { %><% } else { %><% } %> <% if (sortBy == EPerson.LANGUAGE) { %><% } else { %><% } %>
<% } else { %><% } %>" onclick="javascript:<%= clearList %>addEPerson('<%= e.getID() %>', '<%= email %>', '<%= fullname %>');<%= closeWindow %>"/> <%= e.getID() %> <%= (e.getEmail() == null ? "" : Utils.addEntities(e.getEmail())) %> <%= (e.getLastName() == null ? "" : Utils.addEntities(e.getLastName())) %> <%= (e.getFirstName() == null ? "" : Utils.addEntities(e.getFirstName())) %> <%= (e.getLanguage() == null ? "" : Utils.addEntities(e.getLanguage())) %>

<%-- Controls for jumping around list--%>
<%--

--%>

" onclick="window.close();"/>