Skip to content

Commit

Permalink
SEBSERV-405 and SEBSERV-434 SEB Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Aug 31, 2023
1 parent 6c23bf5 commit 5982a9e
Show file tree
Hide file tree
Showing 12 changed files with 854 additions and 453 deletions.
697 changes: 344 additions & 353 deletions pom.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
Expand Down Expand Up @@ -163,12 +165,17 @@ class GroupCellFieldBuilderAdapter implements CellFieldBuilderAdapter {
this.orientationsOfGroup = orientationsOfGroup;

for (final Orientation o : this.orientationsOfGroup) {
final int xpos = o.xPosition - ((o.title == TitleOrientation.LEFT) ? 1 : 0);
final int xpos = o.xPosition
- ((o.title == TitleOrientation.LEFT || o.title == TitleOrientation.LEFT_SPAN) ? 1 : 0);
this.x = Math.min(xpos, this.x);
final int ypos = o.yPosition - ((o.title == TitleOrientation.TOP) ? 1 : 0);
this.y = Math.min(ypos, this.y);
this.width = Math.max(this.width, o.xpos() + o.width());
this.height = Math.max(this.height, o.ypos() + o.height());

if (o.groupId.equals("screenshot[proctoring|ScreenProctoring]")) {
this.x = o.xpos() - o.width();
}
}

this.width = this.width - this.x;
Expand Down Expand Up @@ -243,7 +250,7 @@ class ExpandBarCellFieldBuilderAdapter implements CellFieldBuilderAdapter {
}

this.width = this.width - this.x;
this.height = this.height - this.y + 2;
this.height = this.height - this.y + 10;
}

@Override
Expand Down Expand Up @@ -279,18 +286,29 @@ public void createCell(final ViewGridBuilder builder) {
this.width,
labelKey);

expandItem.setHeight(this.height * HEIGHT_PER_FIELD);
final Composite body = (Composite) expandItem.getControl();
final ViewGridBuilder expandBuilder = new ViewGridBuilder(
body,
builder.viewContext,
this,
builder.examConfigurationService);

final Set<String> groups = new HashSet<>();
for (final Orientation orientation : value) {
final ConfigurationAttribute attribute = builder.viewContext.getAttribute(orientation.attributeId);
expandBuilder.add(attribute);
final String groupKey = ViewGridBuilder.getGroupKey(orientation.groupId);
if (groupKey != null) {
groups.add(groupKey);
}
}

int h = (value.size() + ((groups.size() > 0) ? groups.size() + 1 : 0)) * HEIGHT_PER_FIELD;
if (expandItemKey.equals("ScreenProctoring")) {
h = h + 50;
}

expandItem.setHeight(h);
expandBuilder.compose();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
@GuiProfile
public class SliderFieldBuilder implements InputFieldBuilder {

public SliderFieldBuilder() {
// TODO Auto-generated constructor stub
}

@Override
public boolean builderFor(
final ConfigurationAttribute attribute,
Expand All @@ -63,16 +59,17 @@ public InputField createInputField(
WidgetFactory.setTestId(slider, attributeNameKey);
WidgetFactory.setARIALabel(slider, i18nSupport.getText(attributeNameKey));

final int thumb = slider.getThumb();
try {
final String[] split = StringUtils.split(
attribute.getResources(),
Constants.LIST_SEPARATOR);

slider.setMinimum(Integer.parseInt(split[0]));
slider.setMaximum(Integer.parseInt(split[1]));
slider.setMaximum(Integer.parseInt(split[1]) + thumb);
} catch (final NumberFormatException e) {
slider.setMinimum(0);
slider.setMaximum(100);
slider.setMinimum(1);
slider.setMaximum(100 + thumb);
}

final SliderInputField inputField = new SliderInputField(
Expand All @@ -93,7 +90,9 @@ public InputField createInputField(
};

slider.addListener(SWT.FocusOut, valueChangeEventListener);
slider.addListener(SWT.Traverse, valueChangeEventListener);
slider.addListener(SWT.Selection, event -> {
slider.setToolTipText(String.valueOf(slider.getSelection()));
});
}
return inputField;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,26 @@ protected void setValueToControl(final String value) {

@Override
public void enable(final boolean group) {
this.control.setData(RWT.CUSTOM_VARIANT, null);
this.control.setEditable(true);
if (group) {
this.control.getParent().getParent().setEnabled(true);
} else {
this.control.setData(RWT.CUSTOM_VARIANT, null);
this.control.setEditable(true);
}
}

@Override
public void disable(final boolean group) {
this.control.setData(RWT.CUSTOM_VARIANT, CustomVariant.CONFIG_INPUT_READONLY.key);
this.control.setEditable(false);
final GridData gridData = (GridData) this.control.getLayoutData();
gridData.heightHint = (this.attribute.type == AttributeType.TEXT_AREA)
? WidgetFactory.TEXT_AREA_INPUT_MIN_HEIGHT
: WidgetFactory.TEXT_INPUT_MIN_HEIGHT;
if (group) {
this.control.getParent().getParent().setEnabled(false);
} else {
this.control.setData(RWT.CUSTOM_VARIANT, CustomVariant.CONFIG_INPUT_READONLY.key);
this.control.setEditable(false);
final GridData gridData = (GridData) this.control.getLayoutData();
gridData.heightHint = (this.attribute.type == AttributeType.TEXT_AREA)
? WidgetFactory.TEXT_AREA_INPUT_MIN_HEIGHT
: WidgetFactory.TEXT_INPUT_MIN_HEIGHT;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public class ViewGridBuilder {
this.registeredExpandables = null;
}

private ExpandBarCellFieldBuilderAdapter expandBarBuilderAdapter = null;

ViewGridBuilder(
final Composite parent,
final ViewContext viewContext,
Expand All @@ -100,6 +102,7 @@ public class ViewGridBuilder {
this.viewContext = viewContext;
this.isGroupBuilder = false;
this.isExpandBarBuilder = true;
this.expandBarBuilderAdapter = expandBarBuilderAdapter;
this.xOffset = expandBarBuilderAdapter.x;
this.yOffset = expandBarBuilderAdapter.y;
this.grid = new CellFieldBuilderAdapter[expandBarBuilderAdapter.height - 1][expandBarBuilderAdapter.width];
Expand Down Expand Up @@ -241,6 +244,10 @@ ViewGridBuilder add(final ConfigurationAttribute attribute) {
final GroupCellFieldBuilderAdapter groupBuilder =
new GroupCellFieldBuilderAdapter(this.viewContext.getOrientationsOfGroup(attribute));

if (this.expandBarBuilderAdapter != null) {
groupBuilder.width = this.expandBarBuilderAdapter.width;
}

final int xpos = groupBuilder.x - this.xOffset;
final int ypos = groupBuilder.y - this.yOffset;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ public class ProctoringViewRules implements ValueChangeRule {
public static final String ZOOM_GROUP_FEATURES = "zoomFeatureFlagChat";
public static final String ZOOM_GROUP_CONTROLS = "zoomAudioMuted";

public static final String KEY_ENABLE_SPS = "enableScreenProctoring";
public static final String SPS_GROUP_SCREENSHOT = "screenProctoringScreenshotMinInterval";
public static final String SPS_GROUP_METADATA = "screenProctoringMetadataURLEnabled";

@Override
public boolean observesAttribute(final ConfigurationAttribute attribute) {
return KEY_ENABLE_AI.equals(attribute.name) ||
KEY_ENABLE_JITSI.equals(attribute.name) ||
KEY_ENABLE_ZOOM.equals(attribute.name);
KEY_ENABLE_ZOOM.equals(attribute.name) ||
KEY_ENABLE_SPS.equals(attribute.name);
}

@Override
Expand Down Expand Up @@ -78,6 +83,14 @@ public void applyRule(
context.disableGroup(AI_GROUP_FACE_NUMBER);
context.disableGroup(AI_GROUP_FACE_ANGLE);
}
} else if (KEY_ENABLE_SPS.equals(attribute.name)) {
if (BooleanUtils.toBoolean(value.value)) {
context.enableGroup(SPS_GROUP_SCREENSHOT);
context.enableGroup(SPS_GROUP_METADATA);
} else {
context.disableGroup(SPS_GROUP_SCREENSHOT);
context.disableGroup(SPS_GROUP_METADATA);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config/application-dev-ws.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sebserver.webservice.clean-db-on-startup=false

# webservice configuration
sebserver.init.adminaccount.gen-on-init=false
sebserver.webservice.distributed=true
sebserver.webservice.distributed=false
#sebserver.webservice.master.delay.threshold=10000
sebserver.webservice.http.external.scheme=http
sebserver.webservice.http.external.servername=localhost
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
spring.config.use-legacy-processing=true
spring.application.name=SEB Server
spring.profiles.active=ws,gui,dev
sebserver.version=@sebserver-version@
Expand Down
Loading

0 comments on commit 5982a9e

Please sign in to comment.