I have posted in the resource forum but have got no response; also there is another user who is having exactly the same issues as me who has also received no response.
The two posts are here:
As far as I can tell it is down to the way that view.php is serving the files which differs from the way file.php serves the files. If we use the "direct link to file" then both PDFs and Flash animations display correctly; any other method does not work and is rendering three years worth of setting up Moodle courses a waste of time!
Does anyone know if there is a way to have resources displayed as they used to be, using file.php not view.php?
You seem to be right - I tested your files (great work by the way!!!)
It might be possible to edit files of resource module (view.php and other files) or use old versions of that module but one work around could also be to use Compose a web page instead of Link to a file or web site and to put the place-holder flash inside iframe tags. Then all other flashes are loaded inside iframe but you can set size and other properties of iframe and flash inside it.
A quick test with something as simple as
worked nicely. Just add some more css (centered div, background for page holder page etc)
I can see that working for flash files but we also have the same problem appearing for the way that view.php is handling PDF files that is also causing problems. I can't see the iframe work-around helping those issues...
A more suitable solution would be to have the option to display a resource using the old file.php method (now appearing if you set a pop-up window, as "direct link to this file")
I would need to have a look at the code to see how, if at all, this would be possible; but as it stands the change introduced with view.php is a major show stopper for us. I have over 15 courses each with around 35 flash and pdf files in them that now do not function correctly.
I will try out the iframe idea for the flash files, but it will take ages to update every single one. I would be happier if there was a way to get Moodle to handle the files in the same way as it did before.
test the attached file mod/resource/type/file/resource.class.php
I changed one function - function display() - to use latest moodle 1.7 code and it worked ok with your material on my test server using file.php but I don't quarantee it is totally bug free.
Take first a backup of the original mod/resource/type/file/resource.class.php
Thanks for that! I tried it on my server and it works, in so far that it displays resources using file.php rather than view.php, and yes, the flash files work properly again.
One thing that I did notice however, is that if you select "keep navigation visible" for the resource, it does not keep the course in the navigation and just jumps straight back to the front page of Moodle.
Is it possible to have it keep the navigation visible too?
I have put the original file back in place for now!
I forgot to ask one important question - what version of moodle do you have?
I tested the file with 1.9.3+ (Build: 20081105) and it works here both without and with navigation (frames)...
Edit: now I see what you mean. For example course 2 should have .../course/view.php?id=2 in navigation to redirct to course 2 and not to front page. I must check how it used to work before (moodle 1.6 & 1.7)
How about this attached file. I found the missing navigation items. Do you notice any other missing features?
Thanks for your time on this.
I am going to ask a couple of our teachers who first noticed the problems to check their courses and let me know if everything is handling as they expect now.
Is it possible that this can get put back into the CVS so I do not have to apply this change every time I upgrade?
I am going to let the other person who had seen the issues with PDF files now about this fix you have provided as it seems to solve that problem too.
Again, thank you so much for your time on this!!!
Just in case I added one more navigation code from moodle 1.9.3+ although I did not notice any difference between that previous and this last version. Both seem to work with and without navigation and in popup. Anyway, here's my final version... if you notice anything sent a message...
The official version of moodle 1.9.3+ is totally different - probably people are trying to get it more like moodle 2.0 version for the coming repository changes.
Do you have a way of seeing if files of this type will operate correctly on Moodle 2.0 or is it a case of wait and see?
Thanks again for all your time on this!
Thanx in advance
I know this is so last year, go to:
Above you will find resource.class.php this is the file you need to replace with the one that is attached within this forum.
Still works with 1.9.10+
Hope it helps.
We've tried the suggested fix there (it's a one liner!) and have successfully downloaded the problematic PDF files. We still need to check that IE 7.0 on Vista works (have already checked IE 6.0 on XP, FF 2.x and 3.x on XP and Linux) to confirm the proposed fix and commit the change into CVS.
I suspect a very similar issue is causing the .swf files not to download.
I noticed that bug but this is not exactly the same bug. MDL-14541 solves the case for normal pdf resources and I can confirm that it works on Vista (I have one).
The problem that Jon had was that place holder flash was loaded ok but the inner flash file loaded from the same folder was not rendered...
There are several media file types and this situation looks more complicated than single pdf or flash files inside object tags with params...
Or current file might have some problems with finding the correct path for inner flash files and we might need to add
when flash files are embedded
Jon has good files for testing the bug in http://moodle.org/mod/forum/discuss.php?d=110034
thanks a lot for the details. With Jon's files and the Adobe kb article I've added the lines marked below and I can play the flash embedded file as expected. I need to check that this extra parameter doesn't break non-embedded flash files (it shouldn't) before commiting the changes into CVS.
Add them in .../mod/resource/type/file/resource.class.php, around line 640 (1.9.3+ current as of today)
echo '<param name="loop" value="true" />'; echo '<param name="controller" value="true" />'; echo '<param name="scale" value="aspect" />'; echo '<param name="base" value="." />'; # <-------- This is the new line echo '<!--[if !IE]>-->'; echo "<object type=\"application/x-shockwave-flash\" data=\"$fullurl\">"; echo '<param name="controller" value="true" />'; echo '<param name="autoplay" value="true" />'; echo '<param name="loop" value="true" />'; echo '<param name="scale" value="aspect" />'; echo '<param name="base" value="." />'; # <--------- This is the new line
Could you and Jon check that it actually fixes your problem?
Thanks again for your hard work
I am out of school today (working at another school for the day), but I will add this edit to my file tomorrow and let you know if it fixes the problem.
It does work as expected. Thank you Iñaki!
Oh, one more thing - it fixed the flash embedding problem but there is something else wrong in the current moodle 1.9.3+ resource.class.php:
Even if you leave setting "Keep page navigation visible on the same page" unchecked (should be like (1) ) the file still shows navigation like when that option is checked (2)... but that't controlled by some other tags.
And description has moved down from navigation but that's another tracker issue - http://tracker.moodle.org/browse/MDL-10021
I'm afraid this is beyond the scope of the original bug, and more importantly beyong my knowledge in that area of the code .
I suspect that both things (keeping navigation visible and description appearing at the bottom of the page) are related to the changes introduced with MDL-10021, but I haven't reviewed the whole changeset, so I might be wrong.
I have a problem with resource link too. The resource is an external URL, but the URL is a .pdf file. I want it to open in a new window (it's the lab schedule) but even if it's in the Moodle window the link doesn't work. There's just a blank space where the pdf would be. view.php seems to be the problem. I can force download, but then they are taken out of the Moodle class and beginning students might not know to click the back button to return to the course.
Any way I can just make the resource link open up the actual website instead of using view.php? Yes, there is a link in the "bad" window to go to the actual file, but why make students work with something that is a bug?
I addressed a similar problem by modifying the way Moodle handles some resources, such as PDF files.
See my posts in this thread :
We have Moodle 1.9.3+ (Build: 20081217) and it still seems to have the problem that all old pdf resources are displayed in a new window with an annoying unsizeable "frame" (not sure what it is called, instead of opening a new window that fills properly. We have hundreds of pdf resources that I don't wish to have to go back and fix.
What I would like to be able to do is to have my pdf files open in a new window but not embedded in an html frame. Is there a fix for this, to me, retrograde step?