Bugfixes for edit step of CollectedVolumeAsset
parent
4e03986d45
commit
8d1baa0b58
|
|
@ -111,7 +111,7 @@ public class Publication implements Serializable {
|
|||
@OneToMany(
|
||||
cascade = CascadeType.ALL,
|
||||
fetch = FetchType.LAZY,
|
||||
mappedBy = "author",
|
||||
mappedBy = "publication",
|
||||
orphanRemoval = true
|
||||
)
|
||||
@OrderBy("authorOrder")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import org.librecms.contentsection.privileges.ItemPrivileges;
|
|||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -79,7 +80,6 @@ public class PublicationManager {
|
|||
final Publication toPublication,
|
||||
final boolean asEditor,
|
||||
final int atPosition) {
|
||||
|
||||
Objects.requireNonNull(person);
|
||||
Objects.requireNonNull(toPublication);
|
||||
if (atPosition < 0) {
|
||||
|
|
@ -106,6 +106,7 @@ public class PublicationManager {
|
|||
// Create authorship relation
|
||||
final long numberOfAuthors = toPublication.getAuthorships().size();
|
||||
final Authorship authorship = new Authorship();
|
||||
authorship.setUuid(UUID.randomUUID().toString());
|
||||
authorship.setAuthor(person);
|
||||
authorship.setPublication(toPublication);
|
||||
authorship.setEditor(asEditor);
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@
|
|||
package org.scientificcms.publications.assets;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.librecms.assets.AssetType;
|
||||
import org.librecms.contentsection.Asset;
|
||||
import org.librecms.ui.contentsections.assets.MvcAssetEditKit;
|
||||
import org.scientificcms.publications.CollectedVolume;
|
||||
import org.scientificcms.publications.SciPublicationsConstants;
|
||||
import org.scientificcms.publications.ui.assets.CollectedVolumeAssetCreateStep;
|
||||
import org.scientificcms.publications.ui.assets.CollectedVolumeAssetEditStep;
|
||||
|
||||
|
|
@ -29,6 +31,12 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "COLLECTED_VOLUME_ASSETS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
@AssetType(
|
||||
labelBundle = SciPublicationsConstants.BUNDLE,
|
||||
labelKey = "collectedvolume.label",
|
||||
descriptionBundle = SciPublicationsConstants.BUNDLE,
|
||||
descriptionKey = "collectedvolume.description"
|
||||
)
|
||||
@MvcAssetEditKit(
|
||||
createStep = CollectedVolumeAssetCreateStep.class,
|
||||
editStep = CollectedVolumeAssetEditStep.class
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@
|
|||
package org.scientificcms.publications.assets;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.librecms.assets.AssetType;
|
||||
import org.librecms.contentsection.Asset;
|
||||
import org.scientificcms.publications.Proceedings;
|
||||
import org.scientificcms.publications.SciPublicationsConstants;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -26,6 +28,12 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "PROCEEDINGS_ASSETS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
@AssetType(
|
||||
labelBundle = SciPublicationsConstants.BUNDLE,
|
||||
labelKey = "proceedings.label",
|
||||
descriptionBundle = SciPublicationsConstants.BUNDLE,
|
||||
descriptionKey = "proceedings.description"
|
||||
)
|
||||
public class ProceedingsAsset extends Asset {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ import static org.scientificcms.publications.SciPublicationsConstants.*;
|
|||
@Audited
|
||||
@AssetType(
|
||||
labelBundle = SciPublicationsConstants.BUNDLE,
|
||||
labelKey = "journal.label",
|
||||
labelKey = "series.label",
|
||||
descriptionBundle = SciPublicationsConstants.BUNDLE,
|
||||
descriptionKey = "journal.description"
|
||||
descriptionKey = "series.description"
|
||||
)
|
||||
@MvcAssetEditKit(
|
||||
createStep = SeriesAssetCreateStep.class,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import org.libreccm.security.AuthorizationRequired;
|
|||
import org.libreccm.ui.BaseUrl;
|
||||
import org.librecms.assets.Person;
|
||||
import org.librecms.assets.PersonRepository;
|
||||
import org.librecms.contentsection.Asset;
|
||||
import org.librecms.contentsection.AssetRepository;
|
||||
import org.librecms.ui.contentsections.AssetPermissionsChecker;
|
||||
import org.librecms.ui.contentsections.ContentSectionNotFoundException;
|
||||
|
|
@ -26,6 +27,7 @@ import org.scientificcms.publications.Publisher;
|
|||
import org.scientificcms.publications.PublisherManager;
|
||||
import org.scientificcms.publications.PublisherRepository;
|
||||
import org.scientificcms.publications.assets.CollectedVolumeAsset;
|
||||
import org.scientificcms.publications.assets.PublisherAsset;
|
||||
import org.scientificcms.publications.assets.SeriesAsset;
|
||||
import org.scientificcms.publications.ui.SciPublicationsUiConstants;
|
||||
|
||||
|
|
@ -299,9 +301,9 @@ public class CollectedVolumeAssetEditStep extends AbstractMvcAssetEditStep {
|
|||
|
||||
if (numberOfVolumesParam != null) {
|
||||
if (numberOfVolumesParam.isBlank()) {
|
||||
collectedVolume.setVolume(null);
|
||||
collectedVolume.setNumberOfVolumes(null);
|
||||
} else {
|
||||
collectedVolume.setVolume(
|
||||
collectedVolume.setNumberOfVolumes(
|
||||
Integer.parseInt(numberOfVolumesParam)
|
||||
);
|
||||
}
|
||||
|
|
@ -398,7 +400,7 @@ public class CollectedVolumeAssetEditStep extends AbstractMvcAssetEditStep {
|
|||
}
|
||||
|
||||
@POST
|
||||
@Path("/shortdescription/@add")
|
||||
@Path("/shortdescription/add")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String addShortDescription(
|
||||
|
|
@ -493,9 +495,9 @@ public class CollectedVolumeAssetEditStep extends AbstractMvcAssetEditStep {
|
|||
new Locale(localeParam)
|
||||
);
|
||||
publicationRepo.save(getCollectedVolume());
|
||||
|
||||
|
||||
return buildRedirectPathForStep();
|
||||
} else {
|
||||
} else {
|
||||
return assetUi.showAccessDenied(
|
||||
getContentSection(),
|
||||
getAsset(),
|
||||
|
|
@ -563,7 +565,8 @@ public class CollectedVolumeAssetEditStep extends AbstractMvcAssetEditStep {
|
|||
}
|
||||
|
||||
final Person author = authorResult.get();
|
||||
final boolean editor = "true".equals(editorParam);
|
||||
final boolean editor = "true".equals(editorParam)
|
||||
|| "on".equals(editorParam);
|
||||
publicationManager.addAuthor(author, getCollectedVolume(), editor);
|
||||
|
||||
return buildRedirectPathForStep();
|
||||
|
|
@ -614,7 +617,10 @@ public class CollectedVolumeAssetEditStep extends AbstractMvcAssetEditStep {
|
|||
}
|
||||
|
||||
final Authorship authorship = authorshipResult.get();
|
||||
authorship.setEditor("true".equals(editorParam));
|
||||
authorship.setEditor(
|
||||
"true".equals(editorParam)
|
||||
|| "on".equals(editorParam)
|
||||
);
|
||||
|
||||
publicationRepo.save(collectedVolume);
|
||||
|
||||
|
|
@ -703,31 +709,35 @@ public class CollectedVolumeAssetEditStep extends AbstractMvcAssetEditStep {
|
|||
final Identifier identifier = identifierParser.parseIdentifier(
|
||||
publisherIdentifier
|
||||
);
|
||||
final Optional<Publisher> publisherResult;
|
||||
final Optional<PublisherAsset> assetResult;
|
||||
switch (identifier.getType()) {
|
||||
case ID:
|
||||
publisherResult = publisherRepo.findById(
|
||||
Long.parseLong(identifier.getIdentifier())
|
||||
assetResult = assetRepo.findById(
|
||||
Long.parseLong(identifier.getIdentifier()),
|
||||
PublisherAsset.class
|
||||
);
|
||||
break;
|
||||
case UUID:
|
||||
publisherResult = publisherRepo.findByUuid(
|
||||
identifier.getIdentifier()
|
||||
assetResult = assetRepo.findByUuidAndType(
|
||||
identifier.getIdentifier(),
|
||||
PublisherAsset.class
|
||||
);
|
||||
break;
|
||||
default: {
|
||||
final List<Publisher> result = publisherRepo.findByName(
|
||||
final Optional<Asset> result = assetRepo.findByPath(
|
||||
identifier.getIdentifier()
|
||||
);
|
||||
if (result == null || result.isEmpty()) {
|
||||
publisherResult = Optional.empty();
|
||||
assetResult = Optional.empty();
|
||||
} else if (!(result.get() instanceof PublisherAsset)) {
|
||||
assetResult = Optional.empty();
|
||||
} else {
|
||||
publisherResult = Optional.of(result.get(0));
|
||||
assetResult = Optional.of((PublisherAsset) result.get());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!publisherResult.isPresent()) {
|
||||
if (!assetResult.isPresent()) {
|
||||
return showPublisherNotFound(
|
||||
sectionIdentifier,
|
||||
assetPath,
|
||||
|
|
@ -735,7 +745,7 @@ public class CollectedVolumeAssetEditStep extends AbstractMvcAssetEditStep {
|
|||
);
|
||||
}
|
||||
|
||||
final Publisher publisher = publisherResult.get();
|
||||
final Publisher publisher = assetResult.get().getPublisher();
|
||||
|
||||
publisherManager.addPublicationToPublisher(
|
||||
getCollectedVolume(),
|
||||
|
|
|
|||
|
|
@ -104,13 +104,15 @@
|
|||
<c:forEach items="#{SciCmsCollectedVolumeAssetEditStepModel.authors}"
|
||||
var="author">
|
||||
<tr class="collectedvolume-author"
|
||||
id="#{author.id}"
|
||||
id="#{author.authorshipId}"
|
||||
data-id="#{author.authorshipId}">
|
||||
<td>
|
||||
<button class="btn btn-secondary cms-sort-handle mr-2"
|
||||
type="button">
|
||||
#{author.authorName}
|
||||
<bootstrap:svgIcon icon="arrows-move" />
|
||||
<span class="sr-only">#{SciPublicationsUiMessageBundle['collectedvolume.editstep.authors.move']}</span>
|
||||
</button>
|
||||
#{author.authorName}
|
||||
</td>
|
||||
<td>
|
||||
<c:choose>
|
||||
|
|
@ -125,7 +127,7 @@
|
|||
<td>
|
||||
<button class="btn btn-secondary"
|
||||
data-toggle="modal"
|
||||
data-target="authorship-edit-#{author.authorshipUuid}"
|
||||
data-target="#authorship-edit-#{author.authorshipUuid}"
|
||||
type="button">
|
||||
<bootstrap:svgIcon icon="pen" />
|
||||
<span class="sr-only">
|
||||
|
|
@ -155,7 +157,7 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<bootstrap:formCheck
|
||||
checked="#{author.editor ? 'checked' : ''}"
|
||||
checked="#{author.editor}"
|
||||
inputId="#{author.authorshipUuid}-editor"
|
||||
label="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.authors.editdialog.editor.label']}"
|
||||
name="editor"
|
||||
|
|
@ -166,11 +168,11 @@
|
|||
<button class="btn btn-warning"
|
||||
data-dismiss="modal"
|
||||
type="button">
|
||||
{SciPublicationsUiMessageBundle['collectedvolume.editstep.authors.editdialog.cancel']}
|
||||
#{SciPublicationsUiMessageBundle['collectedvolume.editstep.authors.editdialog.cancel']}
|
||||
</button>
|
||||
<button class="btn btn-success"
|
||||
type="submit">
|
||||
{SciPublicationsUiMessageBundle['collectedvolume.editstep.authors.editdialog.submit']}
|
||||
#{SciPublicationsUiMessageBundle['collectedvolume.editstep.authors.editdialog.submit']}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -222,15 +224,17 @@
|
|||
#{SciCmsCollectedVolumeAssetEditStepModel.publisherName}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<libreccm:deleteDialog
|
||||
actionTarget="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@collectedvolume-edit/publisher/@remove"
|
||||
buttonText="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.remove.label']}"
|
||||
cancelLabel="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.cancel']}"
|
||||
confirmLabel="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.confirm']}"
|
||||
dialogId="publisher.remove"
|
||||
dialogTitle="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.title']}"
|
||||
message="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.message']}"
|
||||
/>
|
||||
<c:if test="#{SciCmsCollectedVolumeAssetEditStepModel.publisherUuid != null}">
|
||||
<libreccm:deleteDialog
|
||||
actionTarget="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@collectedvolume-edit/publisher/@remove"
|
||||
buttonText="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.remove.label']}"
|
||||
cancelLabel="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.cancel']}"
|
||||
confirmLabel="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.confirm']}"
|
||||
dialogId="publisher-remove"
|
||||
dialogTitle="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.title']}"
|
||||
message="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.publisher.message']}"
|
||||
/>
|
||||
</c:if>
|
||||
</p>
|
||||
|
||||
<h3>#{SciPublicationsUiMessageBundle['collectedvolume.editstep.properties']}</h3>
|
||||
|
|
@ -284,10 +288,10 @@
|
|||
/>
|
||||
|
||||
<bootstrap:formGroupNumber
|
||||
help="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.properties.numberofvolume.help']}"
|
||||
inputId="numberOfVolume"
|
||||
label="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.properties.numberofvolume.label']}"
|
||||
name="numberOfVolume"
|
||||
help="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.properties.numberofvolumes.help']}"
|
||||
inputId="numberOfVolumes"
|
||||
label="#{SciPublicationsUiMessageBundle['collectedvolume.editstep.properties.numberofvolumes.label']}"
|
||||
name="numberOfVolumes"
|
||||
value="#{SciCmsCollectedVolumeAssetEditStepModel.numberOfVolumes}"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -315,7 +319,7 @@
|
|||
<dd>#{SciCmsCollectedVolumeAssetEditStepModel.volume}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>#{SciPublicationsUiMessageBundle['collectedvolume.editstep.properties.numberofvolume.label']}</dt>
|
||||
<dt>#{SciPublicationsUiMessageBundle['collectedvolume.editstep.properties.numberofvolumes.label']}</dt>
|
||||
<dd>#{SciCmsCollectedVolumeAssetEditStepModel.numberOfVolumes}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
series.label=Series
|
||||
publisher.label=Publisher
|
||||
series.description=A series of publication.
|
||||
publisher.description=A publisher.
|
||||
journal.label=Journal
|
||||
journal.description=A journal.
|
||||
proceedings.label=Proceedings
|
||||
proceedings.description=Proceedings of conference or an other event.
|
||||
collectedvolume.label=Collected Volume
|
||||
collectedvolume.description=A collected volume.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
series.label=Reihe
|
||||
publisher.label=Verlag
|
||||
series.description=Eine Publikations-Reihe.
|
||||
publisher.description=Ein Verlag.
|
||||
journal.label=Zeitschrift
|
||||
journal.description=Eine Zeitschrift
|
||||
proceedings.label=Tagungsband
|
||||
proceedings.description=Tagungs (Proceedings) einer Konferenz oder \u00e4hnlichen Veranstaltung.
|
||||
collectedvolume.label=Sammelband
|
||||
collectedvolume.description=Ein Sammelband.
|
||||
|
|
@ -137,8 +137,8 @@ collectedvolume.editstep.properties.yearofpublication.help=The year of publicati
|
|||
collectedvolume.editstep.properties.yearofpublication.label=Year of publication
|
||||
collectedvolume.editstep.properties.volume.help=The volume of the publication.
|
||||
collectedvolume.editstep.properties.volume.label=Volume
|
||||
collectedvolume.editstep.properties.numberofvolume.help=The number of volumes of the publication.
|
||||
collectedvolume.editstep.properties.numberofvolume.label=Number of volumes
|
||||
collectedvolume.editstep.properties.numberofvolumes.help=The number of volumes of the publication.
|
||||
collectedvolume.editstep.properties.numberofvolumes.label=Number of volumes
|
||||
collectedvolume.editstep.properties.edit.submit=Save
|
||||
collectedvolume.editstep.shortdescription.add.label=Add localized description
|
||||
collectedvolume.editstep.shortdescription.add.cancel=Cancel
|
||||
|
|
@ -162,3 +162,5 @@ collectedvolume.editstep.shortdescription.remove.title=Confirm removal of locali
|
|||
collectedvolume.editstep.shortdescription.title=Description
|
||||
collectedvolume.createform.yearofpublication.label=Year of publication
|
||||
createstep.title.error.missing=No title for the collected volume was provided.
|
||||
authors.order.save=Save order
|
||||
collectedvolume.editstep.authors.move=Sort authors
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ collectedvolume.editstep.properties.yearofpublication.help=Das Erscheinungsjahr
|
|||
collectedvolume.editstep.properties.yearofpublication.label=Erscheinungsjahr
|
||||
collectedvolume.editstep.properties.volume.help=Der Band der Publikation.
|
||||
collectedvolume.editstep.properties.volume.label=Band
|
||||
collectedvolume.editstep.properties.numberofvolume.help=Die Anzahl der B\u00e4nde der Publikation.
|
||||
collectedvolume.editstep.properties.numberofvolume.label=Anzahl der B\u00e4nde
|
||||
collectedvolume.editstep.properties.numberofvolumes.help=Die Anzahl der B\u00e4nde der Publikation.
|
||||
collectedvolume.editstep.properties.numberofvolumes.label=Anzahl der B\u00e4nde
|
||||
collectedvolume.editstep.properties.edit.submit=Speichern
|
||||
collectedvolume.editstep.shortdescription.add.label=Lokaliserte Beschreibung hinzuf\u00fcgen
|
||||
collectedvolume.editstep.shortdescription.add.cancel=Abbrechen
|
||||
|
|
@ -162,3 +162,5 @@ collectedvolume.editstep.shortdescription.remove.title=Entfernen einer lokaliser
|
|||
collectedvolume.editstep.shortdescription.title=Beschreibung
|
||||
collectedvolume.createform.yearofpublication.label=Erscheinungsjahr
|
||||
createstep.title.error.missing=Es wurde kein Titel f\u00fcr den Sammelband angegeben.
|
||||
authors.order.save=Sortierung speichern
|
||||
collectedvolume.editstep.authors.move=Autoren sortieren
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ function saveOrder() {
|
|||
}
|
||||
|
||||
const headers = new Headers();
|
||||
headers.append("Cotent-Type", "application/json");
|
||||
headers.append("Content-Type", "application/json");
|
||||
fetch(saveUrl, {
|
||||
credentials: "include",
|
||||
body: JSON.stringify(authorsSortable.toArray()),
|
||||
|
|
@ -125,7 +125,7 @@ function saveOrder() {
|
|||
|
||||
function showGeneralError(): void {
|
||||
const alertTemplate = document.querySelector(
|
||||
"authors-sort-error-general"
|
||||
"#authors-sort-error-general"
|
||||
) as HTMLTemplateElement;
|
||||
const alert = alertTemplate.content.cloneNode(true) as Element;
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ function showGeneralError(): void {
|
|||
|
||||
function showSaveError(): void {
|
||||
const alertTemplate = document.querySelector(
|
||||
"authors-sort-error-save"
|
||||
"#authors-sort-error-save"
|
||||
) as HTMLTemplateElement;
|
||||
const alert = alertTemplate.content.cloneNode(true) as Element;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue