Moodle

Need a solution for returning raw URLS (eg Youtube videos)

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Repositories
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

For repositories like Youtube we can't download the content. We need to download the URL to the content and store it somehow, either as a plain URL (processed by filter later) or as some parameters to an Object tag or something ...

Activity

Show
Martin Dougiamas added a comment - Related: http://moodle.org/mod/forum/discuss.php?d=103370
Hide
Dongsheng Cai added a comment -

To return a RAW URLs, you need to rewrite get_file function in repository plug-in
function get_file($url, $title){
return $url;
}
Then you will get the url of the resource in form or editor.

Show
Dongsheng Cai added a comment - To return a RAW URLs, you need to rewrite get_file function in repository plug-in function get_file($url, $title){ return $url; } Then you will get the url of the resource in form or editor.
Hide
Martin Dougiamas added a comment -

Can you explain how that will work overall?

How does the calling form (eg some module) specify that it requires a URL or a file ref, and after that, how does that determine which repository plugins that you see? (Or how they behave if they can support file ref AND URL?)

Show
Martin Dougiamas added a comment - Can you explain how that will work overall? How does the calling form (eg some module) specify that it requires a URL or a file ref, and after that, how does that determine which repository plugins that you see? (Or how they behave if they can support file ref AND URL?)
Hide
Dongsheng Cai added a comment -

When you click "select this file" button, file picker will send a download request to repository api, normally, get_file will return the path of the downloaded file, and tell file picker the name and itemid of the file, if get_file return a raw url, itemid will be replaced by raw url (or text format which we talked last week, this will need further work).

Show
Dongsheng Cai added a comment - When you click "select this file" button, file picker will send a download request to repository api, normally, get_file will return the path of the downloaded file, and tell file picker the name and itemid of the file, if get_file return a raw url, itemid will be replaced by raw url (or text format which we talked last week, this will need further work).
Hide
Dongsheng Cai added a comment -
Show
Dongsheng Cai added a comment - see MDL-16911
Hide
Martin Dougiamas added a comment - - edited

For Youtube, we need a filter that will convert links like this:

<a href="http://au.youtube.com/watch?v=ZdVHZwI8pcA">Youtube video</a>

(where the text and domain might change and possible extra parameters might be added) ... to this (very specific XHTML strict code):

<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/ZdVHZwI8pcA" width="320" height="267"><param name="movie" value="http://au.youtube.com/v/ZdVHZwI8pcA" /><param name="FlashVars" value="playerMode=embedded" /><param name="wmode" value="transparent" /></object>

I've made a working example here: http://test.moodle.org/youtube.html

Can you come up with a filter (in fact we could add it to the medialinks filter)? It would help testing...

Show
Martin Dougiamas added a comment - - edited For Youtube, we need a filter that will convert links like this: <a href="http://au.youtube.com/watch?v=ZdVHZwI8pcA">Youtube video</a> (where the text and domain might change and possible extra parameters might be added) ... to this (very specific XHTML strict code): <object type="application/x-shockwave-flash" data="http://www.youtube.com/v/ZdVHZwI8pcA" width="320" height="267"><param name="movie" value="http://au.youtube.com/v/ZdVHZwI8pcA" /><param name="FlashVars" value="playerMode=embedded" /><param name="wmode" value="transparent" /></object> I've made a working example here: http://test.moodle.org/youtube.html Can you come up with a filter (in fact we could add it to the medialinks filter)? It would help testing...
Hide
Martin Dougiamas added a comment -

I started looking at it and before I knew it I'd done the filter in HEAD

Show
Martin Dougiamas added a comment - I started looking at it and before I knew it I'd done the filter in HEAD
Hide
Dongsheng Cai added a comment -

I have to modify 1 file of tiny_mce, I documented it in lib/editor/tinymce/moodle_readme.txt, the patch is attached there.

You don't need to choose another "youtube" in media dialog(this need to modify more files and more lines), I added a function to identify youtube url, and return html code properly.

Show
Dongsheng Cai added a comment - I have to modify 1 file of tiny_mce, I documented it in lib/editor/tinymce/moodle_readme.txt, the patch is attached there. You don't need to choose another "youtube" in media dialog(this need to modify more files and more lines), I added a function to identify youtube url, and return html code properly.
Hide
Dongsheng Cai added a comment -

done, please review

Show
Dongsheng Cai added a comment - done, please review
Hide
Martin Dougiamas added a comment -

Cool, taking a look now.

Show
Martin Dougiamas added a comment - Cool, taking a look now.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: