Skip to content

Commit

Permalink
Merge branch '2024.06.x'
Browse files Browse the repository at this point in the history
* 2024.06.x:
  Bump nanoid from 3.3.6 to 3.3.8 in /mir-webapp/src/main/vue/name-search
  MIR-1416 pin glassfish jaxb-runtime to MIRAccessKeyPairTransformer
  MIR-1412 Show MD5 sum for each file in the derivate file list (#1089)
  Update README.md (#1091)
  MIR-1413-subject xml:lang should not be removed
  MIR-1408 Added class attributes to list items in action menu (#1083)
  Bump http-proxy-middleware in /mir-webapp/src/main/vue/name-search
  Bump express in /mir-webapp/src/main/vue/editor-tools
  Update README.md (#1086)
  MIR-1361 Allow to enter ROR as affiliation for authors (#1074)
  update PMD ruleset.xml (#1082)
  MIR-1365 Allow to configure max value for xed template subject.simple and subject.simple.required
  MIR-1359 fix choose publication button in related item (#1071)
  Bump express in /mir-webapp/src/main/vue/name-search
  Bump dompurify in /mir-webapp/src/main/vue/editor-tools
  Bump webpack in /mir-webapp/src/main/vue/editor-tools
  Bump braces from 3.0.2 to 3.0.3 in /mir-wizard
  • Loading branch information
yagee-de committed Dec 18, 2024
2 parents 0c12a5a + ba2d177 commit 666c781
Show file tree
Hide file tree
Showing 27 changed files with 1,459 additions and 630 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This guide addresses developers. Thats why you run it in 'dev' profile!
- Run Solr with the command: `mvn -Pdev solr-runner:start`
- To start up a servlet container as a development environment go back to `mir` folder
- Run `mvn install -am -pl mir-webapp && mvn -Pdev -Dtomcat org.codehaus.cargo:cargo-maven3-plugin:run -pl mir-webapp`
- Open `http://localhost/mir` in your browser
- Open `http://localhost:8291/mir` in your browser
- To perform the guided initial configuration
- Use the login token from the server log to continue
- Use the SOLR server URL `http://localhost:8983`
Expand All @@ -35,6 +35,8 @@ This guide addresses developers. Thats why you run it in 'dev' profile!
- Enter usernames `admin`, `indexer` and `searcher` respectively and password `alleswirdgut` for all three users
- Select database type `H2`
- Continue and restart the servlet container as instructed
- Open `http://localhost:8291/mir` in your browser again
- Log in using username `administrator` and password `alleswirdgut`

Afterward, you can stop Solr from the `mir-webapp` folder with `mvn -Pdev solr-runner:stop`.
If you need to update Solr cores, you can do this from the `mir-webapp` folder with `mvn -Pdev solr-runner:stop solr-runner:copyHome solr-runner:start`.
Expand Down
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;
}

.file_md5 {
&.hidden {
display: none;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ $grayDark: #ECF0F1 !default;
height:200px;
}

.mir-ror-logo {
height: 20px;
}
.mir-toc-sections {
list-style-type: none;
padding-left: 0;
Expand Down
1 change: 1 addition & 0 deletions mir-module/GruntFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = function(grunt) {
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/mir/relatedItem-modal.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/mir/relatedItem-modal.js',
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/mir/relatedItem-autocomplete.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/mir/relatedItem-autocomplete.js',
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/mir/xeditor-form.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/mir/xeditor-form.js',
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/mir/ror-search.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/mir/ror-search.js',
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/mir/openaire.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/mir/openaire.js',
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/mir/classification-modal-select.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/mir/classification-modal-select.js',
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/mir/geo-coords.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/mir/geo-coords.js',
Expand Down
5 changes: 5 additions & 0 deletions mir-module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@
<artifactId>bcprov-jdk18on</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-hikaricp</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@
package org.mycore.mir.authorization.accesskeys;

import java.io.IOException;
import java.util.Map;

import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.transform.JDOMSource;
import org.mycore.common.MCRException;
import org.mycore.common.config.MCRConfiguration2;
import org.mycore.common.content.MCRJAXBContent;
import org.mycore.datamodel.metadata.MCRObjectID;
import org.mycore.mir.authorization.accesskeys.backend.MIRAccessKeyPair;

import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBContextFactory;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;

Expand All @@ -54,8 +57,12 @@ private MIRAccessKeyPairTransformer() {

private static JAXBContext initContext() {
try {
return JAXBContext.newInstance(MIRAccessKeyPair.class.getPackage().getName(),
MIRAccessKeyPair.class.getClassLoader());
String factoryProperty = "MIR.AccessKey.JAXBContextFactory";
JAXBContextFactory jaxbContextFactory =
MCRConfiguration2.getInstanceOf(JAXBContextFactory.class, factoryProperty)
.orElseThrow(() -> MCRConfiguration2.createConfigurationException(factoryProperty));
return jaxbContextFactory.createContext(MIRAccessKeyPair.class.getPackage().getName(),
MIRAccessKeyPair.class.getClassLoader(), Map.of());
} catch (final JAXBException e) {
throw new MCRException("Could not instantiate JAXBContext.", e);
}
Expand Down Expand Up @@ -121,8 +128,9 @@ public static MIRAccessKeyPair buildAccessKeyPair(final MCRObjectID mcrObjectId,
}
try {
final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
return MIRAccessKeyPair.fromServiceFlags(mcrObjectId,
(MIRAccessKeyPair.ServiceFlags) unmarshaller.unmarshal(new JDOMSource(element)));
MIRAccessKeyPair.ServiceFlags serviceFlags =
unmarshaller.unmarshal(new JDOMSource(element.clone()), MIRAccessKeyPair.ServiceFlags.class).getValue();
return MIRAccessKeyPair.fromServiceFlags(mcrObjectId, serviceFlags);
} catch (final JAXBException e) {
throw new MCRException("Exception while transforming Element to MIRAccessKeyPair.", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,8 @@
</xed:template>

<xed:template id="person.affiliation">
<mir:textfield repeat="true" xpath="mods:affiliation" help-text="{i18n:mir.help.affiliation}" label="mir.affiliation" />
<mir:textfield repeat="true" xpath="mods:affiliation[not(@authorityURI)]" help-text="{i18n:mir.help.affiliation}" label="mir.affiliation" />
<mir:textfield repeat="true" xpath="mods:affiliation[@authorityURI='https://ror.org/']" help-text="{i18n:mir.help.affiliation.ror}" label="mir.affiliation.ror" id="mir-ror-input"/>
</xed:template>

<xed:template id="nameIdentifier.repeated">
Expand Down Expand Up @@ -1812,7 +1813,7 @@
</xed:template>

<xed:template id="subject.simple">
<xed:repeat xpath="mods:subjectXML" min="1" max="10">
<xed:repeat xpath="mods:subjectXML" min="1" max="{$MIR.Editor.repeat.max.subject.simple}">
<div class="form-group row {$xed-validation-marker}">
<label class="col-md-3 col-form-label text-right">
<xed:output i18n="mir.subject.topic"/>
Expand All @@ -1828,7 +1829,7 @@
</xed:template>

<xed:template id="subject.simple.required">
<xed:repeat xpath="mods:subjectXML" min="1" max="10">
<xed:repeat xpath="mods:subjectXML" min="1" max="{$MIR.Editor.repeat.max.subject.simple.required}">
<div class="form-group row {$xed-validation-marker}">
<label class="col-md-3 col-form-label text-right">
<xed:output i18n="mir.subject.topic"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<a href="{{href}}">
{{name}}
</a>
<div class="file_md5 hidden">
<span class="file_md5_label">{{getI18n "mir.derivate.file.MD5"}}</span> {{md5}}
</div>
</td>
{{/contains}}
{{else}}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 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,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');
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
Loading

0 comments on commit 666c781

Please sign in to comment.