Revert "MDL-32870 mod_lesson: added support for files to question answers and responses"
authorDan Poltawski <dan@moodle.com>
Thu, 2 Oct 2014 08:09:16 +0000 (09:09 +0100)
committerDan Poltawski <dan@moodle.com>
Thu, 2 Oct 2014 08:09:16 +0000 (09:09 +0100)
12 files changed:
mod/lesson/backup/moodle2/backup_lesson_stepslib.php
mod/lesson/backup/moodle2/restore_lesson_activity_task.class.php
mod/lesson/backup/moodle2/restore_lesson_stepslib.php
mod/lesson/editpage.php
mod/lesson/lang/en/lesson.php
mod/lesson/lib.php
mod/lesson/locallib.php
mod/lesson/pagetypes/matching.php
mod/lesson/pagetypes/multichoice.php
mod/lesson/pagetypes/truefalse.php
mod/lesson/tests/behat/questions_images.feature [deleted file]
mod/lesson/tests/fixtures/moodle_logo.jpg [deleted file]

index 2ff5ef6..30367de 100644 (file)
@@ -190,8 +190,6 @@ class backup_lesson_activity_structure_step extends backup_activity_structure_st
         // Annotate the file areas in user by the lesson module.
         $lesson->annotate_files('mod_lesson', 'mediafile', null);
         $page->annotate_files('mod_lesson', 'page_contents', 'id');
-        $answer->annotate_files('mod_lesson', 'page_answers', 'id');
-        $answer->annotate_files('mod_lesson', 'page_responses', 'id');
 
         // Prepare and return the structure we have just created for the lesson module.
         return $this->prepare_activity_structure($lesson);
index 3dbbc90..4b8351c 100644 (file)
@@ -55,7 +55,6 @@ class restore_lesson_activity_task extends restore_activity_task {
         $contents = array();
 
         $contents[] = new restore_decode_content('lesson_pages', array('contents'), 'lesson_page');
-        $contents[] = new restore_decode_content('lesson_answers', array('answer', 'response'), 'lesson_answer');
 
         return $contents;
     }
index 34e8371..a06adb5 100644 (file)
@@ -105,7 +105,7 @@ class restore_lesson_activity_structure_step extends restore_activity_structure_
 
         // Set a dummy mapping to get the old ID so that it can be used by get_old_parentid when
         // processing attempts. It will be corrected in after_execute
-        $this->set_mapping('lesson_answer', $data->id, 0, true); // Has related fileareas.
+        $this->set_mapping('lesson_answer', $data->id, 0);
 
         // Answers need to be processed in order, so we store them in an
         // instance variable and insert them in the after_execute stage
@@ -186,7 +186,7 @@ class restore_lesson_activity_structure_step extends restore_activity_structure_
         ksort($this->answers);
         foreach ($this->answers as $answer) {
             $newitemid = $DB->insert_record('lesson_answers', $answer);
-            $this->set_mapping('lesson_answer', $answer->id, $newitemid, true);
+            $this->set_mapping('lesson_answer', $answer->id, $newitemid);
 
             // Update the lesson attempts to use the newly created answerid
             $DB->set_field('lesson_attempts', 'answerid', $newitemid, array(
@@ -199,8 +199,6 @@ class restore_lesson_activity_structure_step extends restore_activity_structure_
         $this->add_related_files('mod_lesson', 'mediafile', null);
         // Add lesson page files, by lesson_page itemname
         $this->add_related_files('mod_lesson', 'page_contents', 'lesson_page');
-        $this->add_related_files('mod_lesson', 'page_answers', 'lesson_answer');
-        $this->add_related_files('mod_lesson', 'page_responses', 'lesson_answer');
 
         // Remap all the restored prevpageid and nextpageid now that we have all the pages and their mappings
         $rs = $DB->get_recordset('lesson_pages', array('lessonid' => $this->task->get_activityid()),
index 786ab33..e61107c 100644 (file)
@@ -85,31 +85,6 @@ if ($edit) {
     $data->id = $cm->id;
     $editoroptions['context'] = $context;
     $data = file_prepare_standard_editor($data, 'contents', $editoroptions, $context, 'mod_lesson', 'page_contents',  $editpage->id);
-
-    $answerscount = 0;
-    $answers = $editpage->get_answers();
-    foreach ($answers as $answer) {
-        $answereditor = 'answer_editor['.$answerscount.']';
-        if (is_array($data->$answereditor)) {
-            $answerdata = $data->$answereditor;
-            $answerdraftid = file_get_submitted_draft_itemid($answereditor);
-            $answertext = file_prepare_draft_area($answerdraftid, $PAGE->cm->context->id,
-                    'mod_lesson', 'page_answers', $answer->id, $editoroptions, $answerdata['text']);
-            $data->$answereditor = array('text' => $answertext, 'format' => $answerdata['format'], 'itemid' => $answerdraftid);
-        }
-
-        $responseeditor = 'response_editor['.$answerscount.']';
-        if (is_array($data->$responseeditor)) {
-            $responsedata = $data->$responseeditor;
-            $responsedraftid = file_get_submitted_draft_itemid($responseeditor);
-            $responsetext = file_prepare_draft_area($responsedraftid, $PAGE->cm->context->id,
-                    'mod_lesson', 'page_responses', $answer->id, $editoroptions, $responsedata['text']);
-            $data->$responseeditor = array('text' => $responsetext, 'format' => $responsedata['format'],
-                    'itemid' => $responsedraftid);
-        }
-        $answerscount++;
-    }
-
     $mform->set_data($data);
     $PAGE->navbar->add(get_string('edit'), new moodle_url('/mod/lesson/edit.php', array('id'=>$id)));
     $PAGE->navbar->add(get_string('editingquestionpage', 'lesson', get_string($mform->qtypestring, 'lesson')));
index 594554f..81fd75c 100644 (file)
@@ -336,9 +336,7 @@ $string['page'] = 'Page: {$a}';
 $string['page-mod-lesson-x'] = 'Any lesson page';
 $string['page-mod-lesson-view'] = 'View or preview lesson page';
 $string['page-mod-lesson-edit'] = 'Edit lesson page';
-$string['pageanswers'] = 'Page answers';
 $string['pagecontents'] = 'Page contents';
-$string['pageresponses'] = 'Page responses';
 $string['pages'] = 'Pages';
 $string['pagetitle'] = 'Page title';
 $string['password'] = 'Password';
index f83a6e5..e21101d 100644 (file)
@@ -865,13 +865,6 @@ function lesson_pluginfile($course, $cm, $context, $filearea, $args, $forcedownl
         }
         $fullpath = "/$context->id/mod_lesson/$filearea/$pageid/".implode('/', $args);
 
-    } else if ($filearea === 'page_answers' || $filearea === 'page_responses') {
-        $itemid = (int)array_shift($args);
-        if (!$pageanswers = $DB->get_record('lesson_answers', array('id' => $itemid))) {
-            return false;
-        }
-        $fullpath = "/$context->id/mod_lesson/$filearea/$itemid/".implode('/', $args);
-
     } else if ($filearea === 'mediafile') {
         if (count($args) > 1) {
             // Remove the itemid when it appears to be part of the arguments. If there is only one argument
@@ -904,8 +897,6 @@ function lesson_get_file_areas() {
     $areas = array();
     $areas['page_contents'] = get_string('pagecontents', 'mod_lesson');
     $areas['mediafile'] = get_string('mediafile', 'mod_lesson');
-    $areas['page_answers'] = get_string('pageanswers', 'mod_lesson');
-    $areas['page_responses'] = get_string('pageresponses', 'mod_lesson');
     return $areas;
 }
 
index 1d77395..9517df2 100644 (file)
@@ -790,19 +790,8 @@ abstract class lesson_add_page_form_base extends moodleform {
         if ($label === null) {
             $label = get_string('answer', 'lesson');
         }
-
-        if ($this->qtype != 'multichoice' && $this->qtype != 'matching') {
-            $this->_form->addElement('editor', 'answer_editor['.$count.']', $label,
-                    array('rows' => '4', 'columns' => '80'), array('noclean' => true));
-            $this->_form->setDefault('answer_editor['.$count.']', array('text' => '', 'format' => FORMAT_MOODLE));
-        } else {
-            $this->_form->addElement('editor', 'answer_editor['.$count.']', $label,
-                    array('rows' => '4', 'columns' => '80'),
-                    array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->_customdata['maxbytes']));
-            $this->_form->setType('answer_editor['.$count.']', PARAM_RAW);
-            $this->_form->setDefault('answer_editor['.$count.']', array('text' => '', 'format' => FORMAT_HTML));
-        }
-
+        $this->_form->addElement('editor', 'answer_editor['.$count.']', $label, array('rows'=>'4', 'columns'=>'80'), array('noclean'=>true));
+        $this->_form->setDefault('answer_editor['.$count.']', array('text'=>'', 'format'=>FORMAT_MOODLE));
         if ($required) {
             $this->_form->addRule('answer_editor['.$count.']', get_string('required'), 'required', null, 'client');
         }
@@ -819,12 +808,8 @@ abstract class lesson_add_page_form_base extends moodleform {
         if ($label === null) {
             $label = get_string('response', 'lesson');
         }
-        $this->_form->addElement('editor', 'response_editor['.$count.']', $label,
-                 array('rows' => '4', 'columns' => '80'),
-                 array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->_customdata['maxbytes']));
-        $this->_form->setType('response_editor['.$count.']', PARAM_RAW);
-        $this->_form->setDefault('response_editor['.$count.']', array('text' => '', 'format' => FORMAT_HTML));
-
+        $this->_form->addElement('editor', 'response_editor['.$count.']', $label, array('rows'=>'4', 'columns'=>'80'), array('noclean'=>true));
+        $this->_form->setDefault('response_editor['.$count.']', array('text'=>'', 'format'=>FORMAT_MOODLE));
         if ($required) {
             $this->_form->addRule('response_editor['.$count.']', get_string('required'), 'required', null, 'client');
         }
@@ -1876,8 +1861,6 @@ abstract class lesson_page extends lesson_base {
         $context = context_module::instance($cm->id);
         $fs = get_file_storage();
         $fs->delete_area_files($context->id, 'mod_lesson', 'page_contents', $this->properties->id);
-        $fs->delete_area_files($context->id, 'mod_lesson', 'page_answers', $this->properties->id);
-        $fs->delete_area_files($context->id, 'mod_lesson', 'page_responses', $this->properties->id);
 
         // repair the hole in the linkage
         if (!$this->properties->prevpageid && !$this->properties->nextpageid) {
@@ -1975,7 +1958,7 @@ abstract class lesson_page extends lesson_base {
      * @return stdClass Returns the result of the attempt
      */
     final public function record_attempt($context) {
-        global $DB, $USER, $OUTPUT, $PAGE;
+        global $DB, $USER, $OUTPUT;
 
         /**
          * This should be overridden by each page type to actually check the response
@@ -2081,9 +2064,6 @@ abstract class lesson_page extends lesson_base {
                     $options->noclean = true;
                     $options->para = true;
                     $options->overflowdiv = true;
-                    $result->response = file_rewrite_pluginfile_urls($result->response, 'pluginfile.php', $context->id,
-                            'mod_lesson', 'page_responses', $result->answerid);
-
                     $result->feedback = $OUTPUT->box(format_text($this->get_contents(), $this->properties->contentsformat, $options), 'generalbox boxaligncenter');
                     $result->feedback .= '<div class="correctanswer generalbox"><em>'.get_string("youranswer", "lesson").'</em> : '.$result->studentanswer; // already in clean html
                     $result->feedback .= $OUTPUT->box($result->response, $class); // already conerted to HTML
@@ -2166,51 +2146,6 @@ abstract class lesson_page extends lesson_base {
         return true;
     }
 
-    /**
-     * save editor answers files and update answer record
-     *
-     * @param object $context
-     * @param int $maxbytes
-     * @param object $answer
-     * @param object $answereditor
-     * @param object $responseeditor
-     */
-    public function save_answers_files($context, $maxbytes, &$answer, $answereditor = '', $responseeditor = '') {
-        global $DB;
-        if (isset($answereditor['itemid'])) {
-            $answer->answer = file_save_draft_area_files($answereditor['itemid'],
-                    $context->id, 'mod_lesson', 'page_answers', $answer->id,
-                    array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $maxbytes),
-                    $answer->answer, null);
-            $DB->set_field('lesson_answers', 'answer', $answer->answer, array('id' => $answer->id));
-        }
-        if (isset($responseeditor['itemid'])) {
-            $answer->response = file_save_draft_area_files($responseeditor['itemid'],
-                    $context->id, 'mod_lesson', 'page_responses', $answer->id,
-                    array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $maxbytes),
-                    $answer->response, null);
-            $DB->set_field('lesson_answers', 'response', $answer->response, array('id' => $answer->id));
-        }
-    }
-
-    /**
-     * Rewrite urls in answer and response of a question answer
-     *
-     * @param object $answer
-     * @return object answer with rewritten urls
-     */
-    public static function rewrite_answers_urls($answer) {
-        global $PAGE;
-
-        $context = context_module::instance($PAGE->cm->id);
-        $answer->answer = file_rewrite_pluginfile_urls($answer->answer, 'pluginfile.php', $context->id,
-                'mod_lesson', 'page_answers', $answer->id);
-        $answer->response = file_rewrite_pluginfile_urls($answer->response, 'pluginfile.php', $context->id,
-                'mod_lesson', 'page_responses', $answer->id);
-
-        return $answer;
-    }
-
     /**
      * Updates a lesson page and its answers within the database
      *
@@ -2266,10 +2201,6 @@ abstract class lesson_page extends lesson_base {
                     $DB->update_record("lesson_answers", $this->answers[$i]->properties());
                 }
 
-                // Save files in answers and responses.
-                $this->save_answers_files($context, $maxbytes, $this->answers[$i],
-                        $properties->answer_editor[$i], $properties->response_editor[$i]);
-
             } else if (isset($this->answers[$i]->id)) {
                 $DB->delete_records('lesson_answers', array('id'=>$this->answers[$i]->id));
                 unset($this->answers[$i]);
@@ -2329,16 +2260,13 @@ abstract class lesson_page extends lesson_base {
      * @return array
      */
     public function create_answers($properties) {
-        global $DB, $PAGE;
+        global $DB;
         // now add the answers
         $newanswer = new stdClass;
         $newanswer->lessonid = $this->lesson->id;
         $newanswer->pageid = $this->properties->id;
         $newanswer->timecreated = $this->properties->timecreated;
 
-        $cm = get_coursemodule_from_instance('lesson', $this->lesson->id, $this->lesson->course);
-        $context = context_module::instance($cm->id);
-
         $answers = array();
 
         for ($i = 0; $i < $this->lesson->maxanswers; $i++) {
@@ -2361,13 +2289,6 @@ abstract class lesson_page extends lesson_base {
                     $answer->score = $properties->score[$i];
                 }
                 $answer->id = $DB->insert_record("lesson_answers", $answer);
-                if (isset($properties->response_editor[$i])) {
-                    $this->save_answers_files($context, $PAGE->course->maxbytes, $answer,
-                            $properties->answer_editor[$i], $properties->response_editor[$i]);
-                } else {
-                    $this->save_answers_files($context, $PAGE->course->maxbytes, $answer,
-                            $properties->answer_editor[$i]);
-                }
                 $answers[$answer->id] = new lesson_page_answer($answer);
             } else {
                 break;
index 1897188..ea0f0f4 100644 (file)
@@ -96,16 +96,13 @@ class lesson_page_type_matching extends lesson_page {
     }
 
     public function create_answers($properties) {
-        global $DB, $PAGE;
+        global $DB;
         // now add the answers
         $newanswer = new stdClass;
         $newanswer->lessonid = $this->lesson->id;
         $newanswer->pageid = $this->properties->id;
         $newanswer->timecreated = $this->properties->timecreated;
 
-        $cm = get_coursemodule_from_instance('lesson', $this->lesson->id, $this->lesson->course);
-        $context = context_module::instance($cm->id);
-
         $answers = array();
 
         // need to add two to offset correct response and wrong response
@@ -130,8 +127,6 @@ class lesson_page_type_matching extends lesson_page {
 
             if (isset($answer->answer) && $answer->answer != '') {
                 $answer->id = $DB->insert_record("lesson_answers", $answer);
-                $this->save_answers_files($context, $PAGE->course->maxbytes,
-                        $answer, $properties->answer_editor[$i]);
                 $answers[$answer->id] = new lesson_page_answer($answer);
             } else if ($i < 2) {
                 $answer->id = $DB->insert_record("lesson_answers", $answer);
@@ -164,9 +159,6 @@ class lesson_page_type_matching extends lesson_page {
 
         $response = $data->response;
         $getanswers = $this->get_answers();
-        foreach ($getanswers as $key => $answer) {
-            $getanswers[$key] = parent::rewrite_answers_urls($answer);
-        }
 
         $correct = array_shift($getanswers);
         $wrong   = array_shift($getanswers);
@@ -341,9 +333,6 @@ class lesson_page_type_matching extends lesson_page {
                 } else {
                     $DB->update_record("lesson_answers", $this->answers[$i]->properties());
                 }
-                // Save files in answers and responses.
-                $this->save_answers_files($context, $maxbytes, $this->answers[$i],
-                        $properties->answer_editor[$i], $properties->response_editor[$i]);
             } else if ($i < 2) {
                 if (!isset($this->answers[$i]->id)) {
                     $this->answers[$i]->id =  $DB->insert_record("lesson_answers", $this->answers[$i]);
@@ -351,9 +340,6 @@ class lesson_page_type_matching extends lesson_page {
                     $DB->update_record("lesson_answers", $this->answers[$i]->properties());
                 }
 
-                // Save files in answers and responses.
-                $this->save_answers_files( $context, $maxbytes, $this->answers[$i],
-                        $properties->answer_editor[$i], $properties->response_editor[$i]);
             } else if (isset($this->answers[$i]->id)) {
                 $DB->delete_records('lesson_answers', array('id'=>$this->answers[$i]->id));
                 unset($this->answers[$i]);
@@ -474,21 +460,12 @@ class lesson_add_page_form_matching extends lesson_add_page_form_base {
     public function custom_definition() {
 
         $this->_form->addElement('header', 'correctresponse', get_string('correctresponse', 'lesson'));
-        $this->_form->addElement('editor', 'answer_editor[0]', get_string('correctresponse', 'lesson'),
-                array('rows' => '4', 'columns' => '80'),
-                array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->_customdata['maxbytes']));
-        $this->_form->setType('answer_editor[0]', PARAM_RAW);
-        $this->_form->setDefault('answer_editor[0]', array('text' => '', 'format' => FORMAT_HTML));
+        $this->_form->addElement('editor', 'answer_editor[0]', get_string('correctresponse', 'lesson'), array('rows'=>'4', 'columns'=>'80'), array('noclean'=>true));
         $this->add_jumpto(0, get_string('correctanswerjump','lesson'), LESSON_NEXTPAGE);
         $this->add_score(0, get_string("correctanswerscore", "lesson"), 1);
 
         $this->_form->addElement('header', 'wrongresponse', get_string('wrongresponse', 'lesson'));
-        $this->_form->addElement('editor', 'answer_editor[1]', get_string('wrongresponse', 'lesson'),
-                array('rows' => '4', 'columns' => '80'),
-                array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->_customdata['maxbytes']));
-        $this->_form->setType('answer_editor[1]', PARAM_RAW);
-        $this->_form->setDefault('answer_editor[1]', array('text' => '', 'format' => FORMAT_HTML));
-
+        $this->_form->addElement('editor', 'answer_editor[1]', get_string('wrongresponse', 'lesson'), array('rows'=>'4', 'columns'=>'80'), array('noclean'=>true));
         $this->add_jumpto(1, get_string('wronganswerjump','lesson'), LESSON_THISPAGE);
         $this->add_score(1, get_string("wronganswerscore", "lesson"), 0);
 
@@ -511,7 +488,7 @@ class lesson_add_page_form_matching extends lesson_add_page_form_base {
 class lesson_display_answer_form_matching extends moodleform {
 
     public function definition() {
-        global $USER, $OUTPUT, $PAGE;
+        global $USER, $OUTPUT;
         $mform = $this->_form;
         $answers = $this->_customdata['answers'];
         $useranswers = $this->_customdata['useranswers'];
@@ -552,9 +529,6 @@ class lesson_display_answer_form_matching extends moodleform {
                     // Temporary fixed until MDL-38885 gets integrated
                     $mform->setType('response', PARAM_TEXT);
                 }
-                $context = context_module::instance($PAGE->cm->id);
-                $answer->answer = file_rewrite_pluginfile_urls($answer->answer, 'pluginfile.php', $context->id,
-                        'mod_lesson', 'page_answers', $answer->id);
                 $mform->addElement('select', $responseid, format_text($answer->answer,$answer->answerformat,$options), $responseoptions, $disabled);
                 $mform->setType($responseid, PARAM_TEXT);
                 if ($hasattempt) {
index 99cbe08..8d8409f 100644 (file)
@@ -77,8 +77,6 @@ class lesson_page_type_multichoice extends lesson_page {
         foreach ($answers as $key=>$answer) {
             if ($answer->answer === '') {
                 unset($answers[$key]);
-            } else {
-                $answers[$key] = parent::rewrite_answers_urls($answer);
             }
         }
         return $answers;
@@ -248,7 +246,6 @@ class lesson_page_type_multichoice extends lesson_page {
             if (!$answer = $DB->get_record("lesson_answers", array("id" => $result->answerid))) {
                 print_error("Continue: answer record not found");
             }
-            $answer = parent::rewrite_answers_urls($answer);
             if ($this->lesson->jumpto_is_correct($this->properties->id, $answer->jumpto)) {
                 $result->correctanswer = true;
             }
index d5584ee..7a8a0f4 100644 (file)
@@ -50,9 +50,6 @@ class lesson_page_type_truefalse extends lesson_page {
     public function display($renderer, $attempt) {
         global $USER, $CFG, $PAGE;
         $answers = $this->get_answers();
-        foreach ($answers as $key => $answer) {
-            $answers[$key] = parent::rewrite_answers_urls($answer);
-        }
         shuffle($answers);
 
         $params = array('answers'=>$answers, 'lessonid'=>$this->lesson->id, 'contents'=>$this->get_contents(), 'attempt'=>$attempt);
@@ -84,7 +81,6 @@ class lesson_page_type_truefalse extends lesson_page {
         }
         $result->answerid = $data->answerid;
         $answer = $DB->get_record("lesson_answers", array("id" => $result->answerid), '*', MUST_EXIST);
-        $answer = parent::rewrite_answers_urls($answer);
         if ($this->lesson->jumpto_is_correct($this->properties->id, $answer->jumpto)) {
             $result->correctanswer = true;
         }
@@ -108,7 +104,6 @@ class lesson_page_type_truefalse extends lesson_page {
         $options->para = false;
         $i = 1;
         foreach ($answers as $answer) {
-            $answer = parent::rewrite_answers_urls($answer);
             $cells = array();
             if ($this->lesson->custom && $answer->score > 0) {
                 // if the score is > 0, then it is correct
@@ -198,9 +193,6 @@ class lesson_page_type_truefalse extends lesson_page {
                 } else {
                     $DB->update_record("lesson_answers", $this->answers[$i]->properties());
                 }
-                // Save files in answers and responses.
-                $this->save_answers_files($context, $maxbytes, $this->answers[$i],
-                        $properties->answer_editor[$i], $properties->response_editor[$i]);
             } else if (isset($this->answers[$i]->id)) {
                 $DB->delete_records('lesson_answers', array('id'=>$this->answers[$i]->id));
                 unset($this->answers[$i]);
@@ -246,7 +238,6 @@ class lesson_page_type_truefalse extends lesson_page {
         $formattextdefoptions->para = false;
         $formattextdefoptions->noclean = true;
         foreach ($answers as $answer) {
-            $answer = parent::rewrite_answers_urls($answer);
             if ($this->properties->qoption) {
                 if ($useranswer == null) {
                     $userresponse = array();
@@ -394,7 +385,6 @@ class lesson_display_answer_form_truefalse extends moodleform {
                 $ansid = 'answer_id';
             }
 
-            $answer = lesson_page::rewrite_answers_urls($answer);
             $mform->addElement('radio', $ansid, null, format_text($answer->answer, $answer->answerformat, $options), $answer->id, $disabled);
             $mform->setType($ansid, PARAM_INT);
             if ($hasattempt && $answer->id == $USER->modattempts[$lessonid]->answerid) {
diff --git a/mod/lesson/tests/behat/questions_images.feature b/mod/lesson/tests/behat/questions_images.feature
deleted file mode 100644 (file)
index 3433d45..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-@mod @mod_lesson
-Feature: In a lesson activity, teacher can add embedded images in questions answers and responses
-  As a teacher
-  I need to add questions with images in answers and responses
-
-  @javascript @_file_upload
-  Scenario: questions with images in answers and responses
-    Given the following "users" exist:
-      | username | firstname | lastname | email |
-      | teacher1 | Teacher | 1 | teacher1@asd.com |
-      | student1 | Student | 1 | student1@asd.com |
-    And the following "courses" exist:
-      | fullname | shortname | category |
-      | Course 1 | C1 | 0 |
-    And the following "course enrolments" exist:
-      | user | course | role |
-      | teacher1 | C1 | editingteacher |
-      | student1 | C1 | student |
-    And I log in as "teacher1"
-    And I navigate to "My private files" node in "My profile"
-    And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager
-    And I click on "Save changes" "button"
-    When I am on homepage
-    And I follow "Course 1"
-    And I turn editing mode on
-    And I add a "Lesson" to section "1" and I fill the form with:
-      | Name | Test lesson name |
-    And I follow "Test lesson name"
-    And I follow "Add a question page"
-    And I set the field "Select a question type" to "Multichoice"
-    And I press "Add a question page"
-    And I set the following fields to these values:
-      | Page title | Multichoice question |
-      | Page contents | What animal is an amphibian? |
-      | id_answer_editor_0 | Frog |
-      | id_response_editor_0 | Correct answer |
-      | id_jumpto_0 | Next page |
-      | id_score_0 | 1 |
-      | id_answer_editor_1 | Cat |
-      | id_response_editor_1 | Incorrect answer |
-      | id_jumpto_1 | This page |
-      | id_score_1 | 0 |
-      | id_answer_editor_2 | Dog |
-      | id_response_editor_2 | Incorrect answer |
-      | id_jumpto_2 | This page |
-      | id_score_2 | 0 |
-    And I click on "Image" "button" in the "#fitem_id_answer_editor_2" "css_element"
-    And I click on "Browse repositories..." "button"
-    And I click on "Private files" "link"
-    And I click on "moodle_logo.jpg" "link"
-    And I click on "Select this file" "button"
-    And I set the field "Describe this image for someone who cannot see it" to "It's the logo"
-    And I click on "Save image" "button"
-    And I press "Save page"
-    And I set the field "qtype" to "Question"
-    And I set the field "Select a question type" to "True/false"
-    And I press "Add a question page"
-    And I set the following fields to these values:
-      | Page title | Next question |
-      | Page contents | Paper is made from trees. |
-      | id_answer_editor_0 | True |
-      | id_response_editor_0 | Correct |
-      | id_jumpto_0 | Next page |
-      | id_answer_editor_1 | False |
-      | id_response_editor_1 | Wrong |
-      | id_jumpto_1 | This page |
-    And I click on "Image" "button" in the "#fitem_id_response_editor_0" "css_element"
-    And I click on "Browse repositories..." "button"
-    And I click on "Private files" "link"
-    And I click on "moodle_logo.jpg" "link"
-    And I click on "Select this file" "button"
-    And I set the field "Describe this image for someone who cannot see it" to "It's the logo"
-    And I click on "Save image" "button"
-    And I press "Save page"
-    And I log out
-    And I log in as "student1"
-    And I follow "Course 1"
-    When I follow "Test lesson name"
-    Then I should see "What animal is an amphibian?"
-    And "//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist in the ".answeroption" "css_element"
-    And "//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist in the ".answeroption" "css_element"
-    And I set the following fields to these values:
-      | Cat | 1 |
-    And I press "Submit"
-    And I should see "Incorrect answer"
-    And I press "Continue"
-    And I should see "Paper is made from trees."
-    And I set the following fields to these values:
-      | True | 1 |
-    And I press "Submit"
-    And I should see "Correct"
-    And I should not see "Wrong"
-    And "//img[contains(@src, 'pluginfile.php')]" "xpath_element" should exist in the ".correctanswer" "css_element"
-    And "//img[contains(@src, 'moodle_logo.jpg')]" "xpath_element" should exist in the ".correctanswer" "css_element"
-    And I press "Continue"
-    And I should see "Congratulations - end of lesson reached"
-    And I should see "Your score is 1 (out of 2)."
diff --git a/mod/lesson/tests/fixtures/moodle_logo.jpg b/mod/lesson/tests/fixtures/moodle_logo.jpg
deleted file mode 100644 (file)
index f2d5365..0000000
Binary files a/mod/lesson/tests/fixtures/moodle_logo.jpg and /dev/null differ