diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java index 005d9615..d1f07f1f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/monitoring/MonitoringRunningExam.java @@ -22,6 +22,7 @@ import java.util.function.Consumer; import java.util.function.Function; 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.text.StringEscapeUtils; import org.eclipse.swt.SWT; @@ -289,11 +290,14 @@ public class MonitoringRunningExam implements TemplateComposer { exam.checkASK, exam.allowedSEBVersions)); + + final ProctoringServiceSettings proctoringSettings = new ProctoringServiceSettings(exam); - final ScreenProctoringSettings screenProctoringSettings = new ScreenProctoringSettings(exam); guiUpdates.add(createProctoringActions( proctoringSettings, - screenProctoringSettings, + currentUser.isFeatureEnabled(EXAM_SCREEN_PROCTORING) + ? new ScreenProctoringSettings(exam) + : null, currentUser.getProctoringGUIService(), pageContext, content)); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java index cdb1bcdc..2f08571b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java @@ -15,6 +15,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import ch.ethz.seb.sebserver.gbl.model.user.UserFeatures; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -276,6 +277,16 @@ interface CellFieldBuilderAdapter { for (final Map.Entry> entry : this.orientationsOfExpandBar.entrySet()) { 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 value = entry.getValue(); final LocTextKey labelKey = new LocTextKey( ExamConfigurationService.GROUP_LABEL_LOC_TEXT_PREFIX + expandItemKey, diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ExamConfigurationServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ExamConfigurationServiceImpl.java index 5875ee93..49354460 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ExamConfigurationServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ExamConfigurationServiceImpl.java @@ -199,7 +199,7 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService { this.jsonMapper, this.valueChangeRules, valueChangeCallback), - this.widgetFactory.getI18nSupport(), + pageContext.getPageService(), readonly, isTemplate); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/PasswordFieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/PasswordFieldBuilder.java index ddbc8af5..f7399f4f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/PasswordFieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/PasswordFieldBuilder.java @@ -88,7 +88,7 @@ public class PasswordFieldBuilder implements InputFieldBuilder { final LocTextKey confirmNameLocKey = new LocTextKey( SEBSERVER_FORM_CONFIRM_LABEL, - viewContext.i18nSupport.getText(attributeNameLocKey)); + viewContext.getI18nSupport().getText(attributeNameLocKey)); final PasswordInput confirmInput = new PasswordInput( innerGrid, this.widgetFactory, diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/SelectionFieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/SelectionFieldBuilder.java index 39fc3283..1c89fad6 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/SelectionFieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/SelectionFieldBuilder.java @@ -61,7 +61,7 @@ public abstract class SelectionFieldBuilder { final String key = prefix + value + ((toolTipResources) ? 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)) ? (toolTipResources) ? text diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TableContext.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TableContext.java index 2c54c9a2..81ab6d3a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TableContext.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TableContext.java @@ -67,7 +67,7 @@ public class TableContext { } public I18nSupport i18nSupport() { - return this.viewContext.i18nSupport; + return this.viewContext.getI18nSupport(); } public InputFieldBuilderSupplier getInputFieldBuilderSupplier() { diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TableFieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TableFieldBuilder.java index 4815ccac..bd124fa5 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TableFieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TableFieldBuilder.java @@ -97,7 +97,7 @@ public class TableFieldBuilder extends AbstractTableFieldBuilder { if (!viewContext.readonly) { TableColumn column = new TableColumn(table, SWT.NONE); 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 + attribute.name + ADD_TOOLTIP_SUFFIX, @@ -110,7 +110,7 @@ public class TableFieldBuilder extends AbstractTableFieldBuilder { column = new TableColumn(table, SWT.NONE); 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 + attribute.name + REMOVE_TOOLTIP_SUFFIX, @@ -232,7 +232,7 @@ public class TableFieldBuilder extends AbstractTableFieldBuilder { .open( ExamConfigurationService.getTablePopupTitleKey( this.attribute, - this.tableContext.getViewContext().i18nSupport), + this.tableContext.getViewContext().getI18nSupport()), (Consumer>) _rowValues -> applyFormValues( this.values, _rowValues, diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewContext.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewContext.java index a9fe8ac6..978d48f1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewContext.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewContext.java @@ -17,6 +17,7 @@ import java.util.Objects; import java.util.Set; import java.util.function.Function; +import ch.ethz.seb.sebserver.gui.service.page.PageService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +47,7 @@ public final class ViewContext { final AttributeMapping attributeMapping; final Map inputFieldMapping; final ValueChangeListener valueChangeListener; - final I18nSupport i18nSupport; + final PageService pageService; final boolean readonly; final boolean isTemplate; @@ -57,7 +58,7 @@ public final class ViewContext { final int rows, final AttributeMapping attributeContext, final ValueChangeListener valueChangeListener, - final I18nSupport i18nSupport, + final PageService pageService, final boolean readonly, final boolean isTemplate) { @@ -74,7 +75,7 @@ public final class ViewContext { this.attributeMapping = attributeContext; this.inputFieldMapping = new HashMap<>(); this.valueChangeListener = valueChangeListener; - this.i18nSupport = i18nSupport; + this.pageService = pageService; this.readonly = readonly; this.isTemplate = isTemplate; } @@ -84,7 +85,7 @@ public final class ViewContext { } public I18nSupport getI18nSupport() { - return this.i18nSupport; + return this.pageService.getI18nSupport(); } public Long getId() { diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/PageContext.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/PageContext.java index dfdbed34..1aca9da7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/PageContext.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/PageContext.java @@ -63,6 +63,8 @@ public interface PageContext { LocTextKey UNEXPECTED_ERROR_KEY = new LocTextKey("sebserver.error.action.unexpected.message"); + PageService getPageService(); + /** Get the I18nSupport service * * @return the I18nSupport service */ diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java index c69fc9b4..418dc19a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/PageContextImpl.java @@ -22,7 +22,6 @@ import java.util.stream.Collectors; import ch.ethz.seb.sebserver.gui.service.page.*; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; -import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.widgets.DialogCallback; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.*; @@ -68,6 +67,10 @@ public class PageContextImpl implements PageContext { this.attributes = Utils.immutableMapOf(attributes); } + public PageService getPageService() { + return pageService; + } + @Override public I18nSupport getI18nSupport() { return this.i18nSupport;