Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Quiz
    • Labels:
    • Environment:
      qa.moodle.net
    • Rank:
      41214

      Description

      A student uses the Attempt Quiz button or the Re-attempt quiz button to attempt a quiz that contains manually graded items (essay questions) and receives a fatal error. Quizzes with other questions function properly.

      Fatal error: Call to undefined function form_filemanager_render() in /html/question/type/essay/renderer.php on line 116

        Issue Links

          Activity

          Hide
          Carly J Born added a comment -

          I was doing QA testing on qa.moodle.net and discovered this problem. I was working on MDLQA-2019, but I have not failed that ticket as I didn't get so far to actually test the feature in question on that ticket.

          FYI - Just prior to doing this test, qa.moodle.net went through an upgrade.

          Show
          Carly J Born added a comment - I was doing QA testing on qa.moodle.net and discovered this problem. I was working on MDLQA-2019 , but I have not failed that ticket as I didn't get so far to actually test the feature in question on that ticket. FYI - Just prior to doing this test, qa.moodle.net went through an upgrade.
          Hide
          Carly J Born added a comment -

          Logging in as a teacher after the student sees this error, the teacher sees that an attempt was started by the student and is In Progress.

          Show
          Carly J Born added a comment - Logging in as a teacher after the student sees this error, the teacher sees that an attempt was started by the student and is In Progress.
          Hide
          Carly J Born added a comment -

          Logging in as a teacher and trying to preview the questions, it appears that the plain-text essay question is at fault. The preview of that question shows the same rendering error. Whereas the HTML formated essay question renders fine.

          Show
          Carly J Born added a comment - Logging in as a teacher and trying to preview the questions, it appears that the plain-text essay question is at fault. The preview of that question shows the same rendering error. Whereas the HTML formated essay question renders fine.
          Hide
          Pierre Pichet added a comment -

          This issue is link to new code in file renderer see MDL-31901.
          The essay question type seems to be the only place where the obsolete form_filemanager_render() is applied.

          Show
          Pierre Pichet added a comment - This issue is link to new code in file renderer see MDL-31901 . The essay question type seems to be the only place where the obsolete form_filemanager_render() is applied.
          Hide
          Pierre Pichet added a comment -

          The following call in essay/renderer.php
          $fm = new form_filemanager($options);
          $output = $PAGE->get_renderer('core', 'files');
          $html .= $output->render($fm);

          outputs a plausable interface.
          Cannot continue testing as the filetype is not recognized.

          Show
          Pierre Pichet added a comment - The following call in essay/renderer.php $fm = new form_filemanager($options); $output = $PAGE->get_renderer('core', 'files'); $html .= $output->render($fm); outputs a plausable interface. Cannot continue testing as the filetype is not recognized.
          Hide
          Marina Glancy added a comment -

          I replaced the line with proper displaying of filemanager. It works now. Although it is still not exactly correct because filemanager form element rendering should not be used outside the moodle form.

          Thanks for reporting in Carly

          Show
          Marina Glancy added a comment - I replaced the line with proper displaying of filemanager. It works now. Although it is still not exactly correct because filemanager form element rendering should not be used outside the moodle form. Thanks for reporting in Carly
          Hide
          Michael de Raadt added a comment -

          Hi, Carly.

          It would be good if you could fail the linked QA test so we can follow this up properly when the issue is integrated.

          Show
          Michael de Raadt added a comment - Hi, Carly. It would be good if you could fail the linked QA test so we can follow this up properly when the issue is integrated.
          Hide
          Dan Poltawski added a comment -

          Thanks Marina, i've integrated this now.

          If this isn't the proper way to use the filepicker, please file a bug to discuss with Tim - clearly a solution needs to be found.

          Show
          Dan Poltawski added a comment - Thanks Marina, i've integrated this now. If this isn't the proper way to use the filepicker, please file a bug to discuss with Tim - clearly a solution needs to be found.
          Hide
          Carly J Born added a comment -

          Linked the QA where I discovered this issue.

          Show
          Carly J Born added a comment - Linked the QA where I discovered this issue.
          Hide
          Rossiani Wijaya added a comment -

          This is working great.

          Test passed.

          Show
          Rossiani Wijaya added a comment - This is working great. Test passed.
          Hide
          Tim Hunt added a comment -

          Marina,

          Thanks for fixing this.

          Before deleting any API function like form_filemanager_render you should search the whole codebase to see if it is being used anywhere. If you had done that here, this regression would have been avoided.

          It should be possible to display the file-picker in any HTML page, not just in Moodle forms. If the only way to render the filepicker is to create a quickforms element, then that is a problem, but it is not a problem with the essay qtype.

          Show
          Tim Hunt added a comment - Marina, Thanks for fixing this. Before deleting any API function like form_filemanager_render you should search the whole codebase to see if it is being used anywhere. If you had done that here, this regression would have been avoided. It should be possible to display the file-picker in any HTML page, not just in Moodle forms. If the only way to render the filepicker is to create a quickforms element, then that is a problem, but it is not a problem with the essay qtype.
          Hide
          Marina Glancy added a comment -

          Hi Tim,
          yes my bad that I did not search the code properly.

          Please don't confuse file-picker and filemanager-form-element. File-picker allows you to pick a file and return the result to whoever called it. This may be TinyMCE editor image/media/link button, several mod_data fields, and also filepicker form element and filemanager form element, and so on.

          You are using element for moodle form that is called filemanager but you use it outside of moodle form. Fortunately it works.

          Show
          Marina Glancy added a comment - Hi Tim, yes my bad that I did not search the code properly. Please don't confuse file-picker and filemanager-form-element. File-picker allows you to pick a file and return the result to whoever called it. This may be TinyMCE editor image/media/link button, several mod_data fields, and also filepicker form element and filemanager form element, and so on. You are using element for moodle form that is called filemanager but you use it outside of moodle form. Fortunately it works.
          Hide
          Tim Hunt added a comment -

          Yes, you are right we need to distinguish those two things, but actually we need to distinguish three things:

          1. The filepicker, which is just the pop-up window that lets you select 1 file from a repository.

          2. the file manager, as a collection of HTML and JavaScript, that provides the user with the UI to manage the set of files in a draft file area.

          3. the file manager form element, which integrates 2. into the Moodle forms library.

          The problem we have, which dates from the introduction of the Files API in Moodle 2.0, is that the Files API does not really distinguish between 2. and 3., even though, as the essay question demonstrates, sometimes you need 2. Therefore, in order to get 2., I had to abuse 3.

          You are correct to say that is an abuse of 3., but I am only doing that because there is not a nice API for 2. If, in the new 2.3, there is a better way to do 2., please show me how.

          Show
          Tim Hunt added a comment - Yes, you are right we need to distinguish those two things, but actually we need to distinguish three things: 1. The filepicker, which is just the pop-up window that lets you select 1 file from a repository. 2. the file manager, as a collection of HTML and JavaScript, that provides the user with the UI to manage the set of files in a draft file area. 3. the file manager form element, which integrates 2. into the Moodle forms library. The problem we have, which dates from the introduction of the Files API in Moodle 2.0, is that the Files API does not really distinguish between 2. and 3., even though, as the essay question demonstrates, sometimes you need 2. Therefore, in order to get 2., I had to abuse 3. You are correct to say that is an abuse of 3., but I am only doing that because there is not a nice API for 2. If, in the new 2.3, there is a better way to do 2., please show me how.
          Hide
          Marina Glancy added a comment -

          that's a hard question... my answer would be that there is no such instance as your #2, and all forms in moodle should use moodleform. But I know myself perfectly how inflexible they are.

          Well, I guess I'll just keep in mind that somebody might be using filemanager outside of forms when I do my changes to it. I really hope to re-use the code and renderer eventually have a non-editable filemanager (actually, file browser) that will work either with draft file area or normal filearea.

          Show
          Marina Glancy added a comment - that's a hard question... my answer would be that there is no such instance as your #2, and all forms in moodle should use moodleform. But I know myself perfectly how inflexible they are. Well, I guess I'll just keep in mind that somebody might be using filemanager outside of forms when I do my changes to it. I really hope to re-use the code and renderer eventually have a non-editable filemanager (actually, file browser) that will work either with draft file area or normal filearea.
          Hide
          Dan Poltawski added a comment -

          Congratulations!

          Your work has made into the latest Moodle release!

          You are only authorised to celebrate after testing 15 Moodle 2.3 QA tests, thanks!

          Show
          Dan Poltawski added a comment - Congratulations! Your work has made into the latest Moodle release! You are only authorised to celebrate after testing 15 Moodle 2.3 QA tests, thanks!
          Hide
          Tim Hunt added a comment -

          "all forms in moodle should use moodleform". This is clearly not true. Some examples:

          The manage groups UI, the define roles UI, the assign roles / enrol users UI. Every use of $OUTPUT->button and $OUTPUT->single_select (or whatever it is called).

          All these parts of Moodle use forms, without using formslib.

          And, quiz questions are another example where we have a UI that involves HTML form-fields used outside a moodleform.

          Moodleforms are the right way to do many forms in Moodle, but they cannot be used for every instance of the <form> tag in our output.

          Show
          Tim Hunt added a comment - "all forms in moodle should use moodleform". This is clearly not true. Some examples: The manage groups UI, the define roles UI, the assign roles / enrol users UI. Every use of $OUTPUT->button and $OUTPUT->single_select (or whatever it is called). All these parts of Moodle use forms, without using formslib. And, quiz questions are another example where we have a UI that involves HTML form-fields used outside a moodleform. Moodleforms are the right way to do many forms in Moodle, but they cannot be used for every instance of the <form> tag in our output.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: