Merge remote-tracking branch 'origin/master' into development

Conflicts:
	pom.xml
This commit is contained in:
anhefti 2020-12-07 16:35:57 +01:00
commit a502699774
6 changed files with 36 additions and 8 deletions

View file

@ -22,7 +22,6 @@ public class StaticApplicationPropertyResolver implements ApplicationContextAwar
private static ApplicationContext CONTEXT;
public StaticApplicationPropertyResolver() {
// TODO Auto-generated constructor stub
}
@Override

View file

@ -198,7 +198,7 @@ public class LmsSetupForm implements TemplateComposer {
.addField(FormBuilder.singleSelection(
Domain.LMS_SETUP.ATTR_LMS_TYPE,
FORM_TYPE_TEXT_KEY,
(lmsType != null) ? lmsType.name() : LmsType.MOCKUP.name(),
getLmsTypeDefaultSelection(lmsType),
this.resourceService::lmsTypeResources)
.readonlyIf(isNotNew)
.mandatory(!readonly))
@ -350,6 +350,18 @@ public class LmsSetupForm implements TemplateComposer {
.publishIf(() -> !readonly);
}
private String getLmsTypeDefaultSelection(final LmsType lmsType) {
if (lmsType != null) {
return lmsType.name();
}
try {
return this.resourceService.lmsTypeResources().get(0)._1;
} catch (final Exception e) {
return null;
}
}
/** Save and test connection before activation */
public static PageAction activate(
final PageAction action,

View file

@ -131,18 +131,30 @@ public class ResourceService {
private final I18nSupport i18nSupport;
private final RestService restService;
private final CurrentUser currentUser;
private final boolean mock_lms_enabled;
private final EnumSet<LmsType> enabledLmsTypes;
protected ResourceService(
final I18nSupport i18nSupport,
final RestService restService,
final CurrentUser currentUser,
@Value("${sebserver.gui.webservice.mock-lms-enabled:true}") final boolean mock_lms_enabled) {
@Value("${sebserver.gui.webservice.mock-lms-enabled:true}") final boolean mock_lms_enabled,
@Value("${sebserver.gui.webservice.edx-lms-enabled:true}") final boolean edx_lms_enabled,
@Value("${sebserver.gui.webservice.moodle-lms-enabled:true}") final boolean moodle_lms_enabled) {
this.i18nSupport = i18nSupport;
this.restService = restService;
this.currentUser = currentUser;
this.mock_lms_enabled = mock_lms_enabled;
this.enabledLmsTypes = EnumSet.noneOf(LmsType.class);
if (mock_lms_enabled) {
this.enabledLmsTypes.add(LmsType.MOCKUP);
}
if (edx_lms_enabled) {
this.enabledLmsTypes.add(LmsType.OPEN_EDX);
}
if (moodle_lms_enabled) {
this.enabledLmsTypes.add(LmsType.MOODLE);
}
}
public I18nSupport getI18nSupport() {
@ -172,7 +184,7 @@ public class ResourceService {
public List<Tuple<String>> lmsTypeResources() {
return Arrays.stream(LmsType.values())
.filter(lmsType -> lmsType != LmsType.MOCKUP || this.mock_lms_enabled)
.filter(this.enabledLmsTypes::contains)
.map(lmsType -> new Tuple<>(
lmsType.name(),
this.i18nSupport.getText(LMSSETUP_TYPE_PREFIX + lmsType.name(), lmsType.name())))

View file

@ -44,7 +44,7 @@ public abstract class CourseAccess {
this.allQuizzesRequest = asyncService.createMemoizingCircuitBreaker(
allQuizzesSupplier(),
3,
Constants.SECOND_IN_MILLIS * 10,
Constants.MINUTE_IN_MILLIS,
Constants.MINUTE_IN_MILLIS,
true,
Constants.HOUR_IN_MILLIS);

View file

@ -9,7 +9,10 @@ sebserver.gui.webservice.port=8080
sebserver.gui.webservice.apipath=/admin-api/v1
# defines the polling interval that is used to poll the webservice for client connection data on a monitored exam page
sebserver.gui.webservice.poll-interval=1000
sebserver.gui.webservice.mock-lms-enabled=true
sebserver.gui.webservice.mock-lms-enabled=false
sebserver.gui.webservice.edx-lms-enabled=true
sebserver.gui.webservice.moodle-lms-enabled=false
sebserver.gui.theme=css/sebserver.css

View file

@ -24,6 +24,8 @@ sebserver.gui.webservice.apipath=${sebserver.webservice.api.admin.endpoint}
# defines the polling interval that is used to poll the webservice for client connection data on a monitored exam page
sebserver.gui.webservice.poll-interval=1000
sebserver.gui.webservice.mock-lms-enabled=true
sebserver.gui.webservice.edx-lms-enabled=true
sebserver.gui.webservice.moodle-lms-enabled=true
sebserver.gui.seb.client.config.download.filename=SEBServerSettings.seb
sebserver.gui.seb.exam.config.download.filename=SEBExamSettings.seb