}
responseLevelHintsLayout.contextPut("mediaBaseUrl", mediaBaseUrl);
masteryMat = QTIEditHelper.getFeedbackMasteryMaterial(item);
masteryMat = masteryMat == null ? new Material() : masteryMat;
failureMat = QTIEditHelper.getFeedbackFailMaterial(item);
failureMat = failureMat == null ? new Material() : failureMat;
VFSContainer baseContainer = qtiPackage.getBaseDir();
// Mastery Layout
FormLayoutContainer masteryEditLayout = FormLayoutContainer.createCustomFormLayout("masteryEditLayout", getTranslator(), Util
.getPackageVelocityRoot(this.getClass())
+ "/rich_text_and_edit_link.html");
masteryEditLayout.setLabel("item_feedback_mastery", null);
overallFeedbackLayout.add(masteryEditLayout);
RichTextElement masteryFeedback = uifactory.addRichTextElementForStringData("richTextElement", "item_feedback_mastery", masteryMat
.renderAsHtml(mediaBaseUrl), 4, -1, true, true, baseContainer, null, masteryEditLayout, ureq.getUserSession(), getWindowControl());
FormLink editLink = uifactory.addFormLink("editLink", masteryEditLayout, Link.NONTRANSLATED + Link.LINK_CUSTOM_CSS);
((Link) editLink.getComponent()).setCustomDisplayText("");
((Link) editLink.getComponent()).setCustomEnabledLinkCSS("b_small_icon b_edit_icon qti_edit_link");
registerFeedbackElement(masteryMat, masteryFeedback, editLink);
// One Failure Layout
FormLayoutContainer failureEditLayout = FormLayoutContainer.createCustomFormLayout("failureEditLayout", getTranslator(), Util
.getPackageVelocityRoot(this.getClass())
+ "/rich_text_and_edit_link.html");
failureEditLayout.setLabel("item_feedback_fail", null);
overallFeedbackLayout.add(failureEditLayout);
RichTextElement failureFeedback = uifactory.addRichTextElementForStringData("richTextElement", "item_feedback_fail", failureMat
.renderAsHtml(mediaBaseUrl), 4, -1, true, true, baseContainer, null, failureEditLayout, ureq.getUserSession(), getWindowControl());
failureFeedback.setLabel("item_feedback_fail", null);
FormLink failureLink = uifactory.addFormLink("editLink", failureEditLayout, Link.NONTRANSLATED + Link.LINK_CUSTOM_CSS);
((Link) failureLink.getComponent()).setCustomDisplayText("");
((Link) failureLink.getComponent()).setCustomEnabledLinkCSS("b_small_icon b_edit_icon");
registerFeedbackElement(failureMat, failureFeedback, failureLink);
// Feedback for each response when single or multiple choice question
List<Material> responses = new ArrayList<Material>();
boolean hasResponseLevelHints = false;
if (item.getQuestion().getType() <= Question.TYPE_MC) {
int i = 1;
for (Object obj : item.getQuestion().getResponses()) {
ChoiceResponse response = (ChoiceResponse) obj;
// response-level feedback
Material responseFeedbackMat = QTIEditHelper.getFeedbackOlatRespMaterial(item, response.getIdent());
responseFeedbackMat = responseFeedbackMat == null ? new Material() : responseFeedbackMat;
identities.put(responseFeedbackMat, response.getIdent());
RichTextElement responseHintText = uifactory.addRichTextElementForStringData("feedback_" + i, null, responseFeedbackMat
.renderAsHtml(mediaBaseUrl), 4, -1, true, true, baseContainer, null, responseLevelHintsLayout, ureq.getUserSession(),
getWindowControl());
FormLink link = uifactory.addFormLink("link_" + i, responseLevelHintsLayout, Link.NONTRANSLATED + Link.LINK_CUSTOM_CSS);
((Link) link.getComponent()).setCustomDisplayText("");
((Link) link.getComponent()).setCustomEnabledLinkCSS("b_small_icon b_edit_icon");
registerFeedbackElement(responseFeedbackMat, responseHintText, link);
// get response for displaying
Material responseMat = response.getContent();
responses.add(responseMat);
i++;
}
// If 'i' is strictly greater than the initial value, there's at least one
// response.