Form for extended properties
parent
995d3ed63a
commit
6654577ac0
|
|
@ -15,6 +15,7 @@ import org.scientificcms.publications.assets.PublicationAsset;
|
||||||
import org.scientificcms.publications.contenttypes.PublicationItem;
|
import org.scientificcms.publications.contenttypes.PublicationItem;
|
||||||
import org.scientificcms.publications.ui.SciPublicationsUiMessageBundle;
|
import org.scientificcms.publications.ui.SciPublicationsUiMessageBundle;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -22,7 +23,6 @@ import java.util.stream.Collectors;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import javax.ws.rs.FormParam;
|
import javax.ws.rs.FormParam;
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
|
@ -101,6 +101,16 @@ public abstract class AbstractPublicationExtentedPropertiesStep<T extends Public
|
||||||
.map(lang -> lang.toString())
|
.map(lang -> lang.toString())
|
||||||
.orElse(null)
|
.orElse(null)
|
||||||
);
|
);
|
||||||
|
propertiesStepModel.setLanguageOfPublicationDisplayName(
|
||||||
|
Optional
|
||||||
|
.ofNullable(publication.getLanguageOfPublication())
|
||||||
|
.map(
|
||||||
|
lang -> lang.getDisplayName(
|
||||||
|
globalizationHelper.getNegotiatedLocale()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.orElse(null)
|
||||||
|
);
|
||||||
propertiesStepModel.setPeerReviewed(
|
propertiesStepModel.setPeerReviewed(
|
||||||
Optional
|
Optional
|
||||||
.ofNullable(publication.getPeerReviewed())
|
.ofNullable(publication.getPeerReviewed())
|
||||||
|
|
@ -118,6 +128,20 @@ public abstract class AbstractPublicationExtentedPropertiesStep<T extends Public
|
||||||
.ofNullable(publication.getYearFirstPublished())
|
.ofNullable(publication.getYearFirstPublished())
|
||||||
.orElse(null)
|
.orElse(null)
|
||||||
);
|
);
|
||||||
|
propertiesStepModel.setLanguages(
|
||||||
|
Arrays
|
||||||
|
.stream(Locale.getAvailableLocales())
|
||||||
|
.sorted()
|
||||||
|
.collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
Locale::toString,
|
||||||
|
locale -> locale.getDisplayName(
|
||||||
|
globalizationHelper.getNegotiatedLocale()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
propertiesStepModel.setEditStepUrlFragment(getEditStepUrlFragment());
|
||||||
}
|
}
|
||||||
|
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
|
|
@ -212,6 +236,8 @@ public abstract class AbstractPublicationExtentedPropertiesStep<T extends Public
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract String getEditStepUrlFragment();
|
||||||
|
|
||||||
protected abstract String getStepTemplatePath();
|
protected abstract String getStepTemplatePath();
|
||||||
|
|
||||||
private VolumeInSeriesRow buildVolumeInSeriesRow(
|
private VolumeInSeriesRow buildVolumeInSeriesRow(
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ package org.scientificcms.publications.ui.contenttypes;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
@ -15,14 +17,20 @@ import javax.inject.Named;
|
||||||
@Named("SciCmsPublicationExtendedPropertiesStepModel")
|
@Named("SciCmsPublicationExtendedPropertiesStepModel")
|
||||||
public class PublicationExtendedPropertiesStepModel {
|
public class PublicationExtendedPropertiesStepModel {
|
||||||
|
|
||||||
|
private String editStepUrlFragment;
|
||||||
|
|
||||||
private boolean peerReviewed;
|
private boolean peerReviewed;
|
||||||
|
|
||||||
private Integer yearFirstPublished;
|
private Integer yearFirstPublished;
|
||||||
|
|
||||||
private String languageOfPublication;
|
private String languageOfPublication;
|
||||||
|
|
||||||
|
private String languageOfPublicationDisplayName;
|
||||||
|
|
||||||
private List<VolumeInSeriesRow> volumeInSeries;
|
private List<VolumeInSeriesRow> volumeInSeries;
|
||||||
|
|
||||||
|
private Map<String, String> languages;
|
||||||
|
|
||||||
public boolean isPeerReviewed() {
|
public boolean isPeerReviewed() {
|
||||||
return peerReviewed;
|
return peerReviewed;
|
||||||
}
|
}
|
||||||
|
|
@ -55,4 +63,32 @@ public class PublicationExtendedPropertiesStepModel {
|
||||||
this.volumeInSeries = new ArrayList<>(volumeInSeries);
|
this.volumeInSeries = new ArrayList<>(volumeInSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getLanguages() {
|
||||||
|
return Collections.unmodifiableMap(languages);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguages(final Map<String, String> languages) {
|
||||||
|
this.languages = new HashMap<>(languages);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguageOfPublicationDisplayName() {
|
||||||
|
return languageOfPublicationDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguageOfPublicationDisplayName(
|
||||||
|
final String languageOfPublicationDisplayName
|
||||||
|
) {
|
||||||
|
this.languageOfPublicationDisplayName = languageOfPublicationDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEditStepUrlFragment() {
|
||||||
|
return editStepUrlFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditStepUrlFragment(final String editStepUrlFragment) {
|
||||||
|
this.editStepUrlFragment = editStepUrlFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,96 @@
|
||||||
|
|
||||||
<h2>#{authoringStepTitle}</h2>
|
<h2>#{authoringStepTitle}</h2>
|
||||||
|
|
||||||
<!-- peerReviewed: boolean -->
|
<div class="text-right">
|
||||||
|
<button class="btn btn-primary"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#extendedproperties-edit-dialog"
|
||||||
|
type="button">
|
||||||
|
<bootstrap:svgIcon icon="pen" />
|
||||||
|
<span class="sr-only">#{SciPublicationsUiMessageBundle['publication.editstep.extendedproperties.edit']}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div aria-hidden="true"
|
||||||
|
aria-labelledby="properties-edit-dialog-title"
|
||||||
|
class="modal fade"
|
||||||
|
id="extendedproperties-edit-dialog"
|
||||||
|
tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@#{SciCmsPublicationExtendedPropertiesStepModel.editStepUrlFragment}/properties"
|
||||||
|
class="modal-content"
|
||||||
|
method="post">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title"
|
||||||
|
id="properties-edit-dialog-title">
|
||||||
|
#{SciPublicationsUiMessageBundle['publication.editstep.extendedproperties.edit.title']}
|
||||||
|
</h4>
|
||||||
|
<button
|
||||||
|
aria-label="#{SciPublicationsUiMessageBundle['publication.editstep.extendedproperties.edit.close']}"
|
||||||
|
class="close"
|
||||||
|
data-dismiss="modal"
|
||||||
|
type="button">
|
||||||
|
<bootstrap:svgIcon icon="x" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<bootstrap:formCheck
|
||||||
|
inputId="peer-reviewed"
|
||||||
|
label="#{SciPublicationsUiMessageBundle['extendedproperties.peerreviewed.label']}"
|
||||||
|
name="peerReviewed"
|
||||||
|
value="#{SciCmsPublicationExtendedPropertiesStepModel.peerReviewed}"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- yearFirstPublished -->
|
<bootstrap:formGroupNumber
|
||||||
|
help="#{SciPublicationsUiMessageBundle['extendedproperties.yearfirstpublished.help']}"
|
||||||
|
inputId="year-first-published"
|
||||||
|
label="#{SciPublicationsUiMessageBundle['extendedproperties.yearfirstpublished.label']}"
|
||||||
|
name="yearFirstPublished"
|
||||||
|
value="#{SciCmsPublicationExtendedPropertiesStepModel.yearFirstPublished}"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- languageOfPublication: int -->
|
<bootstrap:formGroupSelect
|
||||||
|
help="#{SciPublicationsUiMessageBundle['extendedproperties.languageofpublication.help']}"
|
||||||
|
inputId="language-of-publication"
|
||||||
|
label="#{SciPublicationsUiMessageBundle['extendedproperties.languageofpublication.label']}"
|
||||||
|
name="languageOfPublication"
|
||||||
|
options="#{SciCmsPublicationExtendedPropertiesStepModel.languages}"
|
||||||
|
selectedOptions="#{List.of(SciCmsPublicationExtendedPropertiesStepModel.languageOfPublication)}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-warning"
|
||||||
|
data-dismiss="modal"
|
||||||
|
type="button">
|
||||||
|
#{SciPublicationsUiMessageBundle['publication.editstep.extededproperties.edit.close']}
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-success"
|
||||||
|
type="submit">
|
||||||
|
#{SciPublicationsUiMessageBundle['publication.editstep.extendedproperties.edit.submit']}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<dl>
|
||||||
|
<div>
|
||||||
|
<dt>#{SciPublicationsUiMessageBundle['extendedproperties.peerreviewed.label']}</dt>
|
||||||
|
<dd>#{SciCmsPublicationExtendedPropertiesStepModel.peerReviewed}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>#{SciPublicationsUiMessageBundle['extendedproperties.yearfirstpublished.label']}</dt>
|
||||||
|
<dd>#{SciCmsPublicationExtendedPropertiesStepModel.yearFirstPublished}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>#{SciPublicationsUiMessageBundle['extendedproperties.languageofpublication.label']}</dt>
|
||||||
|
<dd>#{SciCmsPublicationExtendedPropertiesStepModel.languageOfPublicationDisplayName}</dd>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ui:insert name="publicationExtendedProperties" />
|
||||||
|
</dl>
|
||||||
|
|
||||||
<!-- series: asset -->
|
<!-- series: asset -->
|
||||||
|
|
||||||
<ui:insert name="publicationExtendedProperties"/>
|
<ui:insert name="publicationExtendedPropertyWidgets"/>
|
||||||
|
|
||||||
</ui:define>
|
</ui:define>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue