Issue Details (XML | Word | Printable)

Key: MDL-16650
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Dongsheng Cai
Reporter: Martin Dougiamas
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-13766

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

Created: 24/Sep/08 04:04 PM   Updated: 05/Dec/08 11:02 AM
Return to search
Component/s: Repository API
Affects Version/s: 2.0
Fix Version/s: 2.0

Participants: Dongsheng Cai and Martin Dougiamas
Security Level: None
Resolved date: 05/Dec/08
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
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 ...

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martin Dougiamas made changes - 16/Oct/08 05:17 PM
Field Original Value New Value
Assignee Martin Dougiamas [ dougiamas ] Dongsheng Cai [ dongsheng ]
Martin Dougiamas added a comment - 16/Oct/08 05:26 PM

Dongsheng Cai committed 1 file to 'Moodle CVS' - 20/Oct/08 09:40 AM
"MDL-16650, return raw URLs directly"
MODIFY repository/Attic/ws.php   Rev. 1.44    (+9 -6 lines)
Dongsheng Cai added a comment - 20/Oct/08 09:42 AM
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.

Dongsheng Cai made changes - 20/Oct/08 09:42 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Martin Dougiamas added a comment - 20/Oct/08 10:45 AM
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?)


Martin Dougiamas made changes - 20/Oct/08 10:45 AM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Dongsheng Cai added a comment - 23/Oct/08 12:06 PM
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).

Dongsheng Cai committed 1 file to 'Moodle CVS' - 23/Oct/08 12:26 PM
"MDL-16650, fixed bug of returning raw urls"
MODIFY repository/Attic/ws.php   Rev. 1.45    (+2 -2 lines)
Dongsheng Cai added a comment - 23/Oct/08 12:32 PM

Martin Dougiamas added a comment - 25/Nov/08 03:08 PM - 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...


moodler committed 3 files to 'Moodle CVS' - 25/Nov/08 04:52 PM
filter/mediaplugin MDL-16650 Added a Youtube search/replace to turn links to Youtube into embedded videos

Could use a quick security review!
MODIFY filter/mediaplugin/filter.php   Rev. 1.45    (+24 -0 lines)
MODIFY filter/mediaplugin/filtersettings.php   Rev. 1.2    (+3 -1 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.242    (+1 -0 lines)
moodler committed 1 file to 'Moodle CVS' - 25/Nov/08 04:57 PM
filter/mediaplugin MDL-16650 Removed div to keep XHTML strict in most places
MODIFY filter/mediaplugin/filter.php   Rev. 1.46    (+3 -3 lines)
Martin Dougiamas added a comment - 25/Nov/08 04:57 PM
I started looking at it and before I knew it I'd done the filter in HEAD

moodler committed 1 file to 'Moodle CVS' - 25/Nov/08 05:06 PM
filter/mediaplugin MDL-16650 Added support for alternate youtube URLs as well
MODIFY filter/mediaplugin/filter.php   Rev. 1.47    (+3 -0 lines)
Mitsuhiro Yoshida committed 1 file to 'Lang CVS' - 25/Nov/08 05:07 PM
MDL-16650 Translated a new string for admin.
MODIFY ja_utf8/admin.php   Rev. 1.319    (+1 -0 lines)
Dongsheng Cai committed 3 files to 'Moodle CVS' - 25/Nov/08 07:44 PM
HTML_EDITOR, REPOSITORY/MDL-16650
Modify tinymce to return a youtube link instead a object tag.
When media filter enabled, this link will be translated to proper youtube video.
MODIFY lib/editor/tinymce/jscripts/Attic/moodle_readme.txt   Rev. 1.2    (+2 -1 lines)
MODIFY lib/editor/tinymce/jscripts/tiny_mce/plugins/media/js/Attic/media.js   Rev. 1.4    (+21 -3 lines)
ADD lib/editor/tinymce/jscripts/Attic/patch-tinymce_plugin_media.txt   Rev. 1.1    (+0 -0 lines)
Dongsheng Cai added a comment - 25/Nov/08 07:52 PM
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.


Dongsheng Cai committed 2 files to 'Moodle CVS' - 25/Nov/08 09:20 PM
moodler committed 1 file to 'Moodle CVS' - 26/Nov/08 10:47 AM
filter/mediplugin MDL-16650 Avoid some notices if CFG variables not defined yet
MODIFY filter/mediaplugin/filter.php   Rev. 1.48    (+11 -11 lines)
Dongsheng Cai added a comment - 05/Dec/08 10:51 AM
done, please review

Dongsheng Cai made changes - 05/Dec/08 10:51 AM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Martin Dougiamas added a comment - 05/Dec/08 11:02 AM
Cool, taking a look now.

Dongsheng Cai committed 1 file to 'Moodle CVS' - 05/Dec/08 02:21 PM
martignoni committed 1 file to 'Lang CVS' - 07/Dec/08 11:32 PM
MDL-16650 New string added
MODIFY fr_utf8/admin.php   Rev. 1.319    (+2 -1 lines)
moodler committed 1 file to 'Moodle CVS' - 24/Dec/08 04:22 PM
filter/mediplugin MDL-16650 Fixed youtube videos on IE
MODIFY filter/mediaplugin/filter.php   Rev. 1.50    (+2 -2 lines)