Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.9, 1.9.3, 1.9.4
-
Fix Version/s: None
-
Component/s: Assignment (2.2)
-
Labels:None
-
Environment:Tested on
1) OpenOffice 2.4.0 and Firefox 3.0.5 on OpenSUSE
2) MS Word 2003 and IE6.0 on Windows XP
3) MS Word 2003 and Firefox 2.0 on Windows XP
-
Affected Branches:MOODLE_19_STABLE
Description
Tested on 1.9.4 (Build: 20090128), although this problem has existed since at least 1.9 + (Build: 20080425)
While entering comments and grades for assignments in quick grading mode, the child window attempts to update the parent window's content (before closing itself), so the teacher can continue grading without reloading the parent window.
In quick grading mode, a teacher may paste content from other sources (Word, OpenOffice, etc) into the rich text editor, which may contain newline characters. (Example document attached) The embedded newlines cause a Javascript syntax error, so the parent page does not update. The submitted grade and comment are actually received and entered into the database, as one would expect. The changes are just not reflected in the parent window.
Steps to reproduce:
1) Login as a teacher, create an assignment (offline, online text, single or advanced type)
2) View the attempts (via "No attempts have been made on this assignment") link
3) Turn on quick grading
4) Click the "grade" link next to any student
5) Copy the text from the attached word document, and paste it into the rich text editor.
6) Click "save changes"
Expected result: The parent window's "comment" field should update to reflect the comment, and the new grade.
Actual result: A javascript error occurs, and the parent window does not update the grade nor comment.
The JS error, from Firefox's error console is:
Javascript error, Error: unterminated string literal
Source File: http://xxx.yyy.zzz/moodle/mod/assignment/submissions.php
Line: 114
I wrote a hack workaround, which strips out the offending characters before writing the comment's text as the right-hand value of the javascript assignment (Around line 663 in mod/assignment/lib.php):
$submission->submissioncomment=preg_replace('/[\n\r]+/', ' ', $submission->submissioncomment, -1, $replaceCount);
I've attached the full patch of my change, but I'm sure there's a more elegant and appropriate place to solve this one.
This might be considered user error, since it's a problem with the contents of the comment. However, I've had multiple instructors at our institution run into this bug.
In at least one case, an instructor had graded over a dozen students' assignments (with lengthy comments composed in word, pasted to quick grading window), then clicked "Save all my feedback", which promptly replaced all of their lengthy comments with the blank comments (and "no grade" grades) which had originally displayed when he viewed the assignment.
Attachments
Issue Links
| This issue will help resolve: | ||||
| MDL-15791 | Online text assignment: Teacher comments can be lost when using combination of "quick grading" and "comment inline" |
|
|
|
I would prefer to see the code construct the javascript line correctly with the line breaks, rather than strip them out. E.g.:
$submission->submissioncomment = preg_replace('/[\n\r]/', '\n', $submission->submissioncomment);