Viewing resource directory and hidden files

Viewing resource directory and hidden files

by Simon Allgood -
Number of replies: 6

Hi,

Does anyone know how to change it so that the display directory does not show any hidden files?

Thanks in advanced.

Average of ratings: -
In reply to Simon Allgood

Re: Viewing resource directory and hidden files

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

If you put the files you want into one directory/folder and display that, then it shouldn't show any files you don't want it to show. You only display the directories with the files in that you want.

In reply to Mary Cooch

Re: Viewing resource directory and hidden files

by Simon Allgood -

The problem is the files i want to hide are txt files for flash files.  The flash files picks a selection of words from the txt files and displays them.  However with the amount of files i have ready to use on moodle. ive uploaded them and displayed the directory. but currently they can see the answers in the txt file.

*added post from other topic*

Re: Viewing resource directory and hidden files
by Mary Cooch - Monday, 12 January 2009, 09:27 PM
Hi again - just answered your other post but now I see you are wanting something slightly different. What are you wanting to do with these 'flash files'? Just offer them to be used by students? Or are they part of an activity which should run? (you mention txt file which makes me think it is part of, say an xml game) If you can explain more I could maybe help (though I'm teaching in 5 mins!)

*Reply*

Yes this is correct.  Basickly ive tryed marking the txt files as hidden in the hope that moodle will not display the but it still does.  I was looking to see if there was a way to edit the view.php file to exclude the hidden files. Or if there was a way of specifing to only display a set file type.

In reply to Simon Allgood

Re: Viewing resource directory and hidden files

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi again

Is it the sort where you have a swf file/html file and txt file? Can you not just use add a resource>link to a file or website and display the swf file?As long as all  connected files are in the same folder - and you have an up to date version of Moodle! - this should work. I use it with Sanfield.co.uk actitities/with languagesonline actitiviesand spellmaster activities 

In reply to Mary Cooch

Re: Viewing resource directory and hidden files

by Simon Allgood -

I was trying to keep all of the links out of the main page of moodle.

Ive just started making a seperate HTML file that links to all of the other html files.  But if anyone knows how to stop the view files from showing hidden files that would be great.

Thanks for the help.

In reply to Simon Allgood

Re: Viewing resource directory and hidden files

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Sorry not with you- what do you want students to be able to see and what do you want them NOT to be able to see? Is it essential they see a directory? Yes you could do 'add a resource>compose a webpage' and hyperlink to the html files of this flash activity there. Then they only have one click and get to the other activities. I don't see why they need to be pointed towards a directory ?

I am trying to keep all of the links out of the main page of Moodle - Not sure if this is relevant but - is this any use? (There's a video link in there too)

In reply to Mary Cooch

Re: Viewing resource directory and hidden files

by Timothy Takemoto -

In /public_html/moodle/mod/resource/type/directoryresource.class.php
at about line 104 there is

    foreach ($files as $file) {
        if ($file == 'backupdata') {
            continue;

Which is basically telling the display routive to skip files which are called 'backupdata.'

None of the following is tested

If you can change the name of the textfiles tosomething standard then you could do this (where "||" is "or")

    foreach ($files as $file) {
        if ($file == 'backupdata' || $file =="textfilename.txt" ) {
            continue;

or you could aso try this if you don't  mind not displaying all files which contain the substring ".txt"

    foreach ($files as $file) {
        if ($file == 'backupdata' ||  preg_match(".txt", $file)  == ".txt") {
            continue;

Hack with care and caution. Bear in mind that hacking makes upgrading and maintaining a secure moodle much more difficult.