*/
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("fieldset.legend.feedback");
setFormContextHelp("org.olat.ims.qti.editor", "qed-feedback.html", "help.hover.qti-feedback");
FormLayoutContainer switchLayout = FormLayoutContainer.createDefaultFormLayout("switchLayout", getTranslator());
overallFeedbackLayout = FormLayoutContainer.createDefaultFormLayout("overallFeedbackLayout", getTranslator());
responseLevelHintsLayout = FormLayoutContainer.createCustomFormLayout("responseLevelHintsLayout", getTranslator(), Util
.getPackageVelocityRoot(this.getClass())
+ "/response_level_feedback.html");
// add the layouts to the custom layout
formLayout.add(switchLayout);
formLayout.add(overallFeedbackLayout);
formLayout.add(responseLevelHintsLayout);
String[] yesNoKeys, yesNoValues;
yesNoKeys = new String[] { YES, NO };
yesNoValues = new String[] { translate(YES), translate(NO) };
feedbackSwitch = uifactory.addRadiosHorizontal("feedbackswitch", switchLayout, yesNoKeys, yesNoValues);
feedbackSwitch.addActionListener(this, FormEvent.ONCLICK);
if (control.isFeedback()) {
feedbackSwitch.select(yesNoKeys[0], true);
} else {
// defaults to 'not showing feedback'
feedbackSwitch.select(yesNoKeys[1], true);
}
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);