diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs index d7b06b3f..3521d6ab 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs @@ -14,7 +14,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData { internal class DataMapper { - private BaseDataMapper[] mappers = + private readonly BaseDataMapper[] mappers = { new ApplicationDataMapper(), new AudioDataMapper(), @@ -27,6 +27,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData new SecurityDataMapper(), new ServerDataMapper(), new ServiceDataMapper(), + new SystemDataMapper(), new UserInterfaceDataMapper() }; diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/DisplayDataMapper.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/DisplayDataMapper.cs index 1ff2bfe7..3c68986a 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/DisplayDataMapper.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/DisplayDataMapper.cs @@ -19,6 +19,9 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping case Keys.Display.AllowedDisplays: MapAllowedDisplays(settings, value); break; + case Keys.Display.AlwaysOn: + MapAlwaysOn(settings, value); + break; case Keys.Display.IgnoreError: MapIgnoreError(settings, value); break; @@ -36,6 +39,14 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping } } + private void MapAlwaysOn(AppSettings settings, object value) + { + if (value is bool alwaysOn) + { + settings.Display.AlwaysOn = alwaysOn; + } + } + private void MapIgnoreError(AppSettings settings, object value) { if (value is bool ignore) diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/SystemDataMapper.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/SystemDataMapper.cs new file mode 100644 index 00000000..44a5e802 --- /dev/null +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapping/SystemDataMapper.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 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/. + */ + +using SafeExamBrowser.Settings; + +namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping +{ + internal class SystemDataMapper : BaseDataMapper + { + internal override void Map(string key, object value, AppSettings settings) + { + switch (key) + { + case Keys.System.AlwaysOn: + MapAlwaysOn(settings, value); + break; + } + } + + private void MapAlwaysOn(AppSettings settings, object value) + { + if (value is bool alwaysOn) + { + settings.System.AlwaysOn = alwaysOn; + } + } + } +} diff --git a/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs b/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs index 3d202289..6625ced2 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs @@ -177,6 +177,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData internal static class Display { internal const string AllowedDisplays = "allowedDisplaysMaxNumber"; + internal const string AlwaysOn = "displayAlwaysOn"; internal const string IgnoreError = "allowedDisplaysIgnoreFailure"; internal const string InternalDisplayOnly = "allowedDisplayBuiltinEnforce"; } @@ -326,6 +327,11 @@ namespace SafeExamBrowser.Configuration.ConfigurationData internal const string SetVmwareConfiguration = "setVmwareConfiguration"; } + internal static class System + { + internal const string AlwaysOn = "systemAlwaysOn"; + } + internal static class UserInterface { internal const string ShowAudio = "audioControlEnabled"; diff --git a/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj b/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj index c381cd0b..ac923a1f 100644 --- a/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj +++ b/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj @@ -68,6 +68,7 @@ + diff --git a/SebWindowsConfig/SEBSettings.cs b/SebWindowsConfig/SEBSettings.cs index b92c9d54..92d751a9 100644 --- a/SebWindowsConfig/SEBSettings.cs +++ b/SebWindowsConfig/SEBSettings.cs @@ -435,6 +435,9 @@ namespace SebWindowsConfig public const String KeyEnableF11 = "enableF11"; public const String KeyEnableF12 = "enableF12"; + public const String KeyDisplayAlwaysOn = "displayAlwaysOn"; + public const String KeySystemAlwaysOn = "systemAlwaysOn"; + public enum sebConfigPurposes { sebConfigPurposeStartingExam, sebConfigPurposeConfiguringClient @@ -1056,6 +1059,9 @@ namespace SebWindowsConfig SEBSettings.settingsDefault.Add(SEBSettings.KeyEnableF11, true); SEBSettings.settingsDefault.Add(SEBSettings.KeyEnableF12, true); + SEBSettings.settingsDefault.Add(SEBSettings.KeyDisplayAlwaysOn, true); + SEBSettings.settingsDefault.Add(SEBSettings.KeySystemAlwaysOn, true); + // Clear all "current" lists and dictionaries