Details
Description
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!
DIAGNOSTIC
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...
SOLUTIONS
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???)
Joseph
Attachments
Issue Links
| This issue is blocked by: | ||||
| MDL-15571 | Help for radio buttons does not display |
|
|
|
I have finally found a solution to solve this conundrum.
In file question/export_form.php, for each relevant format plugin, I retrieve the Help button code from current($radioarray)
>_helpbutton and add it to current($radioarray)>_text... That way, the Helpbutton is added to the right of the plugin's name. Not so neat as if it could be added to the left of its radio button, but... it works.I am attaching all the relevant patches (for 5 moodle files) in question_format_help_patch_2.txt. And screenshot-2 shows the result...
I have made all of those changes on my moodle test site at http://rezeau.info/moodle/ BE PATIENT, my test site is rather slow...
log in as teacher1, password teacher1, go to Demo course, go to Administration / Questions database. Go to category Rezeau, sub-category What is Moodle?.
Click on the Export questions to file tab, see the Help buttons for the clozejr plugin (and notice that for demo purposes XHTML Format has been provided with its own Help file too).
In the Import questions from file tab, the Learnwise format has been provided with its own Help files too...
Tim, could you please test these proposed changes and commit to 1.9 and HEAD if you agree that they work?
Thanks in advance,
Joseph
>_helpbutton and add it to current($radioarray)>_text... That way, the Helpbutton is added to the right of the plugin's name. Not so neat as if it could be added to the left of its radio button, but... it works. I am attaching all the relevant patches (for 5 moodle files) in question_format_help_patch_2.txt. And screenshot-2 shows the result... I have made all of those changes on my moodle test site at http://rezeau.info/moodle/ BE PATIENT, my test site is rather slow... log in as teacher1, password teacher1, go to Demo course, go to Administration / Questions database. Go to category Rezeau, sub-category What is Moodle?. Click on the Export questions to file tab, see the Help buttons for the clozejr plugin (and notice that for demo purposes XHTML Format has been provided with its own Help file too). In the Import questions from file tab, the Learnwise format has been provided with its own Help files too... Tim, could you please test these proposed changes and commit to 1.9 and HEAD if you agree that they work? Thanks in advance, Joseph