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

View file

@ -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<String, Collection<Orientation>> 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<Orientation> value = entry.getValue();
final LocTextKey labelKey = new LocTextKey(
ExamConfigurationService.GROUP_LABEL_LOC_TEXT_PREFIX + expandItemKey,

View file

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

View file

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

View file

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

View file

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

View file

@ -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<Map<Long, TableValue>>) _rowValues -> applyFormValues(
this.values,
_rowValues,

View file

@ -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<Long, InputField> 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() {

View file

@ -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 */

View file

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