MDL-43295 mod_assign: Removed wrongly used format_text call in online text submission.

This commit is contained in:
Adrian Greeve
2013-12-17 10:44:36 +08:00
parent 8703e6530c
commit d868e5331c
3 changed files with 11 additions and 9 deletions
@@ -140,10 +140,6 @@ class assign_submission_onlinetext extends assign_submission_plugin {
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
$text = format_text($data->onlinetext,
$data->onlinetext_editor['format'],
array('context'=>$this->assignment->get_context()));
$fs = get_file_storage();
$files = $fs->get_area_files($this->assignment->get_context()->id,
@@ -158,7 +154,8 @@ class assign_submission_onlinetext extends assign_submission_plugin {
'objectid' => $submission->id,
'other' => array(
'pathnamehashes' => array_keys($files),
'content' => trim($text)
'content' => trim($data->onlinetext),
'format' => $data->onlinetext_editor['format']
)
);
$event = \assignsubmission_onlinetext\event\assessable_uploaded::create($params);
@@ -424,12 +421,9 @@ class assign_submission_onlinetext extends assign_submission_plugin {
// Format the info for each submission plugin (will be logged).
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
$onlinetextloginfo = '';
$text = format_text($onlinetextsubmission->onlinetext,
$onlinetextsubmission->onlineformat,
array('context'=>$this->assignment->get_context()));
$onlinetextloginfo .= get_string('numwordsforlog',
'assignsubmission_onlinetext',
count_words($text));
count_words($onlinetextsubmission->onlinetext));
return $onlinetextloginfo;
}
@@ -60,6 +60,7 @@ class assignsubmission_onlinetext_events_testcase extends advanced_testcase {
$this->assertEquals($context->id, $event->contextid);
$this->assertEquals($submission->id, $event->objectid);
$this->assertEquals(array(), $event->other['pathnamehashes']);
$this->assertEquals(FORMAT_PLAIN, $event->other['format']);
$this->assertEquals('Submission text', $event->other['content']);
$expected = new stdClass();
$expected->modulename = 'assign';
+7
View File
@@ -1,5 +1,12 @@
This files describes API changes in the assign code.
=== 2.6.1 ===
* format_text() is no longer used for formating assignment content to be used in events (assign_submission_onlinetext::save()) or
the word count (assign_submission_onlinetext::format_for_log()) in mod/assign/submission/onlinetext/locallib.php. format_text()
should only be used when displaying information to the screen. It was being used incorrectly before in these areas. Plugins using
the event assessable_uploaded() should use file_rewrite_pluginfile_urls() to translate the text back to the desired output.
=== 2.6 ===
* To see submission/grades of inactive users, user should have moodle/course:viewsuspendedusers capability.
* count_* functions will return only active participants.