From 46713337da9734fc2401c404352c6c54a5745476 Mon Sep 17 00:00:00 2001 From: Dongsheng Cai Date: Tue, 10 Nov 2009 08:51:42 +0000 Subject: [PATCH] "MDL-20603, added moodlemedia tinymce plugin" --- lang/en_utf8/editor_tinymce.php | 3 + .../extra/patches/tinymce_form_utils.patch | 41 ++++ .../extra/patches/tinymce_lang_string.patch | 24 +++ lib/editor/tinymce/extra/tinymce_utils.js | 2 +- lib/editor/tinymce/lib.php | 10 +- .../tinymce/plugins/moodlemedia/css/media.css | 18 ++ .../plugins/moodlemedia/editor_plugin.js | 54 ++++++ .../plugins/moodlemedia/editor_plugin_src.js | 53 ++++++ .../tinymce/plugins/moodlemedia/img/icon.gif | Bin 0 -> 910 bytes .../tinymce/plugins/moodlemedia/js/dialog.js | 19 ++ .../tinymce/plugins/moodlemedia/js/media.js | 176 ++++++++++++++++++ .../plugins/moodlemedia/moodlemedia.htm | 52 ++++++ lib/editor/tinymce/readme_moodle.txt | 12 +- lib/editor/tinymce/utils/form_utils.js | 20 +- repository/repository.src.js | 12 +- 15 files changed, 479 insertions(+), 17 deletions(-) create mode 100644 lib/editor/tinymce/extra/patches/tinymce_form_utils.patch create mode 100644 lib/editor/tinymce/extra/patches/tinymce_lang_string.patch create mode 100755 lib/editor/tinymce/plugins/moodlemedia/css/media.css create mode 100755 lib/editor/tinymce/plugins/moodlemedia/editor_plugin.js create mode 100755 lib/editor/tinymce/plugins/moodlemedia/editor_plugin_src.js create mode 100644 lib/editor/tinymce/plugins/moodlemedia/img/icon.gif create mode 100755 lib/editor/tinymce/plugins/moodlemedia/js/dialog.js create mode 100755 lib/editor/tinymce/plugins/moodlemedia/js/media.js create mode 100755 lib/editor/tinymce/plugins/moodlemedia/moodlemedia.htm diff --git a/lang/en_utf8/editor_tinymce.php b/lang/en_utf8/editor_tinymce.php index 2748455385..746f86990c 100644 --- a/lang/en_utf8/editor_tinymce.php +++ b/lang/en_utf8/editor_tinymce.php @@ -234,6 +234,8 @@ $string['advlink_dlg:url'] = 'Link URL'; $string['autosave:unload_msg'] = 'The changes you made will be lost if you navigate away from this page.'; $string['common:apply'] = 'Apply'; $string['common:browse'] = 'Browse'; +$string['common:browsemedia'] = 'Find or upload a sound, video or applet'; +$string['common:browseimage'] = 'Find or upload an image'; $string['common:cancel'] = 'Cancel'; $string['common:class_name'] = 'Class'; $string['common:clipboard_msg'] = 'Copy/Cut/Paste is not available in Mozilla and Firefox.\\nDo you want more information about this issue?'; @@ -414,6 +416,7 @@ $string['media_dlg:enabled'] = 'Enabled'; $string['media_dlg:enablejavascript'] = 'Enable JavaScript'; $string['media_dlg:endtime'] = 'End time'; $string['media_dlg:file'] = 'File/URL'; +$string['media_dlg:filename'] = 'Filename'; $string['media_dlg:flash_options'] = 'Flash options'; $string['media_dlg:flashvars'] = 'Flashvars'; $string['media_dlg:flv_autostart'] = 'Auto start'; diff --git a/lib/editor/tinymce/extra/patches/tinymce_form_utils.patch b/lib/editor/tinymce/extra/patches/tinymce_form_utils.patch new file mode 100644 index 0000000000..305add92ac --- /dev/null +++ b/lib/editor/tinymce/extra/patches/tinymce_form_utils.patch @@ -0,0 +1,41 @@ +Index: lib/editor/tinymce/utils/form_utils.js +=================================================================== +RCS file: /cvsroot/moodle/moodle/lib/editor/tinymce/utils/form_utils.js,v +retrieving revision 1.1 +diff -u -r1.1 form_utils.js +--- lib/editor/tinymce/utils/form_utils.js 16 May 2009 20:54:46 -0000 1.1 ++++ lib/editor/tinymce/utils/form_utils.js 10 Nov 2009 08:06:02 -0000 +@@ -48,9 +48,21 @@ + if (!cb) + return ""; + +- html = ""; +- html += ''; +- html += ' '; ++ html = ""; ++ if (id=='filebrowser') { ++ // for moodlemedia plugin ++ html += ''; ++ html += tinyMCEPopup.getLang('browsemedia'); ++ html += ''; ++ } else if (id=='srcbrowser') { ++ // for advimage plugin ++ html += ''; ++ html += tinyMCEPopup.getLang('browseimage'); ++ html += ''; ++ } else { ++ html += ''; ++ html += ' '; ++ } + + return html; + } +@@ -58,7 +70,7 @@ + function openBrowser(img_id, target_form_element, type, option) { + var img = document.getElementById(img_id); + +- if (img.className != "mceButtonDisabled") ++ if (!img || img.className != "mceButtonDisabled") + tinyMCEPopup.openBrowser(target_form_element, type, option); + } + diff --git a/lib/editor/tinymce/extra/patches/tinymce_lang_string.patch b/lib/editor/tinymce/extra/patches/tinymce_lang_string.patch new file mode 100644 index 0000000000..defb040485 --- /dev/null +++ b/lib/editor/tinymce/extra/patches/tinymce_lang_string.patch @@ -0,0 +1,24 @@ +Index: lang/en_utf8/editor_tinymce.php +=================================================================== +RCS file: /cvsroot/moodle/moodle/lang/en_utf8/editor_tinymce.php,v +retrieving revision 1.7 +diff -u -r1.7 editor_tinymce.php +--- lang/en_utf8/editor_tinymce.php 19 Jul 2009 13:05:24 -0000 1.7 ++++ lang/en_utf8/editor_tinymce.php 10 Nov 2009 08:09:43 -0000 +@@ -234,6 +234,8 @@ + $string['autosave:unload_msg'] = 'The changes you made will be lost if you navigate away from this page.'; + $string['common:apply'] = 'Apply'; + $string['common:browse'] = 'Browse'; ++$string['common:browsemedia'] = 'Find or upload a sound, video or applet'; ++$string['common:browseimage'] = 'Find or upload an image'; + $string['common:cancel'] = 'Cancel'; + $string['common:class_name'] = 'Class'; + $string['common:clipboard_msg'] = 'Copy/Cut/Paste is not available in Mozilla and Firefox.\\nDo you want more information about this issue?'; +@@ -414,6 +416,7 @@ + $string['media_dlg:enablejavascript'] = 'Enable JavaScript'; + $string['media_dlg:endtime'] = 'End time'; + $string['media_dlg:file'] = 'File/URL'; ++$string['media_dlg:filename'] = 'Filename'; + $string['media_dlg:flash_options'] = 'Flash options'; + $string['media_dlg:flashvars'] = 'Flashvars'; + $string['media_dlg:flv_autostart'] = 'Auto start'; diff --git a/lib/editor/tinymce/extra/tinymce_utils.js b/lib/editor/tinymce/extra/tinymce_utils.js index 9565fc68f8..0b8b33c064 100644 --- a/lib/editor/tinymce/extra/tinymce_utils.js +++ b/lib/editor/tinymce/extra/tinymce_utils.js @@ -54,5 +54,5 @@ function mce_moodlefilemanager(field_name, url, type, win) { picker.id = 'file-picker-'+client_id; document.body.appendChild(picker); var el = win.document.getElementById(field_name); - eval('open_filepicker(client_id, {"env":"editor","target":el,"filetype":type, "savepath":"/"})'); + open_filepicker(client_id, {"env":"editor","target":el,"filetype":type, "savepath":"/"}); } diff --git a/lib/editor/tinymce/lib.php b/lib/editor/tinymce/lib.php index 9cb5b5dea1..a55ec42ec3 100644 --- a/lib/editor/tinymce/lib.php +++ b/lib/editor/tinymce/lib.php @@ -79,16 +79,16 @@ class tinymce_texteditor extends texteditor { $context = empty($options['context']) ? get_context_instance(CONTEXT_SYSTEM) : $options['context']; if (!empty($options['legacy'])) { - $xmedia = ''; + $xmedia = 'moodlemedia,'; } else { if (!empty($options['noclean']) or !empty($options['trusted'])) { - $xmedia = 'media,'; } else { $xmedia = ''; } } - $xmedia = 'media, '; + // TODO: enabled moodlemedia + $xmedia = 'moodlemedia,'; $filters = filter_get_active_in_context($context); if (array_key_exists('filter/tex', $filters)) { $xdragmath = 'dragmath,'; @@ -112,7 +112,7 @@ class tinymce_texteditor extends texteditor { 'apply_source_formatting' => true, 'remove_script_host' => false, 'entity_encoding' => "raw", - 'plugins' => "safari,table,style,layer,advhr,advimage,advlink,emotions,inlinepopups,{$xmedia}searchreplace,paste,directionality,fullscreen,moodlenolink,{$xdragmath}nonbreaking,contextmenu,insertdatetime,save,iespell,preview,print,noneditable,visualchars,xhtmlxtras,template,pagebreak", + 'plugins' => "{$xmedia}advimage,safari,table,style,layer,advhr,advlink,emotions,inlinepopups,searchreplace,paste,directionality,fullscreen,moodlenolink,{$xdragmath}nonbreaking,contextmenu,insertdatetime,save,iespell,preview,print,noneditable,visualchars,xhtmlxtras,template,pagebreak", 'theme_advanced_font_sizes' => "1,2,3,4,5,6,7", 'theme_advanced_layout_manager' => "SimpleLayout", 'theme_advanced_toolbar_align' => "left", @@ -120,7 +120,7 @@ class tinymce_texteditor extends texteditor { 'theme_advanced_buttons1_add' => "|,undo,redo,|,search,replace,|,fullscreen", 'theme_advanced_buttons2' => "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,justifyright,justifyfull,|,cite,abbr,acronym", 'theme_advanced_buttons2_add' => "|,selectall,cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl", - 'theme_advanced_buttons3' => "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,anchor,|,emotions,image,{$xmedia}{$xdragmath}advhr,nonbreaking,charmap", + 'theme_advanced_buttons3' => "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,anchor,|,image,{$xmedia},emotions,{$xdragmath}advhr,nonbreaking,charmap", 'theme_advanced_buttons3_add' => "|,table,insertlayer,styleprops,visualchars,|,code,preview", 'theme_advanced_fonts' => "Trebuchet=Trebuchet MS,Verdana,Arial,Helvetica,sans-serif;Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;Wingdings=wingdings", 'theme_advanced_resize_horizontal' => true, diff --git a/lib/editor/tinymce/plugins/moodlemedia/css/media.css b/lib/editor/tinymce/plugins/moodlemedia/css/media.css new file mode 100755 index 0000000000..ed33efd687 --- /dev/null +++ b/lib/editor/tinymce/plugins/moodlemedia/css/media.css @@ -0,0 +1,18 @@ +#id, #name, #hspace, #vspace, #class_name, #align { width: 100px } +.moodlebutton {font-size: 1.5em;font-weight:bold;padding: 3px;border:1px solid #ccc;text-decoration:none} +.moodlebutton:hover {background: #ccc} +#hspace, #vspace { width: 50px } +#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px } +#flash_base, #flash_flashvars { width: 240px } +#width, #height { width: 40px } +#src, #media_type { width: 250px } +#class { width: 120px } +#prev {margin: 0; border: 1px solid black; width: 380px; height: 230px; overflow: hidden } +.panel_wrapper div.current { height: 390px; overflow: auto } +#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none } +.mceAddSelectValue { background-color: #DDDDDD } +#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px } +#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px } +#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px } +#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px } +#qt_qtsrc { width: 200px } diff --git a/lib/editor/tinymce/plugins/moodlemedia/editor_plugin.js b/lib/editor/tinymce/plugins/moodlemedia/editor_plugin.js new file mode 100755 index 0000000000..f4f5a0ab17 --- /dev/null +++ b/lib/editor/tinymce/plugins/moodlemedia/editor_plugin.js @@ -0,0 +1,54 @@ +/** + * @author Dongsheng Cai + * @copyright 2009 Dongsheng Cai + */ + +(function() { + var each = tinymce.each; + + tinymce.PluginManager.requireLangPack('moodlemedia'); + + tinymce.create('tinymce.plugins.MoodlemediaPlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + // Register commands + ed.addCommand('mceMoodleMedia', function() { + ed.windowManager.open({ + file : url + '/moodlemedia.htm', + width : 430 + parseInt(ed.getLang('media.delta_width', 0)), + height : 470 + parseInt(ed.getLang('media.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('moodlemedia', { + title : 'Moodle Media', + image : url + '/img/icon.gif', + cmd : 'mceMoodleMedia'}); + + }, + + _parse : function(s) { + return tinymce.util.JSON.parse('{' + s + '}'); + }, + + getInfo : function() { + return { + longname : 'Moodle media', + author : 'Dongsheng Cai ', + version : "1.0" + }; + }, + + }); + + // Register plugin + tinymce.PluginManager.add('moodlemedia', tinymce.plugins.MoodlemediaPlugin); +})(); diff --git a/lib/editor/tinymce/plugins/moodlemedia/editor_plugin_src.js b/lib/editor/tinymce/plugins/moodlemedia/editor_plugin_src.js new file mode 100755 index 0000000000..9de745414c --- /dev/null +++ b/lib/editor/tinymce/plugins/moodlemedia/editor_plugin_src.js @@ -0,0 +1,53 @@ +/** + * @author Dongsheng Cai + */ + +(function() { + var each = tinymce.each; + + tinymce.PluginManager.requireLangPack('moodlemedia'); + + tinymce.create('tinymce.plugins.MoodlemediaPlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + // Register commands + ed.addCommand('mceMoodleMedia', function() { + ed.windowManager.open({ + file : url + '/moodlemedia.htm', + width : 430 + parseInt(ed.getLang('media.delta_width', 0)), + height : 470 + parseInt(ed.getLang('media.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('moodlemedia', { + title : 'Moodle Media', + image : url + '/img/icon.gif', + cmd : 'mceMoodleMedia'}); + + }, + + _parse : function(s) { + return tinymce.util.JSON.parse('{' + s + '}'); + }, + + getInfo : function() { + return { + longname : 'Moodle media', + author : 'Dongsheng Cai ', + version : "1.0" + }; + }, + + }); + + // Register plugin + tinymce.PluginManager.add('moodlemedia', tinymce.plugins.MoodlemediaPlugin); +})(); diff --git a/lib/editor/tinymce/plugins/moodlemedia/img/icon.gif b/lib/editor/tinymce/plugins/moodlemedia/img/icon.gif new file mode 100644 index 0000000000000000000000000000000000000000..85060720ac3aec647ed829d45119281ec16f26fe GIT binary patch literal 910 zcmV;919ALENk%w1VGsZi0OtCcKTM%}ImAk&d@bUef&=iA% zhPA3sm56OYcjMRI^s}jof~E0n!SIozxs`y)bZpaM%~elOt(xIz_1F@`xREtxwxO@X zElsNLx;f_MIwnTOux@bk@5r<-;@s){f~fMSskU>S&vlpdmZGk)n^Ks084*pfMo5}`Y)@uBrt7q^ z_xb)XxI@^-XhLVQWPPfUtMQSg&Xb6UQhU2=S3pa1!Lhs1Kwz1)!P59aI6r5pthLM4 zE-ud4`aC>8zybolqcQ$sRq*)W>+kl^)!br%x2LJkVv+Dui1Oh7|6z>ag023Luhg%= z;=sbh)RP30t>V}2$H?fg=;-%zOTU8v0MO8l85I$+z}bYP#G9DS_#hs}n3hj*tissz zAwYQh{QX~VkH5&*9YTcu{{H^`{_yYcW|;u|{Qilm^upTyi?sd!nVG)6{{LrW`s5%! zQETJeu@Y0sB3Qy+jGVB@-BWO)C1U{h_4v@?@UEu*S8lPiucH6>|4vxO2|0#LaF@v0 z@ZaCy@c8hkxVXaB{z|fT@U~;Hv$d$T$J*xpqPpE8TH+G^0=vlI+KzIEuZN}B@UYO} z&dtoGp5{=vw)ErQRcDJbQgSxGf8JYL_`X^{uFH_9uqY`f`}_Of)zF}&w4mVd!0r05 zoM3>k!2kdMA^8LW00930ECK)m01W^Q000PU0RR0%;6tE61RM;D>|?KfqGRwQE2CJFW&DHUIzs literal 0 HcmV?d00001 diff --git a/lib/editor/tinymce/plugins/moodlemedia/js/dialog.js b/lib/editor/tinymce/plugins/moodlemedia/js/dialog.js new file mode 100755 index 0000000000..fa8341132f --- /dev/null +++ b/lib/editor/tinymce/plugins/moodlemedia/js/dialog.js @@ -0,0 +1,19 @@ +tinyMCEPopup.requireLangPack(); + +var ExampleDialog = { + init : function() { + var f = document.forms[0]; + + // Get the selected contents as text and place it in the input + f.someval.value = tinyMCEPopup.editor.selection.getContent({format : 'text'}); + f.somearg.value = tinyMCEPopup.getWindowArg('some_custom_arg'); + }, + + insert : function() { + // Insert the contents from the input into the document + tinyMCEPopup.editor.execCommand('mceInsertContent', false, document.forms[0].someval.value); + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(ExampleDialog.init, ExampleDialog); diff --git a/lib/editor/tinymce/plugins/moodlemedia/js/media.js b/lib/editor/tinymce/plugins/moodlemedia/js/media.js new file mode 100755 index 0000000000..42ff3ae8f7 --- /dev/null +++ b/lib/editor/tinymce/plugins/moodlemedia/js/media.js @@ -0,0 +1,176 @@ +/** + * @author Dongsheng Cai + */ +tinyMCEPopup.requireLangPack(); + +var oldWidth, oldHeight, ed, url; + +if (url = tinyMCEPopup.getParam("media_external_list_url")) + document.write(''); + +function init() { + ed = tinyMCEPopup.editor; + document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); +} + +function insertMedia() { + var f = document.forms[0]; + var h = ''+f.filename.value+''; + ed.execCommand('mceInsertContent', false, h); + tinyMCEPopup.close(); +} + +function getType(v) { + var fo, i, c, el, x, f = document.forms[0]; + + fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'); + + // YouTube + if (v.match(/watch\?v=(.+)(.*)/)) { + f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1]; + return 'flash'; + } else if (v.match(/v\/(.+)(.*)/)) { + return 'flash'; + } + + // Google video + if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) { + f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en'; + return 'flash'; + } + + for (i=0; i 0 ? s.substring(0, s.length - 1) : s; + + return s; +} + + +function getStr(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "hidden" ? e.value : e.options[e.selectedIndex].value; + + if (n == 'src') + v = tinyMCEPopup.editor.convertURL(v, 'src', null); + + return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',"); +} + +function jsEncode(s) { + s = s.replace(new RegExp('\\\\', 'g'), '\\\\'); + s = s.replace(new RegExp('"', 'g'), '\\"'); + s = s.replace(new RegExp("'", 'g'), "\\'"); + + return s; +} + +function generatePreview(c) { + var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh; + + p.innerHTML = ''; + var type = getType(f.src.value); + var re = new RegExp("(.+)\#(.+)", "i"); + var result = f.src.value.match(re); + f.src.value = result[1]; + f.filename.value = result[2]; + + // After constrain + pl = serializeParameters(); + + switch (type) { + case 'flash': + cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + type = 'application/x-shockwave-flash'; + break; + case "shockwave": + cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + type = 'application/x-director'; + break; + + case "qt": + cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; + codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + type = 'video/quicktime'; + break; + + case "wmp": + cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'application/x-mplayer2'; + break; + + case "rmp": + cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (pl == '') { + p.innerHTML = ''; + return; + } + + pl = tinyMCEPopup.editor.plugins.moodlemedia._parse(pl); + + if (!pl.src) { + p.innerHTML = ''; + return; + } + + pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src); + pl.width = !pl.width ? 100 : pl.width; + pl.height = !pl.height ? 100 : pl.height; + pl.id = !pl.id ? 'moodlemediaid' : pl.id; + pl.name = !pl.name ? 'moodlemedianame' : pl.name; + pl.align = !pl.align ? '' : pl.align; + + // Avoid annoying warning about insecure items + if (!tinymce.isIE || document.location.protocol != 'https:') { + h += ''; + + for (n in pl) { + h += ''; + + // Add extra url parameter if it's an absolute URL + if (n == 'src' && pl[n].indexOf('://') != -1) + h += ''; + } + } + + h += ' + + + {#media_dlg.title} + + + + + + + + + +
+
+
+
+ +
+ {#media_dlg.general} + + + + + + + + + +
 
+
+ +
+ {#media_dlg.preview} + +
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/lib/editor/tinymce/readme_moodle.txt b/lib/editor/tinymce/readme_moodle.txt index 9699f8e994..d7a8c57c08 100644 --- a/lib/editor/tinymce/readme_moodle.txt +++ b/lib/editor/tinymce/readme_moodle.txt @@ -12,23 +12,23 @@ Upgrade procedure: 2/ replace tiny_mce*.* files, themes/*, utils/* and plugins/* (keep dragmath, moodlenolink, spellchecker) 3/ copy tinymce/jscripts/tiny_mce/classes/Popup.js to Popup.js - 4/ apply plugins/media/* (extra/tinymce_plugin_media.patch) - MDL-16650 - 5/ apply strings patch - 6/ copy yuicompressor.jar from dev package into extra/tools/, use shell + 4/ apply strings & form_utils.js patch + 5/ copy yuicompressor.jar from dev package into extra/tools/, use shell script extra/tools/compress.sh to compress modified files - 7/ download all TinyMCE lang files (extra/tools/download_langs.sh) - 8/ update moodle lang string files (extra/tools/update_lang_files.php) + 6/ download all TinyMCE lang files (extra/tools/download_langs.sh) + 7/ update moodle lang string files (extra/tools/update_lang_files.php) + 8/ apply tinymce_lang_string.patch which contains language string for moodlemedia plugin ========================================================================================= Added: * added Popup.js, copy of tinymce/jscripts/tiny_mce/classes/Popup.js from dev package * plugins/gragmath/* * plugins/moodlenolink/* + * plugins/moodlemedia/* Modified: * Popup.js --> compressed into tiny_mce_popup.js (extra/patches/tinymce_strings.patch) * tiny_mce_src.js --> compressed into tiny_mce.js (extra/patches/tinymce_strings.patch) - * plugins/media/js/media.js (extra/patches/tinymce_plugin_media.patch) Removed: * diff --git a/lib/editor/tinymce/utils/form_utils.js b/lib/editor/tinymce/utils/form_utils.js index b8860b280a..865b50aebf 100644 --- a/lib/editor/tinymce/utils/form_utils.js +++ b/lib/editor/tinymce/utils/form_utils.js @@ -48,9 +48,21 @@ function getBrowserHTML(id, target_form_element, type, prefix) { if (!cb) return ""; - html = ""; - html += ''; - html += ' '; + html = ""; + if (id=='filebrowser') { + // for moodlemedia plugin + html += ''; + html += tinyMCEPopup.getLang('browsemedia'); + html += ''; + } else if (id=='srcbrowser') { + // for advimage plugin + html += ''; + html += tinyMCEPopup.getLang('browseimage'); + html += ''; + } else { + html += ''; + html += ' '; + } return html; } @@ -58,7 +70,7 @@ function getBrowserHTML(id, target_form_element, type, prefix) { function openBrowser(img_id, target_form_element, type, option) { var img = document.getElementById(img_id); - if (img.className != "mceButtonDisabled") + if (!img || img.className != "mceButtonDisabled") tinyMCEPopup.openBrowser(target_form_element, type, option); } diff --git a/repository/repository.src.js b/repository/repository.src.js index 4c69efaa52..ca7639ee5a 100644 --- a/repository/repository.src.js +++ b/repository/repository.src.js @@ -630,8 +630,18 @@ repository_client.select_file = function(oldname, url, icon, client_id, repo_id) html += '

'; html += '

'; + var le_checked = ''; + var le_style = ''; + if (MOODLE.repository.listing[client_id][repo_id].return_types == 1) { + // support external links only + le_checked = 'checked'; + le_style = ' style="display:none;"'; + } else if(MOODLE.repository.listing[client_id][repo_id].return_types == 2) { + // support internal files only + le_style = ' style="display:none;"'; + } if (fp_config.externallink && fp.env == 'editor') { - html += '

'+fp_lang.linkexternal+'

'; + html += ''+fp_lang.linkexternal+'

'; } html += '

'; html += ''; -- 2.39.5