diff --git a/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/rulesetmanagement/FunctionalMetadata.java b/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/rulesetmanagement/FunctionalMetadata.java index ab6d9814865..f583adc5a50 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/rulesetmanagement/FunctionalMetadata.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/dataeditor/rulesetmanagement/FunctionalMetadata.java @@ -66,6 +66,11 @@ public enum FunctionalMetadata { */ RECORD_IDENTIFIER("recordIdentifier"), + /** + * In case the metadata key shall be used as node label in the structure tree. + */ + STRUCTURE_TREE_TITLE("structureTreeTitle"), + /** * The title. It is used to form the author-title key or the title key. */ diff --git a/Kitodo-DataEditor/src/test/java/org/kitodo/dataeditor/ruleset/RulesetManagementIT.java b/Kitodo-DataEditor/src/test/java/org/kitodo/dataeditor/ruleset/RulesetManagementIT.java index 456425c1a6c..fefdfc340b8 100644 --- a/Kitodo-DataEditor/src/test/java/org/kitodo/dataeditor/ruleset/RulesetManagementIT.java +++ b/Kitodo-DataEditor/src/test/java/org/kitodo/dataeditor/ruleset/RulesetManagementIT.java @@ -768,6 +768,9 @@ public void testGettingOfSpecialFields() throws Exception { assertThat("Periodical was not found!", rulesetManagement.getFunctionalDivisions(FunctionalDivision.CREATE_CHILDREN_FROM_PARENT), contains("Periodical")); + assertThat("structureTreeTitle was not found!", + rulesetManagement.getFunctionalKeys(FunctionalMetadata.STRUCTURE_TREE_TITLE), + contains("LABEL")); // not existing uses assertThat("Something was found!", diff --git a/Kitodo-DataEditor/src/test/resources/ruleset.xsd b/Kitodo-DataEditor/src/test/resources/ruleset.xsd index 33560322467..31a60d2d99c 100644 --- a/Kitodo-DataEditor/src/test/resources/ruleset.xsd +++ b/Kitodo-DataEditor/src/test/resources/ruleset.xsd @@ -465,6 +465,9 @@ 'recordIdentifier' Identifier of the data record fetched from an external data source, so that the imported metadata entries from the data source can be updated later. + 'structureTreeTitle' will be displayed as node titles of the structure tree of the metadata editor + if title is selected as the preferred display option. + 'title' This field is used as the title to form the author-title key. 'groupDisplayLabel' keys of this type are displayed in the metadata update dialog of the metadata @@ -484,6 +487,7 @@ + diff --git a/Kitodo-DataEditor/src/test/resources/testAnExtensiveRulesetCanBeLoaded.xml b/Kitodo-DataEditor/src/test/resources/testAnExtensiveRulesetCanBeLoaded.xml index 044dae712d5..82896edc871 100644 --- a/Kitodo-DataEditor/src/test/resources/testAnExtensiveRulesetCanBeLoaded.xml +++ b/Kitodo-DataEditor/src/test/resources/testAnExtensiveRulesetCanBeLoaded.xml @@ -314,7 +314,7 @@ - + diff --git a/Kitodo/rulesets/ruleset.xsd b/Kitodo/rulesets/ruleset.xsd index 33560322467..31a60d2d99c 100644 --- a/Kitodo/rulesets/ruleset.xsd +++ b/Kitodo/rulesets/ruleset.xsd @@ -465,6 +465,9 @@ 'recordIdentifier' Identifier of the data record fetched from an external data source, so that the imported metadata entries from the data source can be updated later. + 'structureTreeTitle' will be displayed as node titles of the structure tree of the metadata editor + if title is selected as the preferred display option. + 'title' This field is used as the title to form the author-title key. 'groupDisplayLabel' keys of this type are displayed in the metadata update dialog of the metadata @@ -484,6 +487,7 @@ + diff --git a/Kitodo/rulesets/simple-book.xml b/Kitodo/rulesets/simple-book.xml index ba43f82cac5..50365cddb01 100644 --- a/Kitodo/rulesets/simple-book.xml +++ b/Kitodo/rulesets/simple-book.xml @@ -36,7 +36,7 @@ - + diff --git a/Kitodo/rulesets/subhh.xml b/Kitodo/rulesets/subhh.xml index 7eb5ce2694d..ed7d23d8951 100644 --- a/Kitodo/rulesets/subhh.xml +++ b/Kitodo/rulesets/subhh.xml @@ -378,7 +378,7 @@ - + diff --git a/Kitodo/src/main/java/org/kitodo/config/enums/ParameterCore.java b/Kitodo/src/main/java/org/kitodo/config/enums/ParameterCore.java index c0801b94a0a..40e6a37e765 100644 --- a/Kitodo/src/main/java/org/kitodo/config/enums/ParameterCore.java +++ b/Kitodo/src/main/java/org/kitodo/config/enums/ParameterCore.java @@ -317,12 +317,6 @@ public enum ParameterCore implements ParameterInterface { */ PAGE_SEPARATORS(new Parameter<>("metsEditor.pageSeparators", "\" \"")), - /** - # Priority list of metadata keys used to display title information in the metadata editors structure and gallery - panels. - */ - TITLE_KEYS(new Parameter<>("metsEditor.titleMetadata", "")), - /* * backup of metadata configuration */ diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java index 7e3225d96dc..fb64e70134d 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java @@ -46,6 +46,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.kitodo.api.MetadataGroup; +import org.kitodo.api.dataeditor.rulesetmanagement.FunctionalMetadata; import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface; import org.kitodo.api.dataformat.LogicalDivision; import org.kitodo.api.dataformat.PhysicalDivision; @@ -197,6 +198,12 @@ public class DataEditorForm implements MetadataTreeTableInterface, RulesetSetupI */ private Task templateTask; + /** + * The list of metadata keys that are annotated with use="structureTreeTitle", meaning, + * they are used to generate the tree node label in case the title is requested by the user. + */ + private Collection structureTreeTitles = new ArrayList<>(); + private DataEditorSetting dataEditorSetting; private static final String DESKTOP_LINK = "/pages/desktop.jsf"; @@ -289,6 +296,7 @@ public void open(String processID, String referringView, String taskId) { String metadataLanguage = user.getMetadataLanguage(); priorityList = LanguageRange.parse(metadataLanguage.isEmpty() ? "en" : metadataLanguage); ruleset = ServiceManager.getRulesetService().openRuleset(process.getRuleset()); + this.loadStructureTreeTitlesFromRuleset(); try { mediaUpdated = openMetsFile(); } catch (MediaNotFoundException e) { @@ -347,6 +355,14 @@ private void checkProjectFolderConfiguration() { } } + private void loadStructureTreeTitlesFromRuleset() { + structureTreeTitles = getRulesetManagement().getFunctionalKeys(FunctionalMetadata.STRUCTURE_TREE_TITLE); + if (structureTreeTitles.isEmpty()) { + Locale locale = LocaleHelper.getCurrentLocale(); + Helper.setWarnMessage(Helper.getString(locale, "dataEditor.noStructureTreeTitleFoundWarning")); + } + } + /** * Load template task from database. * @@ -983,20 +999,25 @@ void unassignView(LogicalDivision logicalDivision, View view, boolean removeLast } /** - * Retrieve and return 'title' value of given Object 'dataObject' if Object is instance of - * 'LogicalDivision' and if it does have a title. Uses a configurable list of metadata keys to determine - * which metadata keys should be considered. + * Retrieve and return title of dataObject if it is a 'LogicalDivision' and if it has a title. + * Uses metadata value as title if one of the provided keys exists. * Return empty string otherwise. * * @param dataObject * StructureTreeNode containing the LogicalDivision whose title is returned + * @param metadataKeys + * the list of metadata keys that are annotated with "structureTreeTitle" * @return 'title' value of the LogicalDivision contained in the given StructureTreeNode 'treeNode' */ - public String getStructureElementTitle(Object dataObject) { + public static String getStructureElementTitle(Object dataObject, Collection metadataKeys) { String title = ""; if (dataObject instanceof LogicalDivision) { LogicalDivision logicalDivision = ((LogicalDivision) dataObject); - title = DataEditorService.getTitleValue(logicalDivision, structurePanel.getTitleMetadata()); + + title = metadataKeys.stream() + .map((key) -> DataEditorService.getTitleValue(logicalDivision, key)) + .filter((t) -> !t.isEmpty()).findFirst().orElse(""); + if (StringUtils.isBlank(title)) { title = logicalDivision.getLabel(); if (StringUtils.isBlank(title)) { @@ -1007,6 +1028,19 @@ public String getStructureElementTitle(Object dataObject) { return title; } + /** + * Retrieve and return title of dataObject if it is a 'LogicalDivision' and if it has a title. + * Uses metadata value as title if one of the provided keys exists. + * Return empty string otherwise. + * + * @param dataObject + * StructureTreeNode containing the LogicalDivision whose title is returned + * @return 'title' value of the LogicalDivision contained in the given StructureTreeNode 'treeNode' + */ + public String getStructureElementTitle(Object dataObject) { + return DataEditorForm.getStructureElementTitle(dataObject, structureTreeTitles); + } + /** * Get referringView. * @@ -1121,7 +1155,7 @@ public void updateNumberOfScans() { */ public void saveDataEditorSetting() { if (Objects.nonNull(dataEditorSetting)) { - if (Objects.nonNull(templateTask) && !templateTask.getId().equals(dataEditorSetting.getTaskId())) { + if (Objects.nonNull(templateTask) && !templateTask.getId().equals(dataEditorSetting.getTaskId())) { // create a copy of the task-independent configuration // in case the user wants to save it as task-specific config dataEditorSetting = new DataEditorSetting(dataEditorSetting); diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java index 9e3d3a164f5..8cb717c7e76 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java @@ -15,6 +15,7 @@ import java.io.Serializable; import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -30,8 +31,6 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.faces.model.SelectItem; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; @@ -50,7 +49,6 @@ import org.kitodo.production.metadata.MetadataEditor; import org.kitodo.production.model.Subfolder; import org.kitodo.production.services.ServiceManager; -import org.kitodo.production.services.dataeditor.DataEditorService; import org.primefaces.event.NodeCollapseEvent; import org.primefaces.event.NodeExpandEvent; import org.primefaces.event.NodeSelectEvent; @@ -126,7 +124,11 @@ public class StructurePanel implements Serializable { */ private String activeTabs; - private String titleMetadata = "type"; + /** + * Stores the users choice of the drop down selection above the logical structure tree. Can be either "type" + * (default), "title" (uses metadata key annotated with "structureTreeTitle" in ruleset) or "type+title". + */ + private String nodeLabelOption = "type"; /** * Determines whether the logical tree is built as a combination of physical media nodes and @@ -1917,31 +1919,22 @@ public void unassign() { } /** - * Get title metadata. - * @return value of titleMetadata + * Get the node label option (either "type", "title" or "type+title"). + * @return value of node label option */ - public String getTitleMetadata() { - return titleMetadata; + public String getNodeLabelOption() { + return nodeLabelOption; } /** - * Set title metadata. - * @param titleMetadata as java.lang.String + * Set node label option. + * @param nodeLabelOption as java.lang.String */ - public void setTitleMetadata(String titleMetadata) { - this.titleMetadata = titleMetadata; - } - - /** - * Get list of metadata keys that are used for displaying title information from the Kitodo configuration file. - * @return list of title metadata keys - */ - public List getTitleMetadataItems() { - return DataEditorService.getTitleKeys() - .stream() - .map(key -> new SelectItem(key,dataEditor.getRulesetManagement().getTranslationForKey( - key,dataEditor.getPriorityList()).orElse(key))) - .collect(Collectors.toList()); + public void setNodeLabelOption(String nodeLabelOption) { + if (!Arrays.asList("type", "title", "type+title").contains(nodeLabelOption)) { + throw new IllegalArgumentException("node label option must be either type, title or type+title"); + } + this.nodeLabelOption = nodeLabelOption; } /** diff --git a/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java b/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java index 8d96ba0a983..6538efc8b61 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java @@ -18,7 +18,6 @@ import java.net.URISyntaxException; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -113,23 +112,12 @@ private String getXsltFolder() { return ConfigCore.getParameter(ParameterCore.DIR_XSLT); } - /** - * Retrieve and return list of metadata keys that are used for displaying title information in the metadata editors - * structure and gallery panels from the Kitodo configuration file. - * - * @return list of title metadata keys - */ - public static List getTitleKeys() { - return Arrays.stream(ConfigCore.getParameter(ParameterCore.TITLE_KEYS, "").split(",")) - .map(String::trim).collect(Collectors.toList()); - } - /** * Retrieve and return title value from given IncludedStructuralElement. * * @param element IncludedStructuralElement for which the title value is returned. * @param metadataTitleKey as a String that its value will be displayed. - * @return title value of given element + * @return title value of given element or an empty string */ public static String getTitleValue(LogicalDivision element, String metadataTitleKey) { String[] metadataPath = metadataTitleKey.split("@"); @@ -143,13 +131,13 @@ public static String getTitleValue(LogicalDivision element, String metadataTitle .flatMap(metadataGroup -> metadataGroup.getMetadata().stream()) .collect(Collectors.toList()); } - Optional metadataTitle = metadata.stream() + return metadata.stream() .filter(currentMetadata -> Objects.equals(currentMetadata.getKey(), metadataPath[lastIndex])) .filter(MetadataEntry.class::isInstance).map(MetadataEntry.class::cast) .map(MetadataEntry::getValue) .filter(value -> !value.isEmpty()) - .findFirst(); - return metadataTitle.orElse(" - "); + .findFirst() + .orElse(""); } /** diff --git a/Kitodo/src/main/resources/kitodo_config.properties b/Kitodo/src/main/resources/kitodo_config.properties index 6c1e4860252..3a658ba8b2e 100644 --- a/Kitodo/src/main/resources/kitodo_config.properties +++ b/Kitodo/src/main/resources/kitodo_config.properties @@ -289,9 +289,6 @@ metsEditor.displayFileManipulation=true # Defaults to one single white space: metsEditor.pageSeparators=" " -# Priority list of metadata keys used to display title information in the metadata editors structure and gallery panels -metsEditor.titleMetadata=TitleDocMain - #Maximum number of media to be uploaded. metsEditor.maxUploadedMedia=3 diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index e63c9f3794e..7ae616e7aaf 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -311,6 +311,7 @@ dataEditor.invalidStructureField=\u201E{0}\u201C kann nicht gespeichert werden: dataEditor.mediaNotFound=Es wurden keine Medien gefunden, aber mindestens eine Dateireferenz ist vorhanden. Die automatische Entfernung der fehlenden Medien aus dem Werkst\u00FCck wurde \u00FCbersprungen. dataEditor.multipleMetadataTasksText=Sie haben mehrere Aufgaben zum Editieren von Metadaten in Bearbeitung. Bitte w\u00E4hlen Sie eine dieser Aufgaben aus! dataEditor.noParentsError=Elternelement von {0} konnte nicht gefunden werden! +dataEditor.noStructureTreeTitleFoundWarning=Es wurden keine Matadaten-Attribute als Titel-Attribute für den Strukturbaum im Ruleset angegeben (use="structureTreeTitle"). dataEditor.numberOfScans=Anzahl von Scans dataEditor.position.afterCurrentElement=Hinter das aktuelle Element dataEditor.position.asFirstChildOfCurrentElement=Als erstes Subelement des aktuellen Elementes diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index 9f50b60b7b2..ddd626b3b0a 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -311,6 +311,7 @@ dataEditor.invalidStructureField=Cannot save "{0}": There is no such field ({1}) dataEditor.mediaNotFound=No media found, but at least one file reference is present. The automatic removal of missing media from the workpiece was skipped. dataEditor.multipleMetadataTasksText=There are multiple metadata editing tasks assigned to you for the current process. Please select the task you want to work on! dataEditor.noParentsError=No parents of structure {0} found! +dataEditor.noStructureTreeTitleFoundWarning=There are no metadata keys that are selected to be used as title attributes in the structure tree (use="structureTreeTitle"). dataEditor.numberOfScans=Number of scans dataEditor.position.afterCurrentElement=After current element dataEditor.position.asFirstChildOfCurrentElement=As first child of current element diff --git a/Kitodo/src/main/resources/messages/messages_es.properties b/Kitodo/src/main/resources/messages/messages_es.properties index 1cb5b184f8d..132b65823be 100644 --- a/Kitodo/src/main/resources/messages/messages_es.properties +++ b/Kitodo/src/main/resources/messages/messages_es.properties @@ -311,6 +311,8 @@ dataEditor.invalidStructureField=„{0}“ no se puede guardar: No existe tal ca dataEditor.mediaNotFound=No se encontraron los archivos multimedia, pero al menos un archivo de referencia está presente. La eleminación de los archivos multimedia faltantes de la pieza de trabajo fue omitida. dataEditor.multipleMetadataTasksText=Tiene varias tareas de edición de metadatos en curso. Por favor, seleccione una de estas tareas. dataEditor.noParentsError=No se ha encontrado el elemento padre de {0}. +# please check google translation below and remove comment if translation is acceptable +dataEditor.noStructureTreeTitleFoundWarning=No hay claves de metadatos seleccionadas para usarse como atributos de título en el árbol de estructura (use="structureTreeTitle"). dataEditor.numberOfScans=Número de imágenes escaneadas dataEditor.position.afterCurrentElement=Después del elemento actual dataEditor.position.asFirstChildOfCurrentElement=Como primer subelemento del elemento actual diff --git a/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css b/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css index d466666964b..751405b6e79 100644 --- a/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css +++ b/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css @@ -2877,7 +2877,7 @@ Column content border-top: 1px solid var(--cloudy-gray); } -#logicalStructureHeader .logicalStructureTitle { +#logicalStructureTitle { flex-grow: 1; flex-shrink: 1; margin-right: var(--default-half-size); diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/gallery.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/gallery.xhtml index 47b37d05888..d5933c33e3b 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/gallery.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/gallery.xhtml @@ -88,11 +88,17 @@ styleClass="pageList" binding="#{currentElement}"> - + rendered="#{DataEditorForm.galleryPanel.stripes.indexOf(stripe) ne 0}"> + + + + - - - + + + @@ -125,9 +126,11 @@ value="<#{fn:length(fn:split(defaultTreeNode.rowKey, '_'))}> "/> + rendered="#{DataEditorForm.structurePanel.nodeLabelOption.contains('type') or logicalNode.linked}"/> + + rendered="#{DataEditorForm.structurePanel.nodeLabelOption.contains('title') and !logicalNode.linked}"/> @@ -144,7 +147,7 @@ icon="ui-icon-media-partial"> + rendered="#{DataEditorForm.structurePanel.nodeLabelOption eq 'type'}"/> diff --git a/Kitodo/src/test/java/org/kitodo/production/forms/dataeditor/DataEditorFormTest.java b/Kitodo/src/test/java/org/kitodo/production/forms/dataeditor/DataEditorFormTest.java index c83d90dabff..cd275e21c1d 100644 --- a/Kitodo/src/test/java/org/kitodo/production/forms/dataeditor/DataEditorFormTest.java +++ b/Kitodo/src/test/java/org/kitodo/production/forms/dataeditor/DataEditorFormTest.java @@ -15,6 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.Objects; @@ -73,16 +74,15 @@ public void shouldCheckIfMediaIsSelected() { */ @Test public void shouldGetStructuralElementTitle() { - // configure data editor form - DataEditorForm dataEditorForm = new DataEditorForm(); - dataEditorForm.getStructurePanel().setTitleMetadata(TITLE_METADATA_KEY); + // define which metadata keys to use as title + Collection metadataKeys = List.of(TITLE_METADATA_KEY); // prepare test structure LogicalDivision structure = new LogicalDivision(); MetadataEntry titleMetadata = new MetadataEntry(); titleMetadata.setKey(TITLE_METADATA_KEY); titleMetadata.setValue(TITLE_METADATA); structure.getMetadata().add(titleMetadata); - assertEquals(TITLE_METADATA, dataEditorForm.getStructureElementTitle(structure), + assertEquals(TITLE_METADATA, DataEditorForm.getStructureElementTitle(structure, metadataKeys), "Wrong title metadata value retrieved from structure element"); } diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/DataEditorServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/DataEditorServiceIT.java index 18e5b0f4faf..04690de8b06 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/DataEditorServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/DataEditorServiceIT.java @@ -89,16 +89,6 @@ public void removeTestProcess() throws DAOException { } } - /** - * Test retrieving title keys. - */ - @Test - public void shouldGetTitleKeys() { - List titleKeys = DataEditorService.getTitleKeys(); - assertTrue(titleKeys.contains(TITLE_DOC_MAIN), - String.format("List of title keys should contain '%s'", TITLE_DOC_MAIN)); - } - /** * Test retrieving title value. * @throws DAOException when adding test process fails. diff --git a/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java b/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java index 3cfc4ad7868..619f9ba84f0 100644 --- a/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java +++ b/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java @@ -413,6 +413,44 @@ public void showPhysicalPageNumberBelowThumbnailTest() throws Exception { assertFalse(Browser.getDriver().findElements(By.cssSelector(".thumbnail-banner")).isEmpty()); } + /** + * Verifies that the label of a node in the logical structure tree changes according to the + * "structureTreeTitle" option from the ruleset after switching to the "title" display option. + */ + @Test + public void selectStructureTreeTitleTest() throws Exception { + login("kowal"); + + // open the metadata editor + Pages.getProcessesPage().goTo().editMetadata(MockDatabase.MEDIA_RENAMING_TEST_PROCESS_TITLE); + + // wait until logical tree is shown + await().ignoreExceptions().pollDelay(100, TimeUnit.MILLISECONDS).atMost(5, TimeUnit.SECONDS) + .until(() -> Browser.getDriver().findElement(By.id("logicalTree")).isDisplayed()); + + // check that first tree node label shows type label "Band" + assertEquals("Band", + Browser.getDriver().findElement(By.cssSelector("#logicalTree\\:0 .ui-treenode-label")).getText()); + + // open select menu + Browser.getDriver().findElement(By.id("logicalStructureTitle")).click(); + + // wait until select menu is open + await().ignoreExceptions().pollDelay(100, TimeUnit.MILLISECONDS).atMost(5, TimeUnit.SECONDS) + .until(() -> Browser.getDriver().findElement(By.id("logicalStructureTitle_panel")).isDisplayed()); + + // click on title menu entry + Browser.getDriver().findElement(By.id("logicalStructureTitle_1")).click(); + + // wait until menu disappears + await().ignoreExceptions().pollDelay(100, TimeUnit.MILLISECONDS).atMost(5, TimeUnit.SECONDS) + .until(() -> !Browser.getDriver().findElement(By.id("logicalStructureTitle_panel")).isDisplayed()); + + // check that node title has changed to metadata value of "HauptTitel" + assertEquals("Der Titel des Bandes", + Browser.getDriver().findElement(By.cssSelector("#logicalTree\\:0 .ui-treenode-label")).getText()); + } + @Test public void linkPageToNextDivision() throws Exception { login("kowal"); diff --git a/Kitodo/src/test/resources/kitodo_config.properties b/Kitodo/src/test/resources/kitodo_config.properties index 7c6bdbfa4a3..fdd97355e43 100644 --- a/Kitodo/src/test/resources/kitodo_config.properties +++ b/Kitodo/src/test/resources/kitodo_config.properties @@ -39,7 +39,6 @@ metadataLanguage.list=Deutsch-de&English-en # ----------------------------------- # backup of metadata configuration # ----------------------------------- -metsEditor.titleMetadata=TitleDocMain numberOfMetaBackups=2 directory.modules=modules/ elasticsearch.port=9205 diff --git a/Kitodo/src/test/resources/metadata/metadataFiles/testRenameMediaMeta.xml b/Kitodo/src/test/resources/metadata/metadataFiles/testRenameMediaMeta.xml index 28b98611bc1..69d62d093d1 100644 --- a/Kitodo/src/test/resources/metadata/metadataFiles/testRenameMediaMeta.xml +++ b/Kitodo/src/test/resources/metadata/metadataFiles/testRenameMediaMeta.xml @@ -23,6 +23,17 @@ + + + + + + Der Titel des Bandes + + + + + @@ -81,7 +92,7 @@ - + diff --git a/Kitodo/src/test/resources/rulesets/ruleset_test.xml b/Kitodo/src/test/resources/rulesets/ruleset_test.xml index e53e0ab1ffa..ce2c46a584b 100644 --- a/Kitodo/src/test/resources/rulesets/ruleset_test.xml +++ b/Kitodo/src/test/resources/rulesets/ruleset_test.xml @@ -31,7 +31,7 @@ - +