3116 Handle projects without Daisy connection when performing the final steps as an author
This commit is contained in:
parent
2c921bf97f
commit
7c42ba67dc
daisy-integration/src/main/java/se/su/dsv/scipro/integration/daisy
view/src/main/java/se/su/dsv/scipro/project/panels
@ -33,6 +33,9 @@ class DaisyConsentService implements PublishingConsentService {
|
||||
|
||||
@Override
|
||||
public PublishingConsent getPublishingConsent(Project project, User author) {
|
||||
if (project.getIdentifier() == null || author.getIdentifier() == null) {
|
||||
return UNAVAILABLE;
|
||||
}
|
||||
try {
|
||||
final se.su.dsv.scipro.io.dto.PublishingConsent publishingConsent = daisyAPI.getPublishingConsent(project.getIdentifier(), author.getIdentifier());
|
||||
final Level selected = fromDaisyLevel(publishingConsent.getSelected());
|
||||
|
@ -44,12 +44,14 @@
|
||||
</label>
|
||||
<textarea class="form-control" wicket:id="reflection" id="reflection" rows="10" required></textarea>
|
||||
</div>
|
||||
<fieldset class="mb-3">
|
||||
<legend>
|
||||
<wicket:message key="publishing_consent"/>
|
||||
</legend>
|
||||
<div wicket:id="publishingConsentLevel"></div>
|
||||
</fieldset>
|
||||
<wicket:enclosure>
|
||||
<fieldset class="mb-3">
|
||||
<legend>
|
||||
<wicket:message key="publishing_consent"/>
|
||||
</legend>
|
||||
<div wicket:id="publishingConsentLevel"></div>
|
||||
</fieldset>
|
||||
</wicket:enclosure>
|
||||
<div wicket:id="publication_metadata">
|
||||
<p>
|
||||
<wicket:message key="publication_metadata_why">
|
||||
|
@ -87,7 +87,13 @@ public class FinalStepsPanel extends GenericPanel<Project> {
|
||||
"publishingConsentLevel",
|
||||
levelModel,
|
||||
publishingConsent.map(PublishingConsentService.PublishingConsent::available),
|
||||
new EnumChoiceRenderer<>(this));
|
||||
new EnumChoiceRenderer<>(this)) {
|
||||
@Override
|
||||
protected void onConfigure() {
|
||||
super.onConfigure();
|
||||
setVisible(!publishingConsent.getObject().available().isEmpty());
|
||||
}
|
||||
};
|
||||
publishingConsentLevel.setRequired(true);
|
||||
add(publishingConsentLevel);
|
||||
|
||||
@ -127,7 +133,10 @@ public class FinalStepsPanel extends GenericPanel<Project> {
|
||||
finalThesisUpload.swedishTitle());
|
||||
}
|
||||
reflectionService.submitReflection(getModelObject(), SciProSession.get().getUser(), reflectionModel.getObject());
|
||||
publishingConsentService.setPublishingConsent(getModelObject(), SciProSession.get().getUser(), levelModel.getObject());
|
||||
if (levelModel.getObject() != null) {
|
||||
// level might be null if there is no publishing consent service available
|
||||
publishingConsentService.setPublishingConsent(getModelObject(), SciProSession.get().getUser(), levelModel.getObject());
|
||||
}
|
||||
publicationMetadataService.save(publicationMetadataModel.getObject());
|
||||
success(getString("reflection_submitted"));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user