Package org.olat.ims.qti.editor.beecom.objects

Examples of org.olat.ims.qti.editor.beecom.objects.Material


    }

    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.
View Full Code Here


    //assert element.getName().equalsIgnoreCase("material");
   
    List materials = element.elements();
    if (materials.size() == 0) return null;

    Material material = new Material();
    // ATTRIBUTES
    Attribute label = element.attribute("label");
    if (label != null)
      material.setLable(label.getValue());

    // ELEMENTS
    for (Iterator i = materials.iterator(); i.hasNext();) {
      QTIObject obj = (QTIObject)parserManager.parse((Element)i.next());   
      if (obj != null)
        material.getElements().add(obj);
    }
    return material;
  }
View Full Code Here

        editQuestion = item.getQuestion().getQuestion();
        displayMaterialFormController(ureq, editQuestion, restrictedEdit);

      } else if (cmd.equals("editr")) {
        editResponse = ((Response) item.getQuestion().getResponses().get(posid));
        Material responseMat = ((Response) item.getQuestion().getResponses().get(posid)).getContent();
        displayMaterialFormController(ureq, responseMat, restrictedEdit);
       
      } else if (cmd.equals("addtext")) {
        FIBQuestion fib = (FIBQuestion) item.getQuestion();
        FIBResponse response = new FIBResponse();
        response.setType(FIBResponse.TYPE_CONTENT);
        Material mat = new Material();
        mat.add(new Mattext(trnsltr.translate("newtextelement")));
        response.setContent(mat);
        fib.getResponses().add(response);
      } else if (cmd.equals("addblank")) {
        FIBQuestion fib = (FIBQuestion) item.getQuestion();
        FIBResponse response = new FIBResponse();
View Full Code Here

TOP

Related Classes of org.olat.ims.qti.editor.beecom.objects.Material

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.