Skip to content

Commit

Permalink
MIR-1412 add changes to display md5 sum in derivates file list
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy 'Alex' Levshyn committed Nov 26, 2024
1 parent d23b3a7 commit 3059e64
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,10 @@ ul ul span.cbNum {
word-break: break-all;
padding-right: 20px;
}

.md5 {
&.hidden {
display: none;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<a href="{{href}}">
{{name}}
</a>
<!-- Show md5 sum -->
<div class="md5 hidden">{{getI18n "mir.derivate.file.MD5"}} {{md5}}</div>
</td>
{{/contains}}
{{else}}
Expand Down
31 changes: 31 additions & 0 deletions mir-module/src/main/resources/META-INF/resources/js/mir/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,37 @@
}
});

// 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';

// Show md5 sums by derivate files by clicking on the 'toggleMD5LinkElement' element
$(toggleMD5LinkElement).click((evt) => {
evt.preventDefault();
// Get the element to show/hide
const elements = document.querySelectorAll('.md5');

elements.forEach(element => {
element.classList.toggle('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) => {
const md5Element = '.md5';
if ($(md5Element)) {
let i18nKey = '';
if ($(md5Element).hasClass('hidden')) {
i18nKey = 'component.mods.metaData.options.MD5.show';
} else {
i18nKey = 'component.mods.metaData.options.MD5.hide';
}
getI18n(i18nKey, toggleMD5LinkElement);
}
});

var languageList = jQuery('#topnav .languageList');
jQuery('#topnav .languageSelect').click(function() {
languageList.toggleClass('hide');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -867,3 +870,4 @@ subselect.category.cancel = Cancel
subselect.category.title = Choose category
user.profile.id.orcid = Your ORCID iD
Original file line number Diff line number Diff line change
Expand Up @@ -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:
6 changes: 6 additions & 0 deletions mir-module/src/main/resources/xsl/modsdetails-external.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,12 @@
<xsl:value-of select="i18n:translate('component.mods.metaData.options.updateDerivateName')" />
</a>
</li>
<li>
<!-- Link to toggle to show/hide md5 sum -->
<a href="#" class="option dropdown-item" id="toggleMD5Link">
<xsl:value-of select="i18n:translate('component.mods.metaData.options.MD5.show')" />
</a>
</li>
</xsl:if>
<xsl:if test="key('rights', $deriv)/@write and iview2:getSupportedMainFile($deriv) and normalize-space($MIR.METSEditor.enable)='true'">
<li>
Expand Down

0 comments on commit 3059e64

Please sign in to comment.