Skip to content

Commit

Permalink
SAK-33939 solved issues when showing feedback attachments to students (
Browse files Browse the repository at this point in the history
  • Loading branch information
bgarciaentornos authored and ern committed Feb 22, 2018
1 parent 70d4859 commit 409bdb6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,10 @@ private String build_student_view_submission_context(VelocityPortlet portlet, Co

setScoringAgentProperties(context, assignment, s, false);

Map<String, Reference> submissionFeedbackAttachmentReferences = new HashMap<>();
s.getFeedbackAttachments().forEach(r -> submissionFeedbackAttachmentReferences.put(r, entityManager.newReference(r)));
context.put("submissionFeedbackAttachmentReferences", submissionFeedbackAttachmentReferences);

Map<String, String> p = s.getProperties();
if (p.get(ResourceProperties.PROP_SUBMISSION_PREVIOUS_FEEDBACK_TEXT) != null) {
context.put("prevFeedbackText", p.get(ResourceProperties.PROP_SUBMISSION_PREVIOUS_FEEDBACK_TEXT));
Expand Down Expand Up @@ -1914,7 +1918,7 @@ protected String build_student_view_assignment_context(VelocityPortlet portlet,
String template = (String) getContext(data).get("template");
return template + TEMPLATE_STUDENT_VIEW_ASSIGNMENT;

} // build_student_view_submission_context
} // build_student_view_assignment_context

/**
* build the student preview of showing an assignment submission
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#set ($feedbackAttachments = $submission.feedbackAttachments)
#if ($feedbackAttachments)
#set ($size = $feedbackAttachments.size())
#if ($size > 0)
<h4>
$tlang.getString("gen.addinstatts")
</h4>
<ul class="attachList indnt1">
#foreach ($attachmentReference in $feedbackAttachments)
#set ($reference = $submissionFeedbackAttachmentReferences.get($attachmentReference))
#if ($reference)
#set ($props = false)
#set ($props = $reference.Properties)
#if ($!props)
<li>
#if ($props.getBooleanProperty($props.NamePropIsCollection))
<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" alt="$tlang.getString("gen.folatt")" />
#else
<img src = "#imageLink($contentTypeImageService.getContentTypeImage($props.getProperty($props.NamePropContentType)))" border="0" alt="$tlang.getString("gen.filatt")" />
#end
#if ($decoratedUrlMap)
<a href="$decoratedUrlMap.get($reference.Url)" target="_blank">$validator.escapeHtml($props.getPropertyFormatted($props.NamePropDisplayName))</a>
#else
<a href="$reference.Url" target="_blank">$validator.escapeHtml($props.getPropertyFormatted($props.NamePropDisplayName))</a>
#end
#propertyDetails($props)
</li>
#end
#end
#end
</ul>
#end
#end
Original file line number Diff line number Diff line change
Expand Up @@ -450,39 +450,7 @@
#end

## Feedback Attachments
#set ($attachments = $submission.feedbackAttachments)
#if ($attachments)
#set ($size = $attachments.size())
#if ($size > 0)
<h4>
$tlang.getString("gen.addinstatts")
</h4>
<ul class="attachList indnt1">
#foreach ($attachmentReference in $attachments)
#set ($reference = $submissionFeedbackAttachmentReferences.get($attachmentReference))
#if ($reference)
#set ($props = false)
#set ($props = $reference.Properties)
#if ($!props)
<li>
#if ($props.getBooleanProperty($props.NamePropIsCollection))
<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" alt="$tlang.getString("gen.folatt")" />
#else
<img src = "#imageLink($contentTypeImageService.getContentTypeImage($props.getProperty($props.NamePropContentType)))" border="0" alt="$tlang.getString("gen.filatt")" />
#end
#if ($decoratedUrlMap)
<a href="$decoratedUrlMap.get($reference.Url)" target="_blank">$validator.escapeHtml($props.getPropertyFormatted($props.NamePropDisplayName))</a>
#else
<a href="$reference.Url" target="_blank">$validator.escapeHtml($props.getPropertyFormatted($props.NamePropDisplayName))</a>
#end
#propertyDetails($props)
</li>
#end
#end
#end
</ul>
#end
#end
#parse ("/vm/assignment/chef_assignments_student_view_feedback_attachments.vm")

## Show reviewer feedback from peer review (if exist and the peer review is closed)
#if ($peerReviews)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,49 +522,16 @@ $(document).ready(function(){
<h3>$tlang.getString("gen.addinst")</h3>
#end
<div class="textPanel">$validator.escapeHtmlFormattedText($submission.FeedbackComment)</div>
#else
#end
## for returned (not resubmitted ) submission, show the instructor feedback
#if ($!prevFeedbackComment && $!prevFeedbackComment.trim().length() > 0)
<h4 id="toggleGen" class="toggleAnchor"><img alt="expand" class="expand" src="/library/image/sakai/expand.gif" /><img alt="collapse" class="collapse" src="/library/image/sakai/collapse.gif" />
$tlang.getString("gradingsub.prefee2")
</h4>
</h4>
<div class="toggledContent gencoms">
$cheffeedbackhelper.showPrevFeedback($cheffeedbackhelper.escapeAssignmentFeedback($!prevFeedbackComment))</div>
#end
#set ($size = 0)
#set ($props = false)
#set ($feedbackAttachments = $submission.FeedbackAttachments)
#set ($size = 0)
#set ($props = false)
#foreach ($attachment in $feedbackAttachments)
#set ($props = $attachment.Properties)
#if ($!props)
#set ($size = $size + 1)
#end
#end
#if ($size == 0)
##$tlang.getString("gen.noatt")
#else
<h4>$tlang.getString("gen.addinstatts")</h4>
<ul class="attachList indnt1">
#foreach ($attachment in $feedbackAttachments)
#set ($props = false)
#set ($props = $attachment.Properties)
#if ($!props)
<li>
#if ($props.getBooleanProperty($props.NamePropIsCollection))
<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" alt="$tlang.getString("gen.folatt")" />
#else
<img src = "#imageLink($contentTypeImageService.getContentTypeImage($props.getProperty($props.NamePropContentType)))" border="0" alt="$tlang.getString("gen.filatt")" />
#end
<a href="$attachment.Url" target="_blank">$validator.escapeHtml($props.getPropertyFormatted($props.NamePropDisplayName))</a>
#propertyDetails($props)
</li>
#end
#end
</ul>
#end
#parse ("/vm/assignment/chef_assignments_student_view_feedback_attachments.vm")
#end
##just show a simple done button for non-electronic submission type
<form name="dummyForm" action="#toolForm("AssignmentAction")" method="post" onsubmit="return true;">
Expand Down Expand Up @@ -975,49 +942,16 @@ $(document).ready(function(){
<h3>$tlang.getString("gen.addinst")</h3>
#end
<div class="textPanel">$validator.escapeHtmlFormattedText($submission.FeedbackComment)</div>
#else
#end
## for returned (not resubmitted ) submission, show the instructor feedback
#if ($!prevFeedbackComment && $!prevFeedbackComment.trim().length() > 0)
<h4 id="toggleGen" class="toggleAnchor"><img alt="expand" class="expand" src="/library/image/sakai/expand.gif" /><img alt="collapse" class="collapse" src="/library/image/sakai/collapse.gif" />
$tlang.getString("gradingsub.prefee2")
</h4>
</h4>
<div class="toggledContent gencoms">
$cheffeedbackhelper.showPrevFeedback($cheffeedbackhelper.escapeAssignmentFeedback($!prevFeedbackComment))</div>
#end
#set ($size = 0)
#set ($props = false)
#set ($feedbackAttachments = $submission.FeedbackAttachments)
#set ($size = 0)
#set ($props = false)
#foreach ($attachment in $feedbackAttachments)
#set ($props = $attachment.Properties)
#if ($!props)
#set ($size = $size + 1)
#end
#end
#if ($size == 0)
##$tlang.getString("gen.noatt")
#else
<h4>$tlang.getString("gen.addinstatts")</h4>
<ul class="attachList indnt1">
#foreach ($attachment in $feedbackAttachments)
#set ($props = false)
#set ($props = $attachment.Properties)
#if ($!props)
<li>
#if ($props.getBooleanProperty($props.NamePropIsCollection))
<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" alt="$tlang.getString("gen.folatt")" />
#else
<img src = "#imageLink($contentTypeImageService.getContentTypeImage($props.getProperty($props.NamePropContentType)))" border="0" alt="$tlang.getString("gen.filatt")" />
#end
<a href="$attachment.Url" target="_blank">$validator.escapeHtml($props.getPropertyFormatted($props.NamePropDisplayName))</a>
#propertyDetails($props)
</li>
#end
#end
</ul>
#end
#parse ("/vm/assignment/chef_assignments_student_view_feedback_attachments.vm")
## show previous grading/feedback attachments if any
#if ($!prevFeedbackAttachments && $prevFeedbackAttachments.size()>0)
## show previous grading/feedback attachments if any
Expand Down Expand Up @@ -1210,47 +1144,14 @@ $(document).ready(function(){
#if ($submission.getGradeReleased() &&($!submission.FeedbackComment) && ($submission.FeedbackComment.trim().length()>0))
<h5>$tlang.getString("gen.addinst")</h5>
<div>$validator.escapeHtmlFormattedText($submission.FeedbackComment)</div>
#else
#end
## for returned submission, show the instructor feedback
#if ($!prevFeedbackComment && $!prevFeedbackComment.trim().length() > 0)
<h5>$tlang.getString("gradingsub.prefee")</h5>
<div class="textPanel">$cheffeedbackhelper.showPrevFeedback($cheffeedbackhelper.escapeAssignmentFeedback($!prevFeedbackComment))</div>
#end
#set ($size = 0)
#set ($props = false)
#set ($feedbackAttachments = $submission.FeedbackAttachments)
#set ($size = 0)
#set ($props = false)
#foreach ($attachment in $feedbackAttachments)
#set ($props = $attachment.Properties)
#if ($!props)
#set ($size = $size + 1)
#end
#end
#if ($size == 0)
##$tlang.getString("gen.noatt")
#else
<h5>$tlang.getString("gen.addinst")</h5>
<ul class="attachList indnt1">
#foreach ($attachment in $feedbackAttachments)
#set ($props = false)
#set ($props = $attachment.Properties)
#if ($!props)
<li>
#if ($props.getBooleanProperty($props.NamePropIsCollection))
<img src = "#imageLink($contentTypeImageService.getContentTypeImage("folder"))" border="0" alt="$tlang.getString("gen.folatt")" />
#else
<img src = "#imageLink($contentTypeImageService.getContentTypeImage($props.getProperty($props.NamePropContentType)))" border="0" alt="$tlang.getString("gen.filatt")" />
#end
<a href="$attachment.Url" target="_blank">$validator.escapeHtml($props.getPropertyFormatted($props.NamePropDisplayName))</a>
#propertyDetails($props)
</li>
#end
#end
</ul>
#end
#end
#parse ("/vm/assignment/chef_assignments_student_view_feedback_attachments.vm")
#end
#if ($withGrade)
#set ($previousGrades = $!submission.Properties.get($NamePropSubmissionScaledPreviousGrades))
#if ($!previousGrades.length() == 0 )
Expand All @@ -1265,7 +1166,6 @@ $(document).ready(function(){
</div>
#end
#end

#if ($!linkInvoked)
<input type="submit" accesskey="x" onClick="SPNR.disableControlsAndSpin( this, null ); window.close();" name="eventSubmit_doConfirm_assignment_submission" value="$tlang.getString("gen.closeexit")" class="disableme"/>
#else
Expand Down

0 comments on commit 409bdb6

Please sign in to comment.