I got file sharing to work in MyFiles/FileManager with Moodle 1.8

I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Number of replies: 35
Hi,

I have been using Moodle for a while but was never active on this forum. I am doing a PowerSchool & Moodle integration for my client in Thailand. One of the requirements is to share files between students & teachers. I had played with the MyFiles block last year in a pre-1.8 Moodle release and it worked fine. Now, I am setting up my client's server Moodle 1.8 and MyFiles is not working with the file sharing feature. I spent almost a day today to get it to work (by now, I know the Moodle backend DB very well from my PowerSchool integration experience and it helps).

I have modified 3 files namely, print_lib.php, lib.php and sharing.php. You can find all my changes if you search for my initial "DWT" in these files. Can someone take a look at it and see if all the sharing functions are working properly. Please download the hacked/patched version from here:

http://www.opensolutionsasia.com/david/file_manager_dwt_18hack_022408.zip

Whoever manages the source tree, you are welcome to put it in as an official change. I have commented things I did that should be done more properly in the code.

Honestly, this block can use a lot of enhancements. I have all the necessary skills (17 years in software development/consulting) to help but time is lacking though.

Regards,
David Tong
Average of ratings: -
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Please let me know if you have verified the fix and everything works. If you find any problems then I'll try to fix it ASAP. It is my best interest to make sure this works without problems so my client won't complain.

Regards,
David
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Fixed some more problems and in the process I actually made the code to run much faster when sharing files to the whole site. I have a Moodle DB with about 1900 students and 12,000 course enrollments, the old MyFiles code would crap out (times-out after 30 seconds) due to some very inefficient DB calls. Basically, I made it to make one DB call for all students and teachers instead of one DB call for every user.

But, I would suggest you keep the global site sharing off which is the default behavior. If I have time I would rewrite the whole global site sharing feature, it is simply too cumbersome in the current stage. How about some funding here? Just kidding.

David
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Clive Gould -

Hi David

Well done for getting MyFiles working with Moodle 1.8 big grin (We've been waiting for ages for this)

Before I test your module can you answer a question:-

Does it work with Moodle groups i.e can separate groups see separate private file storage areas?

I ask this as I'd like to use MyFiles for student file storage for team projects and would like to ensure one team can't see the other team's files.

Thanks again smile

Clive

In reply to Clive Gould

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Clive - While not the most effecient way, I have sometimes used forums for quick and easy file sharing. I you used separate groups I would think that might accomplish what you are looking for. Of course, I would be happy to see David (or anyone else who is interested) work on this in the file_manager (MyFiles) block. Peace - Anthony
In reply to Clive Gould

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Hi Clive,

The short answer is no, it does not work with groups. I noticed it when I was modifying the DB queries.

I don't think the original code was written for groups and it was all course based. My client also uses groups so I'll take a look for a quick fix if possible.

For your environment, can't you just share files with one particular team by selecting the team members only? When sharing a file, you have the option to share it to all course members or share it to any number of selected members. It should work but a little cumbersome.

Regards,
David
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
David - I created CONTRIB-305 to patch the code and at least get it working. Hopefully some folks will test it and give us a thumbs up and then I will resolve the issue as fixed. Thanks again for your work and sharing it with the Moodle community. If folks have any problems with the block, they can comment on CONTRIB-305. Peace - Anthony
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by andy choo -
Hi,

I have tried to install the hacks, however sharing is still not possible.
When i select the "sharing" option, i could not see the list of students/users which i can share to even though there are users in the same course.

Will appreciate for any help possible.

Thanks,
Andy
In reply to andy choo

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Hi Andy,

Please provide more details. Which "sharing" option are you talking about and how did you get to the page with the "sharing" option? Screen shots with comments would be nice.

Also, in the same course you were trying to perform file sharing, click on the "Participants" link (usually on the top left corner of the course page. Do you see the page filled with students and teacher(s)? On this "participants" page, in "Current role", do you see "Teacher " and "Student"? If you select "Student" from "Current role", do you still see a long list of accounts?

Another thing is if you use customized system roles instead of the default Moodle Teacher and Student roles then file sharing would break and you would not be able to see any users when you want to share your files. To check this, you have to be the administrator, go to the top level home page, click Users->Permissions->Assign system roles, you should see a list of roles. Do you see the "Teacher" and "Student" role? Do these 2 URL links contain roleid=3 for "Teacher" and roleid=5 for students?

Last thing, get the latest version of MyFiles from the same link I provided earlier. I did made some changes within one hour after I did the first upload. I didn't think anyone would have downloaded the original package soon after I posted my first message. I learned assumption is bad on my very first job but see what I am doing again smile.

Regards,
David

In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Finally figured out Andy's problem after exchanging few messages. MyFiles is not using database table prefix so none of the DB calls to the Moodle system tables worked. Well, I always create separate database schemas for different Moodle and non-Moodle MySQL installations so I never ran into the same problem.

I'll get a new fix either today or tomorrow and I'll let you all know. This is fun stuff!

Regards,
David
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Andy Choo verified my fix. Here is the newest version with the fix:

http://www.opensolutionsasia.com/david/file_manager_dwt_18hack_030108.zip

Cheers,
David
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Luciano Rodriguez -
Is myfiles/file manager available for Moodle 1.9? I was able ti install it but all I get "The Link Manager has been Disabled!". Is there a way to fix this? Thanks in advance.

-Luciano
In reply to Luciano Rodriguez

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Luciano,

I haven't tested my fix in 1.9. You are welcome to copy my fix http://www.opensolutionsasia.com/david/file_manager_dwt_18hack_030108.zip to your blocks/file_manager directory and see does it work in 1.9. Please let us know how it turns out.

Regards,
David
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Tom Hogan -
Hello,
I haven't tested extensively, but so far this fix works in my 1.9 installation.
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Alan Taylor -
I've tried it in 1.9 and get the Links Manager has been disabled message. Went so far as removing everything from database and doing new install. Same results.
In reply to Alan Taylor

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Alan Taylor -
Ok, I logged in as a test user and My LInks worked with one slight problem. If I set it up once file is uploaded/downloaded it wants to return to the home page and not the course the test user is enrolled in. Logged in as an admin I get the Link Manager message.
In reply to Alan Taylor

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Luciano Rodriguez -
You are right I get the same thing. One thing we did with was to have the file manager link open up in a new window so students can close it when done.

-Luciano
In reply to Alan Taylor

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Alan,

I think I have seen the problem myself too and I know exactly what you are talking about. It was a minor problem and I have forgotten it in the process of making the main features to work again. I'll try to fix it in a week or 2 and I'll let you guys know.

Cheers,
David
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Alan Taylor -

David,

Thanks for your quick response. I'm glad it is something that has been duplicated (always nice to know I'm not the only one experiencing this). Students are happy to have My Links back and look forward to your next release.

Alan

In reply to David Tong

回應: Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Chiu Charlie -
what's the update now? I have the same error message on 1.9 Beta4!!
In reply to Chiu Charlie

Re: 回應: Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
Chiu,

My fix was implemented after the 1.9 release therefore I don't think it is in 1.9. Anyway, take this http://www.opensolutionsasia.com/david/file_manager_dwt_18hack_030108.zip and copy the files directly into your block/file_manager folder. No need to uninstall and reinstall since there was no DB changes therefore a direct file copy would get you the latest working file manager.

To the rest of the Moodlers, I have been tied up with my work and had no time to work on the file manager. Hopefully, in 2-3 weeks, I'll fix the link issue and also do a CVS cleanup for file manager. I'll keep you posted.

Regards,
David
In reply to David Tong

Re: 回應: Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Jeff Ottinger -
Chiu,
I was just curious if you had gotten a chance to fix the link issue.

Thanks in advance,
Jeff
In reply to Jeff Ottinger

Re: 回應: Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Andrew James Smit -
I'm using Moodle 1.9 and I wonder if anyone has got this error message when they try to view a zipped file in the file manager.

"You cannot view this file!"
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Charles Applegate -

Hi, is it possible to have the file manager block course-independent?

I.e. for a file repositry for students, whatever course they are in? I am thinking about using this block as a 'exemplar' repositry for work students want to show off to anyone else, irrespective of courses. However, I note from the code that there are many references to courses (ids etc).

Thanks for your time with this post, and the project as a whole.

Charles.

In reply to Charles Applegate

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by David Tong -
You can add file manager on the Moodle home/front page and it would allow users to share files with all users on the site.
In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Jason Hollowell -
Picture of Particularly helpful Moodlers
Hello,

I just tried this on the latest version of 1.9 and the install (DB tables etc.) went without issue but when I create the block on the front of my site (or in a course) and set everything (file uploads, file sharing, security) and then try to access the manager by clicking on "MyLinks" I get the following error message:

The Link Manager has been Disabled!

Just curious if there has been any further work on getting this up and running under 1.9?

Jason


In reply to Jason Hollowell

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Jason Hollowell -
Picture of Particularly helpful Moodlers
In the spirit of constructivism, I am experimenting with code and hoping that I'll be able to 'develop' some new knowledge in the process smile

For the "The Link Manager has been Disabled" error, if you open lib.php in your favorite php editing software (Dreamweaver in my case) and edit line 575 as follows:

if ($tmp->enable_fmanager == 0) {

to

if ($tmp->enable_fmanager == 1) {

The "The Link Manager has been Disabled" error disappears and the block seems to function....as admin at least. Admittedly, I have absolutely no idea what the if clause is checking for so this is not a "fix" by any means. Just experimenting in the hopes that I'll learn something smile

Jason

P.S. Just checked and this 'ignorant' modification makes the "The Link Manager has been Disabled" error appear for students....sad

P.P.S. But, changing the value from 1 to 2 makes it work for both admin and students. Ok, I guess I need to spend some time and see what this if clause is checking for huh....

**WARNING** The change in P.P.S. makes the file manager work in 1.9 but you cannot disable the file manager from >security>admin settings>"Enable the file manager">No

I'm just documenting my experimentation.....in real time smile
In reply to Jason Hollowell

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Melissa Benson -
I'm having the same problem. Is the only fix to go into that code in the lib.php file and change it to "2"? I'm using version 1.9.1
In reply to Melissa Benson

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Melissa Benson -
I changed it to "2" and it did work! And you're right smile I can not disable it now that normal way.

This seems like a very very useful tool for our staff development and collaboration! However, it would be great if that problem could get fixed.

Also, I want to be able to allow/disallow certain people or certain roles access to this file manager or permissions to upload/download the files.

Any help would be great! This tool seems great!
In reply to Jason Hollowell

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Doug Loomer -
This module (which I really like) quit working when we upgraded to 1.9.8 last spring. I later made the "if ($tmp->enable_fmanager == 2) {" change to the code and it worked for awhile. But now...we can't create links or folders. Suggestions anyone?
In reply to Doug Loomer

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Doug Loomer -

I just found out that our 1.9.8 install of MyFiles (with the 0 to 2 modification) does work in Safari and Chrome but not in Firefox.  Anyone have the same situation?

In reply to Doug Loomer

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Isabelle Langeveld -

Does this My Files/File manager also work in 2.x???

Or do you guys know another solution for groups who want to have an easy way of file sharing?

In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by John Harald Gartland -
This one is also working with 1.9

JH
Average of ratings: Useful (1)
In reply to John Harald Gartland

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Prashant Bansal -
Hi,
I'm integrating File manager and its working fine with the "f_manager == 2" tweak. I was wondering if there is a new version of File manager with that problem fixed??

Also, is it possible for a teacher to use the files in his/her Mylinks to use as resource in a course??

I apologize if am asking any stupid questions because i'm new to Moodle.

Thanks.
In reply to Prashant Bansal

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by Alex 09 -

Another one working here on 1.9 - One slight annoyance tho is that when visiting sharing.php the page stretches to fill the screen (my theme isn't a full screen theme), which doesn't look too nice. None of the other pages do this?

Cheers
Alex

In reply to David Tong

Re: I got file sharing to work in MyFiles/FileManager with Moodle 1.8

by jane lopez -

Hi Sir, Can i ask for help? We're currently added the file manager block to our moodle 1.9. And i noticed that after clicking the "Share to others!" icon and redirected to http://..../blocks/file_manager/sharing.php?id=14&groupid=0&linkid=14&from='link'&rootdir=0

the list of users were being shown.
Some of our users are complaining that it is quite hard for them to look for names of users to share their files with..
Since i do not enough knowledge to understand the php codes you have made. I am humbly asking for your help.

Is there a way that we can make the list alphabetically? or integrate an sorting option or seach area? thank you in advance. smile