From 90401da1edf0849457b47c74e140a02887ee70a4 Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 16 Jan 2024 16:01:56 +0100 Subject: [PATCH] fixed Exam description --- src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java | 2 +- .../java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java | 4 ++-- .../java/ch/ethz/seb/sebserver/gui/form/TextFieldBuilder.java | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java index b7aef066..ce114266 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java @@ -427,7 +427,7 @@ public final class Exam implements GrantEntity { builder.append(", name="); builder.append(this.name); builder.append(", description="); - builder.append(Utils.truncateText(this.getDescription(), 255)); + builder.append(Utils.truncateText(this.getDescription(), 32)); builder.append(", startTime="); builder.append(this.startTime); builder.append(", endTime="); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java index f43917eb..880cfab7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java @@ -466,7 +466,7 @@ public class ExamForm implements TemplateComposer { QuizData.QUIZ_ATTR_DESCRIPTION, FORM_DESCRIPTION_TEXT_KEY, exam.getDescription()) - .asHTMLOrArea(50, exam.lmsSetupId != null) + .asHTML(50) .readonly(true) .withInputSpan(7) .withEmptyCellSeparation(false)) @@ -562,7 +562,7 @@ public class ExamForm implements TemplateComposer { QuizData.QUIZ_ATTR_DESCRIPTION, FORM_DESCRIPTION_TEXT_KEY, exam.getDescription()) - .asArea() + .asHTMLOrArea(50, hasLMS) .readonly(hasLMS)) .withAdditionalValueMapping(QuizData.QUIZ_ATTR_DESCRIPTION) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/form/TextFieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/form/TextFieldBuilder.java index e7c9def1..caaa4639 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/form/TextFieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/form/TextFieldBuilder.java @@ -10,6 +10,7 @@ package ch.ethz.seb.sebserver.gui.form; import java.util.function.Consumer; +import ch.ethz.seb.sebserver.gbl.util.Utils; import org.apache.commons.lang3.StringUtils; import org.eclipse.rap.rwt.RWT; import org.eclipse.swt.SWT; @@ -187,7 +188,7 @@ public final class TextFieldBuilder extends FieldBuilder { private String createHTMLText(final String text) { return HTML_TEXT_BLOCK_START - + text + + Utils.formatHTMLLinesForceEscaped( text) .replace("