Merge branch 'dev-1.5' into development

This commit is contained in:
anhefti 2023-05-11 12:12:20 +02:00
commit 0db5c59947
4 changed files with 27 additions and 5 deletions

View file

@ -15,6 +15,7 @@ import java.util.function.BooleanSupplier;
import java.util.function.Function;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
@ -481,7 +482,7 @@ public class LmsSetupForm implements TemplateComposer {
case TOKEN_REQUEST: {
throw new PageMessageException(new LocTextKey(
"sebserver.lmssetup.action.test.tokenRequestError",
Utils.formatHTMLLinesForceEscaped(Utils.escapeHTML_XML_EcmaScript(error.message))));
Utils.formatHTMLLinesForceEscaped(StringEscapeUtils.escapeHtml4(error.message))));
}
case QUIZ_ACCESS_API_REQUEST: {
if (error.message.contains("quizaccess_sebserver_get_exams")) {

View file

@ -11,7 +11,9 @@ package ch.ethz.seb.sebserver.gui.service.i18n.impl;
import java.util.Locale;
import java.util.function.Consumer;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
@ -30,6 +32,8 @@ import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -49,6 +53,8 @@ import ch.ethz.seb.sebserver.gui.widget.Selection;
@GuiProfile
public final class PolyglotPageServiceImpl implements PolyglotPageService {
private static final Logger log = LoggerFactory.getLogger(PolyglotPageServiceImpl.class);
private final I18nSupport i18nSupport;
public PolyglotPageServiceImpl(final I18nSupport i18nSupport) {
@ -93,7 +99,11 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService {
@Override
public void injectI18n(final Label label, final LocTextKey locTextKey) {
injectI18n(label, locTextKey, null);
try {
injectI18n(label, locTextKey, null);
} catch (final Exception e) {
log.error("Failed to injectI18n: {}", e.getMessage());
}
}
@Override
@ -269,8 +279,14 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService {
final I18nSupport i18nSupport) {
return label -> {
if (locTextKey != null) {
label.setText(i18nSupport.getText(locTextKey));
final String text = i18nSupport.getText(locTextKey);
if (BooleanUtils.toBoolean((Boolean) label.getData(RWT.MARKUP_ENABLED))) {
label.setText(StringEscapeUtils.escapeHtml4(text));
} else {
label.setText(text);
}
}
if (i18nSupport.hasText(locToolTipKey)) {
label.setToolTipText(Utils.formatLineBreaks(i18nSupport.getText(locToolTipKey)));

View file

@ -10,6 +10,7 @@ package ch.ethz.seb.sebserver.gui.widget;
import java.util.Locale;
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.widgets.DialogCallback;
import org.eclipse.swt.graphics.Rectangle;
@ -17,7 +18,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import ch.ethz.seb.sebserver.gbl.util.Utils;
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
@ -46,7 +46,7 @@ public final class Message extends MessageBox {
super.prepareOpen();
} catch (final IllegalArgumentException e) {
// fallback on markup text error
super.setMessage(Utils.escapeHTML_XML_EcmaScript(super.getMessage()));
super.setMessage(StringEscapeUtils.escapeHtml4(super.getMessage()));
super.prepareOpen();
}
final GridLayout layout = (GridLayout) super.shell.getLayout();

View file

@ -326,6 +326,11 @@ public class ExamProctoringRoomServiceImpl implements ExamProctoringRoomService
cc.getExamId(),
cc.getConnectionToken());
if (proctoringRoom == null) {
log.warn("Assign SEB client to proctoring room failed for: {}", cc);
return;
}
if (log.isDebugEnabled()) {
log.debug("Assigning new SEB client to proctoring room: {}, connection: {}",
proctoringRoom.id,