Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-38253

Adding an editor with files is horrendously inefficent

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_24_STABLE

      Description

      I've just freshly installed Moodle 24 STABLE.

      Doing a simple editor is ridiculously inefficent and costs *100* queries for a student:

      $mform->addElement('editor', 'test', 'test', null, array('maxfiles'=>EDITOR_UNLIMITED_FILES, 'noclean'=>true, 'context'=>$PAGE->context));
      

      Here is a test file which demonstrates the issue:

      <?php
       
      require_once('config.php');
      require_once($CFG->libdir . '/formslib.php');
       
      class test_form extends moodleform {
          public function definition() {
              global $PAGE;
              $mform = & $this->_form;
              $mform->addElement('editor', 'test', 'test', null, array('maxfiles'=>EDITOR_UNLIMITED_FILES, 'noclean'=>true, 'context'=>$PAGE->context));
          }
      }
       
      $PAGE->set_context(context_system::instance());
      $PAGE->set_url(new moodle_url('/testform.php'));
      echo $OUTPUT->header();
      $mform = new test_form();
      $mform->display();
      echo $OUTPUT->footer();
      

      Repositories list should not be populated and passed in JS variables three times for each textarea. Actually it should not be pre-populated at all, filepicker should do it in AJAX request when opened for the first time (if ever opened at all). Also draftareaid should be passed only once as mentioned in MDL-41046 (closed as a duplicate)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              poltawski Dan Poltawski
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: