Пример #1
0
  /** {@inheritDoc} */
  public Component getViewDeliveryUi() {
    Text question = this.uiService.newText();
    question.setText(
        null, this.uiService.newHtmlPropertyReference().setReference("question.presentation.text"));

    Attachments attachments = this.uiService.newAttachments();
    attachments.setAttachments(
        this.uiService.newPropertyReference().setReference("question.presentation.attachments"),
        null);
    attachments.setIncluded(
        this.uiService
            .newHasValueDecision()
            .setProperty(
                this.uiService
                    .newPropertyReference()
                    .setReference("question.presentation.attachments")));

    Selection selection = this.uiService.newSelection();
    selection.addSelection(
        this.uiService.newMessage().setMessage("true"),
        this.uiService.newMessage().setTemplate("true"));
    selection.addSelection(
        this.uiService.newMessage().setMessage("false"),
        this.uiService.newMessage().setTemplate("false"));
    selection.setReadOnly(this.uiService.newTrueDecision());

    Section first = this.uiService.newSection();
    first.add(question).add(attachments).add(selection);

    return this.uiService.newFragment().setMessages(this.messages).add(first);
  }
Пример #2
0
  /** {@inheritDoc} */
  public Component getDeliveryUi() {
    Text question = this.uiService.newText();
    question.setText(
        null,
        this.uiService
            .newHtmlPropertyReference()
            .setReference("answer.question.presentation.text"));

    Attachments attachments = this.uiService.newAttachments();
    attachments.setAttachments(
        this.uiService
            .newPropertyReference()
            .setReference("answer.question.presentation.attachments"),
        null);
    attachments.setIncluded(
        this.uiService
            .newHasValueDecision()
            .setProperty(
                this.uiService
                    .newPropertyReference()
                    .setReference("answer.question.presentation.attachments")));

    Selection selection = this.uiService.newSelection();
    selection.setProperty(
        this.uiService.newPropertyReference().setReference("answer.typeSpecificAnswer.answer"));
    selection.addSelection(
        this.uiService.newMessage().setMessage("true"),
        this.uiService.newMessage().setTemplate("true"));
    selection.addSelection(
        this.uiService.newMessage().setMessage("false"),
        this.uiService.newMessage().setTemplate("false"));
    selection.setOnEmptyAlert(
        this.uiService
            .newDecision()
            .setReversed()
            .setProperty(
                this.uiService
                    .newPropertyReference()
                    .setReference("answer.submission.assessment.randomAccess")),
        "linear-missing");

    Section section = this.uiService.newSection();
    section.add(question).add(attachments).add(selection);

    return this.uiService.newFragment().setMessages(this.messages).add(section);
  }
Пример #3
0
  /** {@inheritDoc} */
  public Component getViewStatsUi() {
    Text question = this.uiService.newText();
    question.setText(
        null, this.uiService.newHtmlPropertyReference().setReference("question.presentation.text"));

    Attachments attachments = this.uiService.newAttachments();
    attachments.setAttachments(
        this.uiService.newPropertyReference().setReference("question.presentation.attachments"),
        null);
    attachments.setIncluded(
        this.uiService
            .newHasValueDecision()
            .setProperty(
                this.uiService
                    .newPropertyReference()
                    .setReference("question.presentation.attachments")));

    EntityList entityList = this.uiService.newEntityList();
    entityList.setStyle(EntityList.Style.form);
    entityList.setIterator(
        this.uiService.newPropertyReference().setReference("question.typeSpecificQuestion.choices"),
        "choice");
    entityList.setEmptyTitle("no-answer");

    SelectionColumn selCol = this.uiService.newSelectionColumn();
    selCol.setSingle();
    selCol.setValueProperty(this.uiService.newTextPropertyReference().setReference("choice.id"));
    selCol.setProperty(
        this.uiService
            .newPropertyReference()
            .setReference("question.typeSpecificQuestion.correctAnswer"));
    selCol.setReadOnly(this.uiService.newTrueDecision());
    selCol.setCorrect(
        this.uiService
            .newPropertyReference()
            .setReference("question.typeSpecificQuestion.correctAnswer"));
    selCol.setCorrectDecision(
        this.uiService
            .newDecision()
            .setProperty(
                this.uiService.newPropertyReference().setReference("question.hasCorrect")));
    entityList.addColumn(selCol);

    PropertyColumn propCol = this.uiService.newPropertyColumn();
    propCol.setProperty(this.uiService.newHtmlPropertyReference().setReference("choice.text"));
    entityList.addColumn(propCol);

    propCol = this.uiService.newPropertyColumn();
    propCol.setRight();
    propCol.setProperty(
        this.uiService
            .newHtmlPropertyReference()
            .setReference("choice.id")
            .setFormatDelegate(this.uiService.getFormatDelegate("FormatPercent", "sakai.mneme")));
    entityList.addColumn(propCol);

    propCol = this.uiService.newPropertyColumn();
    propCol.setRight();
    propCol.setProperty(
        this.uiService
            .newHtmlPropertyReference()
            .setReference("choice.id")
            .setFormatDelegate(this.uiService.getFormatDelegate("FormatCount", "sakai.mneme")));
    entityList.addColumn(propCol);

    Text answerKey = this.uiService.newText();
    PropertyReference[] refs = new PropertyReference[2];
    refs[0] = this.uiService.newIconPropertyReference().setIcon("/icons/answer_key.png");
    refs[1] =
        this.uiService
            .newHtmlPropertyReference()
            .setReference("question.typeSpecificQuestion.answerKey");
    answerKey.setText("answer-key", refs);

    Text unanswered =
        this.uiService
            .newText()
            .setText(
                null,
                this.uiService
                    .newHtmlPropertyReference()
                    .setFormatDelegate(
                        this.uiService.getFormatDelegate(
                            "FormatUnansweredPercent", "sakai.mneme")));

    Section first = this.uiService.newSection();
    first.add(question).add(attachments).add(entityList).add(unanswered);

    Section second = this.uiService.newSection();
    second.setIncluded(
        this.uiService
            .newDecision()
            .setProperty(
                this.uiService.newPropertyReference().setReference("question.hasCorrect")));
    second.add(answerKey);

    return this.uiService.newFragment().setMessages(this.messages).add(first).add(second);
  }
Пример #4
0
  /** {@inheritDoc} */
  public Component getViewQuestionUi() {
    Text question = this.uiService.newText();
    question.setText(
        null, this.uiService.newHtmlPropertyReference().setReference("question.presentation.text"));

    Attachments attachments = this.uiService.newAttachments();
    attachments.setAttachments(
        this.uiService.newPropertyReference().setReference("question.presentation.attachments"),
        null);
    attachments.setIncluded(
        this.uiService
            .newHasValueDecision()
            .setProperty(
                this.uiService
                    .newPropertyReference()
                    .setReference("question.presentation.attachments")));

    Selection selection = this.uiService.newSelection();
    selection.setProperty(
        this.uiService
            .newPropertyReference()
            .setReference("question.typeSpecificQuestion.correctAnswer"));
    selection.addSelection(
        this.uiService.newMessage().setMessage("true"),
        this.uiService.newMessage().setTemplate("true"));
    selection.addSelection(
        this.uiService.newMessage().setMessage("false"),
        this.uiService.newMessage().setTemplate("false"));
    selection.setReadOnly(this.uiService.newTrueDecision());
    selection.setCorrect(
        this.uiService
            .newPropertyReference()
            .setReference("question.typeSpecificQuestion.correctAnswer"));
    selection.setCorrectDecision(
        this.uiService
            .newDecision()
            .setProperty(
                this.uiService.newPropertyReference().setReference("question.hasCorrect")));

    Text answerKey = this.uiService.newText();
    PropertyReference[] refs = new PropertyReference[2];
    refs[0] = this.uiService.newIconPropertyReference().setIcon("/icons/answer_key.png");
    refs[1] =
        this.uiService
            .newHtmlPropertyReference()
            .setReference("question.typeSpecificQuestion.answerKey");
    answerKey.setText("answer-key", refs);

    Section first = this.uiService.newSection();
    first.add(question).add(attachments).add(selection);

    Section second = this.uiService.newSection();
    second.setIncluded(
        this.uiService
            .newDecision()
            .setProperty(
                this.uiService.newPropertyReference().setReference("question.hasCorrect")));
    second.add(answerKey);

    return this.uiService.newFragment().setMessages(this.messages).add(first).add(second);
  }
Пример #5
0
  /** {@inheritDoc} */
  public Component getReviewUi() {
    Text question = this.uiService.newText();
    question.setText(
        null,
        this.uiService
            .newHtmlPropertyReference()
            .setReference("answer.question.presentation.text"));

    Attachments attachments = this.uiService.newAttachments();
    attachments.setAttachments(
        this.uiService
            .newPropertyReference()
            .setReference("answer.question.presentation.attachments"),
        null);
    attachments.setIncluded(
        this.uiService
            .newHasValueDecision()
            .setProperty(
                this.uiService
                    .newPropertyReference()
                    .setReference("answer.question.presentation.attachments")));

    Selection selection = this.uiService.newSelection();
    selection.setProperty(
        this.uiService.newPropertyReference().setReference("answer.typeSpecificAnswer.answer"));
    selection.addSelection(
        this.uiService.newMessage().setMessage("true"),
        this.uiService.newMessage().setTemplate("true"));
    selection.addSelection(
        this.uiService.newMessage().setMessage("false"),
        this.uiService.newMessage().setTemplate("false"));
    selection.setReadOnly(this.uiService.newTrueDecision());
    selection.setCorrect(
        this.uiService
            .newPropertyReference()
            .setReference("answer.question.typeSpecificQuestion.correctAnswer"));

    // should we show correct marks?
    AndDecision mayReviewAndShowCorrect = this.uiService.newAndDecision();
    Decision[] decisionsMayReviewAndShowCorrect = new Decision[2];
    decisionsMayReviewAndShowCorrect[0] =
        this.uiService
            .newDecision()
            .setProperty(
                this.uiService.newPropertyReference().setReference("answer.submission.mayReview"));
    decisionsMayReviewAndShowCorrect[1] =
        this.uiService
            .newDecision()
            .setProperty(
                this.uiService.newPropertyReference().setReference("answer.showCorrectReview"));
    mayReviewAndShowCorrect.setRequirements(decisionsMayReviewAndShowCorrect);

    OrDecision or = this.uiService.newOrDecision();
    Decision[] decisionsOr = new Decision[2];
    decisionsOr[0] =
        this.uiService
            .newDecision()
            .setProperty(this.uiService.newPropertyReference().setReference("grading"));
    decisionsOr[1] = mayReviewAndShowCorrect;
    or.setOptions(decisionsOr);

    Decision[] decisionsShowCorrect = new Decision[2];
    decisionsShowCorrect[0] =
        this.uiService
            .newDecision()
            .setProperty(
                this.uiService.newPropertyReference().setReference("answer.question.hasCorrect"));
    decisionsShowCorrect[1] = or;
    Decision showCorrect = this.uiService.newAndDecision().setRequirements(decisionsShowCorrect);

    selection.setCorrectDecision(showCorrect);

    Text answerKey = this.uiService.newText();
    PropertyReference[] refs = new PropertyReference[2];
    refs[0] = this.uiService.newIconPropertyReference().setIcon("/icons/answer_key.png");
    refs[1] =
        this.uiService
            .newHtmlPropertyReference()
            .setReference("answer.question.typeSpecificQuestion.answerKey");
    answerKey.setText("answer-key", refs);

    Decision[] orInc = new Decision[2];
    orInc[0] =
        this.uiService
            .newDecision()
            .setProperty(this.uiService.newPropertyReference().setReference("grading"));
    orInc[1] =
        this.uiService
            .newDecision()
            .setProperty(
                this.uiService.newPropertyReference().setReference("answer.showCorrectReview"));
    Decision[] andInc = new Decision[2];
    andInc[0] =
        this.uiService
            .newDecision()
            .setProperty(
                this.uiService.newPropertyReference().setReference("answer.question.hasCorrect"));
    andInc[1] = this.uiService.newOrDecision().setOptions(orInc);
    answerKey.setIncluded(this.uiService.newAndDecision().setRequirements(andInc));

    Section first = this.uiService.newSection();
    first.add(question).add(attachments).add(selection);

    Section second = this.uiService.newSection();
    second.add(answerKey);

    return this.uiService.newFragment().setMessages(this.messages).add(first).add(second);
  }