index.jsp 5.64 KB
Newer Older
1 2 3 4
<!DOCTYPE html>

<%@include file="/WEB-INF/jsp/init.jsp"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
5
<%@ taglib prefix="mini" tagdir="/WEB-INF/tags/mini"%>
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

<html>
<head>
  <title><spring:message code="search.page.title" /></title>
</head>
<body>
<h1><spring:message code="search.page.title" /></h1>

<div class="main-col-header clearfix">
  <div class="nav-header">
    <div class="results"><spring:message code="paged.totalElements" arguments="${pagedData == null ? 0 : pagedData.totalElements}" /></div>
    <form method="get" action="search2">
      <input type="hidden" name="q" value="<c:out value="${q}" />" />
      <div class="pagination">
        <spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
        <a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?q=<c:out value="${q}" />&amp;page=${pagedData.number eq 0 ? 1 : pagedData.number}&amp;section=${section}"><spring:message code="pagination.previous-page" /></a>
        <input class="form-control" style="display: inline; max-width: 5em; text-align: center" type="text" name="page" placeholder="${pagedData.number + 1}" />
        <a href="?q=<c:out value="${q}" />&amp;page=${pagedData.number + 2}&amp;section=${section}"><spring:message code="pagination.next-page" /></a>
      </div>
    </form>
  </div>
</div>

<c:if test="${error ne null}">
  <div class="alert alert-warning">
    <spring:message code="search.search-query-failed" arguments="${error.message}" />
  </div>
</c:if>
<c:if test="${pagedData eq null}">
  <div class="alert alert-warning">
    <spring:message code="search.search-query-missing" />
  </div>
</c:if>

<div class="applied-filters">
  <form class="" method="get" action="<c:url value="/acn/search2" />">
42
  	<input type="hidden" name="section" value="<c:out value="${section}" />" />
43 44 45 46 47 48 49
    <div class="row">
      <div class="col-md-4"><input type="text" placeholder="<spring:message code="search.input.placeholder" />" name="q" class="form-control" value="<c:out value="${q}" />" /></div>
      <div class="col-md-2"><input type="submit" value="<spring:message code="search.button.label" />" class="btn" /></div>
    </div>
  </form>
</div>

50
<c:set var="sectionList">accession,article,activitypost,country,institute</c:set>
51 52 53 54

<ul class="nav nav-tabs">
  <c:forTokens items="${sectionList}" delims="," var="sect">
    <li class=${sect eq section ? "active" : ""}>
55
      <a href="<c:url value="/acn/search2" />?q=${q}&amp;section=${sect}"><spring:message code="search.section.${sect}" /></a>
56 57 58 59 60 61 62 63 64
    </li>
  </c:forTokens>
</ul>

<c:choose>
  <c:when test="${pagedData ne null and pagedData.totalElements gt 0}">
    <table class="accessions">
      <thead>
      <tr>
65
        <c:if test="${section eq 'accession'}">
66 67 68 69 70 71 72
          <td />
          <td><spring:message code="accession.accessionName" /></td>
          <td><spring:message code="accession.taxonomy" /></td>
          <td class="notimportant"><spring:message code="accession.origin" /></td>
          <td class="notimportant"><spring:message code="accession.sampleStatus" /></td>
          <td class="notimportant"><spring:message code="accession.holdingInstitute" /></td>
        </c:if>
73
        <c:if test="${section eq 'article'}">
74
        </c:if>
75
        <c:if test="${section eq 'activitypost'}">
76
        </c:if>
77
        <c:if test="${section eq 'country'}">
78
        </c:if>
79
        <c:if test="${section eq 'institute'}">
80 81 82 83 84 85 86
        </c:if>
      </tr>
      </thead>
      <tbody>
      <c:forEach items="${pagedData.content}" var="unit" varStatus="status">
        <tr class="acn">
          <c:choose>
87
            <c:when test="${section eq 'accession'}">
88 89 90 91 92 93 94 95 96
              <td class="sel" x-aid="${unit.id}"></td>
              <td><a href="<c:url value="/acn/id/${unit.id}" />"><b>
                <c:out value="${unit.acceNumb}" />
              </b></a></td>
              <td><c:out value="${unit.taxonomy.sciName}" /></td>
              <td class="notimportant"><c:out value="${jspHelper.getCountry(unit.orgCty.iso3).getName(pageContext.response.locale)}" /></td>
              <td class="notimportant"><spring:message code="accession.sampleStatus.${unit.sampStat}" /></td>
              <td class="notimportant"><a href="<c:url value="/wiews/${unit.institute.code}" />"><c:out value="${unit.institute.code}" /></a></td>
            </c:when>
97 98 99 100 101 102
            <c:when test="${section eq 'country'}">
            	<td><mini:country country="${unit}" /></td>
            </c:when>
            <c:when test="${section eq 'institute'}">
            	<td><mini:institute institute="${unit}" /></td>
            </c:when>
103 104 105 106 107 108
            <c:when test="${section eq 'article'}">
            	<td><mini:article article="${unit}" /></td>
            </c:when>
            <c:when test="${section eq 'activitypost'}">
            	<td><mini:activitypost activityPost="${unit}" /></td>
            </c:when>
109 110
            <c:otherwise>
              <td>
111
              	<b><c:out value="${section}" /></b>
112
                <a href="<c:url value="${unit.urlToContent}" />">
113
                  <c:set var="body" value="${unit.body}" />
114
                  <c:if test="${fn:length(body) > 100}">
115
                    <c:set var="body" value="${fn:substring(body, 0, 100)}..." />
116 117 118 119 120 121 122 123 124 125 126 127 128
                  </c:if>
                  <b><c:out value="${body}" escapeXml="false" /></b>
                </a>
              </td>
              <td><c:out value="${unit.summary}" escapeXml="false" /></td>
            </c:otherwise>
          </c:choose>
        </tr>
      </c:forEach>
      </tbody>
    </table>
  </c:when>
  <c:otherwise>
129
    <div class="alert alert-info"><spring:message code="search.no-results" /></div>
130 131 132 133
  </c:otherwise>
</c:choose>
</body>
</html>