SEBSERV-85 fix

This commit is contained in:
anhefti 2019-08-22 16:53:50 +02:00
parent 1a3aac4802
commit 1f6810cdf2
3 changed files with 15 additions and 0 deletions

View file

@ -44,6 +44,7 @@ import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
import ch.ethz.seb.sebserver.gui.service.page.PageContext;
import ch.ethz.seb.sebserver.gui.service.page.PageContext.AttributeKeys;
import ch.ethz.seb.sebserver.gui.service.page.PageMessageException;
import ch.ethz.seb.sebserver.gui.service.page.PageService;
import ch.ethz.seb.sebserver.gui.service.page.PageService.PageActionBuilder;
import ch.ethz.seb.sebserver.gui.service.page.TemplateComposer;
@ -98,6 +99,8 @@ public class ExamForm implements TemplateComposer {
private static final LocTextKey FORM_LMSSETUP_TEXT_KEY =
new LocTextKey("sebserver.exam.form.lmssetup");
private final static LocTextKey CONFIG_ACTION_NO_CONFIG_MESSAGE =
new LocTextKey("sebserver.exam.configuration.action.noconfig.message");
private final static LocTextKey CONFIG_LIST_TITLE_KEY =
new LocTextKey("sebserver.exam.configuration.list.title");
private final static LocTextKey CONFIG_NAME_COLUMN_KEY =
@ -324,10 +327,20 @@ public class ExamForm implements TemplateComposer {
EntityType.CONFIGURATION_NODE)
: null;
final boolean noConfigsAvailable = this.resourceService
.examConfigurationSelectionResources()
.isEmpty();
actionBuilder
.newAction(ActionDefinition.EXAM_CONFIGURATION_NEW)
.withParentEntityKey(entityKey)
.withExec(action -> {
if (noConfigsAvailable) {
throw new PageMessageException(CONFIG_ACTION_NO_CONFIG_MESSAGE);
}
return action;
})
.publishIf(() -> modifyGrant && editable && !configurationTable.hasAnyContent())
.newAction(ActionDefinition.EXAM_CONFIGURATION_EXAM_CONFIG_VIEW_PROP)

View file

@ -129,6 +129,7 @@ public class ExamSebConfigMapForm implements TemplateComposer {
.putStaticValue(
Domain.EXAM_CONFIGURATION_MAP.ATTR_EXAM_ID,
String.valueOf(examConfigurationMap.examId))
.addField(FormBuilder.singleSelection(
Domain.EXAM_CONFIGURATION_MAP.ATTR_CONFIGURATION_NODE_ID,
CONFIG_MAPPING_NAME_TEXT_KEY,

View file

@ -318,6 +318,7 @@ sebserver.exam.configuration.list.column.description=Description
sebserver.exam.configuration.list.column.status=Status
sebserver.exam.configuration.list.empty=There is currently no SEB Configuration defined for this Exam. Please add one
sebserver.exam.configuration.list.pleaseSelect=Please Select a SEB Configuration first
sebserver.exam.configuration.action.noconfig.message=There is currently no SEB exam configuration to select.<br/>Please create one in SEB Configuration / Exam Configuration
sebserver.exam.configuration.action.list.new=Add
sebserver.exam.configuration.action.list.modify=Edit