SEBSERV-259
This commit is contained in:
parent
7a71839124
commit
fad3810ba8
2 changed files with 37 additions and 3 deletions
|
@ -572,6 +572,11 @@ public enum ActionDefinition {
|
||||||
ImageIcon.IMPORT,
|
ImageIcon.IMPORT,
|
||||||
ActionCategory.FORM),
|
ActionCategory.FORM),
|
||||||
|
|
||||||
|
SEB_EXAM_CONFIG_COPY_CONFIG_FROM_LIST(
|
||||||
|
new LocTextKey("sebserver.examconfig.action.copy"),
|
||||||
|
ImageIcon.COPY,
|
||||||
|
// PageStateDefinitionImpl.SEB_EXAM_CONFIG_PROP_EDIT,
|
||||||
|
ActionCategory.SEB_EXAM_CONFIG_LIST),
|
||||||
SEB_EXAM_CONFIG_COPY_CONFIG(
|
SEB_EXAM_CONFIG_COPY_CONFIG(
|
||||||
new LocTextKey("sebserver.examconfig.action.copy"),
|
new LocTextKey("sebserver.examconfig.action.copy"),
|
||||||
ImageIcon.COPY,
|
ImageIcon.COPY,
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import ch.ethz.seb.sebserver.gbl.Constants;
|
||||||
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
import ch.ethz.seb.sebserver.gbl.api.EntityType;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.Domain;
|
import ch.ethz.seb.sebserver.gbl.model.Domain;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.Entity;
|
import ch.ethz.seb.sebserver.gbl.model.Entity;
|
||||||
|
@ -68,6 +69,7 @@ public class SEBExamConfigList implements TemplateComposer {
|
||||||
|
|
||||||
private final PageService pageService;
|
private final PageService pageService;
|
||||||
private final SEBExamConfigImportPopup sebExamConfigImportPopup;
|
private final SEBExamConfigImportPopup sebExamConfigImportPopup;
|
||||||
|
private final SEBExamConfigCreationPopup sebExamConfigCreationPopup;
|
||||||
private final CurrentUser currentUser;
|
private final CurrentUser currentUser;
|
||||||
private final ResourceService resourceService;
|
private final ResourceService resourceService;
|
||||||
private final int pageSize;
|
private final int pageSize;
|
||||||
|
@ -75,10 +77,12 @@ public class SEBExamConfigList implements TemplateComposer {
|
||||||
protected SEBExamConfigList(
|
protected SEBExamConfigList(
|
||||||
final PageService pageService,
|
final PageService pageService,
|
||||||
final SEBExamConfigImportPopup sebExamConfigImportPopup,
|
final SEBExamConfigImportPopup sebExamConfigImportPopup,
|
||||||
|
final SEBExamConfigCreationPopup sebExamConfigCreationPopup,
|
||||||
@Value("${sebserver.gui.list.page.size:20}") final Integer pageSize) {
|
@Value("${sebserver.gui.list.page.size:20}") final Integer pageSize) {
|
||||||
|
|
||||||
this.pageService = pageService;
|
this.pageService = pageService;
|
||||||
this.sebExamConfigImportPopup = sebExamConfigImportPopup;
|
this.sebExamConfigImportPopup = sebExamConfigImportPopup;
|
||||||
|
this.sebExamConfigCreationPopup = sebExamConfigCreationPopup;
|
||||||
this.currentUser = pageService.getCurrentUser();
|
this.currentUser = pageService.getCurrentUser();
|
||||||
this.resourceService = pageService.getResourceService();
|
this.resourceService = pageService.getResourceService();
|
||||||
this.pageSize = pageSize;
|
this.pageSize = pageSize;
|
||||||
|
@ -149,7 +153,8 @@ public class SEBExamConfigList implements TemplateComposer {
|
||||||
.withSelectionListener(this.pageService.getSelectionPublisher(
|
.withSelectionListener(this.pageService.getSelectionPublisher(
|
||||||
pageContext,
|
pageContext,
|
||||||
ActionDefinition.SEB_EXAM_CONFIG_VIEW_PROP_FROM_LIST,
|
ActionDefinition.SEB_EXAM_CONFIG_VIEW_PROP_FROM_LIST,
|
||||||
ActionDefinition.SEB_EXAM_CONFIG_MODIFY_PROP_FROM_LIST))
|
ActionDefinition.SEB_EXAM_CONFIG_MODIFY_PROP_FROM_LIST,
|
||||||
|
ActionDefinition.SEB_EXAM_CONFIG_COPY_CONFIG_FROM_LIST))
|
||||||
|
|
||||||
.compose(pageContext.copyOf(content));
|
.compose(pageContext.copyOf(content));
|
||||||
|
|
||||||
|
@ -160,14 +165,38 @@ public class SEBExamConfigList implements TemplateComposer {
|
||||||
.publishIf(examConfigGrant::iw)
|
.publishIf(examConfigGrant::iw)
|
||||||
|
|
||||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_VIEW_PROP_FROM_LIST)
|
.newAction(ActionDefinition.SEB_EXAM_CONFIG_VIEW_PROP_FROM_LIST)
|
||||||
.withSelect(configTable::getSelection, PageAction::applySingleSelectionAsEntityKey,
|
.withSelect(
|
||||||
|
configTable::getSelection,
|
||||||
|
PageAction::applySingleSelectionAsEntityKey,
|
||||||
EMPTY_SELECTION_TEXT_KEY)
|
EMPTY_SELECTION_TEXT_KEY)
|
||||||
.publish(false)
|
.publish(false)
|
||||||
|
|
||||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_MODIFY_PROP_FROM_LIST)
|
.newAction(ActionDefinition.SEB_EXAM_CONFIG_MODIFY_PROP_FROM_LIST)
|
||||||
.withSelect(
|
.withSelect(
|
||||||
configTable.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
|
configTable.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
|
||||||
PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
|
PageAction::applySingleSelectionAsEntityKey,
|
||||||
|
EMPTY_SELECTION_TEXT_KEY)
|
||||||
|
.publishIf(() -> examConfigGrant.im(), false)
|
||||||
|
|
||||||
|
.newAction(ActionDefinition.SEB_EXAM_CONFIG_COPY_CONFIG_FROM_LIST)
|
||||||
|
//.withEntityKey(entityKey)
|
||||||
|
.withSelect(
|
||||||
|
configTable.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
|
||||||
|
pageAction -> {
|
||||||
|
this.sebExamConfigCreationPopup.configCreationFunction(
|
||||||
|
pageAction.pageContext()
|
||||||
|
.withEntityKey(pageAction.getSingleSelection())
|
||||||
|
.withAttribute(
|
||||||
|
PageContext.AttributeKeys.COPY_AS_TEMPLATE,
|
||||||
|
Constants.FALSE_STRING)
|
||||||
|
.withAttribute(
|
||||||
|
PageContext.AttributeKeys.CREATE_FROM_TEMPLATE,
|
||||||
|
Constants.FALSE_STRING))
|
||||||
|
.apply(pageAction);
|
||||||
|
return pageAction;
|
||||||
|
},
|
||||||
|
EMPTY_SELECTION_TEXT_KEY)
|
||||||
|
.noEventPropagation()
|
||||||
.publishIf(() -> examConfigGrant.im(), false)
|
.publishIf(() -> examConfigGrant.im(), false)
|
||||||
|
|
||||||
.newAction(ActionDefinition.SEB_EXAM_CONFIG_IMPORT_TO_NEW_CONFIG)
|
.newAction(ActionDefinition.SEB_EXAM_CONFIG_IMPORT_TO_NEW_CONFIG)
|
||||||
|
|
Loading…
Reference in a new issue