Several bugfixes for the workflow widget
parent
2be640f8d4
commit
d6a0874654
|
|
@ -243,6 +243,7 @@ public abstract class AbstractMvcAuthoringStep implements MvcAuthoringStep {
|
||||||
);
|
);
|
||||||
final String docPath = Optional
|
final String docPath = Optional
|
||||||
.ofNullable(documentPath)
|
.ofNullable(documentPath)
|
||||||
|
.map(this::withoutLeadingSlash)
|
||||||
.orElseThrow(
|
.orElseThrow(
|
||||||
() -> new WebApplicationException(
|
() -> new WebApplicationException(
|
||||||
String.format(
|
String.format(
|
||||||
|
|
@ -377,4 +378,11 @@ public abstract class AbstractMvcAuthoringStep implements MvcAuthoringStep {
|
||||||
.orElse("");
|
.orElse("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String withoutLeadingSlash(final String path) {
|
||||||
|
if (path.startsWith("/")) {
|
||||||
|
return path.substring(1);
|
||||||
|
} else {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ public class DocumentWorkflowController {
|
||||||
* @return A redirect to the {@code returnUrl}.
|
* @return A redirect to the {@code returnUrl}.
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/tasks/${taskIdentifier}/@lock")
|
@Path("/tasks/{taskIdentifier}/@lock")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String lockTask(
|
public String lockTask(
|
||||||
|
|
@ -185,7 +185,7 @@ public class DocumentWorkflowController {
|
||||||
* @return A redirect to the {@code returnUrl}.
|
* @return A redirect to the {@code returnUrl}.
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/tasks/${taskIdentifier}/@unlock")
|
@Path("/tasks/{taskIdentifier}/@unlock")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String unlockTask(
|
public String unlockTask(
|
||||||
|
|
@ -243,7 +243,7 @@ public class DocumentWorkflowController {
|
||||||
* @return A redirect to the {@code returnUrl}.
|
* @return A redirect to the {@code returnUrl}.
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/tasks/${taskIdentifier}/@finish")
|
@Path("/tasks/{taskIdentifier}/@finish")
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String finishTask(
|
public String finishTask(
|
||||||
|
|
|
||||||
|
|
@ -298,6 +298,12 @@ public class SelectedDocumentModel {
|
||||||
.orElse(false)
|
.orElse(false)
|
||||||
);
|
);
|
||||||
entry.setLocked(task.isLocked());
|
entry.setLocked(task.isLocked());
|
||||||
|
entry.setLockedByCurrentUser(
|
||||||
|
shiro
|
||||||
|
.getUser()
|
||||||
|
.map(user -> Objects.equals(user, task.getLockingUser()))
|
||||||
|
.orElse(false)
|
||||||
|
);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,11 @@ public class TaskListEntry {
|
||||||
*/
|
*/
|
||||||
private boolean locked;
|
private boolean locked;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the task locked by the current user?
|
||||||
|
*/
|
||||||
|
private boolean lockedByCurrentUser;
|
||||||
|
|
||||||
public String getTaskUuid() {
|
public String getTaskUuid() {
|
||||||
return taskUuid;
|
return taskUuid;
|
||||||
}
|
}
|
||||||
|
|
@ -126,4 +131,14 @@ public class TaskListEntry {
|
||||||
this.locked = locked;
|
this.locked = locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLockedByCurrentUser() {
|
||||||
|
return lockedByCurrentUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLockedByCurrentUser(final boolean lockedByCurrentUser) {
|
||||||
|
this.lockedByCurrentUser = lockedByCurrentUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,47 +57,53 @@
|
||||||
</c:choose>
|
</c:choose>
|
||||||
<c:if test="#{CmsSelectedDocumentModel.currentTask != null}">
|
<c:if test="#{CmsSelectedDocumentModel.currentTask != null}">
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="#{CmsSelectedDocumentModel.currentTask.assignedToCurrentUser and CmsSelectedDocumentModel.currentTask.locked}">
|
<c:when test="#{(CmsSelectedDocumentModel.currentTask.assignedToCurrentUser or CmsSelectedDocumentModel.currentTask.lockedByCurrentUser)and CmsSelectedDocumentModel.currentTask.locked}">
|
||||||
|
<div class="d-flex">
|
||||||
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@workflow/tasks/UUID-#{CmsSelectedDocumentModel.currentTask.taskUuid}/@unlock"
|
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@workflow/tasks/UUID-#{CmsSelectedDocumentModel.currentTask.taskUuid}/@unlock"
|
||||||
|
class="mr-2"
|
||||||
method="post">
|
method="post">
|
||||||
<input name="returnUrl"
|
<input name="returnUrl"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
value="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/#{authoringStep}" />
|
value="#{CmsArticlePropertiesStep.stepPath}" />
|
||||||
<button class="btn btn-secondary btn-sm"
|
<button class="btn btn-secondary btn-sm"
|
||||||
type="submit">
|
type="submit">
|
||||||
#{CmsAdminMessages['contentsection.document.authoring.workflow.active_task.release']}
|
#{CmsAdminMessages['contentsection.document.authoring.workflow.active_task.release']}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@workflow/tasks/UUID-#{CmsSelectedDocumentModel.currentTask.taskUuid}/@finish"
|
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@workflow/tasks/UUID-#{CmsSelectedDocumentModel.currentTask.taskUuid}/@finish"
|
||||||
|
class="ml-2"
|
||||||
method="post">
|
method="post">
|
||||||
<input name="returnUrl"
|
<input name="returnUrl"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
value="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/#{authoringStep}" />
|
value="#{CmsArticlePropertiesStep.stepPath}" />
|
||||||
<button class="btn btn-secondary btn-sm"
|
<button class="btn btn-secondary btn-sm"
|
||||||
type="submit">
|
type="submit">
|
||||||
#{CmsAdminMessages['contentsection.document.authoring.workflow.active_task.finish']}
|
#{CmsAdminMessages['contentsection.document.authoring.workflow.active_task.finish']}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:when test="#{CmsSelectedDocumentModel.currentTask.locked and CmsSelectedDocumentModel.canChangeWorkflow}">
|
<c:when test="#{CmsSelectedDocumentModel.currentTask.locked and CmsSelectedDocumentModel.canChangeWorkflow}">
|
||||||
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@workflow/tasks/UUID-#{CmsSelectedDocumentModel.currentTask.taskUuid}/@lock"
|
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@workflow/tasks/UUID-#{CmsSelectedDocumentModel.currentTask.taskUuid}/@lock"
|
||||||
method="post">
|
method="post">
|
||||||
<input name="returnUrl"
|
<input name="returnUrl"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
value="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/#{authoringStep}" />
|
value="#{CmsArticlePropertiesStep.stepPath}" />
|
||||||
<button class="btn btn-secondary btn-sm"
|
<button class="btn btn-secondary btn-sm"
|
||||||
type="submit">
|
type="submit">
|
||||||
#{CmsAdminMessages['contentsection.document.authoring.workflow.active_task.takeover']}
|
#{CmsAdminMessages['contentsection.document.authoring.workflow.active_task.takeover']}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:when test="#{CmsSelectedDocumentModel.currentTask.assignedToCurrentUser or CmsSelectedDocumentModel.canChangeWorkflow}">
|
<c:when test="#{CmsSelectedDocumentModel.currentTask.assignedToCurrentUser or CmsSelectedDocumentModel.canChangeWorkflow}">
|
||||||
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@workflow/tasks/UUID-#{CmsSelectedDocumentModel.currentTask.taskUuid}/@lock">
|
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@workflow/tasks/UUID-#{CmsSelectedDocumentModel.currentTask.taskUuid}/@lock"
|
||||||
|
method="post">
|
||||||
<input name="returnUrl"
|
<input name="returnUrl"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
value="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/#{authoringStep}" />
|
value="#{CmsArticlePropertiesStep.stepPath}" />
|
||||||
<button class="btn btn-secondary btn-sm"
|
<button class="btn btn-secondary btn-sm"
|
||||||
type="button">
|
type="submit">
|
||||||
#{CmsAdminMessages['contentsection.document.authoring.workflow.active_task.lock']}
|
#{CmsAdminMessages['contentsection.document.authoring.workflow.active_task.lock']}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue