Issue Details (XML | Word | Printable)

Key: MDL-19550
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Tim Hunt
Reporter: Matt Campbell
Votes: 1
Watchers: 3
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Question formats from contrib are not completely pluggable - must modify core lang files.

Created: 17/Jun/09 10:53 PM   Updated: 22/Jun/09 08:41 PM
Return to search
Component/s: Questions
Affects Version/s: 1.9.5
Fix Version/s: 2.0

File Attachments: 1. Text File MDL-19550-head.patch (0.9 kB)
2. Text File MDL-19550.patch (2 kB)
3. Text File MDL-19550.patch (2 kB)

Issue Links:
Dependency
 
Relates
 

Participants: Anthony Borrow, Matt Campbell, Petr Skoda and Tim Hunt
Security Level: None
Resolved date: 19/Jun/09
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
Need to be able to make question formats completely pluggable. Currently, you must edit /lang/LANGUAGE/quiz.php and add the new format for it to display properly. Would like to be able to add contrib question formats without modifying moodle core files.

Suggest that an additional location be added in places_to_search_for_lang_strings function (starting at line 5157 in /lib.moodlelib.php), probably something along the lines of 'qformat_' => array('question/format').

Then you would just need to modify the get_import_export_formats function (starting at line 2029 in /lib/questionlib.php) to allow for this - currently it uses the directory name and looks for it in quiz.php.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Anthony Borrow added a comment - 18/Jun/09 09:08 AM
Tim - Here is a quick and simple stab at this, it just adds an extra attempt to get the string and an additional place to check (questionformat). I'm going to downgrade this to trivial but hopefully this patch will make it painless. I don't want it to distract you from the work on Moodle 2.0 themes. Peace - Anthony

Anthony Borrow added a comment - 18/Jun/09 09:10 AM
Downgrading to trivial. The work around is simple enough to add the string to the lang folder's quiz.php file but it would be nice to make question formats more modular. Peace - Anthony

Tim Hunt added a comment - 18/Jun/09 11:13 AM
I think we should first wait for MDL-16438. Can you do another patch once Petr has committed his work.

Also, we really need separate patches for 1.9 and HEAD. However, your patch is definitely along the right lines, and it would be great to get it committed. Thanks.


Anthony Borrow added a comment - 18/Jun/09 11:43 AM
Thanks Tim - once MDL-16438 is done then I will look and see what needs to happen in 2.0. I remembered that you had done some work refactoring get_string but I could not remember if that was for 1.9 or just for 2.0. I've linked the issues so we can see if it is still an issue for Moodle 2.0. In fact, if you want we could make this tracker issue specific to 1.9 and create another for 2.0 after we confirm it is still an issue. It could be that the new get_string and MDL-16438 work will resolve this issue for HEAD. Peace - Anthony

Tim Hunt added a comment - 18/Jun/09 04:14 PM
By the way, we already have qformat_ in 2.0 for question formats.

Anthony Borrow added a comment - 18/Jun/09 08:36 PM - edited
Tim - Good to know, so then we should probably use qformat_ instead of questionformat_ in the 1.9 patch. I do prefer questionformat_ for better readability. I wonder if qformat deviates a bit from the norm of using whole English words as mentioned in http://docs.moodle.org/en/Development:Coding_style#Naming_Conventions. The simple q could be interpreted as quiz, question, queue, query, etc. Peace - Anthony

Tim Hunt added a comment - 18/Jun/09 09:30 PM
Too late to change it now. qformat is short, at least.

Anthony Borrow added a comment - 19/Jun/09 08:17 AM
Well, switching qformat to questionformat could easily be handled with a quick vim search and replace but it is trivial and not something I feel strongly about so long as we don't start getting lazy and start abbreviating all over the place resulting in cryptic code. I just figured I would mention it to raise awareness. Peace - Anthony

Petr Skoda added a comment - 19/Jun/09 10:27 PM
this was fixed together with the rest of all other plugins types inMDL-16438
thanks for the report, please test and report any problems or regressions

petr


Anthony Borrow added a comment - 20/Jun/09 01:00 AM
Thanks Petr - Since this is fixed in head, do you think it would be worth applying the patch I attached (changing questionformat_ to qformat_) for Moodle 1.9 only? It is a trivial issue but for those affected by it, it could be helpful. Alternatively they could apply the patch if they are so affected. We could just add a comment to the question format installation instructions or just have them continue to patch the /lang/en_utf8/quiz.php file. The workaround is simple enough that that those affected should be able to handle it without too much trouble. Peace - Anthony

Petr Skoda added a comment - 20/Jun/09 02:41 AM
Assigning back to Tim for consideration...

Tim Hunt added a comment - 20/Jun/09 04:26 PM
Anthony, yes, please update the patch and apply it to 1.9. Also, does the bit of the patch that gets the name of the import format need to be applied to head?

Anthony Borrow added a comment - 21/Jun/09 01:47 AM
updated patch file (questionformat changed to qformat)

Anthony Borrow added a comment - 21/Jun/09 05:13 AM
Tim - Sorry I didn't understand your question about: "does the bit of the patch that gets the name of the import format need to be applied to head?" Peace - Anthony

Anthony Borrow added a comment - 21/Jun/09 12:27 PM
Tim - I think this is what you may have been referring to. Yes, in order for the things to work in HEAD we need this. I'll go ahead and commit. Peace - Anthony

Tim Hunt added a comment - 22/Jun/09 01:32 PM
Oops. Anthony typo-ed the issue number in the commit, so you can find the commits for this bug under MDL-19950).

However, the actual code changes are fine. Thanks Anthony.


Anthony Borrow added a comment - 22/Jun/09 08:41 PM
grrr@self