From ba44f12571745de9262ebfc8e7d70095434e2ee9 Mon Sep 17 00:00:00 2001 From: scyrma Date: Thu, 31 Jul 2008 03:18:40 +0000 Subject: [PATCH] MDL-14741: Removing the old moodleimage plugin - the TinyMCE builtin plugin does the same. --- lib/editor/tinymce.js.php | 2 +- .../plugins/moodleimage/editor_plugin.js | 1 - .../plugins/moodleimage/editor_plugin_src.js | 78 ---- .../plugins/moodleimage/img/image.gif | Bin 156 -> 0 bytes .../plugins/moodleimage/insert_image.php | 294 ------------- .../tiny_mce/plugins/moodleimage/js/image.js | 414 ------------------ .../plugins/moodleimage/js/moodleimage.js | 171 -------- .../plugins/moodleimage/langs/en_dlg.js | 4 - .../tiny_mce/plugins/moodleimage/preview.php | 31 -- 9 files changed, 1 insertion(+), 994 deletions(-) delete mode 100644 lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/editor_plugin.js delete mode 100644 lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/editor_plugin_src.js delete mode 100644 lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/img/image.gif delete mode 100644 lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/insert_image.php delete mode 100644 lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/js/image.js delete mode 100644 lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/js/moodleimage.js delete mode 100644 lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/langs/en_dlg.js delete mode 100644 lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/preview.php diff --git a/lib/editor/tinymce.js.php b/lib/editor/tinymce.js.php index 986da2ff74..a50335c4e6 100644 --- a/lib/editor/tinymce.js.php +++ b/lib/editor/tinymce.js.php @@ -178,7 +178,7 @@ echo <<wo;Bz6r~CIG{Qv)-0R!lO zL_m5OSON`BdS+W$yw)+dY*|=(BV5F#D?z1j-@)T?529HPSDei6I?wL1sz5@Zr-dPD sQV_2IQ_Dst500LuDXmHjIl|k79R#MC1mAoUX>?%c?Sebsr5PEl0hlv17XSbN diff --git a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/insert_image.php b/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/insert_image.php deleted file mode 100644 index d1f85e18d9..0000000000 --- a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/insert_image.php +++ /dev/null @@ -1,294 +0,0 @@ -maxbytes); - -?> - - - - -{#moodleimage_dlg.title} - - - - - - - - - - -
- - - - - - - - - - - -
: -
: -
-
- - - - - - -
-
-
- - - - - - - - - -
: -
: -
-
 
-
-
- - - - - - - - - -
: - -
: -
-
-
- - - - - - - - - -
: - -
: - - -
-
- - - - - -
"; - echo ""; - ?> - :
- -
- - - - - - - - -
- - - - - - - -
:
- " onclick="return submit_form('delete');" />
- " onclick="return submit_form('move');" />
- " onclick="return submit_form('zip');" />
- - - - - - " />
-
- -
- -
-
-   : - - : -
-
-
-
- - - - - - - - -
-
-
- - - - - - - " /> - -
-
-

 

- - diff --git a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/js/image.js b/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/js/image.js deleted file mode 100644 index 9a26c0aeb5..0000000000 --- a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/js/image.js +++ /dev/null @@ -1,414 +0,0 @@ -var ImageDialog = { - preInit : function() { - var url; - - tinyMCEPopup.requireLangPack(); - - if (url = tinyMCEPopup.getParam("external_image_list_url")) - document.write(''); - }, - - init : function(ed) { - var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(); - - tinyMCEPopup.resizeToInnerSize(); - this.fillClassList('class_list'); - this.fillFileList('src_list', 'tinyMCEImageList'); - this.fillFileList('over_list', 'tinyMCEImageList'); - this.fillFileList('out_list', 'tinyMCEImageList'); - - if (n.nodeName == 'IMG') { - nl.src.value = dom.getAttrib(n, 'src'); - nl.width.value = dom.getAttrib(n, 'width'); - nl.height.value = dom.getAttrib(n, 'height'); - nl.alt.value = dom.getAttrib(n, 'alt'); - nl.title.value = dom.getAttrib(n, 'title'); - nl.vspace.value = this.getAttrib(n, 'vspace'); - nl.hspace.value = this.getAttrib(n, 'hspace'); - nl.border.value = this.getAttrib(n, 'border'); - selectByValue(f, 'align', this.getAttrib(n, 'align')); - selectByValue(f, 'class_list', dom.getAttrib(n, 'class')); - nl.style.value = dom.getAttrib(n, 'style'); - nl.id.value = dom.getAttrib(n, 'id'); - nl.dir.value = dom.getAttrib(n, 'dir'); - nl.lang.value = dom.getAttrib(n, 'lang'); - nl.usemap.value = dom.getAttrib(n, 'usemap'); - nl.longdesc.value = dom.getAttrib(n, 'longdesc'); - nl.insert.value = ed.getLang('update'); - - if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover'))) - nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); - - if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout'))) - nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); - } - - // Setup browse button - document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); - if (isVisible('srcbrowser')) - document.getElementById('src').style.width = '260px'; - - // Setup browse button - document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image'); - if (isVisible('overbrowser')) - document.getElementById('onmouseoversrc').style.width = '260px'; - - // Setup browse button - document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image'); - if (isVisible('outbrowser')) - document.getElementById('onmouseoutsrc').style.width = '260px'; - - // If option enabled default contrain proportions to checked - if (ed.getParam("advimage_constrain_proportions", true)) - f.constrain.checked = true; - - // Check swap image if valid data - if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value) - this.setSwapImage(true); - else - this.setSwapImage(false); - - this.changeAppearance(); - this.updateStyle(); - this.showPreviewImage(nl.src.value, 1); - }, - - insert : function(file, title) { - var ed = tinyMCEPopup.editor, t = this, f = document.forms[0]; - - if (f.src.value === '') { - ed.dom.remove(ed.selection.getNode()); - ed.execCommand('mceRepaint'); - tinyMCEPopup.close(); - return; - } - - if (tinyMCEPopup.getParam("accessibility_warnings", 1)) { - if (!f.alt.value) { - tinyMCEPopup.editor.windowManager.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) { - if (s) - t.insertAndClose(); - }); - - return; - } - } - - t.insertAndClose(); - }, - - insertAndClose : function() { - var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el; - - // Fixes crash in Safari - if (tinymce.isWebKit) - ed.getWin().focus(); - - if (!ed.settings.inline_styles) { - args = tinymce.extend(args, { - vspace : nl.vspace.value, - hspace : nl.hspace.value, - border : nl.border.value, - align : getSelectValue(f, 'align') - }); - } - - tinymce.extend(args, { - src : nl.src.value, - width : nl.width.value, - height : nl.height.value, - alt : nl.alt.value, - title : nl.title.value, - 'class' : getSelectValue(f, 'class_list'), - style : nl.style.value, - id : nl.id.value, - dir : nl.dir.value, - lang : nl.lang.value, - usemap : nl.usemap.value, - longdesc : nl.longdesc.value - }); - - args.onmouseover = args.onmouseout = ''; - - if (f.onmousemovecheck.checked) { - if (nl.onmouseoversrc.value) - args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';"; - - if (nl.onmouseoutsrc.value) - args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';"; - } - - el = ed.selection.getNode(); - - if (el && el.nodeName == 'IMG') { - ed.dom.setAttribs(el, args); - } else { - ed.execCommand('mceInsertContent', false, ''); - ed.dom.setAttribs('__mce_tmp', args); - ed.dom.setAttrib('__mce_tmp', 'id', ''); - } - - tinyMCEPopup.close(); - }, - - getAttrib : function(e, at) { - var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; - - if (ed.settings.inline_styles) { - switch (at) { - case 'align': - if (v = dom.getStyle(e, 'float')) - return v; - - if (v = dom.getStyle(e, 'vertical-align')) - return v; - - break; - - case 'hspace': - v = dom.getStyle(e, 'margin-left') - v2 = dom.getStyle(e, 'margin-right'); - if (v && v == v2) - return parseInt(v.replace(/[^0-9]/g, '')); - - break; - - case 'vspace': - v = dom.getStyle(e, 'margin-top') - v2 = dom.getStyle(e, 'margin-bottom'); - if (v && v == v2) - return parseInt(v.replace(/[^0-9]/g, '')); - - break; - - case 'border': - v = 0; - - tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { - sv = dom.getStyle(e, 'border-' + sv + '-width'); - - // False or not the same as prev - if (!sv || (sv != v && v !== 0)) { - v = 0; - return false; - } - - if (sv) - v = sv; - }); - - if (v) - return parseInt(v.replace(/[^0-9]/g, '')); - - break; - } - } - - if (v = dom.getAttrib(e, at)) - return v; - - return ''; - }, - - setSwapImage : function(st) { - var f = document.forms[0]; - - f.onmousemovecheck.checked = st; - setBrowserDisabled('overbrowser', !st); - setBrowserDisabled('outbrowser', !st); - - if (f.over_list) - f.over_list.disabled = !st; - - if (f.out_list) - f.out_list.disabled = !st; - - f.onmouseoversrc.disabled = !st; - f.onmouseoutsrc.disabled = !st; - }, - - fillClassList : function(id) { - var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; - - if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { - cl = []; - - tinymce.each(v.split(';'), function(v) { - var p = v.split('='); - - cl.push({'title' : p[0], 'class' : p[1]}); - }); - } else - cl = tinyMCEPopup.editor.dom.getClasses(); - - if (cl.length > 0) { - lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); - - tinymce.each(cl, function(o) { - lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); - }); - } else - dom.remove(dom.getParent(id, 'tr')); - }, - - fillFileList : function(id, l) { - var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; - - l = window[l]; - - if (l && l.length > 0) { - lst.options[lst.options.length] = new Option('', ''); - - tinymce.each(l, function(o) { - lst.options[lst.options.length] = new Option(o[0], o[1]); - }); - } else - dom.remove(dom.getParent(id, 'tr')); - }, - - resetImageData : function() { - var f = document.forms[0]; - - f.elements.width.value = f.elements.height.value = ''; - }, - - updateImageData : function(img, st) { - var f = document.forms[0]; - - if (!st) { - f.elements.width.value = img.width; - f.elements.height.value = img.height; - } - - this.preloadImg = img; - }, - - changeAppearance : function() { - var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg'); - - if (img) { - if (ed.getParam('inline_styles')) { - ed.dom.setAttrib(img, 'style', f.style.value); - } else { - img.align = f.align.value; - img.border = f.border.value; - img.hspace = f.hspace.value; - img.vspace = f.vspace.value; - } - } - }, - - changeHeight : function() { - var f = document.forms[0], tp, t = this; - - if (!f.constrain.checked || !t.preloadImg) { - t.updateStyle(); - return; - } - - if (f.width.value == "" || f.height.value == "") - return; - - tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height; - f.height.value = tp.toFixed(0); - t.updateStyle(); - }, - - changeWidth : function() { - var f = document.forms[0], tp, t = this; - - if (!f.constrain.checked || !t.preloadImg) { - t.updateStyle(); - return; - } - - if (f.width.value == "" || f.height.value == "") - return; - - tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width; - f.width.value = tp.toFixed(0); - t.updateStyle(); - }, - - updateStyle : function() { - var dom = tinyMCEPopup.dom, st, v, f = document.forms[0]; - - if (tinyMCEPopup.editor.settings.inline_styles) { - st = tinyMCEPopup.dom.parseStyle(dom.get('style').value); - - // Handle align - v = getSelectValue(f, 'align'); - if (v) { - if (v == 'left' || v == 'right') { - st['float'] = v; - delete st['vertical-align']; - } else { - st['vertical-align'] = v; - delete st['float']; - } - } else { - delete st['float']; - delete st['vertical-align']; - } - - // Handle border - v = f.border.value; - if (v || v == '0') { - if (v == '0') - st['border'] = '0'; - else - st['border'] = v + 'px solid black'; - } else - delete st['border']; - - // Handle hspace - v = f.hspace.value; - if (v) { - delete st['margin']; - st['margin-left'] = v + 'px'; - st['margin-right'] = v + 'px'; - } else { - delete st['margin-left']; - delete st['margin-right']; - } - - // Handle vspace - v = f.vspace.value; - if (v) { - delete st['margin']; - st['margin-top'] = v + 'px'; - st['margin-bottom'] = v + 'px'; - } else { - delete st['margin-top']; - delete st['margin-bottom']; - } - - // Merge - st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st)); - dom.get('style').value = dom.serializeStyle(st); - } - }, - - changeMouseMove : function() { - }, - - showPreviewImage : function(u, st) { - if (!u) { - tinyMCEPopup.dom.setHTML('prev', ''); - return; - } - - if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true)) - this.resetImageData(); - - u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u); - - if (!st) - tinyMCEPopup.dom.setHTML('prev', ''); - else - tinyMCEPopup.dom.setHTML('prev', ''); - } -}; - -ImageDialog.preInit(); -tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/js/moodleimage.js b/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/js/moodleimage.js deleted file mode 100644 index 03b1d2cb42..0000000000 --- a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/js/moodleimage.js +++ /dev/null @@ -1,171 +0,0 @@ -tinyMCEPopup.requireLangPack(); - -var MoodleImageDialog = { - init : function(ed) { - var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(); - course_id = tinyMCEPopup.getParam('moodleimage_course_id'); - tinyMCEPopup.resizeToInnerSize(); - if (n.nodeName == 'IMG') { - nl.f_url.value = dom.getAttrib(n, 'src'); - nl.f_width.value = dom.getAttrib(n, 'width'); - nl.f_height.value = dom.getAttrib(n, 'height'); - nl.f_alt.value = dom.getAttrib(n, 'alt'); - nl.f_vert.value = this.getAttrib(n, 'vspace'); - nl.f_horiz.value = this.getAttrib(n, 'hspace'); - nl.f_border.value = this.getAttrib(n, 'border'); - selectByValue(f, 'f_align', this.getAttrib(n, 'align')); - window.ipreview.location.replace('preview.php?id='+ course_id +'&imageurl='+ nl.f_url.value); - } - - }, - - insert : function(file, title) { - var ed = tinyMCEPopup.editor, t = this, f = document.forms[0]; - - if (f.f_url.value === '') { - ed.dom.remove(ed.selection.getNode()); - ed.execCommand('mceRepaint'); - tinyMCEPopup.close(); - return; - } - - if (tinyMCEPopup.getParam("accessibility_warnings", 1)) { - if (!f.f_alt.value) { - tinyMCEPopup.editor.windowManager.confirm(tinyMCEPopup.getLang('moodleimage_dlg.missing_alt'), function(s) { - if (s) - t.insertAndClose(); - }); - - return; - } - } - - t.insertAndClose(); - }, - - insertAndClose : function() { - var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el; - - // Fixes crash in Safari - if (tinymce.isWebKit) - ed.getWin().focus(); - - tinymce.extend(args, { - src : nl.f_url.value, - width : nl.f_width.value, - height : nl.f_height.value, - alt : nl.f_alt.value, - vspace : nl.f_vert.value, - hspace : nl.f_horiz.value, - border : nl.f_border.value, - align : getSelectValue(f, 'f_align') - }); - - el = ed.selection.getNode(); - - if (el && el.nodeName == 'IMG') { - ed.dom.setAttribs(el, args); - } else { - ed.execCommand('mceInsertContent', false, ''); - ed.dom.setAttribs('__mce_tmp', args); - ed.dom.setAttrib('__mce_tmp', 'id', ''); - } - - tinyMCEPopup.close(); - }, - - changeHeight : function() { - var f = document.forms[0], tp, t = this; - - //if (!f.constrain.checked || !t.preloadImg) { - //t.updateStyle(); - //return; - //} - - if (f.width.value == "" || f.height.value == "") - return; - - tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height; - f.height.value = tp.toFixed(0); - //t.updateStyle(); - }, - - changeWidth : function() { - var f = document.forms[0], tp, t = this; - - //if (!f.constrain.checked || !t.preloadImg) { - //t.updateStyle(); - //return; - //} - - if (f.f_width.value == "" || f.f_height.value == "") - return; - - tp = (parseInt(f.f_height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width; - f.width.value = tp.toFixed(0); - //t.updateStyle(); - }, - getAttrib : function(e, at) { - var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; - - if (ed.settings.inline_styles) { - switch (at) { - case 'align': - if (v = dom.getStyle(e, 'float')) - return v; - - if (v = dom.getStyle(e, 'vertical-align')) - return v; - - break; - - case 'hspace': - v = dom.getStyle(e, 'margin-left') - v2 = dom.getStyle(e, 'margin-right'); - if (v && v == v2) - return parseInt(v.replace(/[^0-9]/g, '')); - - break; - - case 'vspace': - v = dom.getStyle(e, 'margin-top') - v2 = dom.getStyle(e, 'margin-bottom'); - if (v && v == v2) - return parseInt(v.replace(/[^0-9]/g, '')); - - break; - - case 'border': - v = 0; - - tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { - sv = dom.getStyle(e, 'border-' + sv + '-width'); - - // False or not the same as prev - if (!sv || (sv != v && v !== 0)) { - v = 0; - return false; - } - - if (sv) - v = sv; - }); - - if (v) - return parseInt(v.replace(/[^0-9]/g, '')); - - break; - } - } - - if (v = dom.getAttrib(e, at)) - return v; - - return ''; - } - - -}; - - -tinyMCEPopup.onInit.add(MoodleImageDialog.init, MoodleImageDialog); diff --git a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/langs/en_dlg.js b/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/langs/en_dlg.js deleted file mode 100644 index 4627138574..0000000000 --- a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/langs/en_dlg.js +++ /dev/null @@ -1,4 +0,0 @@ -tinyMCE.addI18n('en.moodleimage_dlg',{ -title:"Insert Image", -missing_alt:"Are you sure you want to continue without including an Alternate Text? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off." -}); \ No newline at end of file diff --git a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/preview.php b/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/preview.php deleted file mode 100644 index 223d9e4888..0000000000 --- a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/preview.php +++ /dev/null @@ -1,31 +0,0 @@ -'); - -?> - - - -<?php echo get_string('preview') ?> - - - - - - - - -- 2.39.5