Commit da314c87 authored by Matija Obreza's avatar Matija Obreza

TODO action

Use 1 accession browser
parent 5bed3d59
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/country/data.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
encoding//src/main/webapp/WEB-INF/jsp/metadata/view.jsp=UTF-8
encoding//src/main/webapp/WEB-INF/jsp/selection/index.jsp=UTF-8
encoding//src/main/webapp/WEB-INF/jsp/wiews/data.jsp=UTF-8
encoding//src/main/webapp/WEB-INF/jsp/wiews/index.jsp=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
......@@ -17,6 +17,8 @@
package org.crophub.rest.servlet.controller;
import java.util.HashMap;
import org.crophub.rest.common.model.impl.Country;
import org.crophub.rest.common.service.GenesysService;
import org.crophub.rest.common.service.GeoService;
......@@ -84,11 +86,15 @@ public class CountryController extends BaseController {
if (country==null) {
throw new ResourceNotFoundException();
}
model.addAttribute("country", country);
model.addAttribute("accessions", genesysService.listAccessionsByOrigin(country, new PageRequest(page - 1, 50, new Sort("accessionName"))));
model.addAttribute("selection", selectionBean);
return "/country/data";
HashMap<Object, Object> filters = new HashMap<Object, Object>();
filters.put("filter.countryOfOrigin", country);
model.addAttribute("filters", filters);
return "/accession/data";
}
}
......@@ -53,6 +53,12 @@ public class SelectionController extends BaseController {
return "/selection/index";
}
@RequestMapping("order")
public String order(ModelMap model) {
// TODO
return "/todo";
}
@RequestMapping("add/{id}")
public String add(ModelMap model, @PathVariable("id") long accessionId) {
selectionBean.add(accessionId);
......
......@@ -91,7 +91,6 @@ public class WiewsController extends BaseController {
if (faoInstitute == null) {
throw new ResourceNotFoundException();
}
model.addAttribute("faoInstitute", faoInstitute);
_logger.warn("Searching accessions of: " + faoInstitute);
Page<Accession> accessions = genesysService.listAccessionsByInstitute(faoInstitute, new PageRequest(page - 1, 50, new Sort("accessionName")));
......@@ -99,8 +98,12 @@ public class WiewsController extends BaseController {
model.addAttribute("accessions", accessions);
model.addAttribute("selection", selectionBean);
HashMap<Object, Object> filters = new HashMap<Object, Object>();
filters.put("filter.holdingInstitute", faoInstitute);
model.addAttribute("filters", filters);
return "/wiews/data";
return "/accession/data";
}
@RequestMapping("/{wiewsCode}/t/{genus}/{species}")
......@@ -117,19 +120,20 @@ public class WiewsController extends BaseController {
Taxonomy taxonomy=taxonomyService.get(genus, species);
_logger.debug("Got "+ taxonomy);
HashMap<Object, Object> filters = new HashMap<Object, Object>();
filters.put("filter.taxonomy", taxonomy);
model.addAttribute("filters", filters);
_logger.warn("Searching accessions of: " + faoInstitute);
Page<Accession> accessions = genesysService.listAccessionsByInstituteAndTaxonomy(faoInstitute, taxonomy, new PageRequest(page - 1, 50, new Sort("accessionName")));
_logger.info("Got: " + accessions);
model.addAttribute("accessions", accessions);
model.addAttribute("selection", selectionBean);
HashMap<Object, Object> filters = new HashMap<Object, Object>();
filters.put("filter.taxonomy", taxonomy);
filters.put("filter.holdingInstitute", faoInstitute);
model.addAttribute("filters", filters);
return "/wiews/data";
return "/accession/data";
}
}
......@@ -72,7 +72,7 @@ sample.message.invite.to.network = Invite to Network
data.error.404=The data you requested was not found in the system.
page.rendertime=Processing this page took {0}ms.
footer.copyright-statement=&copy; 2013 Global Crop Diversity Trust
footer.copyright-statement=&copy; 2013 Data Providers and GCDT
menu.home=Home
menu.browse=Browse
......@@ -171,6 +171,8 @@ selection.add-many.accessionIds=List accession IDs as used in Genesys separated
filter.taxonomy=Taxonomy
filter.crop=Crop
filter.countryOfOrigin=Country of Origin
filter.holdingInstitute=Holding Institute
search.page.title=Full-text Search
search.no-results=No matches found for your query.
......
......@@ -66,7 +66,7 @@
<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>
<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()">
......
......@@ -17,16 +17,29 @@
<c:if test="${filters ne null}">
<c:forEach items="${filters.keySet()}" var="by">
<div><spring:message code="${by}" />:
<c:if test="${filters[by].getClass().name eq 'org.crophub.rest.common.model.genesys.Taxonomy'}">
<b>${filters[by].taxonName}</b>
</c:if>
<c:if test="${filters[by].getClass().name eq 'org.crophub.rest.common.model.impl.Crop'}">
<b>${filters[by].name}</b>
</c:if>
<c:set value="${filters[by].getClass().simpleName}" var="clazz" />
<div><spring:message code="${by}" />:
<b>
<c:choose>
<c:when test="${clazz eq 'Taxonomy'}">
${filters[by].taxonName}
</c:when>
<c:when test="${clazz eq 'Crop'}">
${filters[by].name}
</c:when>
<c:when test="${clazz eq 'Country'}">
<a href="<c:url value="/geo/${filters[by].code3.toLowerCase()}" />"><c:out value="${filters[by].name}" /></a>
</c:when>
<c:when test="${clazz eq 'FaoInstitute'}">
<a href="<c:url value="/wiews/${filters[by].code.toLowerCase()}" />"><c:out value="${filters[by].fullName}" /></a>
</c:when>
<c:otherwise>
${filters[by]}
</c:otherwise>
</c:choose>
</b>
</div>
<c:remove var="clazz" />
</c:forEach>
</c:if>
......
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<html>
<head>
<title><spring:message code="country.page.profile.title" arguments="${country.name}" argumentSeparator="|" /></title>
</head>
<body>
<c:if test="${country eq null}">
<div class="alert alert-error">
<spring:message code="data.error.404" />
</div>
</c:if>
<h1>
<spring:message code="country.accessions.from" arguments="${country.name}" />
<img class="country-flag bigger" src="http://genesys-pgr.org/images/flags/${country.code3.toUpperCase()}.png" />
</h1>
<div>
<a href="<c:url value="/geo/${country.code3.toLowerCase()}" />"><c:out value="${country.name}" /></a>
</div>
<div class="nav-header">
<spring:message code="accessions.number" arguments="${accessions.totalElements}" />
<br />
<spring:message code="paged.pageOfPages" arguments="${accessions.number+1},${accessions.totalPages}" />
<a href="?page=${accessions.number}">⇇ Previous</a>
<a href="?page=${accessions.number + 2}">Next ⇉</a>
</div>
<table class="accessions">
<thead>
<tr>
<td class="idx-col"></td>
<c:if test="${selection ne null}">
<td />
</c:if>
<td><spring:message code="accession.accessionName" /></td>
<td><spring:message code="accession.origin" /></td>
<td><spring:message code="accession.taxonomy" /></td>
<td><spring:message code="accession.holdingInstitute" /></td>
<td><spring:message code="accession.holdingCountry" /></td>
</tr>
</thead>
<tbody>
<c:forEach items="${accessions.content}" var="accession" varStatus="status">
<tr class="acn ${status.count % 2 == 0 ? 'even' : 'odd'}">
<td class="idx-col">${status.count + accessions.size * accessions.number}</td>
<c:if test="${selection ne null}">
<td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td>
</c:if>
<td><a href="<c:url value="/acn/id/${accession.id}" />"><b><c:out value="${accession.accessionName}" /></b></a></td>
<td><c:out value="${country.name}" /></td>
<td><c:out value="${accession.taxonomy.taxonName}" /></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>
</c:forEach>
</tbody>
</table>
<div class="nav-header">
<a href="?page=${accessions.number}">⇇ Previous</a> <a href="?page=${accessions.number + 2}">Next ⇉</a>
</div>
</body>
</html>
\ No newline at end of file
......@@ -18,10 +18,7 @@
</c:if>
<c:if test="${accessions != null}">
<div class="page-header">
<a href="<c:url value="/sel/clear" />">Clear list</a>
</div>
<div class="nav-header">
<spring:message code="accessions.number" arguments="${accessions.totalElements}" />
<br />
......@@ -34,7 +31,7 @@
<tr>
<td class="idx-col"></td>
<c:if test="${selection ne null}">
<td />
<td />
</c:if>
<td><spring:message code="accession.accessionName" /></td>
<td><spring:message code="accession.origin" /></td>
......@@ -49,7 +46,7 @@
<tr id="a${accession.id}" class="acn targeted ${status.count % 2 == 0 ? 'even' : 'odd'}">
<td class="idx-col">${status.count + accessions.size * accessions.number}</td>
<c:if test="${selection ne null}">
<td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td>
<td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td>
</c:if>
<td><a href="<c:url value="/acn/id/${accession.id}" />"><b><c:out value="${accession.accessionName}" /></b></a></td>
<td><c:out value="${accession.countryOfOrigin.name}" /></td>
......@@ -61,7 +58,14 @@
</c:forEach>
</tbody>
</table>
<form method="post" action="<c:url value="/sel/order" />" class="form-vertical">
<div class="form-actions">
<button class="btn btn-primary" type="submit">Send request for germplasm</button>
<a href="<c:url value="/sel/clear" />"><button class="btn" type="button">Clear list</button></a>
</div>
</form>
</c:if>
......@@ -75,18 +79,18 @@
</div>
</div>
<div class="form-actions clearfix">
<input type="submit" value="<spring:message code="selection.add-many" />" />
<input type="submit" class="btn" value="<spring:message code="selection.add-many" />" />
</div>
</form>
</c:if>
<script type="text/javascript">
/* jQuery(document).ready(function(){
if(document.location.hash != '') {
setTimeout(function() { document.location.hash=''; }, 2000);
}
}); */
/* jQuery(document).ready(function(){
if(document.location.hash != '') {
setTimeout(function() { document.location.hash=''; }, 2000);
}
}); */
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<%@include file="init.jsp"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<html>
<head>
<title><spring:message code="page.home.title" /></title>
</head>
<body>
<h1>:-(</h1>
<p>Sorry, but this function is not implemented. We're working on it.</p>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<html>
<head>
<title><spring:message code="faoInstitutes.page.data.title" arguments="${faoInstitute.code}" argumentSeparator="|" /></title>
</head>
<body>
<h1>
<spring:message code="faoInstitute.accessions.at" arguments="${faoInstitute.fullName}" argumentSeparator="||," />
</h1>
<%-- <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">
<div><spring:message code="${by}" />: <b>${filters[by].taxonName}</b></div>
</c:forEach>
</c:if>
<div class="nav-header">
<spring:message code="accessions.number" arguments="${accessions.totalElements}" />
<br />
<spring:message code="paged.pageOfPages" arguments="${accessions.number+1},${accessions.totalPages}" />
<a href="?page=${accessions.number}">⇇ Previous</a>
<a href="?page=${accessions.number + 2}">Next ⇉</a>
</div>
<table class="accessions">
<thead>
<tr>
<td class="idx-col"></td>
<c:if test="${selection ne null}">
<td />
</c:if>
<td><spring:message code="accession.accessionName" /></td>
<td><spring:message code="accession.origin" /></td>
<td><spring:message code="accession.taxonomy" /></td>
<td><spring:message code="accession.holdingInstitute" /></td>
<td><spring:message code="accession.holdingCountry" /></td>
</tr>
</thead>
<tbody>
<c:forEach items="${accessions.content}" var="accession" varStatus="status">
<tr class="acn ${status.count % 2 == 0 ? 'even' : 'odd'}">
<td class="idx-col">${status.count + accessions.size * accessions.number}</td>
<c:if test="${selection ne null}">
<td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td>
</c:if>
<td><a href="<c:url value="/acn/id/${accession.id}" />"><b><c:out value="${accession.accessionName}" /></b></a></td>
<td><a href="<c:url value="/geo/${accession.origin.toLowerCase()}" />"><c:out value="${accession.countryOfOrigin.name}" /></a></td>
<td><c:out value="${accession.taxonomy.taxonName}" /></td>
<td><a href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}" />"><c:out value="${faoInstitute.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>
</c:forEach>
</tbody>
</table>
<div class="nav-header">
<a href="?page=${accessions.number}">⇇ Previous</a> <a href="?page=${accessions.number + 2}">Next ⇉</a>
</div>
</body>
</html>
\ No newline at end of file
......@@ -258,4 +258,14 @@ tr.acn .sel.picked {
position: relative;
right: -0.5em;
top: -0.6em;
}
.btn-primary {
background-color: #88ba41;
background-image: linear-gradient(to bottom, #88ba41, #88ba41);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
background-color: #88ba41;
background-image: linear-gradient(to bottom, #88ba41, #88ba41);
}
\ No newline at end of file
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