MDL-24265 adding missing moodlemedia dirs
authorPetr Skoda <skodak@moodle.org>
Wed, 29 Sep 2010 19:57:48 +0000 (19:57 +0000)
committerPetr Skoda <skodak@moodle.org>
Wed, 29 Sep 2010 19:57:48 +0000 (19:57 +0000)
lib/editor/tinymce/tiny_mce/3.3.9.1/plugins/moodlemedia/css/media.css [new file with mode: 0755]
lib/editor/tinymce/tiny_mce/3.3.9.1/plugins/moodlemedia/img/icon.gif [new file with mode: 0644]
lib/editor/tinymce/tiny_mce/3.3.9.1/plugins/moodlemedia/js/media.js [new file with mode: 0755]

diff --git a/lib/editor/tinymce/tiny_mce/3.3.9.1/plugins/moodlemedia/css/media.css b/lib/editor/tinymce/tiny_mce/3.3.9.1/plugins/moodlemedia/css/media.css
new file mode 100755 (executable)
index 0000000..f8b8e3f
--- /dev/null
@@ -0,0 +1,25 @@
+#id, #name, #hspace, #vspace, #class_name, #align {    width: 100px }
+.moodlebutton {
+    font-size: 1.5em;
+    font-weight:bold;
+    padding: 3px 3px 3px 1.5em;
+    border:1px solid #ccc;
+    text-decoration:none;
+    background: url(../../../../../../../../../pix/a/search.png) .2em .3em no-repeat;
+}
+.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/tiny_mce/3.3.9.1/plugins/moodlemedia/img/icon.gif b/lib/editor/tinymce/tiny_mce/3.3.9.1/plugins/moodlemedia/img/icon.gif
new file mode 100644 (file)
index 0000000..8506072
Binary files /dev/null and b/lib/editor/tinymce/tiny_mce/3.3.9.1/plugins/moodlemedia/img/icon.gif differ
diff --git a/lib/editor/tinymce/tiny_mce/3.3.9.1/plugins/moodlemedia/js/media.js b/lib/editor/tinymce/tiny_mce/3.3.9.1/plugins/moodlemedia/js/media.js
new file mode 100755 (executable)
index 0000000..f79a787
--- /dev/null
@@ -0,0 +1,185 @@
+/**
+ * @author Dongsheng Cai <dongsheng@moodle.com>
+ */
+tinyMCEPopup.requireLangPack();
+
+var oldWidth, oldHeight, ed, url;
+
+if (url = tinyMCEPopup.getParam("media_external_list_url")) {
+    document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+}
+
+function init() {
+    ed = tinyMCEPopup.editor;
+    document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
+}
+
+function insertMedia() {
+    var f = document.forms[0];
+    var url = f.filename.value;
+    var linkname = url.substring(url.lastIndexOf('/')+1);
+    var h = '<a href="'+f.src.value+'">'+linkname+'</a>';
+    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<fo.length; i++) {
+        c = fo[i].split('=');
+
+        el = c[1].split(',');
+        for (x=0; x<el.length; x++)
+            if (v.indexOf('.' + el[x]) != -1)
+                return c[0];
+    }
+
+    return null;
+}
+
+
+function serializeParameters() {
+    var d = document, f = d.forms[0], s = '';
+    s += getStr(null, 'src');
+    s += 'width:300,';
+    s += 'height:225,';
+
+    // delete the tail comma
+    s = s.length > 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 = '<!-- x --->';
+    var type = getType(f.src.value);
+    var re = new RegExp("(.+)\#(.+)", "i");
+    var result = f.src.value.match(re);
+    if (result) {
+        f.src.value = result[1];
+        f.filename.value = result[2];
+    } else {
+        f.src.value = f.src.value;
+        f.filename.value = f.src.value;
+    }
+
+    // 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 += '<object classid="' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
+
+        for (n in pl) {
+                h += '<param name="' + n + '" value="' + pl[n] + '">';
+
+                // Add extra url parameter if it's an absolute URL
+                if (n == 'src' && pl[n].indexOf('://') != -1)
+                        h += '<param name="url" value="' + pl[n] + '" />';
+        }
+    }
+
+    h += '<embed type="' + type + '" ';
+
+    for (n in pl) {
+        h += n + '="' + pl[n] + '" ';
+    }
+
+    h += '></embed>';
+
+    // Avoid annoying warning about insecure items
+    if (!tinymce.isIE || document.location.protocol != 'https:')
+        h += '</object>';
+
+    p.innerHTML = "<!-- x --->" + h;
+}
+
+tinyMCEPopup.onInit.add(init);