diff --git a/mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_browse.scss b/mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_browse.scss index 753b98f970..f1626bb73f 100644 --- a/mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_browse.scss +++ b/mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_browse.scss @@ -143,4 +143,10 @@ ul ul span.cbNum { word-break: break-all; padding-right: 20px; } + + .file_md5 { + &.hidden { + display: none; + } + } } diff --git a/mir-module/src/main/resources/META-INF/resources/hbs/derivate-fileList.hbs b/mir-module/src/main/resources/META-INF/resources/hbs/derivate-fileList.hbs index bfe8124805..567e6d9d55 100644 --- a/mir-module/src/main/resources/META-INF/resources/hbs/derivate-fileList.hbs +++ b/mir-module/src/main/resources/META-INF/resources/hbs/derivate-fileList.hbs @@ -41,6 +41,9 @@ {{name}} +
{{/contains}} {{else}} diff --git a/mir-module/src/main/resources/META-INF/resources/js/mir/base.js b/mir-module/src/main/resources/META-INF/resources/js/mir/base.js index b5c9f006fd..867efa6dab 100644 --- a/mir-module/src/main/resources/META-INF/resources/js/mir/base.js +++ b/mir-module/src/main/resources/META-INF/resources/js/mir/base.js @@ -329,6 +329,57 @@ } }); + // Element with the link to toggle to show/hide md5 sums + const toggleMD5LinkElement = '.toggleMD5Link'; + // Derivate action dropdown toggle button element + const derivateActionDropdownToggleButton = '.headline .dropdown.options .dropdown-toggle'; + // Element selector with md5 information + const md5ElementSelector = '.file_md5'; + // Element selector for the derivate file box + const fileBoxSelector = '.file_box'; + + // Show/hide md5 sums by derivate files by clicking on the 'toggleMD5LinkElement' element + $(toggleMD5LinkElement).click((evt) => { + evt.preventDefault(); + // Get a current derivate parent element + const currentDerivateIdParentElements = $(evt.currentTarget).closest(fileBoxSelector); + if (currentDerivateIdParentElements.length) { + // Get all elements for all files with the md5 sum + const currentMd5Elements = $(currentDerivateIdParentElements.get(0)).find(md5ElementSelector); + if (currentMd5Elements.length) { + // Show/hide every element + currentMd5Elements.each((index, element) => { + $(element).toggleClass('hidden'); + }); + } + } + }); + + // Getting i18n translation for the link to switch state 'show/hide MD5 amounts' depending on the visibility of the + // message with this amount when clicking on the 'derivateActionDropdownToggleButton' element + $(derivateActionDropdownToggleButton).click((evt) => { + // Get a current derivate parent element + const currentDerivateIdParentElements = $(evt.currentTarget).closest(fileBoxSelector); + if (currentDerivateIdParentElements.length) { + // Get all elements for all files with the md5 sum + const currentMd5Elements = $(currentDerivateIdParentElements.get(0)).find(md5ElementSelector); + if (currentMd5Elements.length) { + // only the first element is checked for the presence/absence of a hidden class, + // assuming that the remaining elements of the current derivate meet this condition + const i18nKey = ($(currentMd5Elements.get(0)).hasClass('hidden')) + ? ('component.mods.metaData.options.MD5.show') + : ('component.mods.metaData.options.MD5.hide'); + + // Get a current toggle element + const currentToggleMD5LinkElement = $(currentDerivateIdParentElements.get(0)).find(toggleMD5LinkElement); + + if (currentToggleMD5LinkElement.length) { + getI18n(i18nKey, currentToggleMD5LinkElement.get(0)); + } + } + } + }); + var languageList = jQuery('#topnav .languageList'); jQuery('#topnav .languageSelect').click(function() { languageList.toggleClass('hide'); diff --git a/mir-module/src/main/resources/META-INF/resources/js/mir/derivate-fileList.js b/mir-module/src/main/resources/META-INF/resources/js/mir/derivate-fileList.js index c9119c2406..566e935940 100644 --- a/mir-module/src/main/resources/META-INF/resources/js/mir/derivate-fileList.js +++ b/mir-module/src/main/resources/META-INF/resources/js/mir/derivate-fileList.js @@ -516,7 +516,9 @@ const mirKeyURL = webApplicationBaseURL + "rsc/locale/translate/" + lang + "/mir.confirm.*"; const pagiKeyURL = webApplicationBaseURL + "rsc/locale/translate/" + lang + "/mir.pagination.*"; const uploadKeyURL = webApplicationBaseURL + "rsc/locale/translate/" + lang + "/mir.upload.drop.*"; - const allRequests = Promise.all([ifsKeyURL, mirKeyURL, pagiKeyURL, uploadKeyURL] + const derivateFileKeyURL = webApplicationBaseURL + "rsc/locale/translate/" + lang + "/mir.derivate.file.*"; + const allRequests = Promise.all([ifsKeyURL, mirKeyURL, pagiKeyURL, uploadKeyURL, + derivateFileKeyURL] .map((url)=> fetch(url)) .map((promise)=> promise.then((response)=> response.json()))); diff --git a/mir-module/src/main/resources/config/mir/messages_de.properties b/mir-module/src/main/resources/config/mir/messages_de.properties index a513c6ddb1..a436cd420c 100644 --- a/mir-module/src/main/resources/config/mir/messages_de.properties +++ b/mir-module/src/main/resources/config/mir/messages_de.properties @@ -48,6 +48,8 @@ component.mods.metaData.options.derivateLocked = Bearbeitung wg. PI ges component.mods.metaData.options.updateDerivateName = Dateibereich verwalten component.mods.metaData.options.startmets = im METS-Editor \u00F6ffnen component.mods.metaData.options.zip = als Zip speichern +component.mods.metaData.options.MD5.show = MD5 Summen anzeigen +component.mods.metaData.options.MD5.hide = MD5 Summen ausblenden component.pi.register.DNBURN = URN registrieren component.pi.register.Datacite = DOI registrieren component.pi.register.Epic = ePIC registrieren @@ -915,3 +917,4 @@ subselect.category.title = Kategorie ausw\u00E4hlen user.profile.id.orcid = Ihre ORCID iD selfRegistration.error.mailExists = Die E-Mail-Adresse wird bereits verwendet. +mir.derivate.file.MD5 = MD5 Summe: diff --git a/mir-module/src/main/resources/config/mir/messages_en.properties b/mir-module/src/main/resources/config/mir/messages_en.properties index 5f34c0d38d..0f0027e9e9 100644 --- a/mir-module/src/main/resources/config/mir/messages_en.properties +++ b/mir-module/src/main/resources/config/mir/messages_en.properties @@ -45,6 +45,8 @@ component.mods.metaData.options.derivateLocked = locked due to PI component.mods.metaData.options.startmets = open in METS editor component.mods.metaData.options.updateDerivateName = Manage file space component.mods.metaData.options.zip = save as Zip +component.mods.metaData.options.MD5.show = Show MD5 sums +component.mods.metaData.options.MD5.hide = Hide MD5 sums component.pi.register.DNBURN = register URN component.pi.register.Datacite = register DOI component.pi.register.Epic = register ePIC @@ -286,6 +288,7 @@ mir.derivate.no_access.intern = To see the attached files you h mir.derivate.no_access.ipAddressRange = You can access the attached files only from a computer in the library. mir.derivate.not_full_access = You do not have the required rights to see all attached files. mir.derivate.type = derivate type +mir.derivate.file.MD5 = MD5 sum: mir.details.issue = No. mir.details.personpopover.title = person details mir.details.volume.journal = Vol. @@ -867,3 +870,4 @@ subselect.category.cancel = Cancel subselect.category.title = Choose category user.profile.id.orcid = Your ORCID iD + diff --git a/mir-module/src/main/resources/config/mir/messages_it.properties b/mir-module/src/main/resources/config/mir/messages_it.properties index 8045bf1bc7..68bc956c26 100644 --- a/mir-module/src/main/resources/config/mir/messages_it.properties +++ b/mir-module/src/main/resources/config/mir/messages_it.properties @@ -53,3 +53,6 @@ mir.response.facet.modifiedby.title = Modificato da mir.response.facet.mods.author.title = Autore user.profile.id.orcid = Your ORCID iD +component.mods.metaData.options.MD5.show = Mostra somme MD5 +component.mods.metaData.options.MD5.hide = Nascondi somme MD5 +mir.derivate.file.MD5 = somma MD5: diff --git a/mir-module/src/main/resources/xsl/modsdetails-external.xsl b/mir-module/src/main/resources/xsl/modsdetails-external.xsl index f975168fbb..762ecf2228 100644 --- a/mir-module/src/main/resources/xsl/modsdetails-external.xsl +++ b/mir-module/src/main/resources/xsl/modsdetails-external.xsl @@ -720,6 +720,12 @@