Managing members of a SciProject.
parent
06d7839b70
commit
aaaa9d8277
|
|
@ -130,9 +130,13 @@ public class SciProjectMananger implements Serializable {
|
||||||
final Optional<Membership> result = fromProject
|
final Optional<Membership> result = fromProject
|
||||||
.getMembers()
|
.getMembers()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(membership -> filterMembership(membership,
|
.filter(
|
||||||
person,
|
membership -> filterMembership(
|
||||||
fromProject))
|
membership,
|
||||||
|
person,
|
||||||
|
fromProject
|
||||||
|
)
|
||||||
|
)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
|
||||||
if (result.isPresent()) {
|
if (result.isPresent()) {
|
||||||
|
|
|
||||||
|
|
@ -533,8 +533,28 @@ public class SciProjectDescriptionStep extends AbstractMvcAuthoringStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemPermissionChecker.canEditItem(getProject())) {
|
if (itemPermissionChecker.canEditItem(getProject())) {
|
||||||
final Optional<Person> result = assetRepo
|
final Optional<Person> result;
|
||||||
.findByUuidAndType(personUuid, Person.class);
|
final Identifier personIdentifier = identifierParser
|
||||||
|
.parseIdentifier(personUuid);
|
||||||
|
switch (personIdentifier.getType()) {
|
||||||
|
case ID:
|
||||||
|
result = assetRepo.findById(
|
||||||
|
Long.parseLong(personIdentifier.getIdentifier()),
|
||||||
|
Person.class
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case UUID:
|
||||||
|
result = assetRepo
|
||||||
|
.findByUuidAndType(
|
||||||
|
personIdentifier.getIdentifier(),
|
||||||
|
Person.class
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
models.put("personNotFound", personUuid);
|
||||||
|
return showStep(sectionIdentifier, documentPath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (!result.isPresent()) {
|
if (!result.isPresent()) {
|
||||||
models.put("personNotFound", personUuid);
|
models.put("personNotFound", personUuid);
|
||||||
|
|
@ -565,7 +585,7 @@ public class SciProjectDescriptionStep extends AbstractMvcAuthoringStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/members/edit/{membershipId")
|
@Path("/members/edit/{membershipId}")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
public String editMembership(
|
public String editMembership(
|
||||||
|
|
@ -620,7 +640,7 @@ public class SciProjectDescriptionStep extends AbstractMvcAuthoringStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/members/remove")
|
@Path("/members/remove/{membershipId}")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
public String removeMembership(
|
public String removeMembership(
|
||||||
|
|
@ -628,7 +648,7 @@ public class SciProjectDescriptionStep extends AbstractMvcAuthoringStep {
|
||||||
final String sectionIdentifier,
|
final String sectionIdentifier,
|
||||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||||
final String documentPath,
|
final String documentPath,
|
||||||
@FormParam("membershipId")
|
@PathParam("membershipId")
|
||||||
final String membershipId
|
final String membershipId
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -778,6 +798,7 @@ public class SciProjectDescriptionStep extends AbstractMvcAuthoringStep {
|
||||||
model.setPrefix(
|
model.setPrefix(
|
||||||
membership.getMember().getPersonName().getPrefix()
|
membership.getMember().getPersonName().getPrefix()
|
||||||
);
|
);
|
||||||
|
model.setRole(membership.getRole());
|
||||||
model.setStatus(Objects.toString(membership.getStatus()));
|
model.setStatus(Objects.toString(membership.getStatus()));
|
||||||
model.setSuffix(
|
model.setSuffix(
|
||||||
membership.getMember().getPersonName().getSuffix()
|
membership.getMember().getPersonName().getSuffix()
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,18 @@
|
||||||
</div>
|
</div>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
|
<c:if test="#{personNotFound != null}">
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
#{SciProjectMessageBundle.getMessage('description_step.errors.person_not_found', [personNotFound])}
|
||||||
|
</div>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<c:if test="#{illegalStatusValue != null}">
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
#{SciProjectMessageBundle.getMessage('description_step.errors.illegal_member_status_value', [illegalStatusValue])}
|
||||||
|
</div>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
<template id="sciproject-contacts-sort-error-general">
|
<template id="sciproject-contacts-sort-error-general">
|
||||||
<div class="alert alert-danger mt-3" role="alert">
|
<div class="alert alert-danger mt-3" role="alert">
|
||||||
#{SciProjectMessageBundle['contacts.sort.errors.general']}
|
#{SciProjectMessageBundle['contacts.sort.errors.general']}
|
||||||
|
|
@ -206,18 +218,19 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<librecms:assetPicker
|
<librecms:assetPicker
|
||||||
actionUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@sciproject-description/description/members/add"
|
actionUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@sciproject-description/members/add"
|
||||||
assetPickerId="members-picker"
|
assetPickerId="members-picker"
|
||||||
assetType="#{SciProjectDescriptionMembers.memberType}"
|
assetType="#{SciProjectDescriptionMembers.memberType}"
|
||||||
baseUrl="#{SciProjectDescriptionContacts.baseUrl}"
|
baseUrl="#{SciProjectDescriptionContacts.baseUrl}"
|
||||||
contentSection="#{ContentSectionModel.sectionName}"
|
contentSection="#{ContentSectionModel.sectionName}"
|
||||||
formParamName="memberUuid">
|
dialogTitle="#{SciProjectMessageBundle['memberships.add.title']}"
|
||||||
|
formParamName="personUuid">
|
||||||
|
|
||||||
<bootstrap:formGroupText
|
<bootstrap:formGroupText
|
||||||
help="#{SciProjectMessageBundle['memberships.role.help']}"
|
help="#{SciProjectMessageBundle['memberships.role.help']}"
|
||||||
inputId="type"
|
inputId="type"
|
||||||
label="#{SciProjectMessageBundle['contacts.role.label']}"
|
label="#{SciProjectMessageBundle['memberships.role.label']}"
|
||||||
name="type"
|
name="role"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<bootstrap:formGroupSelect
|
<bootstrap:formGroupSelect
|
||||||
|
|
@ -271,7 +284,9 @@
|
||||||
id="membership-edit-dialog"
|
id="membership-edit-dialog"
|
||||||
tabindex="-1">
|
tabindex="-1">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<form class="modal-content">
|
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@sciproject-description/members/edit/#{member.membershipId}"
|
||||||
|
class="modal-content"
|
||||||
|
method="post">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title"
|
<h4 class="modal-title"
|
||||||
id="membership-edit-dialog-title">
|
id="membership-edit-dialog-title">
|
||||||
|
|
@ -287,17 +302,19 @@
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<bootstrap:formGroupText
|
<bootstrap:formGroupText
|
||||||
help="#{SciProjectMessageBundle['memberships.edit.role.help']}"
|
help="#{SciProjectMessageBundle['memberships.edit.role.help']}"
|
||||||
inputId="type"
|
inputId="role"
|
||||||
label="#{SciProjectMessageBundle['memberships.edit.role.label']}"
|
label="#{SciProjectMessageBundle['memberships.edit.role.label']}"
|
||||||
name="type-edit"
|
name="role"
|
||||||
|
value="#{member.role}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<bootstrap:formGroupSelect
|
<bootstrap:formGroupSelect
|
||||||
help="#{SciProjectMessageBundle['memberships.edit.status.help']}"
|
help="#{SciProjectMessageBundle['memberships.edit.status.help']}"
|
||||||
inputId="status"
|
inputId="status"
|
||||||
label="#{SciProjectMessageBundle['memberships.edit.status.label']}"
|
label="#{SciProjectMessageBundle['memberships.edit.status.label']}"
|
||||||
name="status-edit"
|
name="status"
|
||||||
options="#{SciProjectDescriptionMembers.statusValues}"
|
options="#{SciProjectDescriptionMembers.statusValues}"
|
||||||
|
selectedOptions="#{[member.status]}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
@ -337,7 +354,6 @@
|
||||||
|
|
||||||
<ui:define name="scripts">
|
<ui:define name="scripts">
|
||||||
<script src="#{request.contextPath}/assets/@sciproject/sciproject-contacts.js" />
|
<script src="#{request.contextPath}/assets/@sciproject/sciproject-contacts.js" />
|
||||||
<!--<script src="#{request.contextPath}/assets/@content-sections/sciproject-members.js" />-->
|
|
||||||
</ui:define>
|
</ui:define>
|
||||||
|
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
|
||||||
|
|
@ -178,3 +178,6 @@ contacts.order.save=Save order
|
||||||
contacts.sort.errors.general=Error sorting contacts.
|
contacts.sort.errors.general=Error sorting contacts.
|
||||||
contacts.sort.errors.save=Failed to save contacts order.
|
contacts.sort.errors.save=Failed to save contacts order.
|
||||||
contact.add.title=Add contact
|
contact.add.title=Add contact
|
||||||
|
memberships.add.title=Add member
|
||||||
|
description_step.errors.person_not_found=Selected person {0} not found.
|
||||||
|
description_step.errors.illegal_member_status_value=The status value {0} is not valid.
|
||||||
|
|
|
||||||
|
|
@ -178,3 +178,6 @@ contacts.order.save=Sortierung speichern
|
||||||
contacts.sort.errors.general=Fehler f\u00fcr Sortierung der Kontakte.
|
contacts.sort.errors.general=Fehler f\u00fcr Sortierung der Kontakte.
|
||||||
contacts.sort.errors.save=Fehler beim Speichern der Sortierung der Kontakte.
|
contacts.sort.errors.save=Fehler beim Speichern der Sortierung der Kontakte.
|
||||||
contact.add.title=Kontakt hinzuf\u00fcgen
|
contact.add.title=Kontakt hinzuf\u00fcgen
|
||||||
|
memberships.add.title=Mitglied hinzuf\u00fcgen
|
||||||
|
description_step.errors.person_not_found=Die ausgew\u00e4hlte Person {0} wurde nicht gefunden.
|
||||||
|
description_step.errors.illegal_member_status_value=Der Status {0} wird nicht unterst\u00fctzt.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue