Commit 34283223 authored by Matija Obreza's avatar Matija Obreza

Include GA trackers

parent b0c79e71
......@@ -23,8 +23,10 @@ import javax.servlet.http.HttpServletResponse;
import org.genesys2.server.model.genesys.Accession;
import org.genesys2.server.model.genesys.Metadata;
import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.service.DatasetService;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.InstituteService;
import org.genesys2.spring.ResourceNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
......@@ -58,6 +60,9 @@ public class DatasetController extends BaseController {
@Autowired
private Validator validator;
@Autowired
private InstituteService instituteService;
@RequestMapping("/")
public String index(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
model.addAttribute("pagedData", genesysService.listMetadata(new PageRequest(page - 1, 50)));
......@@ -75,6 +80,9 @@ public class DatasetController extends BaseController {
model.addAttribute("metadata", metadata);
model.addAttribute("methods", genesysService.listMethods(metadata));
FaoInstitute faoInstitute = instituteService.getInstitute(metadata.getInstituteCode());
model.addAttribute("faoInstitute", faoInstitute);
Page<Accession> accessions = genesysService.listMetadataAccessions(metadata.getId(), new PageRequest(page - 1, 50));
model.addAttribute("pagedData", accessions);
......
......@@ -274,10 +274,7 @@
});
</c:if>
<%-- // institute GA --%>
<c:if test="${faoInstitute.settings['googleAnalytics.tracker'] ne null}">
_pageTrackers=["${faoInstitute.settings['googleAnalytics.tracker'].value}"];
</c:if>
<%@include file="/WEB-INF/jsp/wiews/ga.jsp"%>
_pageDim = { institute: '${accession.instituteCode}', genus: '${accession.taxonomy.genus}' };
</script>
</body>
......
......@@ -16,6 +16,12 @@
<fmt:formatDate value="${metadata.lastModifiedDate}" type="both" />
</div>
<c:if test="${faoInstitute ne null}">
<p>
<a class="" href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}" />"><b><c:out value="${faoInstitute.code}" /></b> <c:out value="${faoInstitute.fullName}" /></a>
</p>
</c:if>
<c:if test="${page eq 1}">
<table>
<thead>
......@@ -36,6 +42,7 @@
</c:forEach>
</tbody>
</table>
<p>
<c:out value="${metadata.description}" />
</p>
......@@ -115,5 +122,9 @@
</tbody>
</table>
</div>
<script type="text/javascript">
<%@include file="/WEB-INF/jsp/wiews/ga.jsp"%>
</script>
</body>
</html>
\ No newline at end of file
......@@ -126,20 +126,19 @@
</div>
<c:if test="${faoInstitute.latitude ne null}">
<script type="text/javascript">
jQuery(document).ready(function() {
<c:if test="${faoInstitute.latitude ne null}">
var map=GoogleMaps.map("${pageContext.response.locale.language}", $("#map"), {
maxZoom: 6, /* WIEWS does not provide enough detail */
center: new GoogleMaps.LatLng(${faoInstitute.latitude}, ${faoInstitute.longitude}),
markerTitle: "<spring:escapeBody javaScriptEscape="true">${faoInstitute.fullName}</spring:escapeBody>"
});
</c:if>
});
<%-- // institute GA --%>
<c:if test="${faoInstitute.settings['googleAnalytics.tracker'] ne null}">
_pageTrackers=["${faoInstitute.settings['googleAnalytics.tracker'].value}"];
</c:if>
</script>
</c:if>
<script type="text/javascript">
<%@include file="/WEB-INF/jsp/wiews/ga.jsp"%>
_pageDim = { institute: '${faoInstitute.code}' };
</script>
</body>
......
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:if test="${faoInstitute.settings['googleAnalytics.tracker'] ne null}">
_pageTrackers=["${faoInstitute.settings['googleAnalytics.tracker'].value}"];
</c:if>
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