Do resource files *have to* be embedded ?

Do resource files *have to* be embedded ?

by Nicolas Dunand -
Number of replies: 12
Picture of Core developers Picture of Plugin developers
Hello,

I recently updated our Moodle to version 1.9.

My problem is the following : when we add a file resource to a course page, clicking on the provided link displays a page with the resource embedded into HTML. For instance, the PDF or SWF file displays embedded into an HTML page.

This is very unconvenient, as :
  • this hardly works right on IE web browsers;
  • usually PDF files display with two vertical scrollbard (i.e., one for the PDF <object>, and one for the HTML page);
  • such embedded SWF files display frequently too small, and I can't figure how to get their size right;
  • to get the file to display correctly, one has to click the "link to the actual file" provided at the bottom of this HTML page.
I couldn't find any setting to display this as wanted by our teachers (i.e. in a new browser window/tab, only PDF or SWF in the page, without any HTML), and the only thing I came out with so far is an ugly hack to the mod/resource/type/file/resource.class.php, changing inside display() the $embedded=true to $embedded=false for the desired file types.

Do any of you know of a cleaner way of doing this ? This would be greatly appreciated.


Regards.
Nicolas
Average of ratings: -
In reply to Nicolas Dunand

Re: Do resource files *have to* be embedded ?

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Are you saying that when you go to 'add a resource' and add your pdf you don't get the message as below?
In reply to Mary Cooch

Re: Do resource files *have to* be embedded ?

by Nicolas Dunand -
Picture of Core developers Picture of Plugin developers
Hi,

Well, yes I can use this setting, but whatever setting I choose (i.e. Same Window or New Window), my PDF and SWF files display embedded into an HTML page.
In reply to Nicolas Dunand

Re: Do resource files *have to* be embedded ?

by Mauno Korpelainen -

If you want to open the pdf or swf file directly you should be able to copy the address of the file from course files (or somewhere in www) with mouse right click -> properties and use normal links in editor with link to that address... for example

link to a swf file

link to a pdf file

In reply to Mauno Korpelainen

Re: Do resource files *have to* be embedded ?

by Mauno Korpelainen -
And you may add these normal links to labels, resources, html blocks...wink

Embed, object or iframe tags and frames are used when you want to place some media file with parameters to a certain "window" inside another document.
In reply to Mauno Korpelainen

Re: Do resource files *have to* be embedded ?

by Nicolas Dunand -
Picture of Core developers Picture of Plugin developers
Thanks for that info Mauno.

Indeed a normal link into a label would do it ... but regarding your second post, how to / is it possible to add a normal link to a resouce (i.e. a file) ?
In reply to Nicolas Dunand

Re: Do resource files *have to* be embedded ?

by Mauno Korpelainen -

Check Administration -> Modules -> Filters -> Manage filters and click Settings at the end of row starting with Multimedia Plugins

If .swf filter is enabled disable it (Note: As a default security measure, normal users should not be allowed to embed swf flash files.)

If .swf filter is enabled all normal links to .swf files will be changed to embedded flash.

In editor write some text, select it, press the link button, browse and select the file from course files or add the web link to URL. Add Title and press OK... works nicely with pdf and also with swf if .swf filter is not enabled.

If you want to add links inside other resource files like Word docs or powerpoint presentations you can copy the links from editor or course files (mouse right click...) to those files, save and upload the files with hyperlinks to course files...

EDIT: ...and the next problem is of course how to embed .swf without the filter? In editor with embed or object tags for htmlarea but in moodle 2.0 tinymce media plugin should also allow embedding media files (if allowed) with a media plugin button (Flash, Shockwave, Quicktime, Windows media and Real media) with selectable parameters without filter if full XHTML rule set is not on...

Attachment files.gif
In reply to Mauno Korpelainen

Re: Do resource files *have to* be embedded ?

by Nicolas Dunand -
Picture of Core developers Picture of Plugin developers
Thanks a lot Mauno for this very clear explanation. grand sourire

This works great indeed !
In reply to Nicolas Dunand

Re: Do resource files *have to* be embedded ?

by Jacques Monnard -
Hi Nicolas,

Just found your message, as the semester just started here and students are having lots of problems with pdf files! Here are the two solutions we are using :
  1. We advise users to upgrade to the latest Adobe Reader (version 9), which seems to solve the problem (for pdf only, of course).
  2. In the resource itself, there is an option "Force download" ("Forcer le téléchargement"). Selecting this will open the document (whether pdf or swf) in the current tab/window, but without anything else surrounding it. The only drawback here is that if users close the window/tab, they are out of their Moodle course (they should use their "Back" button instead).
In reply to Jacques Monnard

Re: Do resource files *have to* be embedded ?

by Hellmuth Sole -

Hi Nicholas, a quick question regarding your "dirty" solution to embedded files.  I'm having the same issue with pdf files only using moodle 1.9.2, and also have found that you have to force download (it's actually stated you have to do this using IE) so it opens within the same window, but as Jacques mentions, if the users close their browser window, you're pretty much lost...

With your not so useful solution, does this open up the save as dialog?  If so, then in my case I'd actually like to know how you do this so I could make the manual hack so my courses would function the way I want them to.

Thanks.

In reply to Hellmuth Sole

Re: Do resource files *have to* be embedded ?

by Nicolas Dunand -
Picture of Core developers Picture of Plugin developers
Hi Hellmuth,

To answer your question : yes my hack-solution makes the web browser display the "save as..." dialog, allowing the user to download the file to whatever place wished on the local computer.

This was the best solution I could come up with so far.
In reply to Jacques Monnard

Re: Do resource files *have to* be embedded ?

by Nicolas Dunand -
Picture of Core developers Picture of Plugin developers
Hi Jacques,

Thanks for the info. I indeed saw your e-mail on monday (I guess I'm on your mdl_user list) ... wink

Thanks also for sharing your solutions ... we indeed also had to tell people to update their Adobe Reader's, but we didn't want to use the "force download" solution as it seemed easier for user experience (because course editor would have to use this setting, and course attendee would have to remember not to close the blank window) to simply hack the code. I just have to keep my Moodle-Hacks documentation up to date for the next upgrade.
In reply to Mauno Korpelainen

Re: Do resource files *have to* be embedded ?

by alex oyuga -

Hi mauno i have a question can i display my pdf files in my moodle account..jst to ease my uploading...And and when i appload content in a text or web page my images dont show please help