Sharing questions with images in Moodle 1.9

Sharing questions with images in Moodle 1.9

by Barbara Lawrence -
Number of replies: 19
We want a group of teachers to be able to create questions which are shared across a department's courses. The department has a moodle course category of its own so I created a question category in this context (called "Shared Questions").

I created a shared question creator role as recommended in Moodle docs, and assigned each of the teachers to this role in the same contextas the "Shared Questions" category.

I also created a metacourse as a parent to all the department's courses because I thought that we could place any image files used by the questions there. But I found that it doesn't work like that: the teachers can see the metacourse, they can see the "Shared Questions" category and they can create questions in that category. However, when they try to insert an image into a question by using the image button in the html editor, although the popup window opens, only the top half of it is displayed - there is no browser window.

If I add the manage files capability to the shared question creator role, then the bottom part of the browser window does become visible, but it is the site files that are displayed, rather than the course files.

However I found a workaround which avoids using site files:

Add a question from within the metacourse:
In the questions tab on the question bank screen, leave the category as the default for the course, then select the desired question type from the Create new question dropdown box. Then, on the edit question page, change the category to "Shared Questions". When the add image button is clicked, the course files are displayed in the browser window, so the the question can be created as required and saved. It then appears in the "Shared Questions" category.

My question is this: should I allow teachers to use this workaround, or should I be forcing them to place images in site files? I have always avoided using site files for sharing and would like to continue avoiding it if possible.




Average of ratings: Useful (1)
In reply to Barbara Lawrence

Re: Sharing questions with images in Moodle 1.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think you have found one of the limitations of the current question bank system, and have found a pretty good work-around.

Another work-around would be to create the questions in any course, then move then to the shared area, which would give you the option to move the files to site files at the same time.

I think the official line at the moment is that all files for shared questions should be in site files.

Looking to the future, Moodle 2.0 changes things so you no longer have general pools like site files, and course files. Instead files are specifically stored with the content that uses them, so you have 'files used in the course description', or 'files used in this question'. That will finally resolve this issue. However, it is still some way off.


In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Daniel McCloy -
Quoting Tim: "Another work-around would be to create the questions in any course, then move then to the shared area, which would give you the option to move the files to site files at the same time."

Maybe this is a fluke of our particular install, but this approach doesn't work. I've been trying to move questions created within a course out to the category level, so that other courses in the category can share the questions. Every time I try to do it, I'm asked how to handle the linked images (four choices: copy images & change links; move images & change links; update links only; or do nothing). The sensible choice would seem to be to either move or copy the images to the category level and have moodle automatically change the links, but when I try this I get a red rectangle around the choice box and red text "filecantmoveto"

Do you have any idea why this won't work? We've tried other methods of sharing our question bank as well, and have met with similar failure. For now our workaround is to move the questions to the category level but leave the images at the course level. In my initial tests this appears to work (meaning the images in questions set up this way are visible from courses other than the course in which the question was authored). However this is not an acceptable long-term solution because eventually the old courses will need to be taken offline, and their images with them.

thanks in advance for any advice.
-- dan

Dan McCloy
Digital Curriculum Development
Dept. of Linguistics
University of Washington
In reply to Daniel McCloy

Re: Sharing questions with images in Moodle 1.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
That is a bug, please report it at http://tracker.moodle.org/ and I will take a look in the new year. Thanks.
In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Susan Mangan -
I'm wondering if anything has happened with this? I did a search for 'filecantmoveto' in the bug db and nothing recent came up. We tried, unsuccessfully, to recover all of our shared question banks with images last year when we upgraded from 1.8 to 1.9 and I was halted by the same error. I guess, at the time, I was so utterly confused I thought perhaps I was doing something wrong. Found a workaround and now we are having similar issues again. I will update this in the tracker - hopefully I didn't just miss it...
In reply to Susan Mangan

Re: Sharing questions with images in Moodle 1.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I guess no one ever filed a bug report, and as a result, I forgot to look into it.

Please can you create a new tracker issue. Then I'll have to find some time to do some bug-fixing.
In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Daniel McCloy -
A bug report was in fact filed, by me, on 27 dec 2009.
http://tracker.moodle.org/browse/MDL-21195

In reply to Daniel McCloy

Re: Sharing questions with images in Moodle 1.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Oops. Right. So the real issue is that I have not had any time to look at it. Sorry.
In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Susan Mangan -
Tim,

I think I understand the concept where a teacher creates a question bank in their course and then moves it to the shared system or category context, at which time, any images in the questions should theoretically copy or move as well (but don't because of the above bug), but once the question and image files are completed and reside in Site files and the teacher then wants to edit the question and perhaps insert a new image, how would they do this?




In reply to Susan Mangan

Re: Sharing questions with images in Moodle 1.9

by Jennie McKelvie -

I have been grappling with the issue of image availability and just come up with a very simple answer.

At my university, all related courses, eg 160 Mathematics, are in the same category (or context). We wanted to have only one version of a very extensive question database to be available to all the maths lecturers. Then any corrections would be conveyed to all instances of the question.

I created a meta-course which holds all the questions (and their associated images) - called MathsQuestionDatabase. I then moved all questions up to Category level and selected the "Don't copy or move files or change links" option- leaving all images still addressed to the meta-course. (NB - all images had been added via the Add/edit image button in the html editor, or coded into multichoice answers).

A course wanting to use the quiz questions is made a child course - quizzes are created in the child courses so that grades are in the correct place. Shared Question Users can pull down any questions from the Category level and assign to a quiz.

Everything in the meta-course is hidden except for a label at the top, and the meta-course is available to students. The Shared Question Creator builds many of the quizzes in here and then imports them into the various child courses. He has also created quizzes that reference all the questions by category as a back-up plan.

Anyone who is a Shared Question Creator can edit the text of questions inside any of the child courses, but needs to be inside the meta-course to make links to any new images.

In our system, images were not visible to students until I created (in the meta-course) a Directory that linked to the folder containing the images in the Files. This directory remains hidden, but provides a potential link to the images and seems to over-ride the permissions issue that was preventing students from seeing any images.
I am sure there must be a proper explanation, but it does seem to work and does not use the Site files (which are not accessible to me).


Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I just got around to looking at this. I am sorry it took so long.

There are two issues here. One is the minor one that the error message filecantmovefrom is missing from the language pack, so people see that cryptic message, rather than a message that explain the situation.

The real issue is that Moodle checks to see whether the user has the 'moodle/course:managefiles' capability in the destination, before it lets them copy files there. (Also, if they are doing a move, it checks it in the source course, before deleting the files.)

I think that permission check is correct, so you need to adjust the permissions so that teachers who can share questions are allowed to manage site files.

However, I am starting to agree with the people who say that it is all too complicated.

In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Daniel McCloy -
I think there is still a further issue, raised above by Susan: once the images reside at the category level, how does one get at them? As I recall the "insert image" file browser doesn't give you a choice between course-level files and category-level files, in the way that the question bank splits question categories into course-level and category-level questions.

And I agree with Susan's comment on the bug tracker, which is that this problem arose for me when I was signed in with administrator privileges for both the course I was moving questions/images FROM, as well as admin privileges for the course category that I was moving the questions/images TO. So I should have passed the permissions check, and did not.

I've mentioned this on other threads, but for anyone still struggling with this issue, there are two work-arounds I've identified. The first one: create a fake course to house the questionbank and images. Then move the questions to the category level, but leave the images in the fake course, and tell moodle not to change the URLs when moving the questions up. Then hack the properties of the fake course so that every student is automatically enrolled in it. That way the questions are available to all course creators/teachers/students within the category, and the images will display properly because everyone passes the permissions check since they are all automatically enrolled in the fake course behind-the-scenes.

The second work-around (not really a work-around at all) was to move all images to a separate server not running moodle, that functions simply as a file repository. Downside: all images must be added by hand-coding the URL. Upside: permissions become irrelevant.
In reply to Daniel McCloy

Re: Sharing questions with images in Moodle 1.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Of course, once Moodle 2.0 is released, this problem should go away. Files are no longer stored in a shared course files area, but are instead stored as belonging to the question they are used by.

I realise that does not help much now, but at least we are moving in the right direction.
In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Jim Gary -
>> Files are no longer stored in a shared course files area, but are instead stored as belonging to the question they are used by.

So how will that affect quizzes created under Moodle 1.9x? Will the upgrade move the files that currently reside in the shared course area? Can we still edit "old" quizzes with 2.0 without causing problems?
In reply to Jim Gary

Re: Sharing questions with images in Moodle 1.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Upgrade from Moodle 1.9 should just work.

If your site does complex things with questions and images, then it would be really helpful if you could test the upgrade on a copy of your site, once MDL-16094 has been fixed.
In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Jim Gary -
>> If your site does complex things with questions and images

If I can avoid creating a copy, I want to! I don't think it's complex. But if you think it is, I'll test it first: I make one category/text book/course. Individual units are treated as separate meta "Moodle Courses". I create individual non-Meta Moodle courses for each class. I do this because each class may progress through a book at different speeds or order or may even skip some units. Also, I found it very difficult to track grades with so many activities - each unit has about 30 activities and there are 16 units/book. Course files are kept in each course's default directory but sound files are kept in a subdirectory of the unit. Questions are kept in each question's category.

So, speaking of file storage, is that complex and do I need to test it first?
In reply to Jim Gary

Re: Sharing questions with images in Moodle 1.9

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think you misunderstood my post.

The bit that is complex is the automated process of updating a Moodle 1.9 site with lots of questions that use images, particularly shared questions.

So, if you are able to make a complete copy of your real Moodle site for testing purposes, then it would be really great if you could test the complex upgrade code for us on that copy. Of course, do you use your real Moodle site for testing like this.

In terms of acutally using it, Moodle 2.0 should be no harder to use that Moodle 1.9, and hopefully in some areas it is actually easier.
In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Susan Mangan -
I have been thinking of trying to get another server for a beta 2.0 install and we do have a fair amount of complexity with our quizzes/question banks/sharing/images. I'll make sure to keep in contact if and when we do this.
In reply to Tim Hunt

Re: Sharing questions with images in Moodle 1.9

by Susan Mangan -

Re: "I think that permission check is correct, so you need to adjust the permissions so that teachers who can share questions are allowed to manage site files."

Perhaps this should be in the documentation.  I understand the concepts and followed everything to a T (I even like the diagram you did smile  however, by default teacher's do not have the ability to store files at the site level.  Simply creating the new role and assigning it at the category context doesn't work.  You then need to create a new role with manage files capability and assign that one on front page roles.  This is a step that I took for granted since the documentation stated that all you had to do was create a role... assign it at the context level (eg, category) and then move your questions into that shared category.   I've read pages on pages of documentation on this stuff and this forum post/bug tracker post is where I finally was able to resolve my issue.  Unless I am missing something....

And I now I have another issue - I don't want my teachers potentially deleting, moving or renaming my site files  mixed

In reply to Susan Mangan

Re: Sharing questions with images in Moodle 1.9

by Susan Mangan -

hmm I just thought of another issue with storing images/media in site files.

This could potentially be a copyright issue in that if permissions were granted for use of certain media then it was most likely given with the understanding that the material would be behind a password-protected course/site and only available to a subset of students online.