SEBSERV-511 removed also from Monitoring and form Exam Config

This commit is contained in:
anhefti 2024-03-13 16:28:10 +01:00
parent a905ed63c3
commit dc8a21daaf
10 changed files with 35 additions and 14 deletions

View file

@ -22,6 +22,7 @@ import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import ch.ethz.seb.sebserver.gbl.model.exam.AllowedSEBVersion; import ch.ethz.seb.sebserver.gbl.model.exam.AllowedSEBVersion;
import ch.ethz.seb.sebserver.gbl.model.user.UserFeatures;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.text.StringEscapeUtils; import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
@ -289,11 +290,14 @@ public class MonitoringRunningExam implements TemplateComposer {
exam.checkASK, exam.checkASK,
exam.allowedSEBVersions)); exam.allowedSEBVersions));
final ProctoringServiceSettings proctoringSettings = new ProctoringServiceSettings(exam); final ProctoringServiceSettings proctoringSettings = new ProctoringServiceSettings(exam);
final ScreenProctoringSettings screenProctoringSettings = new ScreenProctoringSettings(exam);
guiUpdates.add(createProctoringActions( guiUpdates.add(createProctoringActions(
proctoringSettings, proctoringSettings,
screenProctoringSettings, currentUser.isFeatureEnabled(EXAM_SCREEN_PROCTORING)
? new ScreenProctoringSettings(exam)
: null,
currentUser.getProctoringGUIService(), currentUser.getProctoringGUIService(),
pageContext, pageContext,
content)); content));

View file

@ -15,6 +15,7 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import ch.ethz.seb.sebserver.gbl.model.user.UserFeatures;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@ -276,6 +277,16 @@ interface CellFieldBuilderAdapter {
for (final Map.Entry<String, Collection<Orientation>> entry : this.orientationsOfExpandBar.entrySet()) { for (final Map.Entry<String, Collection<Orientation>> entry : this.orientationsOfExpandBar.entrySet()) {
final String expandItemKey = ViewGridBuilder.getExpandItemKey(entry.getKey()); final String expandItemKey = ViewGridBuilder.getExpandItemKey(entry.getKey());
if (expandItemKey.equals("ScreenProctoring") &&
!builder.viewContext.pageService.getCurrentUser().isFeatureEnabled(UserFeatures.Feature.EXAM_SCREEN_PROCTORING)) {
continue;
}
if ((expandItemKey.equals("Zoom") || expandItemKey.equals("jitsi")) &&
!builder.viewContext.pageService.getCurrentUser().isFeatureEnabled(UserFeatures.Feature.EXAM_LIVE_PROCTORING)) {
continue;
}
final Collection<Orientation> value = entry.getValue(); final Collection<Orientation> value = entry.getValue();
final LocTextKey labelKey = new LocTextKey( final LocTextKey labelKey = new LocTextKey(
ExamConfigurationService.GROUP_LABEL_LOC_TEXT_PREFIX + expandItemKey, ExamConfigurationService.GROUP_LABEL_LOC_TEXT_PREFIX + expandItemKey,

View file

@ -199,7 +199,7 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService {
this.jsonMapper, this.jsonMapper,
this.valueChangeRules, this.valueChangeRules,
valueChangeCallback), valueChangeCallback),
this.widgetFactory.getI18nSupport(), pageContext.getPageService(),
readonly, readonly,
isTemplate); isTemplate);

View file

@ -88,7 +88,7 @@ public class PasswordFieldBuilder implements InputFieldBuilder {
final LocTextKey confirmNameLocKey = final LocTextKey confirmNameLocKey =
new LocTextKey( new LocTextKey(
SEBSERVER_FORM_CONFIRM_LABEL, SEBSERVER_FORM_CONFIRM_LABEL,
viewContext.i18nSupport.getText(attributeNameLocKey)); viewContext.getI18nSupport().getText(attributeNameLocKey));
final PasswordInput confirmInput = new PasswordInput( final PasswordInput confirmInput = new PasswordInput(
innerGrid, innerGrid,
this.widgetFactory, this.widgetFactory,

View file

@ -61,7 +61,7 @@ public abstract class SelectionFieldBuilder {
final String key = prefix + value + ((toolTipResources) final String key = prefix + value + ((toolTipResources)
? ExamConfigurationService.TOOL_TIP_SUFFIX ? ExamConfigurationService.TOOL_TIP_SUFFIX
: ""); : "");
final String text = viewContext.i18nSupport.getText(key, ""); final String text = viewContext.getI18nSupport().getText(key, "");
return new Tuple<>(value, (StringUtils.isBlank(text)) return new Tuple<>(value, (StringUtils.isBlank(text))
? (toolTipResources) ? (toolTipResources)
? text ? text

View file

@ -67,7 +67,7 @@ public class TableContext {
} }
public I18nSupport i18nSupport() { public I18nSupport i18nSupport() {
return this.viewContext.i18nSupport; return this.viewContext.getI18nSupport();
} }
public InputFieldBuilderSupplier getInputFieldBuilderSupplier() { public InputFieldBuilderSupplier getInputFieldBuilderSupplier() {

View file

@ -97,7 +97,7 @@ public class TableFieldBuilder extends AbstractTableFieldBuilder {
if (!viewContext.readonly) { if (!viewContext.readonly) {
TableColumn column = new TableColumn(table, SWT.NONE); TableColumn column = new TableColumn(table, SWT.NONE);
column.setImage(ImageIcon.ADD_BOX_WHITE.getImage(parent.getDisplay())); column.setImage(ImageIcon.ADD_BOX_WHITE.getImage(parent.getDisplay()));
column.setToolTipText(Utils.formatLineBreaks(viewContext.i18nSupport.getText( column.setToolTipText(Utils.formatLineBreaks(viewContext.getI18nSupport().getText(
ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX +
attribute.name + attribute.name +
ADD_TOOLTIP_SUFFIX, ADD_TOOLTIP_SUFFIX,
@ -110,7 +110,7 @@ public class TableFieldBuilder extends AbstractTableFieldBuilder {
column = new TableColumn(table, SWT.NONE); column = new TableColumn(table, SWT.NONE);
column.setImage(ImageIcon.REMOVE_BOX_WHITE.getImage(parent.getDisplay())); column.setImage(ImageIcon.REMOVE_BOX_WHITE.getImage(parent.getDisplay()));
column.setToolTipText(Utils.formatLineBreaks(viewContext.i18nSupport.getText( column.setToolTipText(Utils.formatLineBreaks(viewContext.getI18nSupport().getText(
ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX +
attribute.name + attribute.name +
REMOVE_TOOLTIP_SUFFIX, REMOVE_TOOLTIP_SUFFIX,
@ -232,7 +232,7 @@ public class TableFieldBuilder extends AbstractTableFieldBuilder {
.open( .open(
ExamConfigurationService.getTablePopupTitleKey( ExamConfigurationService.getTablePopupTitleKey(
this.attribute, this.attribute,
this.tableContext.getViewContext().i18nSupport), this.tableContext.getViewContext().getI18nSupport()),
(Consumer<Map<Long, TableValue>>) _rowValues -> applyFormValues( (Consumer<Map<Long, TableValue>>) _rowValues -> applyFormValues(
this.values, this.values,
_rowValues, _rowValues,

View file

@ -17,6 +17,7 @@ import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import ch.ethz.seb.sebserver.gui.service.page.PageService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -46,7 +47,7 @@ public final class ViewContext {
final AttributeMapping attributeMapping; final AttributeMapping attributeMapping;
final Map<Long, InputField> inputFieldMapping; final Map<Long, InputField> inputFieldMapping;
final ValueChangeListener valueChangeListener; final ValueChangeListener valueChangeListener;
final I18nSupport i18nSupport; final PageService pageService;
final boolean readonly; final boolean readonly;
final boolean isTemplate; final boolean isTemplate;
@ -57,7 +58,7 @@ public final class ViewContext {
final int rows, final int rows,
final AttributeMapping attributeContext, final AttributeMapping attributeContext,
final ValueChangeListener valueChangeListener, final ValueChangeListener valueChangeListener,
final I18nSupport i18nSupport, final PageService pageService,
final boolean readonly, final boolean readonly,
final boolean isTemplate) { final boolean isTemplate) {
@ -74,7 +75,7 @@ public final class ViewContext {
this.attributeMapping = attributeContext; this.attributeMapping = attributeContext;
this.inputFieldMapping = new HashMap<>(); this.inputFieldMapping = new HashMap<>();
this.valueChangeListener = valueChangeListener; this.valueChangeListener = valueChangeListener;
this.i18nSupport = i18nSupport; this.pageService = pageService;
this.readonly = readonly; this.readonly = readonly;
this.isTemplate = isTemplate; this.isTemplate = isTemplate;
} }
@ -84,7 +85,7 @@ public final class ViewContext {
} }
public I18nSupport getI18nSupport() { public I18nSupport getI18nSupport() {
return this.i18nSupport; return this.pageService.getI18nSupport();
} }
public Long getId() { public Long getId() {

View file

@ -63,6 +63,8 @@ public interface PageContext {
LocTextKey UNEXPECTED_ERROR_KEY = LocTextKey UNEXPECTED_ERROR_KEY =
new LocTextKey("sebserver.error.action.unexpected.message"); new LocTextKey("sebserver.error.action.unexpected.message");
PageService getPageService();
/** Get the I18nSupport service /** Get the I18nSupport service
* *
* @return the I18nSupport service */ * @return the I18nSupport service */

View file

@ -22,7 +22,6 @@ import java.util.stream.Collectors;
import ch.ethz.seb.sebserver.gui.service.page.*; import ch.ethz.seb.sebserver.gui.service.page.*;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.widgets.DialogCallback; import org.eclipse.rap.rwt.widgets.DialogCallback;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*; import org.eclipse.swt.widgets.*;
@ -68,6 +67,10 @@ public class PageContextImpl implements PageContext {
this.attributes = Utils.immutableMapOf(attributes); this.attributes = Utils.immutableMapOf(attributes);
} }
public PageService getPageService() {
return pageService;
}
@Override @Override
public I18nSupport getI18nSupport() { public I18nSupport getI18nSupport() {
return this.i18nSupport; return this.i18nSupport;