Skip to content

Commit

Permalink
SAK-45965 Lessons cleanup raw-question-text error message in logs (sa…
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored Sep 30, 2024
1 parent 42fa3dc commit 9160640
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7804,7 +7804,7 @@ public void setAddAnswerData(String data) {
// so this should be safe.
if(questionAnswers == null) {
questionAnswers = new HashMap<>();
log.info("setAddAnswer: it was null");
log.debug("setAddAnswer: it was null");
}

// We store with the index so that we can maintain the order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3160,7 +3160,6 @@ public int compare(SimpleStudentPage o1, SimpleStudentPage o2) {
UIOutput.make(tableRow, "questionDiv");

UIVerbatim.make(tableRow, "questionText", i.getAttribute("questionText"));
UIInput.make(tableRow, "raw-question-text", "#{simplePageBean.questionText}", i.getAttribute("questionText"));

List<SimplePageQuestionAnswer> answers = new ArrayList<SimplePageQuestionAnswer>();
if("multipleChoice".equals(i.getAttribute("questionType"))) {
Expand All @@ -3170,6 +3169,7 @@ public int compare(SimpleStudentPage o1, SimpleStudentPage o2) {
makeCsrf(questionForm, "csrf4");

UIInput.make(questionForm, "multipleChoiceId", "#{simplePageBean.questionId}", String.valueOf(i.getId()));
UIInput.make(questionForm, "raw-question-text", "#{simplePageBean.questionText}", i.getAttribute("questionText"));

String[] options = new String[answers.size()];
String initValue = null;
Expand Down Expand Up @@ -3220,8 +3220,9 @@ public int compare(SimpleStudentPage o1, SimpleStudentPage o2) {
makeCsrf(questionForm, "csrf5");

UIInput.make(questionForm, "shortanswerId", "#{simplePageBean.questionId}", String.valueOf(i.getId()));

UIInput.make(questionForm, "raw-question-text", "#{simplePageBean.questionText}", i.getAttribute("questionText"));
UIInput shortanswerInput = UIInput.make(questionForm, "shortanswerInput", "#{simplePageBean.questionResponse}");

if(!isAvailable || response != null) {
if (canSeeAll)
fakeDisableLink(shortanswerInput, messageLocator);
Expand Down Expand Up @@ -4054,14 +4055,15 @@ private String getLinkText(String linkText, String sakaiId ) {
}

private static String getUserDisplayName(String owner) {
String userDisplayName = StringUtils.EMPTY;
if (owner == null) return StringUtils.EMPTY;

try {
User user = UserDirectoryService.getUser(owner);
userDisplayName = String.format("%s (%s)", user.getSortName(), user.getEid());
return String.format("%s (%s)", user.getSortName(), user.getEid());
} catch (UserNotDefinedException e) {
log.info("Owner #: " + owner + " does not have an associated user.");
log.info("Owner #: {} does not have an associated user.", owner);
}
return userDisplayName;
return StringUtils.EMPTY;
}

private static User getUser(String userId) {
Expand Down Expand Up @@ -4314,7 +4316,7 @@ private void createToolBar(UIContainer tofill, SimplePage currentPage) {
UIOutput.make(tofill, "calendar-link").decorate(new UITooltipDecorator(messageLocator.getMessage("simplepage.calendar-descrip")));
UIForm form = UIForm.make(tofill, "add-calendar-form");
UIInput.make(form, "calendar-addBefore", "#{simplePageBean.addBefore}");
makeCsrf(form, "csrf28");
makeCsrf(form, "csrf29");
UICommand.make(form, "add-calendar", "#{simplePageBean.addCalendar}");
}
UIOutput.make(tofill, "quiz-li");
Expand Down
5 changes: 3 additions & 2 deletions lessonbuilder/tool/src/webapp/templates/ShowPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ <h4><span rsf:id="msg=simplepage.linked.content.items"></span></h4>
</a>
<form rsf:id="add-calendar-form" style="display:none" action="#" id="add-calendar-form" method="post" enctype="multipart/form-data">
<input type="hidden" rsf:id="calendar-addBefore" id="calendar-addBefore" />
<input type="hidden" rsf:id="csrf28" />
<input type="hidden" rsf:id="csrf29" />
<input type="submit" rsf:id="add-calendar" id="add-calendar" />
</form>
</li>
Expand Down Expand Up @@ -3140,9 +3140,9 @@ <h4><span rsf:id="peer-eval-target-name"></span></h4>
<img src="/library/image/silk/text_list_bullets.png" class="item-image question-image" />
<span class="lb-offscreen" rsf:id="questionNote"></span>
<div class="questionText fs-4 fw-bold" rsf:id="questionText"></div>
<input type="hidden" class="raw-question-text" rsf:id="raw-question-text" />
<div class="multiplechoiceDiv" rsf:id="multipleChoiceDiv">
<form action="#" rsf:id="multipleChoiceForm" class="multipleChoiceForm">
<input type="hidden" class="raw-question-text" rsf:id="raw-question-text" />
<input type="hidden" rsf:id="csrf4" />
<input type="hidden" rsf:id="multipleChoiceId" />
<span rsf:id="multipleChoiceSelect:"></span>
Expand All @@ -3157,6 +3157,7 @@ <h4><span rsf:id="peer-eval-target-name"></span></h4>

<div class="shortanswerDiv" rsf:id="shortanswerDiv">
<form action="#" rsf:id="shortanswerForm" class="shortanswerForm">
<input type="hidden" class="raw-question-text" rsf:id="raw-question-text" />
<input type="hidden" rsf:id="csrf5" />
<input type="hidden" rsf:id="shortanswerId" />
<div id="answerInput"><span rsf:id="msg=simplepage.answer"></span></div>
Expand Down

0 comments on commit 9160640

Please sign in to comment.