some fixed in GUI from 1.5.1

This commit is contained in:
anhefti 2023-06-15 11:09:33 +02:00
parent 7dd72f27c9
commit 6281634a46
4 changed files with 31 additions and 27 deletions

View file

@ -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<EntityKey> dependencies = report.results.stream()
.filter(key -> !key.equals(entityKey))
.collect(Collectors.toList());

View file

@ -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<APIMessage> warnings = null;

View file

@ -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)

View file

@ -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);
}