Commit 210d955d authored by Matija Obreza's avatar Matija Obreza

Organization/network overview

parent 6adcc023
......@@ -16,11 +16,15 @@
package org.genesys2.server.servlet.controller;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.model.impl.Organization;
import org.genesys2.server.service.ContentService;
......@@ -29,6 +33,9 @@ import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.OrganizationService;
import org.genesys2.server.service.TaxonomyService;
import org.genesys2.server.service.impl.FilterHandler;
import org.genesys2.server.service.impl.FilterHandler.AppliedFilter;
import org.genesys2.server.service.impl.FilterHandler.AppliedFilters;
import org.genesys2.spring.ResourceNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
......@@ -159,4 +166,17 @@ public class OrganizationController extends BaseController {
return "redirect:/explore";
}
@RequestMapping("/{orgSlug}/overview")
public String overview(HttpServletRequest request, @PathVariable(value = "orgSlug") String orgSlug) throws UnsupportedEncodingException {
final Organization organization = organizationService.getOrganization(orgSlug);
if (organization == null) {
throw new ResourceNotFoundException();
}
AppliedFilters appliedFilters = new AppliedFilters();
appliedFilters.add(new AppliedFilter().setFilterName(FilterConstants.INSTITUTE_NETWORK).addFilterValue(
new FilterHandler.LiteralValueFilter(organization.getSlug())));
return "forward:/explore/overview?filter=" + URLEncoder.encode(appliedFilters.toString(), "UTF8");
}
}
......@@ -205,7 +205,7 @@ public class WiewsController extends BaseController {
@RequestMapping("/{wiewsCode}/overview")
public String viewData(HttpServletRequest request, @PathVariable(value = "wiewsCode") String wiewsCode) throws UnsupportedEncodingException {
public String overview(HttpServletRequest request, @PathVariable(value = "wiewsCode") String wiewsCode) throws UnsupportedEncodingException {
_logger.debug("Viewing institute overview " + wiewsCode);
final FaoInstitute faoInstitute = instituteService.getInstitute(wiewsCode);
if (faoInstitute == null) {
......
......@@ -12,9 +12,10 @@
<small><c:out value="${organization.slug}" /></small>
</h1>
<div class="main-col-header">
<a href="<c:url value="/org/${organization.slug}/map" />"><spring:message code="maps.view-map" /></a>
<a href="<c:url value="/org/${organization.slug}/data" />"><spring:message code="view.accessions" /></a>
<div class="main-col-header text-right">
<a class="btn btn-default" href="<c:url value="/org/${organization.slug}/data" />"><spring:message code="view.accessions" /></a>
<a class="btn btn-default" href="<c:url value="/org/${organization.slug}/overview" />"><span class="glyphicon glyphicon-eye-open"></span><span style="margin-left: 0.5em;"><spring:message code="data-overview.short" /></span></a>
<a class="btn btn-default" href="<c:url value="/org/${organization.slug}/map" />"><span class="glyphicon glyphicon-globe"></span><span style="margin-left: 0.5em;"><spring:message code="maps.view-map" /></span></a>
</div>
<security:authorize access="hasRole('ADMINISTRATOR')">
......
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