summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/results.jsp
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/results.jsp')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/results.jsp102
1 files changed, 99 insertions, 3 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/results.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/results.jsp
index 3367c299f..685f24cfe 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/results.jsp
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/results.jsp
@@ -32,6 +32,11 @@
<h1>Search</h1>
+<c:url var="imgNextPageUrl" value="/images/icon_next_page.gif"/>
+<c:url var="imgPrevPageUrl" value="/images/icon_prev_page.gif"/>
+<c:url var="imgPrevPageDisabledUrl" value="/images/icon_prev_page_disabled.gif"/>
+<c:url var="imgNextPageDisabledUrl" value="/images/icon_next_page_disabled.gif"/>
+
<div id="contentArea">
<div id="searchBox">
<%@ include file="/WEB-INF/jsp/include/quickSearchForm.jspf" %>
@@ -44,13 +49,104 @@
<%-- search was made from the indices --%>
<c:when test="${databaseResults == null}">
- <p>Hits: ${fn:length(results.hits)} of ${results.totalHits}</p>
-
+ <c:set var="hitsNum">${fn:length(results.hits) + (currentPage * results.limits.pageSize)}</c:set>
+ <c:choose>
+ <c:when test="${results.totalHits > results.limits.pageSize}">
+ <p>Hits: ${(hitsNum - results.limits.pageSize) + 1} to ${hitsNum} of ${results.totalHits}</p>
+ </c:when>
+ <c:otherwise>
+ <p>Hits: 1 to ${hitsNum} of ${results.totalHits}</p>
+ </c:otherwise>
+ </c:choose>
<c:choose>
<c:when test="${empty results.hits}">
<p>No results</p>
</c:when>
<c:otherwise>
+
+ <%-- Pagination start --%>
+ <p>
+ <%-- Prev & Next icons --%>
+ <c:set var="prevPageUrl">
+ <ww:url action="quickSearch" namespace="/">
+ <ww:param name="q" value="%{'${q}'}"/>
+ <ww:param name="currentPage" value="%{'${currentPage - 1}'}"/>
+ </ww:url>
+ </c:set>
+ <c:set var="nextPageUrl">
+ <ww:url action="quickSearch" namespace="/">
+ <ww:param name="q" value="%{'${q}'}"/>
+ <ww:param name="currentPage" value="%{'${currentPage + 1}'}"/>
+ </ww:url>
+ </c:set>
+
+ <c:choose>
+ <c:when test="${currentPage == 0}">
+ <img src="${imgPrevPageDisabledUrl}"/>
+ </c:when>
+ <c:otherwise>
+ <a href="${prevPageUrl}">
+ <img src="${imgPrevPageUrl}"/>
+ </a>
+ </c:otherwise>
+ </c:choose>
+
+ <%-- Google-style pagination --%>
+ <c:choose>
+ <c:when test="${totalPages > 11}">
+ <c:choose>
+ <c:when test="${(currentPage - 5) < 0}">
+ <c:set var="beginVal">0</c:set>
+ <c:set var="endVal">10</c:set>
+ </c:when>
+ <c:when test="${(currentPage + 5) > (totalPages - 1)}">
+ <c:set var="beginVal">${(totalPages -1) - 10}</c:set>
+ <c:set var="endVal">${totalPages - 1}</c:set>
+ </c:when>
+ <c:otherwise>
+ <c:set var="beginVal">${currentPage - 5}</c:set>
+ <c:set var="endVal">${currentPage + 5}</c:set>
+ </c:otherwise>
+ </c:choose>
+ </c:when>
+ <c:otherwise>
+ <c:set var="beginVal">0</c:set>
+ <c:set var="endVal">${totalPages - 1}</c:set>
+ </c:otherwise>
+ </c:choose>
+
+ <c:forEach var="i" begin="${beginVal}" end="${endVal}">
+ <c:choose>
+ <c:when test="${i != currentPage}">
+ <c:set var="specificPageUrl">
+ <ww:url action="quickSearch" namespace="/">
+ <ww:param name="q" value="%{'${q}'}"/>
+ <ww:param name="currentPage" value="%{'${i}'}"/>
+ <ww:param name="searchResultsOnly" value="%{'${searchResultsOnly}'}"/>
+ <ww:param name="completeQueryString" value="%{'${completeQueryString}'}"/>
+ </ww:url>
+ </c:set>
+ <a href="${specificPageUrl}">${i + 1}</a>
+ </c:when>
+ <c:otherwise>
+ <b>${i + 1}</b>
+ </c:otherwise>
+ </c:choose>
+ </c:forEach>
+
+ <c:choose>
+ <c:when test="${currentPage == (totalPages - 1)}">
+ <img src="${imgNextPageDisabledUrl}"/>
+ </c:when>
+ <c:otherwise>
+ <a href="${nextPageUrl}">
+ <img src="${imgNextPageUrl}"/>
+ </a>
+ </c:otherwise>
+ </c:choose>
+ </p>
+ <%-- Pagination end --%>
+
<c:forEach items="${results.hits}" var="record" varStatus="i">
<c:choose>
<c:when test="${not empty (record.groupId)}">
@@ -60,7 +156,7 @@
</h3>
<p>
<my:showArtifactLink groupId="${record.groupId}" artifactId="${record.artifactId}"
- version="${record.version}" versions="${record.versions}"/>
+ version="${record.version}" versions="${record.versions}" repositoryId="${record.repositoryId}"/>
</p>
</c:when>
<c:otherwise>