MDL-33041 eliminate core TinyMCE moodlemedia hack

This commit is contained in:
Petr Škoda 2012-08-10 16:43:56 +02:00
parent fb7bcc1396
commit e4ad5d8a5e
2 changed files with 17 additions and 1 deletions

View File

@ -11,7 +11,7 @@ if (url = tinyMCEPopup.getParam("media_external_list_url")) {
function init() {
ed = tinyMCEPopup.editor;
document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
document.getElementById('filebrowsercontainer').innerHTML = getFileBrowserHTML('filebrowser','src','media','media');
}
function insertMedia() {

View File

@ -15,6 +15,22 @@
editor_tinymce_include('utils/validate.js');
editor_tinymce_include('utils/form_utils.js');
editor_tinymce_include('utils/editable_selects.js');
var getFileBrowserHTML = function(id, target_form_element, type, prefix) {
var option = prefix + "_" + type + "_browser_callback", cb, html;
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
if (!cb)
return "";
html = '<a class="moodlebutton" id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
html += tinyMCEPopup.getLang('browsemedia');
html += '</a>';
return html;
}
</script>
<script type="text/javascript" src="js/media.js"></script>
<link href="css/media.css" rel="stylesheet" type="text/css" />