MDL-15654 Incorrect escaping of HTML in the history table on the review quiz attempt page.

This commit is contained in:
tjhunt
2008-08-20 09:46:18 +00:00
parent 23cbde0a14
commit 21a4ca7d79
3 changed files with 14 additions and 8 deletions
+6
View File
@@ -121,6 +121,12 @@ class question_essay_qtype extends default_questiontype {
return true;
}
function response_summary($question, $state, $length = 80) {
$responses = $this->get_actual_response($question, $state);
$response = reset($responses);
return shorten_text($response, $length);
}
/**
* Backup the extra information specific to an essay question - over and above
* what is in the mdl_question table.
+1 -2
View File
@@ -422,8 +422,7 @@ class question_match_qtype extends default_questiontype {
}
function response_summary($question, $state, $length=80) {
// This should almost certainly be overridden
return substr(implode(', ', $this->get_actual_response($question, $state)), 0, $length);
return shorten_text(implode(', ', $this->get_actual_response($question, $state)), $length);
}
/**
+7 -6
View File
@@ -686,7 +686,7 @@ class default_questiontype {
}
/**
* Return the actual response to the question in a given state
* for the question
* for the question.
*
* @return mixed An array containing the response or reponses (multiple answer, match)
* given by the user in a particular attempt.
@@ -939,7 +939,7 @@ class default_questiontype {
$table->data[] = array (
$link,
$b.get_string('event'.$st->event, 'quiz').$be,
$b.s($this->response_summary($question, $st)).$be,
$b.$this->response_summary($question, $st).$be,
$b.userdate($st->timestamp, get_string('timestr', 'quiz')).$be,
$b.question_format_grade($cmoptions, $st->raw_grade).$be,
$b.question_format_grade($cmoptions, $st->grade).$be
@@ -948,7 +948,7 @@ class default_questiontype {
$table->data[] = array (
$link,
$b.get_string('event'.$st->event, 'quiz').$be,
$b.s($this->response_summary($question, $st)).$be,
$b.$this->response_summary($question, $st).$be,
$b.userdate($st->timestamp, get_string('timestr', 'quiz')).$be,
);
}
@@ -1103,7 +1103,8 @@ class default_questiontype {
*
* This function returns a short string of no more than a given length that
* summarizes the student's response in the given $state. This is used for
* example in the response history table
* example in the response history table. This string should already be,
* for output.
* @return string The summary of the student response
* @param object $question
* @param object $state The state whose responses are to be summarized
@@ -1116,9 +1117,9 @@ class default_questiontype {
$responses = array();
}
if (is_array($responses)) {
$responses = implode(',', $responses);
$responses = implode(',', array_map('s', $responses));
}
return substr($responses, 0, $length);
return shorten_text($responses, $length);
}
/**