Commit 15011253 authored by Matija Obreza's avatar Matija Obreza
Browse files

pagedData 2

parent b352a6fb
eclipse.preferences.version=1
encoding//src/main/resources=UTF-8
encoding//src/main/resources/content/language.properties=UTF-8
encoding//src/main/webapp/WEB-INF/jsp/accession/data.jsp=UTF-8
encoding//src/main/webapp/WEB-INF/jsp/descr/index.jsp=UTF-8
encoding//src/main/webapp/WEB-INF/jsp/login.jsp=UTF-8
encoding//src/main/webapp/WEB-INF/jsp/metadata/index.jsp=UTF-8
......
......@@ -105,7 +105,7 @@ public class CropController extends BaseController {
throw new ResourceNotFoundException();
}
model.addAttribute("crop", crop);
model.addAttribute("traits", traitService.listTraits(crop, new PageRequest(page - 1, 50, new Sort("title"))));
model.addAttribute("pagedData", traitService.listTraits(crop, new PageRequest(page - 1, 50, new Sort("title"))));
return "/descr/index";
}
......
......@@ -50,7 +50,7 @@ public class DatasetController extends BaseController {
@RequestMapping("/")
public String index(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
model.addAttribute("metadatas", genesysService.listMetadata(new PageRequest(page - 1, 50)));
model.addAttribute("pagedData", genesysService.listMetadata(new PageRequest(page - 1, 50)));
return "/metadata/index";
}
......
......@@ -41,7 +41,7 @@ public class DescriptorController extends BaseController {
@RequestMapping
public String index(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
model.addAttribute("traits", traitService.listTraits(new PageRequest(page - 1, 50, new Sort("title"))));
model.addAttribute("pagedData", traitService.listTraits(new PageRequest(page - 1, 50, new Sort("title"))));
return "/descr/index";
}
......
......@@ -44,7 +44,7 @@ public class SearchController {
if (!StringUtils.isBlank(searchQuery)) {
LOG.info("Searching for: " + searchQuery);
Page<?> x = searchService.search(searchQuery, new String[] { "title", "body", "description" }, page - 1, 50);
model.addAttribute("searchResults", x);
model.addAttribute("pagedData", x);
}
return "/search/index";
}
......
......@@ -106,6 +106,7 @@ public class WiewsController extends BaseController {
return "/accession/data";
}
@RequestMapping("/{wiewsCode}/t/{genus}/{species}")
public String viewDataByGenusSpecies(ModelMap model, @PathVariable(value = "wiewsCode") String wiewsCode, @PathVariable(value = "genus") String genus,
@PathVariable(value = "species") String species, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
......
<%@include file="/WEB-INF/jsp/init.jsp"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<html>
<head>
<title><sitemesh:write property="title" /></title>
<%@include file="/WEB-INF/jsp/head-init.jsp"%>
<meta charset="utf-8">
<%--Locked Compatible Mode for IE--%>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link type="text/css" href="/html/css/bootstrap.css" rel="stylesheet" />
<link type="text/css" href="/html/css/custom.css" rel="stylesheet" />
<script type="text/javascript" src="/html/js/jquery.min.js"></script>
<!--
<script type="text/javascript" src="/html/js/modernizr-2.6.2.min.js"></script>
<script type="text/javascript" src="/html/js/plugins.js"></script>
<script type="text/javascript" src="/html/js/jquery.validate.js"></script>
<script type="text/javascript" src="/html/js/custom.js"></script>
<link type="text/css" href="/html/css/jquery-ui.css" rel="stylesheet" />
<link type="text/css" href="/html/css/jquery.dataTables.css" rel="stylesheet" />
-->
<%--Fallback for older browsers--%>
<!--
<script type="text/javascript" src="/html/js/json2.js"></script>
<script type="text/javascript" src="/html/js/globalize.js"></script>
<script type="text/javascript" src="/html/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="/html/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="/html/js/handlebars.js"></script> -->
<script type="text/javascript" src="/html/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/html/js/crophub.js"></script>
<!--
--><!-- <script type="text/javascript" src="/html/js/main.js"></script>
-->
<sitemesh:write property="head" />
</head>
<body>
<sec:authentication var="user" property="principal" />
<div class="container">
<div id="header">
<div class="clearfix">
<div class="pull-left">
<a href="<c:url value="/" />"><img style="" src="<c:url value="/html/images/logo2.png" />" /></a>
</div>
<!-- <h4 class="pull-left"><spring:message code="sample.message.welcome"/></h4> -->
<div class="navbar pull-right">
<div class="nav-collapse">
<ul class="nav">
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown"> <spring:message code="sample.message.locale.${pageContext.response.locale}" /> <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="?lang=en"><spring:message code="sample.message.locale.en" /></a></li>
<li><a href="?lang=sl"><spring:message code="sample.message.locale.sl" /></a></li>
</ul></li>
</ul>
</div>
</div>
<div class="navbar pull-right">
<sec:authorize access="isAnonymous()">
<div style="line-height: 20px; padding: 10px 15px;">
<a href="<c:url value="/login" />">Login</a><%-- or <a href="<c:url value="/registration" />"><spring:message code="user.create-new-account" /></a> --%>
</div>
</sec:authorize>
<sec:authorize access="isAuthenticated()">
<ul class="nav">
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" title="<spring:message code="sample.message.change.locale"/>"> You are <b>${user.username}</b> <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<sec:authorize access="hasRole('ADMINISTRATOR')">
<li><a href="<c:url value="/admin/" />">Administation</a></li>
</sec:authorize>
<li><a href="<c:url value="/profile" />"><spring:message code="user.pulldown.profile" /></a></li>
<li><a href="<c:url value="/logout" />"><spring:message code="user.pulldown.logout" /></a></li>
</ul></li>
</ul>
</sec:authorize>
</div>
<div class="pull-right searcher" style="padding: 10px 15px 0 0;">
<form class="search form-horizontal" method="get" action="<c:url value="/search" />">
<input type="text" name="q" class="" /> <button type="submit"class="">Search</button>
</form>
</div>
</div>
</div>
<div id="nav-main" class="clearfix">
<ul>
<li><a href="<c:url value="/" />"><spring:message code="menu.home" /></a></li>
<li><a href="<c:url value="/acn/" />"><spring:message code="menu.browse" /></a></li>
<li><a href="<c:url value="/data/" />"><spring:message code="menu.datasets" /></a></li>
<li><a href="<c:url value="/descriptors/" />"><spring:message code="menu.descriptors" /></a></li>
<li><a href="<c:url value="/geo/" />"><spring:message code="menu.countries" /></a></li>
<li><a href="<c:url value="/wiews/active" />"><spring:message code="menu.institutes" /></a></li>
<li><a href="<c:url value="/sel/" />"><spring:message code="menu.my-list" /><div id="selcounter">${selection.size() gt 0 ? selection.size() : ''}</div></a></li>
</ul>
</div>
<div id="content" class="clearfix">
<div id="dialog"></div>
<div class="clearfix">
<sitemesh:write property="body" />
</div>
<!-- Processing time:
<div class="footer clearfix" style="font-size: 80%"><spring:message code="page.rendertime" arguments="${springExecuteTime}" /></div>
-->
</div>
<div id="footer" class="clearfix">
<div id="nav-foot" class="clearfix">
<div class="pull-left">
<ul>
<li><a href="<c:url value="/content/about" />"><spring:message code="menu.about" /></a></li>
<li><a href="<c:url value="/content/contact" />"><spring:message code="menu.contact" /></a></li>
<li><a href="<c:url value="/content/disclaimer" />"><spring:message code="menu.disclaimer" /></a></li>
<li><a href="<c:url value="/content/feedback" />"><spring:message code="menu.feedback" /></a></li>
<li><a href="<c:url value="/content/help" />"><spring:message code="menu.help" /></a></li>
</ul>
</div>
<div class="pull-right">
<ul>
<li><a href="<c:url value="/content/terms" />"><spring:message code="menu.terms" /></a></li>
<li><a href="<c:url value="/content/copying" />"><spring:message code="menu.copying" /></a></li>
<li><a href="<c:url value="/content/privacy" />"><spring:message code="menu.privacy" /></a></li>
</ul>
</div>
</div>
<div class="clearfix" id="copyright">
<div class="pull-left">
<a href="<c:url value="/" />"><img style="height: 2em; vertical-align: middle; position: relative; top: -0.3em" src="<c:url value="/html/images/logo2.png" />" /></a>
<spring:message code="footer.copyright-statement" />
</div>
</div>
</div>
</div>
</body>
</html>
......@@ -11,16 +11,16 @@
<spring:message code="accession.page.data.title" />
</h1>
<%-- <div>
<%-- <div>
<a href="<c:url value="/geo/${faoInstitute.country.code3.toLowerCase()}" />"><c:out value="${faoInstitute.country.name}" /></a>
</div> --%>
<c:if test="${filters ne null}">
<c:forEach items="${filters.keySet()}" var="by">
<c:set value="${filters[by].getClass().simpleName}" var="clazz" />
<div><spring:message code="${by}" />:
<b>
<c:choose>
<div>
<spring:message code="${by}" />
: <b> <c:choose>
<c:when test="${clazz eq 'Taxonomy'}">
${filters[by].taxonName}
</c:when>
......@@ -48,8 +48,7 @@
<spring:message code="accessions.number" arguments="${pagedData.totalElements}" />
<br />
<spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
<a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a>
<a href="?page=${pagedData.number + 2}">Next ⇉</a>
<a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a> <a href="?page=${pagedData.number + 2}">Next ⇉</a>
</div>
<table class="accessions">
......@@ -63,8 +62,9 @@
<td><spring:message code="accession.taxonomy" /></td>
<td><spring:message code="accession.origin" /></td>
<td><spring:message code="accession.holdingInstitute" /></td>
<%-- <td><spring:message code="accession.holdingCountry" /></td>
--%> </tr>
<%-- <td><spring:message code="accession.holdingCountry" /></td>
--%>
</tr>
</thead>
<tbody>
<c:forEach items="${pagedData.content}" var="accession" varStatus="status">
......@@ -78,7 +78,8 @@
<td><a href="<c:url value="/geo/${accession.origin.toLowerCase()}" />"><c:out value="${accession.countryOfOrigin.name}" /></a></td>
<td><a href="<c:url value="/wiews/${accession.institute.code.toLowerCase()}" />"><c:out value="${accession.institute.code}" /></a></td>
<%-- <td><a href="<c:url value="/geo/${accession.institute.country.code3.toLowerCase()}" />"><c:out value="${accession.institute.country.name}" /></a></td>
--%> </tr>
--%>
</tr>
</c:forEach>
</tbody>
</table>
......
......@@ -17,10 +17,10 @@
</div>
</c:if>
<div class="nav-header">
<spring:message code="paged.totalElements" arguments="${traits.totalElements}" />
<spring:message code="paged.totalElements" arguments="${pagedData.totalElements}" />
<br />
<spring:message code="paged.pageOfPages" arguments="${traits.number+1},${traits.totalPages}" />
<a class="${traits.number eq 0 ? 'disabled' :''}" href="?page=${traits.number eq 0 ? 1 : traits.number}">⇇ Previous</a> <a href="?page=${traits.number + 2}">Next ⇉</a>
<spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
<a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a> <a href="?page=${pagedData.number + 2}">Next ⇉</a>
</div>
<table class="accessions">
......@@ -32,9 +32,9 @@
</tr>
</thead>
<tbody>
<c:forEach items="${traits.content}" var="trait" varStatus="status">
<c:forEach items="${pagedData.content}" var="trait" varStatus="status">
<tr class="${status.count % 2 == 0 ? 'even' : 'odd'}">
<td class="idx-col">${status.count + traits.size * traits.number}</td>
<td class="idx-col">${status.count + pagedData.size * pagedData.number}</td>
<td><a href="<c:url value="/descriptors/${trait.id}" />">${trait.title}</a></td>
<td><a href="<c:url value="/c/${trait.crop.shortName}" />">${trait.crop.name}</a></td>
</tr>
......
......@@ -12,13 +12,13 @@
</h1>
<div class="nav-header">
<spring:message code="paged.totalElements" arguments="${metadatas.totalElements}" />
<spring:message code="paged.totalElements" arguments="${pagedData.totalElements}" />
<br />
<spring:message code="paged.pageOfPages" arguments="${metadatas.number+1},${metadatas.totalPages}" />
<a class="${metadatas.number eq 0 ? 'disabled' :''}" href="?page=${metadatas.number eq 0 ? 1 : metadatas.number}">⇇ Previous</a> <a href="?page=${metadatas.number + 2}">Next ⇉</a>
<spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
<a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a> <a href="?page=${pagedData.number + 2}">Next ⇉</a>
</div>
<ul class="funny-list">
<c:forEach items="${metadatas.content}" var="metadata" varStatus="status">
<c:forEach items="${pagedData.content}" var="metadata" varStatus="status">
<li><a href="/data/view/${metadata.id}"><c:out value="${metadata.title}" /></a> <c:out value="${metadata.institute}" /></li>
</c:forEach>
</ul>
......
......@@ -12,27 +12,27 @@
<input type="text" name="q" class="" value="<c:out value="${q}" />" /> <input type="submit" value="Search" class="" />
</form>
<c:if test="${searchResults.totalElements eq 0}">
<c:if test="${pagedData.totalElements eq 0}">
<div class="alert"><spring:message code="search.no-results" /></div>
</c:if>
<c:if test="${searchResults ne null and searchResults.totalElements gt 0}">
<c:if test="${pagedData ne null and pagedData.totalElements gt 0}">
<div class="nav-header">
<spring:message code="paged.totalElements" arguments="${searchResults.totalElements}" />
<spring:message code="paged.totalElements" arguments="${pagedData.totalElements}" />
<br />
<spring:message code="paged.pageOfPages" arguments="${searchResults.number+1},${searchResults.totalPages}" />
<a href="?q=${q}&amp;page=${searchResults.number}">⇇ Previous</a> <a href="?q=${q}&amp;page=${searchResults.number + 2}">Next ⇉</a>
<spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
<a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?q=${q}&amp;page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a> <a href="?q=${q}&amp;page=${pagedData.number + 2}">Next ⇉</a>
</div>
<ul class="funny-list">
<c:forEach items="${searchResults.content}" var="searchResult" varStatus="status">
<c:forEach items="${pagedData.content}" var="searchResult" varStatus="status">
<c:set value="${searchResult.getClass().simpleName}" var="clazz" />
<c:if test="${clazz.contains('_$$_javassist_')}">
<c:set var="clazz" value="${clazz.substring(0, clazz.indexOf('_$$_javassist'))}" />
</c:if>
<li><small>${clazz} <b><fmt:formatNumber value="${status.count + (searchResults.number)*searchResults.size}" /></b>.</small>
<li><small>${clazz} <b><fmt:formatNumber value="${status.count + (pagedData.number)*pagedData.size}" /></b>.</small>
<c:if test="${clazz eq 'Taxonomy'}">
<a href="<c:url value="/acn/t/${searchResult.genus}/${searchResult.species}" />"><c:out value="${searchResult.taxonName}" /></a>
</c:if>
......
......@@ -12,25 +12,26 @@
</h1>
<c:if test="${activeOnly eq true}">
<div class="page-header"><a href="<c:url value="/wiews/" />"><spring:message code="faoInstitutes.viewAll" /></a></div>
<div class="page-header">
<a href="<c:url value="/wiews/" />"><spring:message code="faoInstitutes.viewAll" /></a>
</div>
</c:if>
<c:if test="${activeOnly ne true}">
<div class="page-header"><a href="<c:url value="/wiews/active" />"><spring:message code="faoInstitutes.viewActiveOnly" /></a></div>
<div class="page-header">
<a href="<c:url value="/wiews/active" />"><spring:message code="faoInstitutes.viewActiveOnly" /></a>
</div>
</c:if>
<div class="nav-header">
<spring:message code="paged.totalElements" arguments="${pagedData.totalElements}" />
<br />
<spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
<a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a>
<a href="?page=${pagedData.number + 2}">Next ⇉</a>
<a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a> <a href="?page=${pagedData.number + 2}">Next ⇉</a>
</div>
<ul class="funny-list">
<c:forEach items="${pagedData.content}" var="faoInstitute" varStatus="status">
<li><a href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}" />"><b><c:out value="${faoInstitute.code}" /></b> <c:out value="${faoInstitute.fullName}" /></a>
<spring:message code="faoInstitute.accessionCount" arguments="${faoInstitute.accessionCount}" />
</li>
<li><a href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}" />"><b><c:out value="${faoInstitute.code}" /></b> <c:out value="${faoInstitute.fullName}" /></a> <spring:message code="faoInstitute.accessionCount" arguments="${faoInstitute.accessionCount}" /></li>
</c:forEach>
</ul>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment