diff --git a/Kitodo/src/main/java/org/kitodo/production/converter/ProcessDetailConverter.java b/Kitodo/src/main/java/org/kitodo/production/converter/ProcessDetailConverter.java new file mode 100644 index 00000000000..0b08a61123d --- /dev/null +++ b/Kitodo/src/main/java/org/kitodo/production/converter/ProcessDetailConverter.java @@ -0,0 +1,44 @@ +/* + * (c) Kitodo. Key to digital objects e. V. + * + * This file is part of the Kitodo project. + * + * It is licensed under GNU General Public License version 3 or later. + * + * For the full copyright and license information, please read the + * GPL3-License.txt file that was distributed with this source code. + */ + +package org.kitodo.production.converter; + +import java.util.List; +import java.util.Optional; + +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.ConverterException; +import javax.inject.Named; + +import org.kitodo.production.forms.createprocess.ProcessDetail; +import org.kitodo.production.forms.createprocess.ProcessFieldedMetadata; + +@Named +public class ProcessDetailConverter implements Converter { + + @Override + public ProcessDetail getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException { + List list = (List) component.getAttributes().get("allMetadataTypes"); + Optional processDetail = list.parallelStream() + .filter(metadata -> metadata.getMetadataID().equals(value)).findFirst(); + return processDetail.orElseGet(ProcessFieldedMetadata::new); + } + + @Override + public String getAsString(FacesContext context, UIComponent component, ProcessDetail value) throws ConverterException { + if (value != null) { + return value.getMetadataID(); + } + return ""; + } +} diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/CalendarForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/CalendarForm.java index fd69530ca87..2f687b8d021 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/CalendarForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/CalendarForm.java @@ -35,18 +35,22 @@ import javax.faces.context.FacesContext; import javax.faces.view.ViewScoped; import javax.inject.Named; +import javax.naming.ConfigurationException; import javax.xml.transform.TransformerException; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.kitodo.api.dataeditor.rulesetmanagement.MetadataViewInterface; import org.kitodo.config.ConfigCore; import org.kitodo.config.enums.ParameterCore; import org.kitodo.data.database.beans.Process; import org.kitodo.data.database.exceptions.DAOException; import org.kitodo.data.exceptions.DataException; +import org.kitodo.exceptions.DoctypeMissingException; +import org.kitodo.exceptions.ProcessGenerationException; +import org.kitodo.production.forms.createprocess.ProcessDetail; +import org.kitodo.production.forms.createprocess.ProcessTextMetadata; import org.kitodo.production.helper.Helper; import org.kitodo.production.helper.XMLUtils; import org.kitodo.production.helper.tasks.GeneratesNewspaperProcessesThread; @@ -58,8 +62,10 @@ import org.kitodo.production.model.bibliography.course.IndividualIssue; import org.kitodo.production.model.bibliography.course.Issue; import org.kitodo.production.model.bibliography.course.metadata.CountableMetadata; +import org.kitodo.production.process.NewspaperProcessesGenerator; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.calendar.CalendarService; +import org.kitodo.production.services.data.ImportService; import org.primefaces.PrimeFaces; import org.primefaces.model.DefaultStreamedContent; import org.primefaces.model.StreamedContent; @@ -110,7 +116,7 @@ public class CalendarForm implements Serializable { private UploadedFile uploadedFile; private LocalDate selectedDate; private Block selectedBlock = null; - private List metadataTypes = null; + private List metadataTypes = null; /** * The field course holds the course of appearance currently under edit by @@ -138,6 +144,7 @@ public class CalendarForm implements Serializable { public CalendarForm() { issueColours = ConfigCore.getParameterOrDefaultValue(ParameterCore.ISSUE_COLOURS).split(";"); course = new Course(); + } /** @@ -596,7 +603,8 @@ public void removeBlock(Block block) { */ public void addIssue(Block block) { if (Objects.nonNull(block)) { - Issue issue = block.addIssue(); + block.addIssue(); + block.checkIssuesWithSameHeading(); } } @@ -745,7 +753,7 @@ public void addMetadata(Issue issue) { if (!selectedBlock.getIssues().isEmpty() && Objects.nonNull(selectedIssue)) { CountableMetadata metadata = new CountableMetadata(selectedBlock, Pair.of(selectedIssue.getDate(), selectedIssue.getIssue())); if (!getAllMetadataTypes().isEmpty()) { - metadata.setMetadataType(getAllMetadataTypes().get(0).getLabel()); + metadata.setMetadataDetail(getAllMetadataTypes().get(0)); } selectedBlock.addMetadata(metadata); } else { @@ -818,11 +826,11 @@ public List getIndividualIssues(Block block) { * * @return the map of metadata types */ - public List getAllMetadataTypes() { + public List getAllMetadataTypes() { if (Objects.isNull(metadataTypes)) { try { Process process = ServiceManager.getProcessService().getById(parentId); - metadataTypes = CalendarService.getAddableMetadata(process); + metadataTypes = CalendarService.getAddableMetadataTable(process); } catch (DAOException | DataException | IOException e) { Helper.setErrorMessage("Unable to load metadata types: " + e.getMessage()); } @@ -863,8 +871,8 @@ public void setLastIssue(CountableMetadata metadata, LocalDate date, Issue issue * @param issue the issue to calculate the metadata for * @return the metadata value as java.lang.String */ - public String getMetadataValue(CountableMetadata metadata, LocalDate date, Issue issue) { - if (Objects.nonNull(metadata)) { + public String getTextMetadataValue(CountableMetadata metadata, LocalDate date, Issue issue) { + if (Objects.nonNull(metadata) && metadata.getMetadataDetail() instanceof ProcessTextMetadata) { return metadata.getValue(new ImmutablePair<>(date, issue), course.getYearStart()); } return ""; @@ -877,7 +885,7 @@ public String getMetadataValue(CountableMetadata metadata, LocalDate date, Issue * @param block the block to get the metadata for * @return list of pairs containing the metadata type and the date of its earliest occurrence */ - public List> getMetadataSummary(Block block) { + public List> getMetadataSummary(Block block) { return CalendarService.getMetadataSummary(block); } @@ -895,4 +903,53 @@ public String getMetadataTranslation(String key) { return key; } } + + /** + * Get the value of the given processDetail. + * + * @param processDetail + * as ProcessDetail + * @return the value as a java.lang.String + */ + public String getMetadataValue(ProcessDetail processDetail) { + return ImportService.getProcessDetailValue(processDetail); + } + + /** + * Check if process with the same processtitle already exists. + */ + public void checkDuplicatedTitles() throws ProcessGenerationException, DataException, DAOException, + ConfigurationException, IOException, DoctypeMissingException { + if (course.parallelStream().noneMatch(block -> Objects.equals(block.checkIssuesWithSameHeading(), true))) { + Process process = ServiceManager.getProcessService().getById(parentId); + NewspaperProcessesGenerator newspaperProcessesGenerator = new NewspaperProcessesGenerator(process, course); + newspaperProcessesGenerator.initialize(); + if (!newspaperProcessesGenerator.isDuplicatedTitles()) { + PrimeFaces.current().executeScript("PF('createProcessesConfirmDialog').show();"); + } + } + } + + /** + * Get first issue that's appear on the selected Date. + * @return issue + */ + public Issue getFirstMatchIssue() { + if (selectedDate != null) { + return getCalendarSheet().get(selectedDate.getDayOfMonth() - 1).get(selectedDate.getMonthValue() - 1).getIssues() + .parallelStream() + .filter(issue -> issue.isMatch(selectedDate)) + .findFirst().orElse(null); + } + return null; + } + + /** + * add Metadata to all Issues that's appear on the selected Date. + */ + public void addMetadataToAllMatchIssues() { + if (getFirstMatchIssue() != null) { + addMetadata(getFirstMatchIssue()); + } + } } diff --git a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Block.java b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Block.java index 87e481781f2..f462ce3500b 100644 --- a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Block.java +++ b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Block.java @@ -20,6 +20,7 @@ import java.util.Date; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.Pair; import org.kitodo.production.helper.Helper; @@ -136,7 +137,7 @@ public Issue addIssue() { * metadata to add */ public void addMetadata(CountableMetadata countableMetadata) { - metadata.add(countableMetadata); + metadata.add(0, countableMetadata); } /** @@ -453,6 +454,24 @@ public void removeIssue(Issue issue) { issues.remove(issue); } + /** + * Check if block has issues with same heading. + * @return 'true' if duplicates are found anf 'false' if not. + */ + public boolean checkIssuesWithSameHeading() { + List issuesTitles = issues.stream().map(Issue::getHeading).collect(Collectors.toList()); + List titles = new ArrayList<>(); + for (String title : issuesTitles) { + if (titles.contains(title)) { + Helper.setErrorMessage("duplicatedTitles", " (Block " + (course.indexOf(this) + 1) + ")" ); + return true; + } else { + titles.add(title); + } + } + return false; + } + /** * Sets a LocalDate as day of first * appearance for this Block. diff --git a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Course.java b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Course.java index 15b2d4109d2..23aa2b34f6a 100644 --- a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Course.java +++ b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/Course.java @@ -37,6 +37,7 @@ import org.kitodo.production.helper.XMLUtils; import org.kitodo.production.model.bibliography.course.metadata.CountableMetadata; import org.kitodo.production.model.bibliography.course.metadata.RecoveredMetadata; +import org.kitodo.production.services.data.ImportService; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -875,7 +876,7 @@ private void addMetadataToIssue(Document xml, IndividualIssue issue, Element iss if (metaDatum.matches(metaDatum.getMetadataType(), issueId, false)) { metadataNode.setAttribute(ATTRIBUTE_VALUE, ""); } else { - metadataNode.setAttribute(ATTRIBUTE_VALUE, metaDatum.getStartValue()); + metadataNode.setAttribute(ATTRIBUTE_VALUE, ImportService.getProcessDetailValue(metaDatum.getMetadataDetail())); if (metaDatum.getStepSize() != null) { metadataNode.setAttribute(ATTRIBUTE_INCREMENT, metaDatum.getStepSize().toString().toLowerCase()); } diff --git a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/IndividualIssue.java b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/IndividualIssue.java index 27572109e00..97847ff7a6d 100644 --- a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/IndividualIssue.java +++ b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/IndividualIssue.java @@ -16,13 +16,19 @@ import java.time.format.DateTimeFormatter; import java.time.temporal.WeekFields; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import org.apache.commons.lang3.tuple.Pair; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.kitodo.api.Metadata; import org.kitodo.api.MetadataEntry; +import org.kitodo.exceptions.InvalidMetadataValueException; import org.kitodo.exceptions.UnreachableCodeException; import org.kitodo.production.model.bibliography.course.metadata.CountableMetadata; @@ -32,6 +38,8 @@ * type of issue. */ public class IndividualIssue { + private static final Logger logger = LogManager.getLogger(IndividualIssue.class); + /** * The constant DAY holds a DateTimeFormatter used to get the a two-digit * day (01—31) from the newspaper’s date. @@ -229,7 +237,7 @@ public Map getGenericFields() { * @return a list of pairs, each consisting of the metadata type name and * the value */ - public Iterable getMetadata(int monthOfYear, int dayOfMonth) { + public Iterable getMetadata(int monthOfYear, int dayOfMonth) { return getMetadata(MonthDay.of(monthOfYear, dayOfMonth)); } @@ -242,15 +250,25 @@ public Iterable getMetadata(int monthOfYear, int dayOfMonth) { * @return a list of pairs, each consisting of the metadata type name and * the value */ - public Iterable getMetadata(MonthDay yearStart) { - List result = new ArrayList<>(); + public Iterable getMetadata(MonthDay yearStart) { + List result = new ArrayList<>(); Pair selectedIssue = Pair.of(date, issue); for (CountableMetadata counter : block.getMetadata(selectedIssue, null)) { - String value = counter.getValue(selectedIssue, yearStart); - MetadataEntry entry = new MetadataEntry(); - entry.setKey(counter.getMetadataType()); - entry.setValue(value); - result.add(entry); + Collection metadata = Collections.emptyList(); + try { + metadata = counter.getMetadataDetail().getMetadata(); + } catch (InvalidMetadataValueException e) { + logger.error(e.getLocalizedMessage()); + } + if (counter.getMetadataDetail().getInput().equals("inputText") + || counter.getMetadataDetail().getInput().equals("inputTextarea")) { + String value = counter.getValue(selectedIssue, yearStart); + if (metadata.stream().findFirst().isPresent() + && metadata.stream().findFirst().get() instanceof MetadataEntry) { + ((MetadataEntry) metadata.stream().findFirst().get()).setValue(value); + } + } + result.addAll(metadata); } return result; } diff --git a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/metadata/CountableMetadata.java b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/metadata/CountableMetadata.java index be60f7cc9c2..1e0078e6e67 100644 --- a/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/metadata/CountableMetadata.java +++ b/Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/metadata/CountableMetadata.java @@ -17,6 +17,12 @@ import java.util.Objects; import org.apache.commons.lang3.tuple.Pair; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.kitodo.api.Metadata; +import org.kitodo.exceptions.InvalidMetadataValueException; +import org.kitodo.production.forms.createprocess.ProcessDetail; +import org.kitodo.production.forms.createprocess.ProcessTextMetadata; import org.kitodo.production.helper.metadata.pagination.Paginator; import org.kitodo.production.model.bibliography.course.Block; import org.kitodo.production.model.bibliography.course.Granularity; @@ -28,6 +34,8 @@ * Generic metadata that is created using a counter. */ public class CountableMetadata { + private static final Logger logger = LogManager.getLogger(CountableMetadata.class); + /** * Block this metadata counter belongs to. The block is needed to have * access to the other issues, which—together with the start value and step @@ -62,6 +70,8 @@ public class CountableMetadata { */ private Granularity stepSize; + private ProcessDetail metadataDetail; + /** * Creates a new countable metadata. * @@ -259,9 +269,29 @@ public void setStepSize(Granularity stepSize) { * the start value to set */ public void setStartValue(String startValue) { + ((ProcessTextMetadata)metadataDetail).setValue(startValue); this.startValue = startValue; } + /** + * Gets metadataDetail. + * + * @return value of metadataDetail + */ + public ProcessDetail getMetadataDetail() { + return metadataDetail; + } + + /** + * Sets metadataDetail. + * + * @param metadataDetail value of metadataDetail + */ + public void setMetadataDetail(ProcessDetail metadataDetail) { + this.metadataDetail = metadataDetail; + this.metadataType = this.metadataDetail.getMetadataID(); + } + /** * Returns a human-readable concise description of this countable metadata. * @@ -270,7 +300,13 @@ public void setStartValue(String startValue) { @Override public String toString() { StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(startValue); + try { + for (Metadata metadata : metadataDetail.getMetadata()) { + stringBuilder.append(metadata); + } + } catch (InvalidMetadataValueException e) { + logger.error(e.getMessage()); + } stringBuilder.append(" from "); stringBuilder.append(DateTimeFormatter.ISO_DATE.format(create.getLeft())); stringBuilder.append(", "); @@ -283,8 +319,10 @@ public String toString() { stringBuilder.append(", "); stringBuilder.append(delete.getRight().getHeading()); } - stringBuilder.append(", step size "); - stringBuilder.append(stepSize); + if (Objects.nonNull(stepSize)) { + stringBuilder.append(", step size "); + stringBuilder.append(stepSize); + } return stringBuilder.toString(); } } diff --git a/Kitodo/src/main/java/org/kitodo/production/process/NewspaperProcessesGenerator.java b/Kitodo/src/main/java/org/kitodo/production/process/NewspaperProcessesGenerator.java index 50af21a9456..3d4c5e50409 100644 --- a/Kitodo/src/main/java/org/kitodo/production/process/NewspaperProcessesGenerator.java +++ b/Kitodo/src/main/java/org/kitodo/production/process/NewspaperProcessesGenerator.java @@ -314,7 +314,7 @@ public boolean nextStep() throws ConfigurationException, DAOException, DataExcep * if something goes wrong when reading or writing one of the * affected files */ - private void initialize() throws ConfigurationException, IOException, DoctypeMissingException { + public void initialize() throws ConfigurationException, IOException, DoctypeMissingException { final long begin = System.nanoTime(); overallMetadataFileUri = processService.getMetadataFileUri(overallProcess); @@ -531,7 +531,13 @@ private void createProcess(int index) throws DAOException, DataException, IOExce } } - private String makeTitle(String definition, Map genericFields) throws ProcessGenerationException { + /** + * Generate process title. + * @param definition as String + * @param genericFields a map with generic fields that can be configured for process + * @return process title as String + */ + public String makeTitle(String definition, Map genericFields) throws ProcessGenerationException { String title; boolean prefixWithProcessTitle = definition.startsWith("+"); if (prefixWithProcessTitle) { @@ -801,20 +807,26 @@ private void finish() throws DataException, IOException { } } - private boolean isDuplicatedTitles() throws ProcessGenerationException, DataException { + /** + * Check if process with the same processtitle already exists. + * @return 'true' if Duplicated titles are found and 'false' if not + */ + public boolean isDuplicatedTitles() throws ProcessGenerationException, DataException { List> processes = course.getProcesses(); List issueTitles = new ArrayList<>(); + boolean check = false; for (List individualProcess : processes) { for (IndividualIssue individualIssue : individualProcess) { Map genericFields = individualIssue.getGenericFields(); String title = makeTitle(issueDivisionView.getProcessTitle().orElse("+'_'+#YEAR+#MONTH+#DAY+#ISSU"), genericFields); if (!ServiceManager.getProcessService().findByTitle(title).isEmpty() || issueTitles.contains(title)) { - return true; + Helper.setErrorMessage("duplicatedTitles", individualIssue.toString()); + check = true; } issueTitles.add(title); } } - return false; + return check; } } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/calendar/CalendarService.java b/Kitodo/src/main/java/org/kitodo/production/services/calendar/CalendarService.java index c44f06ddea7..95e598b91b3 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/calendar/CalendarService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/calendar/CalendarService.java @@ -28,13 +28,17 @@ import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; +import org.kitodo.api.dataeditor.rulesetmanagement.ComplexMetadataViewInterface; import org.kitodo.api.dataeditor.rulesetmanagement.MetadataViewInterface; import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface; +import org.kitodo.api.dataeditor.rulesetmanagement.SimpleMetadataViewInterface; import org.kitodo.api.dataeditor.rulesetmanagement.StructuralElementViewInterface; import org.kitodo.config.ConfigCore; import org.kitodo.config.enums.ParameterCore; import org.kitodo.data.database.beans.Process; import org.kitodo.data.exceptions.DataException; +import org.kitodo.production.forms.createprocess.ProcessDetail; +import org.kitodo.production.forms.createprocess.ProcessFieldedMetadata; import org.kitodo.production.model.bibliography.course.Block; import org.kitodo.production.model.bibliography.course.IndividualIssue; import org.kitodo.production.model.bibliography.course.Issue; @@ -42,6 +46,7 @@ import org.kitodo.production.model.bibliography.course.metadata.MetadataEditMode; import org.kitodo.production.security.SecurityUserDetails; import org.kitodo.production.services.ServiceManager; +import org.kitodo.production.services.data.ImportService; public class CalendarService { @@ -117,9 +122,9 @@ public static List getAddableMetadata(Process completeEdi * @param metadataKey the key for the metadata type to be translated * @return localized metadata type as java.lang.String */ - public static String getMetadataTranslation(List metadataList, String metadataKey) { - for (MetadataViewInterface selectItem : metadataList) { - if (selectItem.getLabel().equals(metadataKey)) { + public static String getMetadataTranslation(List metadataList, String metadataKey) { + for (ProcessDetail selectItem : metadataList) { + if (selectItem.getMetadataID().equals(metadataKey)) { return selectItem.getLabel(); } } @@ -155,16 +160,16 @@ public static List getMetadata(Block block, LocalDate date, I * @param block the block to get the metadata for * @return list of pairs containing the metadata type and the date of its earliest occurrence */ - public static List> getMetadataSummary(Block block) { - Map metadataMap = new HashMap<>(); + public static List> getMetadataSummary(Block block) { + Map metadataMap = new HashMap<>(); if (Objects.nonNull(block)) { for (CountableMetadata metadata : block.getMetadata()) { if (metadataMap.containsKey(metadata.getMetadataType())) { if (metadata.getCreate().getLeft().isBefore(metadataMap.get(metadata.getMetadataType()))) { - metadataMap.replace(metadata.getMetadataType(), metadata.getCreate().getKey()); + metadataMap.replace(metadata.getMetadataDetail(), metadata.getCreate().getKey()); } } else { - metadataMap.put(metadata.getMetadataType(), metadata.getCreate().getKey()); + metadataMap.put(metadata.getMetadataDetail(), metadata.getCreate().getKey()); } } } @@ -191,4 +196,25 @@ public static String dateIssueToString(Pair dateIssue) { } return stringBuilder.toString(); } + + /** + * Get all metadata allowed for the future elements that will be generated + * by the NewspaperProcessesGenerator. + * + * @param completeEdition parent process + * @return list of allowed metadata as List of ProcessDetail + * @throws IOException when ruleset file could not be read + */ + public static List getAddableMetadataTable(Process completeEdition) throws IOException, DataException { + ProcessFieldedMetadata table = new ProcessFieldedMetadata(); + List metadataViewInterfaceList = getAddableMetadata(completeEdition); + for (MetadataViewInterface keyView : metadataViewInterfaceList) { + if (keyView.isComplex()) { + table.createMetadataGroupPanel((ComplexMetadataViewInterface) keyView, Collections.emptyList()); + } else { + table.createMetadataEntryEdit((SimpleMetadataViewInterface) keyView, Collections.emptyList()); + } + } + return table.getRows(); + } } diff --git a/Kitodo/src/main/resources/messages/errors_de.properties b/Kitodo/src/main/resources/messages/errors_de.properties index 1f2c1539b49..c0b697192bc 100644 --- a/Kitodo/src/main/resources/messages/errors_de.properties +++ b/Kitodo/src/main/resources/messages/errors_de.properties @@ -39,7 +39,7 @@ docketMissing=Die Konfigurationsdatei zur Laufzettelgenerierung existiert nicht docketNotFound=Die angegebene Datei konnte nicht gefunden werden. docketTitleDuplicated=Der Laufzettel mit den gleichen Titel existiert schon. docTypeNotFound=docType ''{0}'' wurde nicht im selektierten Regelsatz gefunden -duplicatedTitles=Es wurden duplizierte Titel gefunden +duplicatedTitles=Es wurden dublette Ausgabe-Bezeichnungen gefunden. Dies erzeugt gegebenenfalls dublette Vorgangstitel! emptySourceFolder=Der Quellordner zur Bildgenerierung ist leer errorDataIncomplete=Unvollst\u00E4ndige Daten\: errorDatabaseReading=Fehler beim Datenbanklesen von ''{0}'' with ID {1}. diff --git a/Kitodo/src/main/resources/messages/errors_en.properties b/Kitodo/src/main/resources/messages/errors_en.properties index 6af66c9d872..8d8bcbf2bf5 100644 --- a/Kitodo/src/main/resources/messages/errors_en.properties +++ b/Kitodo/src/main/resources/messages/errors_en.properties @@ -40,7 +40,7 @@ docketMissing=the configuration file for docket creation is missing docketNotFound=The specified file could not be found. docketTitleDuplicated=The docket with the same title exists already. docTypeNotFound=docType ''{0}'' could not be found in selected ruleset -duplicatedTitles=Duplicated titles found +duplicatedTitles=Duplicate issue designations were found. This may produce duplicate process titles! emptySourceFolder=The source folder is empty errorDataIncomplete=Incomplete data\: errorDatabaseReading=Error on reading database for ''{0}'' with ID {1}. diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index b5f5097627d..713c37a66f7 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -119,7 +119,10 @@ calendar.issue.add=Ausgabe hinzuf\u00FCgen calendar.issue.delete=Ausgabe l\u00F6schen calendar.issue.delete.query=Wollen Sie die Augabe l\u00F6schen? calendar.jumpToDay=Zu Tag springen -calendar.metadata.add=Metadatum hinzuf\u00FCgen +calendar.metadata.global.add=Metadatum allen Ausgaben hinzuf\u00FCgen +calendar.metadata.issue.add=Metadatum hinzuf\u00FCgen +calendar.metadata.global.add.tooltip=Metadatum zu allen erschienen Ausgaben hinzuf\u00FCgen +calendar.metadata.issue.add.tooltip=Metadatum zu allen erschienen Ausgaben ab dieser hinzuf\u00FCgen calendar.metadata.currentValue=Aktueller Wert calendar.metadata.firstAppearance=von calendar.metadata.lastAppearance=bis diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index d41646319e9..0a26429b151 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -123,7 +123,10 @@ calendar.issue.add=Add issue calendar.issue.delete=Delete issue calendar.issue.delete.query=Do you want to delete the issue? calendar.jumpToDay=Jump to day -calendar.metadata.add=Add metadata +calendar.metadata.global.add=Add metadata to all issues +calendar.metadata.issue.add=Add metadata +calendar.metadata.global.add.tooltip=Add metadata to all appeared issues +calendar.metadata.issue.add.tooltip=Add metadata to all appeared issues from this one onwards calendar.metadata.currentValue=Current value calendar.metadata.firstAppearance=from calendar.metadata.lastAppearance=up to 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 d1f4a4ec1a7..0652f2944ab 100644 --- a/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css +++ b/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css @@ -1408,6 +1408,9 @@ h3#headerText.calendar-heading { margin: var(--default-full-size); padding: var(--default-half-size); position: relative; + min-width: calc(100% - 50px); + width: fit-content; + max-width: fit-content; } #editForm\:calendarTabView\:blockList .block-label { @@ -1455,7 +1458,6 @@ h3#headerText.calendar-heading { #editForm\:calendarTabView .metadata-list .ui-dataview-row { border: solid var(--default-border-width) var(--cloudy-gray); - height: calc(var(--input-height) + 2 * var(--default-border-width)); line-height: calc(var(--input-height) + 2 * var(--default-border-width)); } @@ -1601,6 +1603,17 @@ h3#headerText.calendar-heading { color: var(--carbon-blue); } +#calendarDayDialog { + width: 80% !important; + height: 80% !important; + overflow-y: hidden ; +} + +#calendarDayDialog_content { + height: 100% !important; + overflow-y: hidden ; +} + #calendarDayDialog .ui-dialog-content, #calendarDayDialog form, #calendarDayDialog form > .ui-panelgrid, @@ -1610,20 +1623,30 @@ h3#headerText.calendar-heading { #calendarDayDialog form { height: calc(100% - 100px); - overflow-y: scroll; + overflow-y: auto; } #calendarDayDialog .dialogButtonWrapper { bottom: var(--default-full-size); + display: inline-block; + height: 60px; position: absolute; width: calc(100% - var(--default-double-size)); } #calendarDayDialog .dialogFieldWrapper { + min-height: 100%; margin-bottom: 0; overflow-y: hidden; } +#calendarDayDialogHeader { + width: 100%; + padding-left: var(--default-double-size); + padding-right: var(--default-double-size); + padding-bottom: var(--default-full-size); +} + #calendarDayDialog .issue-wrapper:not(:last-child) { border-bottom: solid var(--default-border-width) var(--cloudy-gray); } @@ -1645,17 +1668,21 @@ h3#headerText.calendar-heading { border-bottom: solid var(--default-border-width) var(--cloudy-gray); } - - #calendarDayDialog .metadata-first-appearance, -#calendarDayDialog .metadata-last-appearance, -#calendarDayDialog .metadata-value { +#calendarDayDialog .metadata-last-appearance { display: inline-block; font-weight: bold; margin: var(--default-half-size); } +#calendarDayDialog .metadata-value { + font-weight: bold; + margin: var(--default-half-size); + vertical-align: top; +} + #calendarDayDialog .metadata-value-label { + vertical-align: top; margin-left: var(--default-half-size); } @@ -1667,6 +1694,13 @@ h3#headerText.calendar-heading { margin-bottom: var(--default-full-size); } +#calendarDayDialog .ui-selectlistbox-item { + width: 100%; + display: inline-flex; + height: 30px; + vertical-align: center; +} + /*---------------------------------------------------------------------- Metadata Editor ----------------------------------------------------------------------*/ diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/calendarEdit/calendarBlocks.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/calendarEdit/calendarBlocks.xhtml index ab126d3a27d..cdf3a861581 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/calendarEdit/calendarBlocks.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/calendarEdit/calendarBlocks.xhtml @@ -15,68 +15,99 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:h="http://xmlns.jcp.org/jsf/html"> + + + function hide(element) { + $('.p-datepicker-panel').hide(); + $(element).blur(); + } + + function hideAndFocusNextInput(element) { + hide(element); + var inputs = $('.ui-inputfield'); + var nextInput = inputs.get(inputs.index(document.activeElement) + 1); + if (nextInput) { + nextInput.focus(); + } + } + - + -
- - - - - -
-
- - - - - -
- + + + + + +
+ + + + + + +
+ +
+ +
- - - + + + + style="background-color: #{CalendarForm.getIssueColor(rowIndex)}; + border-color: #{CalendarForm.getIssueColor(rowIndex)};"/> @@ -141,13 +172,12 @@ update="editForm:calendarTabView:calendarDetailsLayout"/> - - + +
+
+
@@ -159,7 +189,9 @@ value="#{CalendarForm.getMetadataSummary(block)}"> + update="editForm:calendarTabView:calendarDetailsLayout"> + + -

- #{msgs['calendar.day.'.concat(date.dayOfWeek.value)]} - #{date.toString()} - (#{msgs['calendar.block']} #{CalendarForm.course.indexOf(CalendarForm.getSelectedBlock())+1}) -

+ + +

+ #{msgs['calendar.day.'.concat(date.dayOfWeek.value)]} + #{date.toString()} + (#{msgs['calendar.block']} #{CalendarForm.course.indexOf(CalendarForm.getSelectedBlock())+1}) +

+
+ + + +
- +
- + + update="editForm:calendarTabView:calendarDetailsLayout calendarDayDialogHeader calendarDayForm"/> + +
+ @@ -60,54 +89,119 @@ - - - - - - - - - - - - - - - - - - - - +
+ + + + + + +
+ + +
+ + + + + + + + + + + + +
+ +
+ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update="calendarDayForm"/> + update="calendarDayForm"/>
- -
+
+ - + diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/calendarEdit/calendarDetails.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/calendarEdit/calendarDetails.xhtml index 78db8b195eb..5f19c2804f1 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/calendarEdit/calendarDetails.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/calendarEdit/calendarDetails.xhtml @@ -15,6 +15,25 @@ xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:h="http://xmlns.jcp.org/jsf/html"> + + $(document).ready(function(){ + $(document).on("keypress", "#editForm\\:calendarTabView\\:yearInput", function(event) { + if(event.key == 'Enter') { + event.preventDefault(); + event.target.blur(); + document.activeElement = event.currentTarget; + } + }); + }); + $(document).ready(function(){ + $(document).on("keypress", function(event) { + if(event.key == 'Enter') { + event.preventDefault(); + } + }); + }); + + @@ -28,11 +47,14 @@ icon="fa fa-arrow-left" update="editForm:calendarTabView:calendarDetailsLayout"/> - +