Skip to content

Commit 666c781

Browse files
committed
Merge branch '2024.06.x'
* 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
2 parents 0c12a5a + ba2d177 commit 666c781

File tree

27 files changed

+1459
-630
lines changed

27 files changed

+1459
-630
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This guide addresses developers. Thats why you run it in 'dev' profile!
2525
- Run Solr with the command: `mvn -Pdev solr-runner:start`
2626
- To start up a servlet container as a development environment go back to `mir` folder
2727
- Run `mvn install -am -pl mir-webapp && mvn -Pdev -Dtomcat org.codehaus.cargo:cargo-maven3-plugin:run -pl mir-webapp`
28-
- Open `http://localhost/mir` in your browser
28+
- Open `http://localhost:8291/mir` in your browser
2929
- To perform the guided initial configuration
3030
- Use the login token from the server log to continue
3131
- Use the SOLR server URL `http://localhost:8983`
@@ -35,6 +35,8 @@ This guide addresses developers. Thats why you run it in 'dev' profile!
3535
- Enter usernames `admin`, `indexer` and `searcher` respectively and password `alleswirdgut` for all three users
3636
- Select database type `H2`
3737
- Continue and restart the servlet container as instructed
38+
- Open `http://localhost:8291/mir` in your browser again
39+
- Log in using username `administrator` and password `alleswirdgut`
3840

3941
Afterward, you can stop Solr from the `mir-webapp` folder with `mvn -Pdev solr-runner:stop`.
4042
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`.

mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_browse.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,10 @@ ul ul span.cbNum {
143143
word-break: break-all;
144144
padding-right: 20px;
145145
}
146+
147+
.file_md5 {
148+
&.hidden {
149+
display: none;
150+
}
151+
}
146152
}

mir-layout/src/main/resources/META-INF/resources/mir-layout/scss/common/mir_metadata.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ $grayDark: #ECF0F1 !default;
269269
height:200px;
270270
}
271271

272+
.mir-ror-logo {
273+
height: 20px;
274+
}
272275
.mir-toc-sections {
273276
list-style-type: none;
274277
padding-left: 0;

mir-module/GruntFile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ module.exports = function(grunt) {
6969
'<%= 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',
7070
'<%= 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',
7171
'<%= 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',
72+
'<%= 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',
7273
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/mir/openaire.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/mir/openaire.js',
7374
'<%= 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',
7475
'<%= 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',

mir-module/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@
239239
<artifactId>bcprov-jdk18on</artifactId>
240240
<scope>runtime</scope>
241241
</dependency>
242+
<dependency>
243+
<groupId>org.glassfish.jaxb</groupId>
244+
<artifactId>jaxb-runtime</artifactId>
245+
<scope>runtime</scope>
246+
</dependency>
242247
<dependency>
243248
<groupId>org.hibernate.orm</groupId>
244249
<artifactId>hibernate-hikaricp</artifactId>

mir-module/src/main/java/org/mycore/mir/authorization/accesskeys/MIRAccessKeyPairTransformer.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@
2020
package org.mycore.mir.authorization.accesskeys;
2121

2222
import java.io.IOException;
23+
import java.util.Map;
2324

2425
import org.jdom2.Document;
2526
import org.jdom2.Element;
2627
import org.jdom2.transform.JDOMSource;
2728
import org.mycore.common.MCRException;
29+
import org.mycore.common.config.MCRConfiguration2;
2830
import org.mycore.common.content.MCRJAXBContent;
2931
import org.mycore.datamodel.metadata.MCRObjectID;
3032
import org.mycore.mir.authorization.accesskeys.backend.MIRAccessKeyPair;
3133

3234
import jakarta.xml.bind.JAXBContext;
35+
import jakarta.xml.bind.JAXBContextFactory;
3336
import jakarta.xml.bind.JAXBException;
3437
import jakarta.xml.bind.Unmarshaller;
3538

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

5558
private static JAXBContext initContext() {
5659
try {
57-
return JAXBContext.newInstance(MIRAccessKeyPair.class.getPackage().getName(),
58-
MIRAccessKeyPair.class.getClassLoader());
60+
String factoryProperty = "MIR.AccessKey.JAXBContextFactory";
61+
JAXBContextFactory jaxbContextFactory =
62+
MCRConfiguration2.getInstanceOf(JAXBContextFactory.class, factoryProperty)
63+
.orElseThrow(() -> MCRConfiguration2.createConfigurationException(factoryProperty));
64+
return jaxbContextFactory.createContext(MIRAccessKeyPair.class.getPackage().getName(),
65+
MIRAccessKeyPair.class.getClassLoader(), Map.of());
5966
} catch (final JAXBException e) {
6067
throw new MCRException("Could not instantiate JAXBContext.", e);
6168
}
@@ -121,8 +128,9 @@ public static MIRAccessKeyPair buildAccessKeyPair(final MCRObjectID mcrObjectId,
121128
}
122129
try {
123130
final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
124-
return MIRAccessKeyPair.fromServiceFlags(mcrObjectId,
125-
(MIRAccessKeyPair.ServiceFlags) unmarshaller.unmarshal(new JDOMSource(element)));
131+
MIRAccessKeyPair.ServiceFlags serviceFlags =
132+
unmarshaller.unmarshal(new JDOMSource(element.clone()), MIRAccessKeyPair.ServiceFlags.class).getValue();
133+
return MIRAccessKeyPair.fromServiceFlags(mcrObjectId, serviceFlags);
126134
} catch (final JAXBException e) {
127135
throw new MCRException("Exception while transforming Element to MIRAccessKeyPair.", e);
128136
}

mir-module/src/main/resources/META-INF/resources/editor/editor-includes.xed

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,8 @@
677677
</xed:template>
678678

679679
<xed:template id="person.affiliation">
680-
<mir:textfield repeat="true" xpath="mods:affiliation" help-text="{i18n:mir.help.affiliation}" label="mir.affiliation" />
680+
<mir:textfield repeat="true" xpath="mods:affiliation[not(@authorityURI)]" help-text="{i18n:mir.help.affiliation}" label="mir.affiliation" />
681+
<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"/>
681682
</xed:template>
682683

683684
<xed:template id="nameIdentifier.repeated">
@@ -1812,7 +1813,7 @@
18121813
</xed:template>
18131814

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

18301831
<xed:template id="subject.simple.required">
1831-
<xed:repeat xpath="mods:subjectXML" min="1" max="10">
1832+
<xed:repeat xpath="mods:subjectXML" min="1" max="{$MIR.Editor.repeat.max.subject.simple.required}">
18321833
<div class="form-group row {$xed-validation-marker}">
18331834
<label class="col-md-3 col-form-label text-right">
18341835
<xed:output i18n="mir.subject.topic"/>

mir-module/src/main/resources/META-INF/resources/hbs/derivate-fileList.hbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
<a href="{{href}}">
4242
{{name}}
4343
</a>
44+
<div class="file_md5 hidden">
45+
<span class="file_md5_label">{{getI18n "mir.derivate.file.MD5"}}</span> {{md5}}
46+
</div>
4447
</td>
4548
{{/contains}}
4649
{{else}}
Lines changed: 11 additions & 0 deletions
Loading

mir-module/src/main/resources/META-INF/resources/js/mir/base.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,57 @@
329329
}
330330
});
331331

332+
// Element with the link to toggle to show/hide md5 sums
333+
const toggleMD5LinkElement = '.toggleMD5Link';
334+
// Derivate action dropdown toggle button element
335+
const derivateActionDropdownToggleButton = '.headline .dropdown.options .dropdown-toggle';
336+
// Element selector with md5 information
337+
const md5ElementSelector = '.file_md5';
338+
// Element selector for the derivate file box
339+
const fileBoxSelector = '.file_box';
340+
341+
// Show/hide md5 sums by derivate files by clicking on the 'toggleMD5LinkElement' element
342+
$(toggleMD5LinkElement).click((evt) => {
343+
evt.preventDefault();
344+
// Get a current derivate parent element
345+
const currentDerivateIdParentElements = $(evt.currentTarget).closest(fileBoxSelector);
346+
if (currentDerivateIdParentElements.length) {
347+
// Get all elements for all files with the md5 sum
348+
const currentMd5Elements = $(currentDerivateIdParentElements.get(0)).find(md5ElementSelector);
349+
if (currentMd5Elements.length) {
350+
// Show/hide every element
351+
currentMd5Elements.each((index, element) => {
352+
$(element).toggleClass('hidden');
353+
});
354+
}
355+
}
356+
});
357+
358+
// Getting i18n translation for the link to switch state 'show/hide MD5 amounts' depending on the visibility of the
359+
// message with this amount when clicking on the 'derivateActionDropdownToggleButton' element
360+
$(derivateActionDropdownToggleButton).click((evt) => {
361+
// Get a current derivate parent element
362+
const currentDerivateIdParentElements = $(evt.currentTarget).closest(fileBoxSelector);
363+
if (currentDerivateIdParentElements.length) {
364+
// Get all elements for all files with the md5 sum
365+
const currentMd5Elements = $(currentDerivateIdParentElements.get(0)).find(md5ElementSelector);
366+
if (currentMd5Elements.length) {
367+
// only the first element is checked for the presence/absence of a hidden class,
368+
// assuming that the remaining elements of the current derivate meet this condition
369+
const i18nKey = ($(currentMd5Elements.get(0)).hasClass('hidden'))
370+
? ('component.mods.metaData.options.MD5.show')
371+
: ('component.mods.metaData.options.MD5.hide');
372+
373+
// Get a current toggle element
374+
const currentToggleMD5LinkElement = $(currentDerivateIdParentElements.get(0)).find(toggleMD5LinkElement);
375+
376+
if (currentToggleMD5LinkElement.length) {
377+
getI18n(i18nKey, currentToggleMD5LinkElement.get(0));
378+
}
379+
}
380+
}
381+
});
382+
332383
var languageList = jQuery('#topnav .languageList');
333384
jQuery('#topnav .languageSelect').click(function() {
334385
languageList.toggleClass('hide');

0 commit comments

Comments
 (0)