# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/mod/assignment/type/online/assignment.class.php
--- moodle/mod/assignment/type/online/assignment.class.php Base (1.109)
+++ moodle/mod/assignment/type/online/assignment.class.php Locally Modified (Based On 1.109)
@@ -8,6 +8,8 @@
  */
 class assignment_online extends assignment_base {
 
+    var $filearea = 'submission';
+
     function assignment_online($cmid='staticonly', $assignment=NULL, $cm=NULL, $course=NULL) {
         parent::assignment_base($cmid, $assignment, $cm, $course);
         $this->type = 'online';
@@ -49,7 +51,7 @@
                 $data->textformat = NULL;
             }
 
-            $data = file_prepare_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', 'online_submission', $data->sid);
+            $data = file_prepare_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', $this->filearea, $data->sid);
 
             $mform = new mod_assignment_online_edit_form(null, array($data, $editoroptions));
 
@@ -60,7 +62,7 @@
             if ($data = $mform->get_data()) {
                 $submission = $this->get_submission($USER->id, true); //create the submission if needed & its id
 
-                $data = file_postupdate_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', 'online_submission', $submission->id);
+                $data = file_postupdate_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', $this->filearea, $submission->id);
 
                 $submission = $this->update_submission($data);
 
@@ -97,14 +99,14 @@
             } else {
                 echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter', 'online');
                 if ($submission && has_capability('mod/assignment:exportownsubmission', $this->context)) {
-                    $text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'mod_assignment', 'online_submission', $submission->id);
+                    $text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'mod_assignment', $this->filearea, $submission->id);
                     echo format_text($text, $submission->data2);
                     if ($CFG->enableportfolios) {
                         require_once($CFG->libdir . '/portfoliolib.php');
                         $button = new portfolio_add_button();
                         $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id), '/mod/assignment/locallib.php');
                         $fs = get_file_storage();
-                        if ($files = $fs->get_area_files($this->context->id, 'mod_assignment', 'online_submission', $submission->id, "timemodified", false)) {
+                        if ($files = $fs->get_area_files($this->context->id, 'mod_assignment', $this->filearea, $submission->id, "timemodified", false)) {
                             $button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
                         } else {
                             $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
@@ -230,7 +232,7 @@
         }
         $wordcount .= '</p>';
 
-        $text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'mod_assignment', 'online_submission', $submission->id);
+        $text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'mod_assignment', $this->filearea, $submission->id);
         return $wordcount . format_text($text, $submission->data2);
 
 
@@ -276,7 +278,7 @@
     function portfolio_load_data($caller) {
         $submission = $this->get_submission();
         $fs = get_file_storage();
-        if ($files = $fs->get_area_files($this->context->id, 'mod_assignment', 'online_submission', $submission->id, "timemodified", false)) {
+        if ($files = $fs->get_area_files($this->context->id, 'mod_assignment', $this->filearea, $submission->id, "timemodified", false)) {
             $caller->set('multifiles', $files);
         }
     }
@@ -294,7 +296,7 @@
     function portfolio_prepare_package($exporter, $user) {
         $submission = $this->get_submission($user->id);
         $html = format_text($submission->data1, $submission->data2);
-        $html = portfolio_rewrite_pluginfile_urls($html, $this->context->id, 'mod_assignment', 'online_submission', $submission->id, $exporter->get('format'));
+        $html = portfolio_rewrite_pluginfile_urls($html, $this->context->id, 'mod_assignment', $this->filearea, $submission->id, $exporter->get('format'));
         if (in_array($exporter->get('formatclass'), array(PORTFOLIO_FORMAT_PLAINHTML, PORTFOLIO_FORMAT_RICHHTML))) {
             if ($files = $exporter->get('caller')->get('multifiles')) {
                 foreach ($files as $f) {
Index: moodle/mod/assignment/type/online/file.php
--- moodle/mod/assignment/type/online/file.php Base (1.20)
+++ moodle/mod/assignment/type/online/file.php Locally Modified (Based On 1.20)
@@ -59,7 +59,7 @@
     echo '</table>';
     echo $OUTPUT->box_end();
 
-    $text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $context->id, 'mod_assignment', 'online_submission', $submission->id);
\ No newline at end of file
+    $text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $context->id, 'mod_assignment', $assignmentinstance->filearea, $submission->id);
\ No newline at end of file
     echo $OUTPUT->box(format_text($text, $submission->data2), 'generalbox boxaligncenter boxwidthwide');
     echo $OUTPUT->close_window_button();
     echo $OUTPUT->footer();
