The only way that it will work with a metacourse is to place the files that you want to be accessible to both courses in the meta-course itself. Anyone who is registered in any child of the meta-course should then be able to access them.
If you want people to be able to access the files directly from the child courses, you can, after creating the file instance in the meta-course, take the URL of the instance (from the address line after clicking on it to make it appear) and place that URL as the URL of a "file or web site" in each child. Of course, it might be simpler just to upload the file into each site if you have to go through so much work!
Of course, if you know what shared files you will need before the courses are set up, you can create a course with all of the files set up with links on the course page, and then save & restore that course to the other courses you need to create. After that, you can individualize each course with other material.
Hello,
Unfortunately there is at the moment no single user-friendly solution for sharing resources (not just files) across courses in Moodle. This is for me the most serious flaw in Moodle. I am satisfied with none of the solutions that are proposed whenever this "sharing of resources" question crops up (which is quite frequently).
Some solutions require that you have admin rights, which is not the case of teachers who work in large institutions. Other solutions rely on the meta-courses, which are not easy to manipulate. And yet other solutions rely on your courses being completely written and static at the beginning of the year, which is not my conception of online courses. For instance, at the moment I have about half a dozen of Glossaries with overlapping entries in half a dozen courses. Whenever I update one entry in one course I have to update it in all of the other courses.
What I would very much like to see is a teacher repository, where I would upload all of the files I need in my various courses (html, pdg, images, glossaries, etc.). Whenever I need to use one of those resources I would simply link to it from any of my own courses. Whenever I would need to update one of those resources it would be automatically updated in all of my courses where it is being used.
Unfortunately I have come to the conclusion that the present architecture of Moodle prevents this solution from being implemented - for the time being at least.
Joseph
The problem with the Site files solution is the lack of transparency, as pointed out by the original poster.
One possible solution to the lack-of-transparency problem would be for Moodle to add an "up one level" folder icon named "Site files" to the Files area of each course. This is probably dangerous. For example, teachers without editing privileges in course 1 would now be able to add, delete, and modify files.
A safer solution would be for Moodle to inject links to individual site files into the course files listing of each course, the same (elegant) way the question database injects links to published categories into the category listings of local question databases. Since these files are truly SHARED across all courses, they would be read-only in the listing (no way to delete, move, edit, or rename).
For example, below is a course files listing for course 2. The course itself has three files and site files has three files. The files happen to have the same names. However Moodle has disambiguated the names by adding the suffix (Site files).
b.html
c.zip
a.txt (Site files)
b.html (Site files)
c.zip (Site files)
You hit the nail on the head there. Wish I had the money to make it happen!
Regards,
Art
http://support.microsoft.com/?kbid=205524
I tested it and it works as the solution Joseph posted
I try to use Myfiles, but installation fail.
I think that solution is not hard to implement. I think that is only put in code an instruction for each child course look at metacourse directory in the file choose window or make a link in child's file manager point to metacourse's file manager. I'm not a good programmer, but it look like an easy task.
Anyone is able to make a patch to this?
Thanks
Inte
Ronaldo
I'm not a good programmer either, but I know what I want is not an easy task. If it were it would have been implemented a long time ago.
Joseph
Joseph you have hit the nail on the head. Now how can we make the following happen:
What I would very much like to see is a teacher repository, where I would upload all of the files I need in my various courses (html, pdg, images, glossaries, etc.). Whenever I need to use one of those resources I would simply link to it from any of my own courses. Whenever I would need to update one of those resources it would be automatically updated in all of my courses where it is being used.
Our in house programmer is more than willing to help. We are possibly going to impliment a work-around but it is very inelegant as it requires coding in the server itself for every new course.
How about some of us collaborating to make these capabilities a reality.
How does one bring such an issue to those in charge at moodle?
Way to go is to post a bug report (it will be called a new feature, in fact) in the Moodle Tracker. My programing skills prevent me from helping in this venture but I am keen to carry out tests, should individuals or teams embark on this venture.
Joseph
The admin, using the shell, creates a subdirectory of moodledata/1 ("Site Files") for each teacher. On my (linux) system, this would be
cd /var/moodledata/1
mkdir Harmsen Isner Rezeau
The admin then creates a symbolic link in the moodledata subdirectory for each course. Let's say Harmsen teaches courses 2, 3, 4, Isner teaches 5, 6, 7, and Rezeau teaches 8, 9, 10. Again, on my system:
cd /var/moodledata
ln -s 1/Harmsen 2/MySiteFiles
ln -s 1/Harmsen 3/MySiteFiles
ln -s 1/Harmsen 4/MySiteFiles
ln -s 1/Isner 5/MySiteFiles
ln -s 1/Isner 6/MySiteFiles
ln -s 1/Isner 7/MySiteFiles
ln -s 1/Rezeau 8/MySiteFiles
ln -s 1/Rezeau 9/MySiteFiles
ln -s 1/Rezeau 10/MySiteFiles
Now within each of his courses, a teacher will see a folder named "MySiteFiles" in the Files area (Administration -> Files). Any files he uploads something into this directory, it will be seen in all his other courses.
The files will be backed up with course 1 as well as with each of the individual course backups. Warning: since files uploaded to here are in site files, "they can be accessed by anyone" so you don't store any sensitive material.
Truly a DMS (Document Management System) would be preferable if you have the ambition.
Our goal is to allow a new course to be created with the symbolic link already in place to our "global content" folder. In addition, if this "global content" folder could be excluded from the individual course backups, this would be the ideal solution which would satisfy our needs until the proposed Repository API solution becomes availiable.
Two variables for config.php :
$CFG->repositorydir
:: points to the directory that the repository is contained in.
$CFG->repositorypointer
:: is the name of the symlink pointing to that directory.
Then update file: <moodleRoot>/lib/setuplib.php
look for the function "make_upload_directory($directroy, $shownotices=true){
towards the end of the functions you will see:
foreach ($dirarray as $dir) {
$currdir = $currdir .'/'. $dir;
if (! file_exists($currdir)) {
if (! mkdir($currdir, $CFG->directorypermissions)) {
if ($shownotices) {
echo '<div class="notifyproblem" align="center">ERROR: Could not find or create a directory ('.
$currdir .')</div>'."<br />\n";
}
return false;
}
//add the following here
else {
if( !empty($CFG->repositorydir) && !empty($CFG->repositorypointer) ) {
if (count($dirarray) == 1) { /* We're creating a root directory */
/* Add check for windows here, symlink will die if it's under windows, maybe add shell command for junction under windows? */
if (!symlink($CFG->repositorydir.'/', $CFG->dataroot.'/'.$dir.'/'.$CFG->repositorypointer)) {
echo 'Symlink has failed!';
}
}
}
}
////
As for permissions, you have multiple layers. At the files system layer, the webserver needs read/write access to the repository (so on linux you define apache to run as a user/group then give that user/group access to the repository). Then the webserver has to allow that particular site read/write. So for apache you modify httpd.conf and use the <Directory> tag.
I would also like to see teachers be able to upload a file one time in one place and, if they change it, only have to change it once so that the changes will show up everywhere the file is referenced.
Does your work-around accomplish this?
Peter
yes
Then it shows up in all courses, correct?
yes
Ideally, I'd like to control where it shows up. In other words, I'd like to put everything in one place and then point to the file from the courses where I want it to appear. Does your scheme allow for this?
yes
----------
If you have a fairly dynamic site, consider using Travis Sobeck's automated solution rather than my manual solution. Be aware that with either method you will end up with copies of your "shared files" in a restored course if the course contains symbolic links (I don't think this is a real problem).
Be aware that with either method you will end up with copies of your "shared files" in a restored course if the course contains symbolic links (I don't think this is a real problem).
This can be a real deal-breaker in a large site, because backups of the course each include a full copy of the shared files, which can fill up a hard disk very quickly when there are many courses.
Warning: since files uploaded to here are in site files, "they can be accessed by anyone" so you don't store any sensitive material.
This is a major security problem and unacceptable for a large, live site where files need to be kept for course users only.
I was able to use a similar strategy, instead using a symbolic link to the files area of another course rather than to the site files. Unfortunately, this no longer works, someone must have changed the code for stronger security.
So now the metacourses are the only way to go. There are two problems with this approach:
1. As mentioned above, the files are not "transparent", so to link to one from a child course you need to go and get the correct link from the metacourse and then paste it in to the former, which is a lot of work.
2. Files from the metacourse used at the site level are not accessible.
It really is a headache in Moodle to share files between courses.
You can say that again. . I agree completely with your assessment of this solution.
It would be nice if Moodle backup/restore respected symbolic links.
So it would still be nice if that could be implemented - and I didn't understand Eloy's comment about why it could not be done, so I just thought I would try and clarify it.
By the way, you could try putting the symbolic link in the 'backupdata' folder, because files in there are not included in backups. That worked for me in the past, although I haven't tested it recently (and I am not that interested in symbolic links any more because they only seem to work with files stored in the insecure site files area). Anyway, if this still works then the bug you created may not be so important any more.
Tim.
I already commented on the brilliance of your 'backupdata' idea in the bug report!
this thread sound like a born of a new module.
Unfortunately,
For now, I don't have easy access to server to test all possible solutions, but I read all messages.
By
Ronaldo
I wonder if there are areas of overlap between this requirement and the e-portfolio requirement we have approaching here in the UK. We are using moodle within our secondary school for on-line courses and also on-line examinations.
For non-moodle applications like Word etc. I use windows (server 2003) scripts to tailor user logon's to point to their appropriate repositories (using mapped drives) A users own space is the Y: drive for example.
Backup of this type of repository is easily automated outside moodle.
I think there may be security issues of apache reaching across the internal network...and restore from backup might not be straight foreward.
This is very similar to what I'd like to have done. We don't have the same issues as you can't use our moodle site unless you are a user of the school network so no-one can get to the site files area without already having access internally.
Wes
Travis I've just added the code you've suggested to the Moodle setup we've got but it doesn't seem to be doing anything is there anything else I have to do within the moodle code to activate this? We're currently using Moodle 1.7.1+ (2006101011).
Wes
I've managed to do it manually I'd like to get the automatic php working but I'm happy enough for now I'll re-write the php then I'll give you a heads up.
Wes
Hi - I have just started to set up a MOODLE at this college and I really need to share files for the structure I want. It seems to me that it would all be fine if I could use, say, a Maths Meta-course to hold common files for all the other individual maths courses. I was disappointed to find that after putting files into the meta-course I could not access them from the child-course. I was looking for the folder for the meta-course in the child file structure - but it wasn't there.
This is going to be very awkward......
Jonathan
Not sure if this is what you are talking about.
Eric
To illustrate the difference, suppose you create a question that you want to share with other teachers. You publish the category. Now other teachers can see your question.
But suppose your question contains an image located in your course files area. Other teachers who are using your question will see a broken link where the image should be. This is because the question is shared but the image is not.
Moodle does not offer a good way to share images and other files among courses. You can always copy them, but copying is not sharing.
I too would like to see a comprehensive solution to sharing content among courses without having to copy it. Until that is possible though, we have to find workarounds.
One workaround which I have used, and which has been suggested earlier on this thread, is symbolic links from the course directory back to a central directory. Symbolic links are not normally available on Windows servers, but they can be simulated using NTFS-link
It is easiest to create symbolic links using SSH (Secure Shell), but even if you do not have Shell access, you can sometimes write a little PHP script to create the symbolic link for you. For example, the script below creates a link from the course whose id is "99" back to a central shared folder:
$to = '/home/sharedfiles';
$from = "/home/moodledata/$courseid/sharedfiles";
print "Creating a symbolic link to $to from $from ... ";
if (symlink( $to, $from )) {
In the above script, you will need to set the $courseid and the $to and $from paths, to what you need in your situation. Save the script as "symlink.php", up load it to your server and then run it by typing its URL into your browser.
Once the symbolic link is set, you (and your students) have free access to files and folders in the shared folder.
Watch out when you delete the course though. The standard Moodle delete scripts are not expecting symbolic links and will go and delete all the files in folder in the shared folder! Yikes!
You can modify the standard Moodle scripts to detect symbolic links and act accordingly as follows:
moodle/lib/filelib.php (around line 512)
if (is_dir($location)) {
NEW:
if (is_link($location)) {
You may need to change some modules as well. For example, I worked on a site that used scorm activities a lot, so we had to make the delete function in the scorm module aware of symbolic links too:
moodle/mod/scorm/locallib.php (around line 74)
if (is_dir($directory)) {
NEW:
if (is_link($directory)) {
As has been noted earlier, if you choose to backup course files when making backups of courses with symbolic links such as I have described above, then the entire shared folder will be backed up for each course which links to it. Probably you don't want this. Tim's idea of putting the links within the course "backupdata" seems a good way to get round this.
hope this helps someone
Gordon
Your code above is very useful.
We see three uses
- to link to centralised store of commonly used images (thumbnails, uni images, logos etc)
- to link to a central shared video folder (we process all video to flv - would make the admin of this a lot easier!)
- to allow tutors to share their own common content among their various courses.
However the identified issue with back-up saving everything is a real problem. If I put the shared folder in backupdata it will not be an obvious place for tutors to look when using the image editor etc, although this is a good workaround
Would anyone be able to advise on code to add to the backup.php to unlink symbolic linked folders to prevent back-up - maybe similar the delete work around?
Many Thanks
Roger
I did this for images to allow sharing of images between courses.
Michael Boardman
mboardman@atlanta.k12.ga.us
Has anybody here experiences in using DOOR (Digital Open Pbject Repository) for the shared files issue? It provides a direct PlugIn to the moodle "Add a resource" menu, and seems to run on the same environment. The only additional software needed is cURL library.
http://sourceforge.net/projects/door/
Marcus
How it works this DOOR thing??? Im not good with PHP (no idea about programming).
I looked on the web a site about the "official open metamod". Havent used it, but i look around and ill tell you about it. |
Would you please explain step by step how to overcome the issue with DOOR. I'm novice in moodle. Thanks.