Skip to content

Commit

Permalink
Add icon to inform about loaded metadata layout and remove growl message
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-stoehr committed Dec 19, 2024
1 parent 8d74e64 commit 484d444
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -318,32 +317,13 @@ 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) {
Helper.setErrorMessage(e.getLocalizedMessage(), logger, e);
}
}

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();
Expand Down Expand Up @@ -1174,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);
Expand Down
3 changes: 0 additions & 3 deletions Kitodo/src/main/resources/messages/messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions Kitodo/src/main/resources/messages/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions Kitodo/src/main/resources/messages/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<p:overlayPanel for="metadataEditorLayoutButtonForm:open" style="display: none;">
<p:overlayPanel id="metadataEditorLayoutOverlayPanel"
for="metadataEditorLayoutButtonForm:open"
style="display: none;">
<h:form id="metadataEditorLayoutForm">
<ul>
<li>
<p:commandLink
id="saveDefault"
onclick="saveLayout()"
action="#{DataEditorForm.saveDataEditorSetting()}"
update="metadataEditorLayoutForm dataEditorSavingResultForm"
update="metadataEditorLayoutOverlayPanel dataEditorSavingResultForm metadataEditorLayoutButtonForm:open"
disabled="#{DataEditorForm.templateTask ne null}">
<i class="fa fa-floppy-o"></i>
<h:outputText value="#{msgs['dataEditor.layoutMenuSaveDefaultText']}" />
Expand All @@ -36,7 +38,7 @@
id="removeDefault"
icon="fa fa-trash"
action="#{DataEditorForm.deleteDataEditorSetting()}"
update="metadataEditorLayoutForm dataEditorSavingResultForm"
update="metadataEditorLayoutOverlayPanel dataEditorSavingResultForm metadataEditorLayoutButtonForm:open"
disabled="#{not DataEditorForm.isGlobalLayoutLoaded()}"
styleClass="secondary"
title="#{msgs['dataEditor.layoutMenuDeleteTitle']}" />
Expand All @@ -46,7 +48,7 @@
id="saveForTask"
onclick="saveLayout()"
action="#{DataEditorForm.saveDataEditorSetting()}"
update="metadataEditorLayoutForm dataEditorSavingResultForm"
update="metadataEditorLayoutOverlayPanel dataEditorSavingResultForm metadataEditorLayoutButtonForm:open"
disabled="#{DataEditorForm.templateTask eq null}">
<i class="fa fa-floppy-o"></i>
<h:outputText value="#{msgs['dataEditor.layoutMenuSaveForTaskText']}" />
Expand All @@ -58,7 +60,7 @@
id="removeForTask"
icon="fa fa-trash"
action="#{DataEditorForm.deleteDataEditorSetting()}"
update="metadataEditorLayoutForm dataEditorSavingResultForm"
update="metadataEditorLayoutOverlayPanel dataEditorSavingResultForm metadataEditorLayoutButtonForm:open"
disabled="#{not DataEditorForm.isTaskLayoutLoaded()}"
styleClass="secondary"
title="#{msgs['dataEditor.layoutMenuDeleteTitle']}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@

<h:form id="metadataEditorLayoutButtonForm">
<p:commandButton id="open"
title="#{msgs['dataEditor.layoutMenuButtonTitle']}"
icon="fa fa-wrench"
styleClass="secondary"/>
title="#{msgs['dataEditor.layoutMenuButtonTitle']}"
icon="fa fa-wrench"
styleClass="secondary #{DataEditorForm.isGlobalLayoutLoaded() ? 'settings-loaded' : DataEditorForm.isTaskLayoutLoaded() ? 'settings-loaded-task' : ''}"/>
</h:form>

<h:form id="buttonForm">
Expand Down

0 comments on commit 484d444

Please sign in to comment.