From 921595c3b07c038a3c6ccf518210131dd1c9d548 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 14 Jul 2022 13:05:05 +0200 Subject: [PATCH] added focus out for auto-filter on tex filter for lists --- .../seb/sebserver/gui/table/TableFilter.java | 3 +++ .../lms/impl/mockup/MockCourseAccessAPI.java | 20 +++++++++++++++++++ .../api/ExamAdministrationController.java | 12 ++++------- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java b/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java index 7d51dc1c..6a9646c5 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java @@ -338,6 +338,9 @@ public class TableFilter { TableFilter.this.entityTable.applyFilter(); } }); + this.textInput.addListener(SWT.FocusOut, event -> { + TableFilter.this.entityTable.applyFilter(); + }); return this; } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockCourseAccessAPI.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockCourseAccessAPI.java index 537f2ceb..a92c65a7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockCourseAccessAPI.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockCourseAccessAPI.java @@ -91,6 +91,26 @@ public class MockCourseAccessAPI implements CourseAccessAPI { .toString(Constants.DEFAULT_DATE_TIME_FORMAT), null, "http://lms.mockup.com/api/")); + + if (webserviceInfo.hasProfile("dev")) { + for (int i = 12; i < 50; i++) { + this.mockups.add(new QuizData( + "quiz10" + i, institutionId, lmsSetupId, lmsType, "Demo Quiz 10 " + i + " (MOCKUP)", + i + "_Starts in a minute and ends after five minutes", + DateTime.now(DateTimeZone.UTC).plus(Constants.MINUTE_IN_MILLIS) + .toString(Constants.DEFAULT_DATE_TIME_FORMAT), + DateTime.now(DateTimeZone.UTC).plus(6 * Constants.MINUTE_IN_MILLIS) + .toString(Constants.DEFAULT_DATE_TIME_FORMAT), + "http://lms.mockup.com/api/")); + this.mockups.add(new QuizData( + "quiz11" + i, institutionId, lmsSetupId, lmsType, "Demo Quiz 11 " + i + " (MOCKUP)", + i + "_Starts in a minute and ends never", + DateTime.now(DateTimeZone.UTC).plus(Constants.MINUTE_IN_MILLIS) + .toString(Constants.DEFAULT_DATE_TIME_FORMAT), + null, + "http://lms.mockup.com/api/")); + } + } } @Override diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java index 32bdfac6..e87b585b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java @@ -137,10 +137,11 @@ public class ExamAdministrationController extends EntityController { final HttpServletRequest request) { checkReadPrivilege(institutionId); + this.authorization.check( + PrivilegeType.READ, + EntityType.EXAM, + institutionId); - // NOTE: several attributes for sorting may be originated by the QuizData from LMS not by the database - // of the SEB Server. Therefore in the case we have no or the default sorting we can use the - // native PaginationService within MyBatis and SQL. For the other cases we need an in-line sorting and paging if (StringUtils.isBlank(sort) || (this.paginationService.isNativeSortingSupported(ExamRecordDynamicSqlSupport.examRecord, sort))) { @@ -148,11 +149,6 @@ public class ExamAdministrationController extends EntityController { } else { - this.authorization.check( - PrivilegeType.READ, - EntityType.EXAM, - institutionId); - final Collection exams = this.examDAO .allMatching(new FilterMap( allRequestParams,