diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamDeletePopup.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamDeletePopup.java index 5ec0af5d..c039a91d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamDeletePopup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamDeletePopup.java @@ -16,6 +16,7 @@ import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Collectors; +import org.apache.commons.text.StringEscapeUtils; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; @@ -161,7 +162,7 @@ public class ExamDeletePopup { new ActionEvent(action), action.pageContext()); - final String examName = examToDelete.toName().name; + final String examName = StringEscapeUtils.escapeXml11(examToDelete.toName().name); final List dependencies = report.results.stream() .filter(key -> !key.equals(entityKey)) .collect(Collectors.toList()); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java index cda5b7c5..81fc88cf 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java @@ -242,7 +242,8 @@ public class ExamForm implements TemplateComposer { .getOr(false); final boolean sebRestrictionMismatch = readonly && sebRestrictionAvailable && - isRestricted != exam.sebRestriction; + isRestricted != exam.sebRestriction && + exam.status == ExamStatus.RUNNING; // check exam consistency and inform the user if needed Collection warnings = null; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java index 23972795..67579f65 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamTemplateForm.java @@ -386,7 +386,7 @@ public class ExamTemplateForm implements TemplateComposer { .newAction(ActionDefinition.CLIENT_GROUP_TEMPLATE_MODIFY_FROM_LIST) .withParentEntityKey(entityKey) .withSelect( - indicatorTable::getMultiSelection, + clientGroupTable::getMultiSelection, PageAction::applySingleSelectionAsEntityKey, CLIENT_GROUP_EMPTY_SELECTION_TEXT_KEY) .publishIf(() -> userGrantCheck.m() && clientGroupTable.hasAnyContent(), false) @@ -394,7 +394,7 @@ public class ExamTemplateForm implements TemplateComposer { .newAction(ActionDefinition.CLIENT_GROUP_TEMPLATE_DELETE_FROM_LIST) .withEntityKey(entityKey) .withSelect( - indicatorTable::getMultiSelection, + clientGroupTable::getMultiSelection, this::deleteSelectedClientGroup, CLIENT_GROUP_EMPTY_SELECTION_TEXT_KEY) .publishIf(() -> userGrantCheck.m() && clientGroupTable.hasAnyContent(), false) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/QuizLookupList.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/QuizLookupList.java index c95b2c99..4ba77093 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/QuizLookupList.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/QuizLookupList.java @@ -59,6 +59,7 @@ import ch.ethz.seb.sebserver.gui.table.ColumnDefinition.TableFilterAttribute; import ch.ethz.seb.sebserver.gui.table.EntityTable; import ch.ethz.seb.sebserver.gui.table.TableFilter.CriteriaType; import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; +import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.ImageIcon; @Lazy @Component @@ -109,6 +110,8 @@ public class QuizLookupList implements TemplateComposer { new LocTextKey("sebserver.quizdiscovery.quiz.import.existing"); private final static LocTextKey TEXT_FETCH_NOTE = new LocTextKey("sebserver.quizdiscovery.list.fetchnote"); + private final static LocTextKey TEXT_FETCH_NOTE_TOOLTIP = + new LocTextKey("sebserver.quizdiscovery.list.fetchnote.tooltip"); private final static String TEXT_KEY_ADDITIONAL_ATTR_PREFIX = "sebserver.quizdiscovery.quiz.details.additional."; @@ -448,7 +451,7 @@ public class QuizLookupList implements TemplateComposer { } } - private boolean showingFetchNote = false; + private Composite warningPanel = null; private void handelPageReload( final Composite notePanel, @@ -456,29 +459,28 @@ public class QuizLookupList implements TemplateComposer { if (table.isComplete()) { PageService.clearComposite(notePanel); - this.showingFetchNote = false; - } else { - if (!this.showingFetchNote) { - final Composite warningPanel = this.widgetFactory.createWarningPanel(notePanel, 15, true); - GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, true); - gridData.heightHint = 28; - gridData.widthHint = 25; - gridData.verticalIndent = 5; - final Label action = new Label(warningPanel, SWT.NONE); - action.setImage(WidgetFactory.ImageIcon.SWITCH.getImage(notePanel.getDisplay())); - action.setLayoutData(gridData); - action.addListener(SWT.MouseDown, event -> { - table.applyFilter(); - }); - - final Label text = new Label(warningPanel, SWT.NONE); - text.setData(RWT.MARKUP_ENABLED, Boolean.TRUE); - text.setText(this.pageService.getI18nSupport().getText(TEXT_FETCH_NOTE)); - gridData = new GridData(SWT.LEFT, SWT.FILL, true, true); - gridData.heightHint = 16; - text.setLayoutData(gridData); - this.showingFetchNote = true; + if (this.warningPanel != null) { + this.warningPanel.dispose(); } + this.warningPanel = null; + } else { + if (this.warningPanel != null && !this.warningPanel.isDisposed()) { + this.warningPanel.dispose(); + } + + this.warningPanel = this.widgetFactory.createWarningPanel(notePanel, 15, true); + this.widgetFactory.imageButton( + ImageIcon.SWITCH, + this.warningPanel, + TEXT_FETCH_NOTE_TOOLTIP, + event -> table.applyFilter()); + + final Label text = new Label(this.warningPanel, SWT.NONE); + text.setData(RWT.MARKUP_ENABLED, Boolean.TRUE); + text.setText(this.pageService.getI18nSupport().getText(TEXT_FETCH_NOTE)); + final GridData gridData = new GridData(SWT.LEFT, SWT.FILL, true, true); + gridData.heightHint = 28; + text.setLayoutData(gridData); } notePanel.getParent().layout(true, true); }