Resolution: Not a bug
Affects Version/s: 2.0
Fix Version/s: None
Component/s: HTML Editor (TinyMCE)
Environment:Windows 2008 R2 Sp1; PHP 5.3.5, tinyMCE 126.96.36.199;
1. Create some URLs in a course topic using asolute src URL for images
2. change LIB.php to use relative URLs
3. Edit the topic html TWICE to see changes each time
4. set 'remove_script_host' => true to see if tinyMCE removes the host part of the name but not the full Moodle prefix defined in wwwroot or the document_base_url1. Create some URLs in a course topic using asolute src URL for images 2. change LIB.php to use relative URLs 3. Edit the topic html TWICE to see changes each time 4. set 'remove_script_host' => true to see if tinyMCE removes the host part of the name but not the full Moodle prefix defined in wwwroot or the document_base_url
If you change the relative HTML in tinyMCE to include the missing slash at the front, it then changes that to '../' next time you edit the html. While this works fine for the course view of the topic, it does not view the images whilst in the editor.
Our development server is different to production server and backup/restore of courses to migrate from dev to prod does not fix absolute URLs. Relative URLs are required to migrate courses between servers.
When tinyMCE has the relative_url param set to true; the relative URLs in the editor are incorrect.
the paramater 'document_base_url' is set incorrectly according to tinyMCE doc http://tinymce.moxiecode.com/wiki.php/Configuration:document_base_url
This corrects the issue with making absolute URLs relative in the course topic editor but then they are incorrect when displayed in course view.
HTML that was absolute is will be incorrectly changed to relative
which displays incorrectly in course view as "http://moodle.xxx.com.au/moodle/course/local/pix/lesson.png"
relative URL should be src="/local/pix/lesson.png" to dislay correctly in course view as "http://moodle.xxx.com.au/moodle/local/pix/lesson.png"
The problem is how the delimiting slash on the wwwroot is handled by Moodle and tinyMCE, one requires it and one does not.
If the relative URL tinyMCE created had a leading slash (since $CFG->wwwroot does not have a trailing slash) I think this would work fine.