Finally - A working File Manager example!

Finally - A working File Manager example!

by Andrew Normore -
Number of replies: 26

Howdy community. I am pleased to present my first open source contribution! 

What it Does: 3 files to demonstrate clearly how to use a Moodle drag-and-drop file manager. This will demonstrate how to use this compent easily, and is NOOB FRIENDLY smile

Why? As a new Moodle developer, I found it incredibly difficult to understand file managers. I've stuggled for 2 months figuring this out.

Download it: https://github.com/AndyNormore/filemanager

Try It / Install: Just unrar this to your /local directory. (full path is /local/filemanager/index.php). No database changes are necessary.

Thanks: Davo Smith - For contributing!

 

 

SCREEN SHOTS

Managing a File

 1

 Viewing uploaded files

2

Average of ratings: Useful (1)
In reply to Andrew Normore

Re: Finally - A working File Manager example!

by Derek Chirnside -

Hmm.

Interesting, Andrew.

Is it on the net where I can look at it?

At the risk of starting feature creep with your first project here, does it do bulk operation like delete?

Can it do bulk file upload?

Does it have a progress indicator for file upload?

Does it have a display where you can sort by size, date, name?

Does it have a display where I can see file size?

Just curious.  These are some things on my wish list.

-Derek

In reply to Derek Chirnside

Re: Finally - A working File Manager example!

by Matt Bury -
Picture of Plugin developers

Hi Derek,

I think the future of file management in Moodle 2.x is with external 3rd party repositories. If you want to do anything more than upload and display multimedia files, e.g. SMIL, MPEG-7, backup and restore, or exporting activities with dependent media files, Moodle's file API is inappropriate.

It's an extra layer of admin and management but it's infinitely better than trying to do it with Moodle.

In reply to Matt Bury

Re: Finally - A working File Manager example!

by Derek Chirnside -

I'm sure you are right in this respect Matt, and it probably reflects the views of MoodleHQ plus MP.

But IMO there is still a need for the basic management of files (ie without the dependencies you mention as a complication) in the core Moodle to be slightly improved.

I mean a file manager with no sort by size or date?  No bulk delete? No display fle size?  

 

Not a big ask, and I have not given up yet.  What is sad, and I know I have posted this before, there is tons of work making tweaks, making work arounds and making whole new aproachs and the core functions remain much less featured than in the days of 1.9. Why there is not a little effort by gifted coders to work on this I am unsure.

-Derek

In reply to Derek Chirnside

Re: Finally - A working File Manager example!

by Matt Bury -
Picture of Plugin developers

Hi Derek,

I couldn't believe it when I discovered that exporting activities didn't include the dependent files. Who creates text only courses/activities these days?

Do you think it's a deliberate strategy to make the default file manager lame so that it pushes users onto 3rd party systems? Or is it just a case of a shocking lack of imagination and/or consulation? It doesn't look like they've learned any lessons on media embedding from the Moodle 1.9 days either. Are they afraid to ask people who are more experienced with multimedia? Or do they ask and not listen? You know, "Yes, but..." How is that everyone else can develop decent file managers and media embedding strategies that are powerful and flexible and Moodle HQ can't?

...end of rant.

In reply to Matt Bury

Re: Finally - A working File Manager example!

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Matt - I'm just curious as to what you mean by 'exporting activities didn't include the dependent files'.

Are you exporting activities by using Moodle backup, or some other method?

If you are using Moodle backup, then all necessary files are backed up with the activity (as long as the activity backup has been written correctly).

In reply to Davo Smith

Re: Finally - A working File Manager example!

by Matt Bury -
Picture of Plugin developers

Hi Davo,

Tried backing up Glossary instances in Moodle 2.4 containing embedded images and audio. No option to backup files and all I got was an XML file. Same thing happened with course backup and restore. Additionally, trying to serve audio from an external source, even on the same domain name, doesn't seem to trigger Moodle's MP3 filter, so all you get is an href link. I can put in the necessary embedding code manually but this really isn't usable from a teacher's or learner's point of view, i.e. for building collaborative multimedia activities in situe and exporting/sharing them. It'd also be nice to be able to list, zip and export all the media files used by a particular activity and/or course automatically.

I found a bug report in Moodle's tracker. Initially, it was dismissed but then reopened but it doesn't appear to have been resolved.

I released an example of a "starter" multimedia talking dictionary (with only 30 or so entries) for Moodle 1.9 a short while ago under a Creative Commons BY-SA licence: http://blog.matbury.com/2012/10/10/free-talking-picture-dictionary-for-moodle/ I would like to do the same for Moodle 2.x. It would be nice for teachers to be able to create and share multimedia resources between Moodles, don't you think?

Am I missing something?

In reply to Matt Bury

Re: Finally - A working File Manager example!

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Matt,

From a very brief glance at the code - any URL which includes a file extension of a suitable multimedia file (e.g. '.mp3') should get replaced by a media player, if the media filter is enabled (but I'll test it out later).

Glossary also looks like it should backup & restore any files that are contained within it (again, I will test it out later). If it isn't working, then this is not a feature that Moodle developers have decided to ignore (because they don't think it is important, or something), but a clear bug that needs to be fixed in the glossary activity (backup & restore of other activities certainly takes the files with them). As an aside, you won't be given an option to include the files as relevant files are always included in the backup (unless, as mentioned, there is a bug).

Zipping up all the files used by an activity / course should be reasonably straightforward, but it would involve writing a plugin to do it.

In reply to Davo Smith

Re: Finally - A working File Manager example!

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I've just tried it with a Moodle 2.4 site - glossary backed up with all attached / embedded files included (in this case a couple of images). I've attached the result (if you unzip it, you should see the two files are there under 'files', with their details in 'files.xml').

I've also done a quick test with linking to an external mp3 file. This works (ie it is replaced with a media player) if the file path includes the mp3, e.g. http://domain/path/to/file.mp3 but does not work if the file is a parameter to the URL, e.g. http://domain/sendfile.php?file=file.mp3 - maybe this is something that could be addressed in future versions of the filter.

Average of ratings: Useful (1)
In reply to Andrew Normore

Re: Finally - A working File Manager example!

by Matt Bury -
Picture of Plugin developers

Hi Andrew,

My Moodle 2.4 installation is in a subdirectory so I just did a find and replace for "/local/filemanager/" changing to "/m2/local/filemanager/" and everything works fine.

Now I can learn how Moodle 2's file manager works more easily.

Thank you so much for this, you're a star! smile

In reply to Matt Bury

Re: Finally - A working File Manager example!

by Andrew Normore -

Hey fantastic! I'm really happy this helped you! smile

In reply to Andrew Normore

Re: Finally - A working File Manager example!

by Sami Hwang -

Hello Andrew,

You did a fantastic job.

Are you going to create other plug-ins?

How did you figure it out?

Sami

In reply to Sami Hwang

Re: Finally - A working File Manager example!

by Andrew Normore -

Thanks Sami, 

I'm actually building a new theme, itll blow your mind. It'll be the highest quality theme for Moodle, for sure. I'm not sure to release it for free, or sell it for $50 bucks a pop. 

There's a lot of plugins I could write. 

How'd I figure it out? It wasn't easy. I spent 2 months struggling, asking questions, looking at examples. Finally I had an experience co-worker fill me in on the missing details. I felt it necessary to share this knowledge with the Moodle community, as it was lacking.

In reply to Andrew Normore

Re: Finally - A working File Manager example!

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

I'm actually building a new theme, itll blow your mind. It'll be the highest quality theme for Moodle, for sure. I'm not sure to release it for free, or sell it for $50 bucks a pop.

Wow, I can't tell if you are being serious (hope not!) mixed but I'm fairly sure that the Moodle licensing will not allow you to do this...

In reply to Paul Holden

Re: Finally - A working File Manager example!

by Andrew Normore -

Well that's important to know. However, there are plenty of companies selling Moodle products. 

Why would this not be allowed?

In reply to Paul Holden

Re: Finally - A working File Manager example!

by Mauno Korpelainen -
In reply to Mauno Korpelainen

Re: Finally - A working File Manager example!

by Andrew Normore -

Alright, simple enough. You can only have my theme if you're on my hosting platform. Now I sell a service, not Moodle.

Perhaps a Donate button in the settings.php would do. 

Am I right?

In reply to Andrew Normore

Re: Finally - A working File Manager example!

by Sami Hwang -

Hello Andrew,

If you don't mind, could you answer to the following posting?

Since you figure out how to create a file manager, this question will be an easy one for you. I guess stephane( the author of this posting) and I are the similiar stage that we figure out how to create a block that goes to either the right or left column. Yet, we still don't know how to create a form or text php page in the middle within Moodle. Could you share your experience with us? Is there any template for creating any plug-in?

The full posting is in the below.

https://moodle.org/mod/forum/discuss.php?d=222550

p.s : I can donate your mind-blowing theme...^^

Sami

In reply to Sami Hwang

Re: Finally - A working File Manager example!

by Andrew Normore -

Thank you so much. I posted a reply on your thread. I'll release some screen shots of my theme soon...

In reply to Andrew Normore

Re: Finally - A working File Manager example!

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

Hi Andrew,

I have used your code in moosh 0.7 as a template for showing how filemanager should be coded. I have created a new command for that.

cheers,
Tomek

In reply to Tomasz Muras

Re: Finally - A working File Manager example!

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Tomasz - it's great to see the filemanager example included in moosh 0.7, but it's a bit odd that you've called the command 'generate-filepicker' when it appears to be setting up the code for a 'filemanager' element (filepickers can only hold a single file and should not have the existing files copied into them before they are displayed, plus they should, usually, retrieve the file contents on submission, not the files themselves; whereas filemangers have multiple files and usually need the existing files copying into them and then out again when finished).

In reply to Davo Smith

Re: Finally - A working File Manager example!

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

Hi Davo,

You're right. I actually noticed that but it was too late (at night) to change that. I will rename it next time I work on it (0.8).

Thanks for letting me know!
Tomek

In reply to Davo Smith

Re: Finally - A working File Manager example!

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

Renamed to "filemanager" in just released 0.8, thanks Davo.

 

cheers,
Tomek

In reply to Tomasz Muras

Re: Finally - A working File Manager example!

by Andrew Normore -

Hey that's really cool! I'm glad this helped the community.

In reply to Andrew Normore

Re: Finally - A working File Manager example!

by Frankie Kam -
Picture of Plugin developers

Hi Andrew

I'm not sure I understand. I've downloaded the github filemaneger zip file. Then extracted the file contents to /local/filemanager folder.

Matt said:

My Moodle 2.4 installation is in a subdirectory so I just did a find and
>replace for "/local/filemanager/" changing to "/m2/local/filemanager/"
>and everything works fine.

>

My Moodle 2.4 site is located inside my Linux server's "public_html/moodle" folder. So, like Matt, I've renamed the code string "/local/filemanager" in the files /local/filemanager/index.php and /local/filemanager/view.php, to the code string "/moodle/local/filemanager".

Now what?

>and everything works fine.
>
What's supposed to "work fine"?
Pray tell, how do I activate this new feature of the File Manager?

Regards
Frankie Kam

In reply to Andrew Normore

Re: Finally - A working File Manager example!

by Jan Quiesel -

Hey your example was a big help. Thanks a lot for the work you have put in to create this!

However, I still have two remaining issues that I can not solve.

1) Is there a possibility to add a due date to the filemanageroptions?


2) Eventhough I set the maxfiles to 1, the draft area still allows to drop in more files and stores them temporarily.


I solved both problems with a workaround, however it is not quite as elegant as if the filemangaer would provide these options itself.


Cheers,

Jan