diff --git a/src/main/java/org/genesys2/server/servlet/controller/AccessionController.java b/src/main/java/org/genesys2/server/servlet/controller/AccessionController.java index e14dade5f14c94d41b8a16387a9a33eca34b9d7f..155e9f4b1dff2d2f1c13f7c4a02c15c9d81aa0ea 100644 --- a/src/main/java/org/genesys2/server/servlet/controller/AccessionController.java +++ b/src/main/java/org/genesys2/server/servlet/controller/AccessionController.java @@ -25,12 +25,17 @@ import java.util.UUID; import javax.servlet.http.HttpServletResponse; +import org.genesys.blocks.auditlog.service.AuditTrailService; +import org.genesys.blocks.security.SecurityContextUtil; import org.genesys.filerepository.InvalidRepositoryPathException; import org.genesys.filerepository.model.ImageGallery; import org.genesys.filerepository.service.ImageGalleryService; import org.genesys2.server.model.dataset.DS; import org.genesys2.server.model.elastic.AccessionDetails; import org.genesys2.server.model.genesys.Accession; +import org.genesys2.server.model.genesys.AccessionBreeding; +import org.genesys2.server.model.genesys.AccessionCollect; +import org.genesys2.server.model.genesys.AccessionExchange; import org.genesys2.server.model.genesys.AccessionGeo; import org.genesys2.server.model.genesys.PDCI; import org.genesys2.server.model.genesys.Taxonomy2; @@ -52,6 +57,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PathVariable; @@ -98,6 +104,9 @@ public class AccessionController extends BaseController { @Autowired private DownloadService downloadService; + @Autowired + private AuditTrailService auditService; + @Value("${base.url}") private String baseUrl; @@ -138,13 +147,31 @@ public class AccessionController extends BaseController { */ public ModelAndView displayAccession(ModelMap model, Accession accession) { model.addAttribute("accession", accession); + model.addAttribute("auditAccession", auditService.auditLogs(accession)); + model.addAttribute("accessionNames", genesysService.listAccessionNames(accession.getAccessionId())); model.addAttribute("accessionAliases", genesysService.listAccessionAliases(accession.getAccessionId())); - model.addAttribute("accessionExchange", genesysService.listAccessionExchange(accession.getAccessionId())); - model.addAttribute("accessionCollect", genesysService.listAccessionCollect(accession.getAccessionId())); - model.addAttribute("accessionBreeding", genesysService.listAccessionBreeding(accession.getAccessionId())); - AccessionGeo accessionGeo = genesysService.listAccessionGeo(accession.getAccessionId()); + + AccessionExchange accessionExchange = genesysService.getAccessionExchange(accession.getAccessionId()); + model.addAttribute("accessionExchange", accessionExchange); + + AccessionCollect accessionCollect = genesysService.getAccessionCollect(accession.getAccessionId()); + model.addAttribute("accessionCollect", accessionCollect); + + AccessionBreeding accessionBreeding = genesysService.getAccessionBreeding(accession.getAccessionId()); + model.addAttribute("accessionBreeding", accessionBreeding); + + AccessionGeo accessionGeo = genesysService.getAccessionGeo(accession.getAccessionId()); model.addAttribute("accessionGeo", accessionGeo); + + if (SecurityContextHolder.getContext().getAuthentication().isAuthenticated()) { + // only for authenticated users + model.addAttribute("auditAccessionExchange", auditService.auditLogs(accessionExchange)); + model.addAttribute("auditAccessionCollect", auditService.auditLogs(accessionCollect)); + model.addAttribute("auditAccessionBreeding", auditService.auditLogs(accessionBreeding)); + model.addAttribute("auditAccessionGeo", auditService.auditLogs(accessionGeo)); + } + model.addAttribute("svalbardDeposits", genesysService.getSvalbardData(accession.getAccessionId())); model.addAttribute("accessionRemarks", genesysService.listAccessionRemarks(accession.getAccessionId())); diff --git a/src/main/resources/content/language.properties b/src/main/resources/content/language.properties index d4e6d56d56f1a757da6a759a910e2c3e36f5a3e8..4093d941a3f8910592806cc74d159e1376582207 100644 --- a/src/main/resources/content/language.properties +++ b/src/main/resources/content/language.properties @@ -886,3 +886,5 @@ geo.country=Country: article.is.template=Is template: article.template.false=Article is not a template. article.template.true=This is a template. + +auditLog.no-value=No value diff --git a/src/main/sourceapp/1/styles/genesys.scss b/src/main/sourceapp/1/styles/genesys.scss index 7e8ceb79c46c047b22b761c01495708de96f1be8..8915f75e9d8a400ceacd1b01e38b5b61f05349a4 100644 --- a/src/main/sourceapp/1/styles/genesys.scss +++ b/src/main/sourceapp/1/styles/genesys.scss @@ -6539,3 +6539,17 @@ table.accessions { .margin-top-20 { margin-top: 20px; } .margin-top-25 { margin-top: 25px; } .margin-top-30 { margin-top: 30px; } + +.auditlog-entries { + opacity: .5; +} + +.change-arrow { + // [dir="ltr"] + &::before { + content: '\2192' // → + } + // [dir="rtl"] &::before { + // content: '\2190' // ← + // } +} diff --git a/src/main/webapp/WEB-INF/jsp/accession/details.jsp b/src/main/webapp/WEB-INF/jsp/accession/details.jsp index f5f7edc100b5f1df25492f002b5f5c4b3d158fb4..a1bd5dfbfc116bfad960c77add6495eca198543e 100644 --- a/src/main/webapp/WEB-INF/jsp/accession/details.jsp +++ b/src/main/webapp/WEB-INF/jsp/accession/details.jsp @@ -3,45 +3,46 @@ <%@ include file="/WEB-INF/jsp/init.jsp" %> - -<spring:message code="accession.page.profile.title" arguments="${accession.accessionName}" - argumentSeparator="|" - /> - - - -

- - - - -

+ + <spring:message code="accession.page.profile.title" arguments="${accession.accessionName}" argumentSeparator="|"/> + + + +

+ + + + +

-
-
- - -
-
+
+
+ + +
+
+ + + - - - + + + - - - + + + - - - + + + - - - + <%--

+ ${auditAccession} +

--%> - <%-- + <%-- @@ -50,587 +51,613 @@ --%> - -
-
-

-

-
- - -
-
-

- -

-
-
-

- - "> - -

-
-
-
- -
-
-

- -

-
-
-

- "> -

-
-
-
-
-

- -

-
-
-

- "> -

-
-
-
-
-

- -

-
-
-

- -

-
-
- - -
-
-

- -

-
-
-

- /${accession.origin.toUpperCase()}.svg" /> "> - -

-
-
-
+ +
+
+

+

+
-
-
-

- -

-
-
-

- "> - - -

-
-
-
-
-

- -

-
-
-

- "> - - "> -

-
-
+ +
+
+

+ +

+
+
+

+ + "> + +

+ +
+
+
-
-
-

- -

-
-
-

- - - -

-
-
+
+
+

+ +

+
+
+

+ + "> +

+ +
+
+
+
+

+ +

+
+
+

+ +

+
+
+
+
+

+ +

+
+
+

+ +

+ +
+
- -
-
-

- -

-
-
-

- - "> - -

-
-
-
+ +
+
+

+ +

+
+
+

+ +

+ +
+
+
- -
-
-

- -

-
-
-

-
-
-
+
+
+

+ +

+
+
+

+ "> + + + + +

+ +
+
+
+
+

+ +

+
+
+

+ "> + + + + + — + "> +

+ +
+
-
-
-

- -

-
-
-

- -

-
-
+
+
+

+ +

+
+
+

+ +

+ +
+
-
-
-

- -

-
-
- -

- -

-
-
-
+ +
+
+

+ +

+
+
+

+ + "> + +

+
+
+
-
-
-

- -

-
-
-

- -

-
-
+ +
+
+

+ +

+
+
+

+ +
+
+
-
-
-

- -

-
-
-

- -

-
-
+
+
+

+ +

+
+
+

+ +

+ +
+
-
-
-

- -

-
-
- -

- - - "> - - - - - - - - -

-
-
-
+
+
+

+ +

+
+
+ +

+ +

+
+ +
+
- -
-
-

- -

-
-
- -

- -

-
-
-
-
+
+
+

+ +

+
+
+

+ +

+ +
+
+
+
+

+ +

+
+
+

+ +

+ +
+
- -
-
-

- -

-
-
-

- - - - -

-
-
-
-
-

- -

-
-
-

- -

-
-
-
+
+
+

+ +

+
+
+ +

+ + + "> + + + + + + + + +

+
+
+
- -
-
-

- -

-
-
-

- - urn:uuid: - - -

-
-
-
-
-

- -

-
-
-

- "> -

-
-
-
+ +
+
+

+ +

+
+
+ +

+ +

+ +
+
+
+
- -
-
-

- -

-
-
-

- "> -

-
-
-
+ +
+
+

+ +

+
+
+

+ + + + +

+ + +
+
+
+
+

+ +

+
+
+

+ +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ + urn:uuid: + + +

+
+
+
+
+

+ +

+
+
+

+ "> +

+
+
+
-
- -
- + +
+
+

+ +

+
+
+

+ "> +

+ +
+
+
- - - - + - - - + + + - - -
-

- -

-
-
- -
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- -

-
- <%-- --%> -
-
- -
-
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- -

-
-
-
-
-
-
- + - - -
-

- -

-
- -
-
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- -

-
-
-
-
-
-
- + + +
+

+ +

+
+
+ +
+

+ +

+
+
+

+ +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ +

+ + +
+
+
+ +
+
+

+ +

+
+
+

+ +

+ +
+ <%-- --%> +
+
+ +
+
+

+ +

+
+
+

+ +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ +

+ +
+
+
+
+
+
+ - - -
-

- -

-
+ + +
+

+ +

+
+ +
+
+

+ +

+
+
+

+ +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ +

+ +
+
+
+
+
+
+ + + +
+

+ +

+
- + -
- <%--

--%> -
- <%-- +
+ <%--

--%> +
+ <%--
@@ -644,194 +671,200 @@
:
--%> -
-
+
+ + +
+
+

+ +

+
+
+

+ +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ +

+ + +
+
+
+ +
+
+

+ +

+
+
+

+ + m +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ +

+ +
+
+
+ +
+
+

+ +

+
+
+

+ + m +

+ +
+
+
+
+
+ + - -
-
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- - m -

-
-
-
- -
-
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- -

-
-
-
- -
-
-

- -

-
-
-

- - m -

-
-
-
-
-
- - - - - -
-

- -

-
- -
-
-
- -
-
-
-
-
- -
-
-
-
+ + +
+

+ +

+
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
- -
-
-
- -
- -
-
-
-
-
-
-
- -
-
-
- -
- -
-
-
-
-
-
-
- -
-
-
- -
- -
-
-
-
-
-
-
- -
-
-
- -
- -
-
-
-
-
-
-
- -
-
-
- -
- -
-
-
-
-
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+
+
- <%-- Needs work + <%-- Needs work

@@ -840,330 +873,386 @@
--%> -
-
-
- - - -
-

- -

- -
-
-
-

- -

-
- -
- -
-
-

- -

-
-
-

- -

-
-
-
-
-

- -

-
-
-

- -

-
-
-
-
-

- -

-
-
-

- -

-
-
-
-
-

- -

-

-
-

- -

-
-
-
-
-
-
+
+
+
+ + +
+

+ +

+ +
+
+
+

+ +

+
+ +
- -
-

- -

-
- -
-
- -
-
- -
-
-
-
-
-
-
+
+
+

+ +

+
+
+

+ +

+
+
+
+
+

+ +

+
+
+

+ +

+
+
+
+
+

+ +

+
+
+

+ +

+
+
+
+
+

+ +

+
+

+ +

+
+
+
+ +
+ + +
+

+ +

+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
- -
-
-

- -

-
-
-
-

- -

- - - "> -
-
-
- -
-
-
-
-
+ +
+
+

+ +

+
+
+
+

+ +

+ + + + + "> + +
+
+
+ +
+
+
+
+
- -
-

- -

-
- -
-
- -
-
- -
- - - - - -
-
-
-
- -
-
-
-
-
-
+ +
+

+ +

+
+ +
+
+ +
+
+ +
+ + + + + + + +
+
+
+
+ +
+
+
+
+
+
- -
-

- -

-
-
    - -
  • -
    - "> -
    -
    - -
    -
    - -
    -
  • -
    -
-
-
-
+ +
+

+ +

+
+
    + +
  • +
    + + "> +
    +
    + +
    +
    + +
    +
  • +
    +
+
+
+
-
-
-

- - - - -

-
-
+
+
+

+ + + + +

+
+
- - - - - + + + - - - + + + - - - - - + // Load metadata + $.ajax(baseHref + imageUuid.substring(0, 3) + '/' + imageUuid + imageExt + "?metadata", { + method: 'get', + dataType: 'json', + success: function (respObject) { + // console.log(respObject); + fillMetadata(metadataBox, respObject); + $(metadataBox).show(); + }, + error: function (jqXHR, textStatus, errorThrown) { + console.log(textStatus); + console.log(errorThrown); + } + }); + } + $(document).ready(function () { + var galleryView = $('#accession-image-view')[0]; + var galleryThumbnails = $('#accession-images-thumbs > div'); + galleryThumbnails.click(function (ev) { + showImage(galleryView, $(this).attr('x-uuid'), $(this).attr('x-ext')); + }); + if (galleryThumbnails.length > 0) { + // Show first image + showImage(galleryView, $(galleryThumbnails[0]).attr('x-uuid'), $(galleryThumbnails[0]).attr('x-ext')); + } + }); + + + + + + diff --git a/src/main/webapp/WEB-INF/jsp/accession/explore2.jsp b/src/main/webapp/WEB-INF/jsp/accession/explore2.jsp index c3de023cf123817be8dea41cbdebb855284297a9..cd24052e02441c10cf283d96ad357a8207199b93 100644 --- a/src/main/webapp/WEB-INF/jsp/accession/explore2.jsp +++ b/src/main/webapp/WEB-INF/jsp/accession/explore2.jsp @@ -191,7 +191,7 @@

- "> + ">

@@ -1129,5 +1129,3 @@ - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/tags/auditlog-changes.tag b/src/main/webapp/WEB-INF/tags/auditlog-changes.tag new file mode 100644 index 0000000000000000000000000000000000000000..ccb9fa8b054fb74f8777187c17d3514ecaea8612 --- /dev/null +++ b/src/main/webapp/WEB-INF/tags/auditlog-changes.tag @@ -0,0 +1,40 @@ +<%@ tag description="Displays audit log for a single property" pageEncoding="UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> +<%@ taglib prefix="local" tagdir="/WEB-INF/tags" %> +<%@ attribute name="auditLogs" required="true" type="java.util.List" %> +<%@ attribute name="property" required="false" type="java.lang.String" %> +<%@ attribute name="i18n" required="false" type="java.lang.String" %> + +<%--

+ + Logs=${auditLogs} + +

--%> + + + +
+ +

+ + + + + + + + + + + + + + + +

+
+
+
+
diff --git a/src/main/webapp/WEB-INF/tags/country.tag b/src/main/webapp/WEB-INF/tags/country.tag new file mode 100644 index 0000000000000000000000000000000000000000..7bbc0ca9252ca3ef40047745a08155ddd5fc5370 --- /dev/null +++ b/src/main/webapp/WEB-INF/tags/country.tag @@ -0,0 +1,16 @@ +<%@ tag description="Pretty print taxon name" pageEncoding="UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ attribute name="country" required="true" type="org.genesys2.server.model.impl.Country" %> +<%@ attribute name="flag" required="false" type="java.lang.Boolean" %> + + + + "> + + + /${country.code3.toUpperCase()}.svg" /> + "> + + + + diff --git a/src/main/webapp/WEB-INF/tags/display.tag b/src/main/webapp/WEB-INF/tags/display.tag new file mode 100644 index 0000000000000000000000000000000000000000..c02a348cdf82143699499c5863b5839b3845c5b6 --- /dev/null +++ b/src/main/webapp/WEB-INF/tags/display.tag @@ -0,0 +1,44 @@ +<%@ tag description="Displays stuff" pageEncoding="UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="local" tagdir="/WEB-INF/tags" %> +<%@ attribute name="value" required="true" type="java.lang.Object" %> +<%@ attribute name="property" required="false" type="java.lang.String" %> +<%@ attribute name="i18n" required="false" type="java.lang.String" %> + + + + + + + + <%-- No prop --%> + + + + + + + + + + + + + + + + + + + <%-- Prop='${property}' --%> + + + + + <%-- i18n=${i18n}.${value[property]} --%> + + + + diff --git a/src/main/webapp/WEB-INF/tags/taxonName.tag b/src/main/webapp/WEB-INF/tags/taxonName.tag new file mode 100644 index 0000000000000000000000000000000000000000..8d2ae1094907dfca72011e6b0d42d61302cf3084 --- /dev/null +++ b/src/main/webapp/WEB-INF/tags/taxonName.tag @@ -0,0 +1,7 @@ +<%@ tag description="Pretty print taxon name" pageEncoding="UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ attribute name="taxon" required="true" type="org.genesys2.server.model.genesys.Taxonomy2" %> + + + +