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 fb64e70134d..eace28839f5 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 @@ -18,7 +18,6 @@ import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Paths; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -231,6 +230,9 @@ public class DataEditorForm implements MetadataTreeTableInterface, RulesetSetupI static final String GROWL_MESSAGE = "PF('notifications').renderMessage({'summary':'SUMMARY','detail':'DETAIL','severity':'SEVERITY'});"; + private boolean globalLayoutLoaded = false; + private boolean taskLayoutLoaded = false; + /** * Public constructor. */ @@ -315,9 +317,6 @@ public void open(String processID, String referringView, String taskId) { } else { PrimeFaces.current().executeScript("PF('metadataLockedDialog').show();"); } - if (Objects.nonNull(this.dataEditorSetting) && Objects.nonNull(dataEditorSetting.getId())) { - showDataEditorSettingsLoadedMessage(); - } } catch (FileNotFoundException e) { metadataFileLoadingError = e.getLocalizedMessage(); } catch (IOException | DAOException | InvalidImagesException | NoSuchElementException e) { @@ -325,22 +324,6 @@ public void open(String processID, String referringView, String taskId) { } } - private void showDataEditorSettingsLoadedMessage() throws DAOException { - Locale locale = LocaleHelper.getCurrentLocale(); - String title = Helper.getString(locale, "dataEditor.layoutLoadedSuccessfullyTitle"); - String text = Helper.getString(locale, "dataEditor.layoutLoadedSuccessfullyDefaultText"); - if (Objects.nonNull(this.templateTask) && Objects.nonNull(dataEditorSetting) - && templateTask.getId().equals(dataEditorSetting.getTaskId())) { - text = MessageFormat.format( - Helper.getString(locale, "dataEditor.layoutLoadedSuccessfullyForTaskText"), this.templateTask.getTitle() - ); - } - String script = GROWL_MESSAGE.replace("SUMMARY", title).replace("DETAIL", text) - .replace("SEVERITY", "info"); - PrimeFaces.current().executeScript("PF('notifications').removeAll();"); - PrimeFaces.current().executeScript(script); - } - private void checkProjectFolderConfiguration() { if (Objects.nonNull(this.process)) { Project project = this.process.getProject(); @@ -405,6 +388,14 @@ private void loadDataEditorSettings() { dataEditorSetting.setUserId(userId); dataEditorSetting.setTaskId(taskId); } + + // initialize flags to signal whether global or task specific settings have been loaded or not + boolean layoutLoaded = (dataEditorSetting.getStructureWidth() > 0 + || dataEditorSetting.getMetadataWidth() > 0 + || dataEditorSetting.getGalleryWidth() > 0); + + globalLayoutLoaded = Objects.isNull(dataEditorSetting.getTaskId()) && layoutLoaded; + taskLayoutLoaded = Objects.nonNull(dataEditorSetting.getTaskId()) && layoutLoaded; } /** @@ -1163,6 +1154,7 @@ public void saveDataEditorSetting() { } try { ServiceManager.getDataEditorSettingService().saveToDatabase(dataEditorSetting); + loadDataEditorSettings(); PrimeFaces.current().executeScript("PF('dataEditorSavingResultDialog').show();"); } catch (DAOException e) { Helper.setErrorMessage("errorSaving", new Object[] {ObjectType.DATAEDITORSETTING.getTranslationSingular() }, logger, e); @@ -1400,4 +1392,22 @@ public String getGroupDisplayLabel(MetadataGroup metadataGroup) { return ""; } } + + /** + * Get value of 'globalLayoutLoaded'. + * + * @return value of 'globalLayoutLoaded' + */ + public boolean isGlobalLayoutLoaded() { + return globalLayoutLoaded; + } + + /** + * Get value of 'taskLayoutLoaded'. + * + * @return value of 'taskLayoutLoaded' + */ + public boolean isTaskLayoutLoaded() { + return taskLayoutLoaded; + } } diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index 58f410606f9..c4113beb4ac 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -323,9 +323,6 @@ dataEditor.removeElement.noConsecutivePagesSelected=Strukturelemente k\u00F6nnen dataEditor.selectMetadataTask=Aufgabe w\u00E4hlen dataEditor.layoutDeletedSuccessfullyTitle=Metadaten-Editor-Layout gelöscht dataEditor.layoutDeletedSuccessfullyText=Die Standard-Spalteneinstellungen wurden erfolgreich gelöscht -dataEditor.layoutLoadedSuccessfullyTitle=Metadaten-Editor-Layout geladen -dataEditor.layoutLoadedSuccessfullyDefaultText=Standard-Spalteneinstellungen erfolgreich geladen -dataEditor.layoutLoadedSuccessfullyForTaskText=Standard-Spalteneinstellungen f\u00FCr Aufgabe "{0}" erfolgreich geladen dataEditor.layoutMenuActiveText=aktiv dataEditor.layoutMenuButtonTitle=Menu zum Speichern des Layout (Spaltenaufteilung) öffnen dataEditor.layoutMenuDeleteTitle=Gespeicherte Spaltenaufteilung löschen diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index c05ba95b74e..c74442431db 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -323,9 +323,6 @@ dataEditor.removeElement.noConsecutivePagesSelected=Select consecutive pages to dataEditor.selectMetadataTask=Select task dataEditor.layoutDeletedSuccessfullyTitle=Custom layout deleted dataEditor.layoutDeletedSuccessfullyText=Default column configuration deleted successfully -dataEditor.layoutLoadedSuccessfullyTitle=Custom layout loaded -dataEditor.layoutLoadedSuccessfullyDefaultText=Default column configuration loaded successfully -dataEditor.layoutLoadedSuccessfullyForTaskText=Default column configuration for task "{0}" loaded successfully dataEditor.layoutMenuActiveText=active dataEditor.layoutMenuButtonTitle=Open menu to save default layout (column configuration) dataEditor.layoutMenuDeleteTitle=Delete default layout diff --git a/Kitodo/src/main/resources/messages/messages_es.properties b/Kitodo/src/main/resources/messages/messages_es.properties index b9774146bb2..78a4a1cb60b 100644 --- a/Kitodo/src/main/resources/messages/messages_es.properties +++ b/Kitodo/src/main/resources/messages/messages_es.properties @@ -323,9 +323,6 @@ dataEditor.removeElement.noConsecutivePagesSelected=Los elementos estructurales dataEditor.selectMetadataTask=Seleccionar la tarea dataEditor.layoutDeletedSuccessfullyTitle=El diseño personalizado fue eliminado dataEditor.layoutDeletedSuccessfullyText=La configuración de columna predeterminada se eliminó correctamente -dataEditor.layoutLoadedSuccessfullyTitle=El diseño personalizado está cargado -dataEditor.layoutLoadedSuccessfullyDefaultText=La configuración de columna personalizada se cargó correctamente -dataEditor.layoutLoadedSuccessfullyForTaskText=La configuración de la columna personalizada para la tarea "{0}" se ha cargado correctamente. dataEditor.layoutMenuActiveText=activa dataEditor.layoutMenuButtonTitle=Abrir menú para guardar el diseño predeterminado (configuración de columna) dataEditor.layoutMenuDeleteTitle=Eliminar diseño predeterminado 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 d5ecb12f6da..11bb3589633 100644 --- a/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css +++ b/Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css @@ -2908,6 +2908,26 @@ Column content padding: 0.5em 0.25em; } +button.settings-loaded::after, +button.settings-loaded-task::after { + background: white; + color: var(--green); + font-family: FontAwesome; + font-size: large; + font-weight: normal; + position: absolute; + right: -6px; + top: -6px; +} + +button.settings-loaded::after { + content: "\f05d"; +} + +button.settings-loaded-task::after { + content: "\f058"; +} + #metadataEditorLayoutForm ul { list-style: none; margin: 0.25em 0; diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/dataEditorSettingMenu.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/dataEditorSettingMenu.xhtml index 7c6d818f266..93161b6cf85 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/dataEditorSettingMenu.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/dataEditorSettingMenu.xhtml @@ -16,11 +16,9 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"> - - +