-
Improvement
-
Resolution: Unresolved
-
Minor
-
2.0.3, 2.1
-
MOODLE_20_STABLE, MOODLE_21_STABLE
Well first I must say that I don't use GIFT myself, Moodle XML is so much better, and I don't use any question creator software that produce GIFT files not have any archive of questions in GIFT format.
Maybe GIFT has been pushed too far and I souldn't create this tracker issue ?
But I see a lot of Moodle users in the quiz forum are still using it so maybe it would be usefull to still improve it if we can ?
In fact Moodle 2.0 has created a problem for GIFT users that were used to create question with images : previously it was possible to create questions with source urls to files in the course files area. Of course this is no more possible with Moodle 2.0/2.1. Their only solution is to use the question editor IU to manually add the images wich can be tedious if they have many questions.
I also saw your comments in MDL-24594 :
At the moment, GIFT exports like
// question: 4 name: MC Single
::MC Single::[html]<p>Which is the amphibian</p>{
~<p><img src\="@@PLUGINFILE@@/quiz_usage.png" alt\="Graph" width\="645" height\="407" /></p>#<p><img src\="@@PLUGINFILE@@/roles.png" alt\="Flowchart" width\="359" height\="313" /></p>
=<p>Frog</p>\n<p>Toad</p>
~<p>Dog</p>\n<p>XXX<img src\="@@PLUGINFILE@@/quiz_usage.png" alt\="Graph" width\="645" height\="407" /></p>
}
When that is re-imported you get broken images in the question, but otherwise it works. One can use the HTML editor to re-upload the images.
Can anyone thing of a better way than this of handling GIFT? I think we can live with this until someone has a better idea.
and also :
Coming up with a better way to handle references to images when doing GIFT export (which if fundamentally a plain-text format) is a separate problem. I don't have a good solution to suggest at the moment.
Also there is the tracker issue MDL-13905 but I don't like this proposal.
My idea is in fact inspired by my work on the examview format.
Requirements
- don't change anything at actual working of the GIFT format
- permit import of images in a zipped form
- permit export under a form that can be reimported later with no broken images in that cycle
My proposal
- make the gift format import accept either a plain text file or a zip file (I know you will have to modify the working of the mime_type function of all formats and line 132 of import_form.php, but as it is new and as you will have to do it to fix blackboard format I guess this is not a problem ?)
- if it's a text file then no problem all is as before
- if it's a zip file unzip it in a subfolder of /temp
- look for a text file in it and a folder with all images in it
- the text file should be parsed as before except that when an html img tag is found, Verify if there is a corresponding image of that name in the folder. If no then assume it's a reference to an external image and let the tag unchanged. If yes the rewrite the tag as @@PLUGINFILE@@ and import the image in the filesystem with the correct parameters. (as an added compatibility with broken GIFT export we can also do that when we encounter an @@PLUGINFILE@@)
At the end (unless I missed something and there is garbage collection in /temp ?) correctly delete all temporary files in /temp wich all formats cuurently don't do
During export (and this is the little bit that is still unclear to me until questions format can have settings) ask the user if he just want a plain text file or a zip file with all question images and in the 2nd case do the reverse processing converting all @@PLUGINFILE@@ img src urls to relatives ones (foldename/filename) creating the folder with all the images files in it).
To ease all the process the name of the image folder and of the GIFT text file in the zip file could be fixed because as we are creating this feature we can ask users to respect these names don't we ?
- is duplicated by
-
MDL-13905 Image support for GIFT format
- Closed