merge config keys with attached config history, minor GUI bug
This commit is contained in:
parent
63f8358107
commit
a8082471bc
9 changed files with 28 additions and 20 deletions
BIN
docs/images/lookup/details.png
Normal file
BIN
docs/images/lookup/details.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
BIN
docs/images/lookup/import_exam.png
Normal file
BIN
docs/images/lookup/import_exam.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
BIN
docs/images/lookup/list.png
Normal file
BIN
docs/images/lookup/list.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
|
@ -117,9 +117,6 @@ public final class Exam implements GrantEntity {
|
|||
@JsonProperty(EXAM.ATTR_STATUS)
|
||||
public final ExamStatus status;
|
||||
|
||||
// @JsonProperty(EXAM.ATTR_LMS_SEB_RESTRICTION)
|
||||
// public final Boolean lmsSebRestriction;
|
||||
|
||||
@JsonProperty(EXAM.ATTR_BROWSER_KEYS)
|
||||
public final String browserExamKeys;
|
||||
|
||||
|
@ -145,7 +142,6 @@ public final class Exam implements GrantEntity {
|
|||
@JsonProperty(EXAM.ATTR_OWNER) final String owner,
|
||||
@JsonProperty(EXAM.ATTR_SUPPORTER) final Collection<String> supporter,
|
||||
@JsonProperty(EXAM.ATTR_STATUS) final ExamStatus status,
|
||||
// @JsonProperty(EXAM.ATTR_LMS_SEB_RESTRICTION) final Boolean lmsSebRestriction,
|
||||
@JsonProperty(EXAM.ATTR_BROWSER_KEYS) final String browserExamKeys,
|
||||
@JsonProperty(EXAM.ATTR_ACTIVE) final Boolean active,
|
||||
@JsonProperty(EXAM.ATTR_LASTUPDATE) final String lastUpdate) {
|
||||
|
@ -163,7 +159,6 @@ public final class Exam implements GrantEntity {
|
|||
this.quitPassword = quitPassword;
|
||||
this.owner = owner;
|
||||
this.status = (status != null) ? status : getStatusFromDate(startTime, endTime);
|
||||
// this.lmsSebRestriction = (lmsSebRestriction != null) ? lmsSebRestriction : Boolean.FALSE;
|
||||
this.browserExamKeys = browserExamKeys;
|
||||
this.active = (active != null) ? active : Boolean.TRUE;
|
||||
this.lastUpdate = lastUpdate;
|
||||
|
@ -216,7 +211,6 @@ public final class Exam implements GrantEntity {
|
|||
this.quitPassword = null;
|
||||
this.owner = null;
|
||||
this.status = (status != null) ? status : getStatusFromDate(this.startTime, this.endTime);
|
||||
// this.lmsSebRestriction = null;
|
||||
this.browserExamKeys = null;
|
||||
this.active = null;
|
||||
this.supporter = null;
|
||||
|
@ -314,10 +308,6 @@ public final class Exam implements GrantEntity {
|
|||
return this.status;
|
||||
}
|
||||
|
||||
// public Boolean getLmsSebRestriction() {
|
||||
// return this.lmsSebRestriction;
|
||||
// }
|
||||
|
||||
public String getBrowserExamKeys() {
|
||||
return this.browserExamKeys;
|
||||
}
|
||||
|
@ -357,8 +347,6 @@ public final class Exam implements GrantEntity {
|
|||
builder.append(this.supporter);
|
||||
builder.append(", status=");
|
||||
builder.append(this.status);
|
||||
// builder.append(", lmsSebRestriction=");
|
||||
// builder.append(this.lmsSebRestriction);
|
||||
builder.append(", browserExamKeys=");
|
||||
builder.append(this.browserExamKeys);
|
||||
builder.append(", active=");
|
||||
|
|
|
@ -10,6 +10,7 @@ package ch.ethz.seb.sebserver.gui.service.examconfig.impl;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rap.rwt.RWT;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
|
@ -83,6 +84,7 @@ interface CellFieldBuilderAdapter {
|
|||
builder.parent,
|
||||
new LocTextKey(ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name,
|
||||
attribute.name));
|
||||
label.setData(RWT.MARKUP_ENABLED, true);
|
||||
|
||||
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
|
||||
switch (orientation.title) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
package ch.ethz.seb.sebserver.gui.service.examconfig.impl;
|
||||
|
||||
import org.eclipse.rap.rwt.RWT;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
@ -54,6 +55,7 @@ public class LabelBuilder implements InputFieldBuilder {
|
|||
final Label label = this.widgetFactory.labelLocalized(
|
||||
parent,
|
||||
ExamConfigurationService.attributeNameLocKey(attribute));
|
||||
label.setData(RWT.MARKUP_ENABLED, true);
|
||||
|
||||
return new LabelField(
|
||||
attribute,
|
||||
|
|
|
@ -114,9 +114,9 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService {
|
|||
public void injectI18n(final Button button, final LocTextKey locTextKey, final LocTextKey locToolTipKey) {
|
||||
final Consumer<Button> buttonFunction = b -> {
|
||||
if (locTextKey != null) {
|
||||
b.setText(this.i18nSupport.getText(locTextKey));
|
||||
b.setText(Utils.formatLineBreaks(this.i18nSupport.getText(locTextKey)));
|
||||
}
|
||||
if (i18nSupport.hasText(locToolTipKey)) {
|
||||
if (this.i18nSupport.hasText(locToolTipKey)) {
|
||||
b.setToolTipText(Utils.formatLineBreaks(this.i18nSupport.getText(locToolTipKey)));
|
||||
}
|
||||
};
|
||||
|
@ -177,12 +177,13 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void injectI18nTooltip(Control control, LocTextKey locTooltipKey) {
|
||||
public void injectI18nTooltip(final Control control, final LocTextKey locTooltipKey) {
|
||||
if (locTooltipKey == null || control == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.i18nSupport.hasText(locTooltipKey) && StringUtils.isNotBlank(this.i18nSupport.getText(locTooltipKey, ""))) {
|
||||
if (this.i18nSupport.hasText(locTooltipKey)
|
||||
&& StringUtils.isNotBlank(this.i18nSupport.getText(locTooltipKey, ""))) {
|
||||
control.setData(POLYGLOT_ITEM_TOOLTIP_DATA_KEY, locTooltipKey);
|
||||
control.setToolTipText(Utils.formatLineBreaks(this.i18nSupport.getText(locTooltipKey)));
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ public interface SebRestrictionService {
|
|||
/** Used as name prefix to store additional SEB restriction properties within AdditionalAttribute domain. */
|
||||
String SEB_RESTRICTION_ADDITIONAL_PROPERTY_NAME_PREFIX = "sebRestrictionProp_";
|
||||
|
||||
String SEB_RESTRICTION_ADDITIONAL_PROPERTY_CONFIG_KEY = "config_key";
|
||||
|
||||
/** Get the SebRestriction properties for specified Exam.
|
||||
*
|
||||
* @param exam the Exam
|
||||
|
|
|
@ -11,8 +11,11 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -60,14 +63,24 @@ public class SebRestrictionServiceImpl implements SebRestrictionService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
@Transactional
|
||||
public Result<SebRestriction> getSebRestrictionFromExam(final Exam exam) {
|
||||
return Result.tryCatch(() -> {
|
||||
// generate the config keys from applied exam configurations
|
||||
final Collection<String> configKeys = this.examConfigService
|
||||
// load the config keys from restriction and merge with new generated config keys
|
||||
final Set<String> configKeys = new HashSet<>();
|
||||
final Collection<String> generatedKeys = this.examConfigService
|
||||
.generateConfigKeys(exam.institutionId, exam.id)
|
||||
.getOrThrow();
|
||||
|
||||
configKeys.addAll(generatedKeys);
|
||||
if (generatedKeys != null && !generatedKeys.isEmpty()) {
|
||||
configKeys.addAll(this.lmsAPIService
|
||||
.getLmsAPITemplate(exam.lmsSetupId)
|
||||
.flatMap(lmsTemplate -> lmsTemplate.getSebClientRestriction(exam))
|
||||
.map(r -> r.configKeys)
|
||||
.getOr(Collections.emptyList()));
|
||||
}
|
||||
|
||||
// get the browser exam keys from exam record
|
||||
final Collection<String> browserExamKeys = new ArrayList<>();
|
||||
final String browserExamKeysString = exam.getBrowserExamKeys();
|
||||
|
@ -137,7 +150,7 @@ public class SebRestrictionServiceImpl implements SebRestrictionService {
|
|||
.stream()
|
||||
.filter(attr -> attr.getName().startsWith(SEB_RESTRICTION_ADDITIONAL_PROPERTY_NAME_PREFIX))
|
||||
.forEach(attr -> this.additionalAttributesDAO.delete(attr.getId()));
|
||||
// create new once if needed
|
||||
// create new ones if needed
|
||||
sebRestriction.additionalProperties
|
||||
.entrySet()
|
||||
.stream()
|
||||
|
|
Loading…
Reference in a new issue