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

Making a Help button available for new plugin questions export/import formats.



    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Questions
    • Labels:
    • Affected Branches:
    • Fixed Branches:


      Moodle Improvement
      Moodle Questions.
      Making a Help button available for new plugin questions export/import formats.
      See forum discussion: http://moodle.org/mod/forum/discuss.php?d=94739
      Work done so far:

      1- in file lib/moodlelib.php added
      'qformat_' => array('question/format') (as suggested by Tim in forum discussion)

      2- in file question/format.php added
      function has_import_help_file() {
      return false;
      function has_export_help_file() {
      return false;
      NOTE.- New plugins will have to declare their existence of their help file for import or export as true.

      3- in file lib/questionlib.php
      introduced $hashelpfile, $fileformat and $formatname, now returns $fileformatnames as an array of arrays. See attached patch file for details

      4- in file questions/export_form.php
      Added setHelpButton for those plugin formats which have their own lang files... See patch file for more details...

      NOTE.- If we managed to get the export_form new help buttons to work, similar changes will have to be made to file import_form.php of course.
      I am currently stumped by the following problem...
      I am testing this with my own clozejr export format type, and I have also provisionally made XHTML format a "new" plugin format for testing purposes.
      The necessary Help buttons are correctly created for each plugin format type not included in the moodle distribution.
      They are displayed when I dump the $mform array and they do work as expected when clicked (see attached screenshot) but... the individual radio buttons Help buttons are **not displayed** within the $radioarray,'format' group!


      It seems that it is not possible for moodleforms to attach Help buttons to those radio buttons because they all have the same name 'format'... even though those Help buttons are indeed present in $mform...


      One solution would be to give each individual button a different name (instead of naming them all 'format'), e.g. name them after their formatname. Plus, they should be added as single elements to $mform, not as a group.
      RESULT: this works as far as the individual Help buttons are displayed where relevant, but... it does not work because then those radio buttons are not inside a group, and can all be clicked... And even when one radio button only is clicked, its name is sent as form data, instead of the expected 'format' key, so things go wrong in question/export.php...

      WISHED SOLUTION (if it exists)...
      moodle forms should display Help buttons which have been correctly created even if those buttons reside within groups and even if they have identical names (maybe Help buttons should be lined to IDs, not names???)



          Issue Links



              howardsmiller Howard Miller
              rezeau Joseph Rézeau
              Component watchers:
              Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              0 Vote for this issue
              2 Start watching this issue


                Fix Release Date: