SEBSERV-298
This commit is contained in:
parent
a761ade1aa
commit
57657feffd
7 changed files with 51 additions and 1 deletions
|
@ -61,6 +61,7 @@ public final class Exam implements GrantEntity {
|
||||||
public static final String FILTER_ATTR_TYPE = "type";
|
public static final String FILTER_ATTR_TYPE = "type";
|
||||||
public static final String FILTER_ATTR_STATUS = "status";
|
public static final String FILTER_ATTR_STATUS = "status";
|
||||||
public static final String FILTER_CACHED_QUIZZES = "cached-quizzes";
|
public static final String FILTER_CACHED_QUIZZES = "cached-quizzes";
|
||||||
|
public static final String FILTER_ATTR_HIDE_MISSING = "show-missing";
|
||||||
|
|
||||||
public static final String ATTR_ADDITIONAL_ATTRIBUTES = "additionalAttributes";
|
public static final String ATTR_ADDITIONAL_ATTRIBUTES = "additionalAttributes";
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,17 @@ public enum ActionDefinition {
|
||||||
PageStateDefinitionImpl.EXAM_VIEW,
|
PageStateDefinitionImpl.EXAM_VIEW,
|
||||||
ActionCategory.FORM),
|
ActionCategory.FORM),
|
||||||
|
|
||||||
|
EXAM_LIST_HIDE_MISSING(
|
||||||
|
new LocTextKey("sebserver.exam.action.list.hide.missing"),
|
||||||
|
ImageIcon.TOGGLE_OFF,
|
||||||
|
PageStateDefinitionImpl.EXAM_LIST,
|
||||||
|
ActionCategory.EXAM_LIST),
|
||||||
|
EXAM_LIST_SHOW_MISSING(
|
||||||
|
new LocTextKey("sebserver.exam.action.list.show.missing"),
|
||||||
|
ImageIcon.TOGGLE_ON,
|
||||||
|
PageStateDefinitionImpl.EXAM_LIST,
|
||||||
|
ActionCategory.EXAM_LIST),
|
||||||
|
|
||||||
EXAM_MODIFY_SEB_RESTRICTION_DETAILS(
|
EXAM_MODIFY_SEB_RESTRICTION_DETAILS(
|
||||||
new LocTextKey("sebserver.exam.action.sebrestriction.details"),
|
new LocTextKey("sebserver.exam.action.sebrestriction.details"),
|
||||||
ImageIcon.RESTRICTION,
|
ImageIcon.RESTRICTION,
|
||||||
|
@ -956,6 +967,7 @@ public enum ActionDefinition {
|
||||||
ImageIcon.TOGGLE_ON,
|
ImageIcon.TOGGLE_ON,
|
||||||
PageStateDefinitionImpl.MONITORING_RUNNING_EXAM,
|
PageStateDefinitionImpl.MONITORING_RUNNING_EXAM,
|
||||||
ActionCategory.STATE_FILTER),
|
ActionCategory.STATE_FILTER),
|
||||||
|
|
||||||
MONITOR_EXAM_HIDE_CLOSED_CONNECTION(
|
MONITOR_EXAM_HIDE_CLOSED_CONNECTION(
|
||||||
new LocTextKey("sebserver.monitoring.exam.connection.action.hide.closed"),
|
new LocTextKey("sebserver.monitoring.exam.connection.action.hide.closed"),
|
||||||
ImageIcon.TOGGLE_OFF,
|
ImageIcon.TOGGLE_OFF,
|
||||||
|
|
|
@ -243,6 +243,29 @@ public class ExamList implements TemplateComposer {
|
||||||
EMPTY_SELECTION_TEXT_KEY)
|
EMPTY_SELECTION_TEXT_KEY)
|
||||||
.publishIf(() -> userGrant.im(), false);
|
.publishIf(() -> userGrant.im(), false);
|
||||||
|
|
||||||
|
actionBuilder
|
||||||
|
.newAction(ActionDefinition.EXAM_LIST_HIDE_MISSING)
|
||||||
|
.withExec(action -> hideMissingExams(action, table))
|
||||||
|
.noEventPropagation()
|
||||||
|
.withSwitchAction(
|
||||||
|
actionBuilder.newAction(ActionDefinition.EXAM_LIST_SHOW_MISSING)
|
||||||
|
.withExec(action -> showMissingExams(action, table))
|
||||||
|
.noEventPropagation()
|
||||||
|
.create())
|
||||||
|
.publish();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private PageAction showMissingExams(final PageAction action, final EntityTable<Exam> table) {
|
||||||
|
table.setStaticFilter(Exam.FILTER_ATTR_HIDE_MISSING, Constants.FALSE_STRING);
|
||||||
|
table.applyFilter();
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PageAction hideMissingExams(final PageAction action, final EntityTable<Exam> table) {
|
||||||
|
table.setStaticFilter(Exam.FILTER_ATTR_HIDE_MISSING, Constants.TRUE_STRING);
|
||||||
|
table.applyFilter();
|
||||||
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PageAction modifyExam(final PageAction action, final EntityTable<Exam> table) {
|
static PageAction modifyExam(final PageAction action, final EntityTable<Exam> table) {
|
||||||
|
|
|
@ -254,6 +254,10 @@ public class EntityTable<ROW extends ModelIdAware> {
|
||||||
return this.sortOrder;
|
return this.sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStaticFilter(final String name, final String value) {
|
||||||
|
this.staticQueryParams.set(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
public EntityType getEntityType() {
|
public EntityType getEntityType() {
|
||||||
if (this.pageSupplier != null) {
|
if (this.pageSupplier != null) {
|
||||||
return this.pageSupplier.getEntityType();
|
return this.pageSupplier.getEntityType();
|
||||||
|
|
|
@ -183,6 +183,13 @@ public class ExamRecordDAO {
|
||||||
ExamRecordDynamicSqlSupport.type,
|
ExamRecordDynamicSqlSupport.type,
|
||||||
isEqualToWhenPresent(filterMap.getExamType()));
|
isEqualToWhenPresent(filterMap.getExamType()));
|
||||||
|
|
||||||
|
// SEBSERV-298
|
||||||
|
if (filterMap.getBoolean(Exam.FILTER_ATTR_HIDE_MISSING)) {
|
||||||
|
whereClause = whereClause.and(
|
||||||
|
ExamRecordDynamicSqlSupport.lmsAvailable,
|
||||||
|
SqlBuilder.isGreaterThan(0));
|
||||||
|
}
|
||||||
|
|
||||||
final String examStatus = filterMap.getExamStatus();
|
final String examStatus = filterMap.getExamStatus();
|
||||||
if (StringUtils.isNotBlank(examStatus)) {
|
if (StringUtils.isNotBlank(examStatus)) {
|
||||||
whereClause = whereClause
|
whereClause = whereClause
|
||||||
|
|
|
@ -265,7 +265,8 @@ public class ExamSessionServiceImpl implements ExamSessionService {
|
||||||
|
|
||||||
filterMap
|
filterMap
|
||||||
.putIfAbsent(Exam.FILTER_ATTR_ACTIVE, Constants.TRUE_STRING)
|
.putIfAbsent(Exam.FILTER_ATTR_ACTIVE, Constants.TRUE_STRING)
|
||||||
.putIfAbsent(Exam.FILTER_ATTR_STATUS, ExamStatus.RUNNING.name());
|
.putIfAbsent(Exam.FILTER_ATTR_STATUS, ExamStatus.RUNNING.name())
|
||||||
|
.putIfAbsent(Exam.FILTER_ATTR_HIDE_MISSING, Constants.TRUE_STRING);
|
||||||
|
|
||||||
return this.examDAO.allMatching(filterMap, predicate)
|
return this.examDAO.allMatching(filterMap, predicate)
|
||||||
.map(col -> col.stream()
|
.map(col -> col.stream()
|
||||||
|
|
|
@ -528,6 +528,8 @@ sebserver.exam.autogen.error.config.text=There was an unexpected error while set
|
||||||
sebserver.exam.action.list=Exam
|
sebserver.exam.action.list=Exam
|
||||||
sebserver.exam.action.list.view=View Exam
|
sebserver.exam.action.list.view=View Exam
|
||||||
sebserver.exam.action.list.modify=Edit Exam
|
sebserver.exam.action.list.modify=Edit Exam
|
||||||
|
sebserver.exam.action.list.hide.missing=Hide Missing Exams
|
||||||
|
sebserver.exam.action.list.show.missing=Show Missing Exams
|
||||||
sebserver.exam.action.modify=Edit Exam
|
sebserver.exam.action.modify=Edit Exam
|
||||||
sebserver.exam.action.import=Import From Quizzes
|
sebserver.exam.action.import=Import From Quizzes
|
||||||
sebserver.exam.action.save=Save Exam
|
sebserver.exam.action.save=Save Exam
|
||||||
|
|
Loading…
Reference in a new issue