SEBSERV-201 finished up

This commit is contained in:
anhefti 2021-09-30 15:45:57 +02:00
parent f7a8fb4a33
commit 1a592ac606
3 changed files with 71 additions and 1 deletions

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 2021 ETH Zürich, Educational Development and Technology (LET)
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package ch.ethz.seb.sebserver.gui.service.examconfig.impl.rules;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute;
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue;
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
import ch.ethz.seb.sebserver.gui.service.examconfig.ValueChangeRule;
import ch.ethz.seb.sebserver.gui.service.examconfig.impl.ViewContext;
@Lazy
@Service
@GuiProfile
public class RaiseHandRule implements ValueChangeRule {
public static final String KEY_RAISE_HAND = "raiseHandButtonShow";
public static final String KEY_PROMPT_MESSAGE = "raiseHandButtonAlwaysPromptMessage";
@Override
public boolean observesAttribute(final ConfigurationAttribute attribute) {
return KEY_RAISE_HAND.equals(attribute.name);
}
@Override
public void applyRule(final ViewContext context, final ConfigurationAttribute attribute,
final ConfigurationValue value) {
if (context.isReadonly()) {
return;
}
if (BooleanUtils.toBoolean(value.value)) {
context.enable(KEY_PROMPT_MESSAGE);
} else {
context.disable(KEY_PROMPT_MESSAGE);
context.setValue(
KEY_PROMPT_MESSAGE,
context.getAttributeByName(KEY_PROMPT_MESSAGE).defaultValue);
}
}
}

View file

@ -35,4 +35,16 @@ INSERT IGNORE INTO orientation (config_attribute_id, template_id, view_id, group
UPDATE orientation SET width=2 WHERE config_attribute_id=53;
INSERT IGNORE INTO orientation (config_attribute_id, template_id, view_id, group_id, x_position, y_position, width, height, title) VALUES
(904, 0, 3, 'userAgentTouch', 9, 5, 3, 1, 'NONE');
(904, 0, 3, 'userAgentTouch', 9, 5, 3, 1, 'NONE');
-- -----------------------------------------------------------------
-- SEBSERV-201 Number 5 (raise hand)
-- -----------------------------------------------------------------
INSERT IGNORE INTO configuration_attribute VALUES
(974, 'raiseHandButtonShow', 'CHECKBOX', null, null, null, null, 'false'),
(975, 'raiseHandButtonAlwaysPromptMessage', 'CHECKBOX', null, null, null, null, 'false');
INSERT IGNORE INTO orientation (config_attribute_id, template_id, view_id, group_id, x_position, y_position, width, height, title) VALUES
(974, 0, 2, 'taskbar', 0, 11, 3, 1, 'NONE'),
(975, 0, 2, 'taskbar', 0, 12, 3, 1, 'NONE');

View file

@ -943,6 +943,12 @@ sebserver.examconfig.props.label.showTime=Show time
sebserver.examconfig.props.label.showTime.tooltip=Show current time
sebserver.examconfig.props.label.showInputLanguage=Show keyboard layout
sebserver.examconfig.props.label.showInputLanguage.tooltip=Shows current keyboard layout and allows to switch between other active keyboard layouts
sebserver.examconfig.props.label.raiseHandButtonShow=Show raise hand button
sebserver.examconfig.props.label.raiseHandButtonShow.tooltip=
sebserver.examconfig.props.label.raiseHandButtonAlwaysPromptMessage=Raise hand prompt message
sebserver.examconfig.props.label.raiseHandButtonAlwaysPromptMessage.tooltip=if this is enabled the raise hand function will always prompt the user to give a message for the raise hand action
sebserver.examconfig.props.group.zoom=Enable Zoom (Win/Mac)
sebserver.examconfig.props.label.enableZoomPage=Enable page zoom