2021-02-09 14:44:59 +01:00
|
|
|
|
/*
|
2024-03-05 18:37:42 +01:00
|
|
|
|
* Copyright (c) 2024 ETH Zürich, IT Services
|
2021-02-09 14:44:59 +01:00
|
|
|
|
*
|
|
|
|
|
* 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.Core.Contracts.OperationModel;
|
|
|
|
|
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
|
|
|
|
using SafeExamBrowser.I18n.Contracts;
|
|
|
|
|
using SafeExamBrowser.Logging.Contracts;
|
|
|
|
|
using SafeExamBrowser.Runtime.Operations.Events;
|
|
|
|
|
using SafeExamBrowser.UserInterface.Contracts.MessageBox;
|
|
|
|
|
|
|
|
|
|
namespace SafeExamBrowser.Runtime.Operations
|
|
|
|
|
{
|
|
|
|
|
internal class DisclaimerOperation : SessionOperation
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger logger;
|
|
|
|
|
|
|
|
|
|
public override event ActionRequiredEventHandler ActionRequired;
|
|
|
|
|
public override event StatusChangedEventHandler StatusChanged;
|
|
|
|
|
|
|
|
|
|
public DisclaimerOperation(ILogger logger, SessionContext context) : base(context)
|
|
|
|
|
{
|
|
|
|
|
this.logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override OperationResult Perform()
|
|
|
|
|
{
|
2023-11-08 18:07:30 +01:00
|
|
|
|
var result = OperationResult.Success;
|
|
|
|
|
|
2024-02-01 17:36:11 +01:00
|
|
|
|
if (Context.Next.Settings.Proctoring.JitsiMeet.Enabled)
|
2021-02-10 00:49:32 +01:00
|
|
|
|
{
|
2024-02-01 17:36:11 +01:00
|
|
|
|
result = ShowVideoProctoringDisclaimer();
|
|
|
|
|
}
|
2024-03-11 09:55:44 +01:00
|
|
|
|
|
2024-03-14 14:24:11 +01:00
|
|
|
|
//if (result == OperationResult.Success && Context.Next.Settings.Proctoring.ScreenProctoring.Enabled)
|
|
|
|
|
//{
|
|
|
|
|
// result = ShowScreenProctoringDisclaimer();
|
|
|
|
|
//}
|
2024-03-11 09:55:44 +01:00
|
|
|
|
|
|
|
|
|
if (result == OperationResult.Success && Context.Next.Settings.Proctoring.Zoom.Enabled)
|
2023-11-08 18:07:30 +01:00
|
|
|
|
{
|
|
|
|
|
result = ShowZoomError();
|
|
|
|
|
}
|
2021-02-10 00:49:32 +01:00
|
|
|
|
|
2023-11-08 18:07:30 +01:00
|
|
|
|
return result;
|
2021-02-09 14:44:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override OperationResult Repeat()
|
|
|
|
|
{
|
2023-11-08 18:07:30 +01:00
|
|
|
|
var result = OperationResult.Success;
|
|
|
|
|
|
2024-02-01 17:36:11 +01:00
|
|
|
|
if (Context.Next.Settings.Proctoring.JitsiMeet.Enabled)
|
|
|
|
|
{
|
|
|
|
|
result = ShowVideoProctoringDisclaimer();
|
|
|
|
|
}
|
2024-03-11 09:55:44 +01:00
|
|
|
|
|
2024-03-14 14:24:11 +01:00
|
|
|
|
//if (result == OperationResult.Success && Context.Next.Settings.Proctoring.ScreenProctoring.Enabled)
|
|
|
|
|
//{
|
|
|
|
|
// result = ShowScreenProctoringDisclaimer();
|
|
|
|
|
//}
|
2024-03-11 09:55:44 +01:00
|
|
|
|
|
|
|
|
|
if (result == OperationResult.Success && Context.Next.Settings.Proctoring.Zoom.Enabled)
|
2023-11-08 18:07:30 +01:00
|
|
|
|
{
|
|
|
|
|
result = ShowZoomError();
|
|
|
|
|
}
|
2021-02-10 00:49:32 +01:00
|
|
|
|
|
2023-11-08 18:07:30 +01:00
|
|
|
|
return result;
|
2021-02-09 14:44:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override OperationResult Revert()
|
|
|
|
|
{
|
|
|
|
|
return OperationResult.Success;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-11 09:55:44 +01:00
|
|
|
|
private OperationResult ShowScreenProctoringDisclaimer()
|
|
|
|
|
{
|
|
|
|
|
var args = new MessageEventArgs
|
|
|
|
|
{
|
|
|
|
|
Action = MessageBoxAction.OkCancel,
|
|
|
|
|
Icon = MessageBoxIcon.Information,
|
|
|
|
|
Message = TextKey.MessageBox_ScreenProctoringDisclaimer,
|
|
|
|
|
Title = TextKey.MessageBox_ScreenProctoringDisclaimerTitle
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
StatusChanged?.Invoke(TextKey.OperationStatus_WaitDisclaimerConfirmation);
|
|
|
|
|
ActionRequired?.Invoke(args);
|
|
|
|
|
|
|
|
|
|
if (args.Result == MessageBoxResult.Ok)
|
|
|
|
|
{
|
|
|
|
|
logger.Info("The user confirmed the screen proctoring disclaimer.");
|
|
|
|
|
|
|
|
|
|
return OperationResult.Success;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logger.Warn("The user did not confirm the screen proctoring disclaimer! Aborting session initialization...");
|
|
|
|
|
|
|
|
|
|
return OperationResult.Aborted;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-01 17:36:11 +01:00
|
|
|
|
private OperationResult ShowVideoProctoringDisclaimer()
|
2021-02-09 14:44:59 +01:00
|
|
|
|
{
|
|
|
|
|
var args = new MessageEventArgs
|
|
|
|
|
{
|
2021-02-09 23:07:09 +01:00
|
|
|
|
Action = MessageBoxAction.OkCancel,
|
|
|
|
|
Icon = MessageBoxIcon.Information,
|
2024-03-11 09:55:44 +01:00
|
|
|
|
Message = TextKey.MessageBox_VideoProctoringDisclaimer,
|
|
|
|
|
Title = TextKey.MessageBox_VideoProctoringDisclaimerTitle
|
2021-02-09 14:44:59 +01:00
|
|
|
|
};
|
|
|
|
|
|
2021-02-09 23:07:09 +01:00
|
|
|
|
StatusChanged?.Invoke(TextKey.OperationStatus_WaitDisclaimerConfirmation);
|
2021-02-09 14:44:59 +01:00
|
|
|
|
ActionRequired?.Invoke(args);
|
|
|
|
|
|
|
|
|
|
if (args.Result == MessageBoxResult.Ok)
|
|
|
|
|
{
|
2024-03-11 09:55:44 +01:00
|
|
|
|
logger.Info("The user confirmed the video proctoring disclaimer.");
|
2021-02-09 14:44:59 +01:00
|
|
|
|
|
|
|
|
|
return OperationResult.Success;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-03-11 09:55:44 +01:00
|
|
|
|
logger.Warn("The user did not confirm the video proctoring disclaimer! Aborting session initialization...");
|
2021-02-09 14:44:59 +01:00
|
|
|
|
|
|
|
|
|
return OperationResult.Aborted;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-08 18:07:30 +01:00
|
|
|
|
|
|
|
|
|
private OperationResult ShowZoomError()
|
|
|
|
|
{
|
|
|
|
|
var args = new MessageEventArgs
|
|
|
|
|
{
|
|
|
|
|
Action = MessageBoxAction.Ok,
|
|
|
|
|
Icon = MessageBoxIcon.Error,
|
|
|
|
|
Message = TextKey.MessageBox_ZoomNotSupported,
|
|
|
|
|
Title = TextKey.MessageBox_ZoomNotSupportedTitle
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
logger.Error("Zoom proctoring is enabled but not supported! Aborting session initialization...");
|
|
|
|
|
|
|
|
|
|
StatusChanged?.Invoke(TextKey.OperationStatus_WaitErrorConfirmation);
|
|
|
|
|
ActionRequired?.Invoke(args);
|
|
|
|
|
|
|
|
|
|
return OperationResult.Aborted;
|
|
|
|
|
}
|
2021-02-09 14:44:59 +01:00
|
|
|
|
}
|
|
|
|
|
}
|