diff --git a/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/SciProject.java b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/SciProject.java index 352418f..d000e1a 100644 --- a/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/SciProject.java +++ b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/SciProject.java @@ -11,6 +11,11 @@ import org.hibernate.envers.Audited; import org.libreccm.l10n.LocalizedString; import org.librecms.contentsection.ContentItem; import org.librecms.contenttypes.ContentTypeDescription; +import org.librecms.ui.contentsections.documents.MvcAuthoringKit; +import org.scientificcms.contenttypes.sciproject.ui.SciProjectCreateStep; +import org.scientificcms.contenttypes.sciproject.ui.SciProjectDescriptionStep; +import org.scientificcms.contenttypes.sciproject.ui.SciProjectFundingStep; +import org.scientificcms.contenttypes.sciproject.ui.SciProjectPropertiesStep; import java.io.Serializable; import java.time.LocalDate; @@ -44,6 +49,14 @@ import static org.scientificcms.contenttypes.sciproject.SciProjectConstants.*; labelBundle = "org.scientificcms.contenttypes.SciProject", descriptionBundle = "org.scientificcms.contenttypes.SciProject" ) +@MvcAuthoringKit( + createStep = SciProjectCreateStep.class, + authoringSteps = { + SciProjectPropertiesStep.class, + SciProjectDescriptionStep.class, + SciProjectFundingStep.class + } +) @NamedQueries({ @NamedQuery( name = "SciProject.findWhereBeginIsBefore", @@ -144,6 +157,7 @@ public class SciProject extends ContentItem implements Serializable { public SciProject() { super(); + shortDescription = new LocalizedString(); contacts = new ArrayList<>(); members = new ArrayList<>(); } diff --git a/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectAuthoringSteps.java b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectAuthoringSteps.java new file mode 100644 index 0000000..5ce0ac4 --- /dev/null +++ b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectAuthoringSteps.java @@ -0,0 +1,35 @@ +package org.scientificcms.contenttypes.sciproject.ui; + +import org.librecms.ui.contentsections.documents.MvcAuthoringSteps; + +import java.util.Set; + +import javax.enterprise.context.ApplicationScoped; + +/** + * + * @author Jens Pelzetter + */ +@ApplicationScoped +public class SciProjectAuthoringSteps implements MvcAuthoringSteps { + + @Override + public Set> getClasses() { + return Set.of( + SciProjectPropertiesStep.class, + SciProjectDescriptionStep.class, + SciProjectFundingStep.class + ); + } + + @Override + public Set> getResourceClasses() { + return Set.of( + SciProjectDescriptionStepService.class, + SciProjectFundingStepService.class + ); + } + + + +} diff --git a/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectCreateStep.java b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectCreateStep.java index 0e758cd..e789cec 100644 --- a/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectCreateStep.java +++ b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectCreateStep.java @@ -352,26 +352,27 @@ public class SciProjectCreateStep && formParams.get(FORM_PARAM_END) != null && formParams.get(FORM_PARAM_END).length > 0) { endParam = formParams.get(FORM_PARAM_END)[0]; - if (endParam != null) { - try { - return LocalDate.parse( - endParam, - DateTimeFormatter.ISO_DATE - ); - } catch (DateTimeParseException ex) { - addMessage( - "danger", - globalizationHelper - .getLocalizedTextsUtil(getBundle()) - .getText("createstep.enddate.error.malformed") - ); - return null; - } - } else { + if (endParam == null || endParam.isBlank()) { + return null; + } + + try { + return LocalDate.parse( + endParam, + DateTimeFormatter.ISO_DATE + ); + } catch (DateTimeParseException ex) { + addMessage( + "danger", + globalizationHelper + .getLocalizedTextsUtil(getBundle()) + .getText("createstep.enddate.error.malformed") + ); return null; } } else { return null; } } + } diff --git a/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectStepsConstants.java b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectStepsConstants.java index 42cab7e..5910dad 100644 --- a/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectStepsConstants.java +++ b/sci-types-project/src/main/java/org/scientificcms/contenttypes/sciproject/ui/SciProjectStepsConstants.java @@ -30,5 +30,5 @@ public final class SciProjectStepsConstants { } public static final String BUNDLE - = "org.scientificcms.contentypes.sciproject.ui.SciProjectBundle"; + = "org.scientificcms.contenttypes.sciproject.ui.SciProjectBundle"; } \ No newline at end of file diff --git a/sci-types-project/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/sciproject/ui/create-sciproject.xhtml b/sci-types-project/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/sciproject/ui/create-sciproject.xhtml new file mode 100644 index 0000000..e55d492 --- /dev/null +++ b/sci-types-project/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/sciproject/ui/create-sciproject.xhtml @@ -0,0 +1,107 @@ +]> + + + + + + #{SciProjectMessageBundle['createstep.title']} + + + + #{message.value} + + + + + + + + + + + + + + + + + + + + + #{SciProjectMessageBundle['createform.cancel']} + + + #{SciProjectMessageBundle['createform.submit']} + + + + + + + + + + diff --git a/sci-types-project/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/sciproject/ui/sciproject-basic-properties.xhtml b/sci-types-project/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/sciproject/ui/sciproject-basic-properties.xhtml index 85042f6..fdce987 100644 --- a/sci-types-project/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/sciproject/ui/sciproject-basic-properties.xhtml +++ b/sci-types-project/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/sciproject/ui/sciproject-basic-properties.xhtml @@ -5,46 +5,145 @@ xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> - - + - - #{SciProjectMessageBundle.getMessage('basicproperties.header', [SciProjectPropertiesStep.name])} + + #{SciProjectMessageBundle.getMessage('basicproperties.header', [SciProjectPropertiesStep.name])} + + #{SciProjectMessageBundle['basicproperties.name.header']} + + #{SciProjectPropertiesStep.name} + + + + + #{SciProjectMessageBundle['basicproperties.name.edit']} + + + + - #{SciProjectMessageBundle['basicproperties.name.header']} - - #{SciProjectPropertiesStep.name} + + + + + + #{SciProjectMessageBundle['basicproperties.name.edit.title']} + + + + + + + + + + + + + + + + + + + #{SciProjectMessageBundle['basicproperties.begin.header']} - #{SciProjectMessageBundle['basicproperties.name.edit']} + #{SciProjectMessageBundle['basicproperties.begin.edit']} - - - - + + + #{SciProjectMessageBundle['basicproperties.begin.label']} + + #{SciProjectPropertiesStep.begin} + + - - #{SciProjectMessageBundle['basicproperties.name.edit.title']} + id="begin-edit-dialog-title"> + #{SciProjectMessageBundle['basicproperties.begin.edit.dialog.title']} - @@ -52,230 +151,131 @@ - + - - - - - - #{SciProjectMessageBundle['basicproperties.begin.header']} - - - - #{SciProjectMessageBundle['basicproperties.begin.edit']} - - - - - #{SciProjectMessageBundle['basicproperties.begin.label']} - - #{SciProjectPropertiesStep.begin} - - - - - - - - #{SciProjectMessageBundle['basicproperties.begin.edit.dialog.title']} - - - - - - - - - - + + #{SciProjectMessageBundle['basicproperties.end.header']} + + + + #{SciProjectMessageBundle['basicproperties.end.edit']} + + - - - - #{SciProjectMessageBundle['basicproperties.end.header']} - - - - #{SciProjectMessageBundle['basicproperties.end.edit']} - - - - - #{SciProjectMessageBundle['basicproperties.end.label']} - - #{SciProjectPropertiesStep.end} - - - - - - - - #{SciProjectMessageBundle['basicproperties.end.edit.dialog.title']} - - - - - - - - - - + + #{SciProjectMessageBundle['basicproperties.end.label']} + + #{SciProjectPropertiesStep.end} + + + + + + + + #{SciProjectMessageBundle['basicproperties.end.edit.dialog.title']} + + + + + + + + + + + - - + - + +
#{SciProjectPropertiesStep.name}