Skip to content
Snippets Groups Projects
Commit 8b9475bd authored by srosse's avatar srosse
Browse files

OO-4892: allow formatted text for coach comment in grading workflow

parent 89c4abe9
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,7 @@ import org.olat.core.util.Formatter; ...@@ -49,6 +49,7 @@ import org.olat.core.util.Formatter;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.ZipUtil; import org.olat.core.util.ZipUtil;
import org.olat.core.util.filter.FilterFactory;
import org.olat.core.util.io.ShieldOutputStream; import org.olat.core.util.io.ShieldOutputStream;
import org.olat.core.util.openxml.OpenXMLWorkbook; import org.olat.core.util.openxml.OpenXMLWorkbook;
import org.olat.core.util.openxml.OpenXMLWorkbookResource; import org.olat.core.util.openxml.OpenXMLWorkbookResource;
...@@ -623,7 +624,7 @@ public class QTI21ArchiveFormat { ...@@ -623,7 +624,7 @@ public class QTI21ArchiveFormat {
} }
} }
if (exportConfig.isCommentCol()) { if (exportConfig.isCommentCol()) {
dataRow.addCell(col++, itemSession.getCoachComment(), null); dataRow.addCell(col++, getCoachComment(itemSession), null);
} }
if (exportConfig.isTimeCols()) { if (exportConfig.isTimeCols()) {
if (anonymizerCallback == null){ if (anonymizerCallback == null){
...@@ -646,6 +647,16 @@ public class QTI21ArchiveFormat { ...@@ -646,6 +647,16 @@ public class QTI21ArchiveFormat {
} }
} }
private String getCoachComment(AssessmentItemSession itemSession) {
if(itemSession == null || !StringHelper.containsNonWhitespace(itemSession.getCoachComment())) return null;
String comment = itemSession.getCoachComment();
if(StringHelper.isHtml(comment)) {
comment = FilterFactory.getHtmlTagAndDescapingFilter().filter(comment);
}
return comment;
}
private BigDecimal calculateSectionScore(SessionResponses responses, SectionInfos section) { private BigDecimal calculateSectionScore(SessionResponses responses, SectionInfos section) {
BigDecimal sectionScore = BigDecimal.valueOf(0l); BigDecimal sectionScore = BigDecimal.valueOf(0l);
......
...@@ -481,7 +481,7 @@ ...@@ -481,7 +481,7 @@
#if($r.isNotEmpty($itemResult.comment)) #if($r.isNotEmpty($itemResult.comment))
<div class="o_sel_assessmentitem_comment o_qti_item_comment"> <div class="o_sel_assessmentitem_comment o_qti_item_comment">
<h4>$r.translate("results.comment")</h4> <h4>$r.translate("results.comment")</h4>
$r.escapeHtml($itemResult.comment) $r.xssScan($itemResult.comment)
</div> </div>
#end #end
......
...@@ -32,6 +32,7 @@ import org.olat.core.gui.components.form.flexible.FormItem; ...@@ -32,6 +32,7 @@ import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.elements.FormLink; import org.olat.core.gui.components.form.flexible.elements.FormLink;
import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement; import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement;
import org.olat.core.gui.components.form.flexible.elements.RichTextElement;
import org.olat.core.gui.components.form.flexible.elements.StaticTextElement; import org.olat.core.gui.components.form.flexible.elements.StaticTextElement;
import org.olat.core.gui.components.form.flexible.elements.TextElement; import org.olat.core.gui.components.form.flexible.elements.TextElement;
import org.olat.core.gui.components.form.flexible.impl.Form; import org.olat.core.gui.components.form.flexible.impl.Form;
...@@ -41,6 +42,7 @@ import org.olat.core.gui.components.form.flexible.impl.FormJSHelper; ...@@ -41,6 +42,7 @@ import org.olat.core.gui.components.form.flexible.impl.FormJSHelper;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer; import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.components.form.flexible.impl.elements.FormCancel; import org.olat.core.gui.components.form.flexible.impl.elements.FormCancel;
import org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit; import org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit;
import org.olat.core.gui.components.form.flexible.impl.elements.richText.TextMode;
import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event; import org.olat.core.gui.control.Event;
...@@ -106,12 +108,11 @@ public class CorrectionIdentityInteractionsController extends FormBasicControlle ...@@ -106,12 +108,11 @@ public class CorrectionIdentityInteractionsController extends FormBasicControlle
private static final String[] onKeys = new String[] { "on" }; private static final String[] onKeys = new String[] { "on" };
private TextElement scoreEl; private TextElement scoreEl;
private TextElement commentEl; private RichTextElement commentEl;
private StaticTextElement statusEl; private StaticTextElement statusEl;
private FormLink viewSolutionButton; private FormLink viewSolutionButton;
private FormLink overrideScoreButton; private FormLink overrideScoreButton;
private FormLink viewCorrectSolutionButton; private FormLink viewCorrectSolutionButton;
private ItemBodyResultFormItem answerItem;
private ItemBodyResultFormItem solutionItem; private ItemBodyResultFormItem solutionItem;
private FeedbackResultFormItem correctSolutionItem; private FeedbackResultFormItem correctSolutionItem;
private MultipleSelectionElement toReviewEl; private MultipleSelectionElement toReviewEl;
...@@ -180,7 +181,7 @@ public class CorrectionIdentityInteractionsController extends FormBasicControlle ...@@ -180,7 +181,7 @@ public class CorrectionIdentityInteractionsController extends FormBasicControlle
AssessmentTestSession testSession = correction.getTestSession(); AssessmentTestSession testSession = correction.getTestSession();
TestSessionState testSessionState = correction.getTestSessionState(); TestSessionState testSessionState = correction.getTestSessionState();
answerItem = initFormInteraction(testPlanNodeKey, testSessionState, testSession, formLayout, true, false); ItemBodyResultFormItem answerItem = initFormInteraction(testPlanNodeKey, testSessionState, testSession, formLayout, true, false);
formLayout.add("answer", answerItem); formLayout.add("answer", answerItem);
viewSolutionButton = uifactory.addFormLink("view.solution", formLayout); viewSolutionButton = uifactory.addFormLink("view.solution", formLayout);
...@@ -258,7 +259,10 @@ public class CorrectionIdentityInteractionsController extends FormBasicControlle ...@@ -258,7 +259,10 @@ public class CorrectionIdentityInteractionsController extends FormBasicControlle
overrideScoreButton.setDomReplacementWrapperRequired(false); overrideScoreButton.setDomReplacementWrapperRequired(false);
overrideScoreButton.setVisible(!readOnly); overrideScoreButton.setVisible(!readOnly);
} }
commentEl = uifactory.addTextAreaElement("commentItem", "comment", 2500, 4, 60, false, false, coachComment, scoreCont); commentEl = uifactory.addRichTextElementForStringData("commentItem", "comment", coachComment, 8, -1,
false, null, null, null, scoreCont, ureq.getUserSession(), getWindowControl());
commentEl.getEditorConfiguration().setSimplestTextModeAllowed(TextMode.multiLine);
commentEl.getEditorConfiguration().setPathInStatusBar(false);
commentEl.setHelpText(translate("comment.help")); commentEl.setHelpText(translate("comment.help"));
commentEl.setEnabled(!readOnly); commentEl.setEnabled(!readOnly);
IdentityAssessmentItemWrapper wrapper = new IdentityAssessmentItemWrapper(fullname, assessmentItem, correction, responseItems, IdentityAssessmentItemWrapper wrapper = new IdentityAssessmentItemWrapper(fullname, assessmentItem, correction, responseItems,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment