- |
+ |
|
@@ -229,11 +225,11 @@
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advimage/images/sample.gif
Binary file includes/clientside/tinymce/plugins/advimage/images/sample.gif has changed
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advimage/img/sample.gif
Binary file includes/clientside/tinymce/plugins/advimage/img/sample.gif has changed
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advimage/js/image.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/clientside/tinymce/plugins/advimage/js/image.js Thu Dec 27 22:09:33 2007 -0500
@@ -0,0 +1,403 @@
+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 t = this;
+
+ if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {
+ if (!document.forms[0].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
+ });
+
+ 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 -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advimage/jscripts/functions.js
--- a/includes/clientside/tinymce/plugins/advimage/jscripts/functions.js Wed Dec 26 00:37:26 2007 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,534 +0,0 @@
-/* Functions for the advimage plugin popup */
-
-var preloadImg = null;
-var orgImageWidth, orgImageHeight;
-
-function preinit() {
- // Initialize
- tinyMCE.setWindowArg('mce_windowresize', false);
-
- // Import external list url javascript
- var url = tinyMCE.getParam("external_image_list_url");
- if (url != null) {
- // Fix relative
- if (url.charAt(0) != '/' && url.indexOf('://') == -1)
- url = tinyMCE.documentBasePath + "/" + url;
-
- document.write('');
- }
-}
-
-function convertURL(url, node, on_save) {
- return eval("tinyMCEPopup.windowOpener." + tinyMCE.settings['urlconverter_callback'] + "(url, node, on_save);");
-}
-
-function getImageSrc(str) {
- var pos = -1;
-
- if (!str)
- return "";
-
- if ((pos = str.indexOf('this.src=')) != -1) {
- var src = str.substring(pos + 10);
-
- src = src.substring(0, src.indexOf('\''));
-
- if (tinyMCE.getParam('convert_urls'))
- src = convertURL(src, null, true);
-
- return src;
- }
-
- return "";
-}
-
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- var formObj = document.forms[0];
- var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
- var elm = inst.getFocusElement();
- var action = "insert";
- var html = "";
-
- // Image list src
- html = getImageListHTML('imagelistsrc','src','onSelectMainImage');
- if (html == "")
- document.getElementById("imagelistsrcrow").style.display = 'none';
- else
- document.getElementById("imagelistsrccontainer").innerHTML = html;
-
- // Image list oversrc
- html = getImageListHTML('imagelistover','onmouseoversrc');
- if (html == "")
- document.getElementById("imagelistoverrow").style.display = 'none';
- else
- document.getElementById("imagelistovercontainer").innerHTML = html;
-
- // Image list outsrc
- html = getImageListHTML('imagelistout','onmouseoutsrc');
- if (html == "")
- document.getElementById("imagelistoutrow").style.display = 'none';
- else
- document.getElementById("imagelistoutcontainer").innerHTML = html;
-
- // Src browser
- html = getBrowserHTML('srcbrowser','src','image','advimage');
- document.getElementById("srcbrowsercontainer").innerHTML = html;
-
- // Over browser
- html = getBrowserHTML('oversrcbrowser','onmouseoversrc','image','advimage');
- document.getElementById("onmouseoversrccontainer").innerHTML = html;
-
- // Out browser
- html = getBrowserHTML('outsrcbrowser','onmouseoutsrc','image','advimage');
- document.getElementById("onmouseoutsrccontainer").innerHTML = html;
-
- // Longdesc browser
- html = getBrowserHTML('longdescbrowser','longdesc','file','advimage');
- document.getElementById("longdesccontainer").innerHTML = html;
-
- // Resize some elements
- if (isVisible('srcbrowser'))
- document.getElementById('src').style.width = '260px';
-
- if (isVisible('oversrcbrowser'))
- document.getElementById('onmouseoversrc').style.width = '260px';
-
- if (isVisible('outsrcbrowser'))
- document.getElementById('onmouseoutsrc').style.width = '260px';
-
- if (isVisible('longdescbrowser'))
- document.getElementById('longdesc').style.width = '180px';
-
- // Check action
- if (elm != null && elm.nodeName == "IMG")
- action = "update";
-
- formObj.insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true);
-
- if (action == "update") {
- var src = tinyMCE.getAttrib(elm, 'src');
- var onmouseoversrc = getImageSrc(tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseover')));
- var onmouseoutsrc = getImageSrc(tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseout')));
-
- src = convertURL(src, elm, true);
-
- // Use mce_src if found
- var mceRealSrc = tinyMCE.getAttrib(elm, 'mce_src');
- if (mceRealSrc != "") {
- src = mceRealSrc;
-
- if (tinyMCE.getParam('convert_urls'))
- src = convertURL(src, elm, true);
- }
-
- if (onmouseoversrc != "" && tinyMCE.getParam('convert_urls'))
- onmouseoversrc = convertURL(onmouseoversrc, elm, true);
-
- if (onmouseoutsrc != "" && tinyMCE.getParam('convert_urls'))
- onmouseoutsrc = convertURL(onmouseoutsrc, elm, true);
-
- // Setup form data
- var style = tinyMCE.parseStyle(tinyMCE.getAttrib(elm, "style"));
-
- // Store away old size
- orgImageWidth = trimSize(getStyle(elm, 'width'))
- orgImageHeight = trimSize(getStyle(elm, 'height'));
-
- formObj.src.value = src;
- formObj.alt.value = tinyMCE.getAttrib(elm, 'alt');
- formObj.title.value = tinyMCE.getAttrib(elm, 'title');
- formObj.border.value = trimSize(getStyle(elm, 'border', 'borderWidth'));
- formObj.vspace.value = tinyMCE.getAttrib(elm, 'vspace');
- formObj.hspace.value = tinyMCE.getAttrib(elm, 'hspace');
- formObj.width.value = orgImageWidth;
- formObj.height.value = orgImageHeight;
- formObj.onmouseoversrc.value = onmouseoversrc;
- formObj.onmouseoutsrc.value = onmouseoutsrc;
- formObj.id.value = tinyMCE.getAttrib(elm, 'id');
- formObj.dir.value = tinyMCE.getAttrib(elm, 'dir');
- formObj.lang.value = tinyMCE.getAttrib(elm, 'lang');
- formObj.longdesc.value = tinyMCE.getAttrib(elm, 'longdesc');
- formObj.usemap.value = tinyMCE.getAttrib(elm, 'usemap');
- formObj.style.value = tinyMCE.serializeStyle(style);
-
- // Select by the values
- if (tinyMCE.isMSIE)
- selectByValue(formObj, 'align', getStyle(elm, 'align', 'styleFloat'));
- else
- selectByValue(formObj, 'align', getStyle(elm, 'align', 'cssFloat'));
-
- addClassesToList('classlist', 'advimage_styles');
-
- selectByValue(formObj, 'classlist', tinyMCE.getAttrib(elm, 'class'));
- selectByValue(formObj, 'imagelistsrc', src);
- selectByValue(formObj, 'imagelistover', onmouseoversrc);
- selectByValue(formObj, 'imagelistout', onmouseoutsrc);
-
- updateStyle();
- showPreviewImage(src, true);
- changeAppearance();
-
- window.focus();
- } else
- addClassesToList('classlist', 'advimage_styles');
-
- // If option enabled default contrain proportions to checked
- if (tinyMCE.getParam("advimage_constrain_proportions", true))
- formObj.constrain.checked = true;
-
- // Check swap image if valid data
- if (formObj.onmouseoversrc.value != "" || formObj.onmouseoutsrc.value != "")
- setSwapImageDisabled(false);
- else
- setSwapImageDisabled(true);
-}
-
-function setSwapImageDisabled(state) {
- var formObj = document.forms[0];
-
- formObj.onmousemovecheck.checked = !state;
-
- setBrowserDisabled('overbrowser', state);
- setBrowserDisabled('outbrowser', state);
-
- if (formObj.imagelistover)
- formObj.imagelistover.disabled = state;
-
- if (formObj.imagelistout)
- formObj.imagelistout.disabled = state;
-
- formObj.onmouseoversrc.disabled = state;
- formObj.onmouseoutsrc.disabled = state;
-}
-
-function setAttrib(elm, attrib, value) {
- var formObj = document.forms[0];
- var valueElm = formObj.elements[attrib];
-
- if (typeof(value) == "undefined" || value == null) {
- value = "";
-
- if (valueElm)
- value = valueElm.value;
- }
-
- if (value != "") {
- elm.setAttribute(attrib, value);
-
- if (attrib == "style")
- attrib = "style.cssText";
-
- if (attrib == "longdesc")
- attrib = "longDesc";
-
- if (attrib == "width") {
- attrib = "style.width";
- value = value + "px";
- value = value.replace(/%px/g, 'px');
- }
-
- if (attrib == "height") {
- attrib = "style.height";
- value = value + "px";
- value = value.replace(/%px/g, 'px');
- }
-
- if (attrib == "class")
- attrib = "className";
-
- eval('elm.' + attrib + "=value;");
- } else
- elm.removeAttribute(attrib);
-}
-
-function makeAttrib(attrib, value) {
- var formObj = document.forms[0];
- var valueElm = formObj.elements[attrib];
-
- if (typeof(value) == "undefined" || value == null) {
- value = "";
-
- if (valueElm)
- value = valueElm.value;
- }
-
- if (value == "")
- return "";
-
- // XML encode it
- value = value.replace(/&/g, '&');
- value = value.replace(/\"/g, '"');
- value = value.replace(//g, '>');
-
- return ' ' + attrib + '="' + value + '"';
-}
-
-function insertAction() {
- var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
- var elm = inst.getFocusElement();
- var formObj = document.forms[0];
- var src = formObj.src.value;
- var onmouseoversrc = formObj.onmouseoversrc.value;
- var onmouseoutsrc = formObj.onmouseoutsrc.value;
-
- if (!AutoValidator.validate(formObj)) {
- alert(tinyMCE.getLang('lang_invalid_data'));
- return false;
- }
-
- if (tinyMCE.getParam("accessibility_warnings")) {
- if (formObj.alt.value == "" && !confirm(tinyMCE.getLang('lang_advimage_missing_alt', '', true)))
- return;
- }
-
- if (onmouseoversrc && onmouseoversrc != "")
- onmouseoversrc = "this.src='" + convertURL(onmouseoversrc, tinyMCE.imgElement) + "';";
-
- if (onmouseoutsrc && onmouseoutsrc != "")
- onmouseoutsrc = "this.src='" + convertURL(onmouseoutsrc, tinyMCE.imgElement) + "';";
-
- if (elm != null && elm.nodeName == "IMG") {
- setAttrib(elm, 'src', convertURL(src, tinyMCE.imgElement));
- setAttrib(elm, 'mce_src', src);
- setAttrib(elm, 'alt');
- setAttrib(elm, 'title');
- setAttrib(elm, 'border');
- setAttrib(elm, 'vspace');
- setAttrib(elm, 'hspace');
- setAttrib(elm, 'width');
- setAttrib(elm, 'height');
- setAttrib(elm, 'onmouseover', onmouseoversrc);
- setAttrib(elm, 'onmouseout', onmouseoutsrc);
- setAttrib(elm, 'id');
- setAttrib(elm, 'dir');
- setAttrib(elm, 'lang');
- setAttrib(elm, 'longdesc');
- setAttrib(elm, 'usemap');
- setAttrib(elm, 'style');
- setAttrib(elm, 'class', getSelectValue(formObj, 'classlist'));
- setAttrib(elm, 'align', getSelectValue(formObj, 'align'));
-
- //tinyMCEPopup.execCommand("mceRepaint");
-
- // Repaint if dimensions changed
- if (formObj.width.value != orgImageWidth || formObj.height.value != orgImageHeight)
- inst.repaint();
-
- // Refresh in old MSIE
- if (tinyMCE.isMSIE5)
- elm.outerHTML = elm.outerHTML;
- } else {
- var html = "";
-
- tinyMCEPopup.execCommand("mceInsertContent", false, html);
- }
-
- tinyMCE._setEventsEnabled(inst.getBody(), false);
- tinyMCEPopup.close();
-}
-
-function cancelAction() {
- tinyMCEPopup.close();
-}
-
-function changeAppearance() {
- var formObj = document.forms[0];
- var img = document.getElementById('alignSampleImg');
-
- if (img) {
- img.align = formObj.align.value;
- img.border = formObj.border.value;
- img.hspace = formObj.hspace.value;
- img.vspace = formObj.vspace.value;
- }
-}
-
-function changeMouseMove() {
- var formObj = document.forms[0];
-
- setSwapImageDisabled(!formObj.onmousemovecheck.checked);
-}
-
-function updateStyle() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
-
- if (tinyMCE.getParam('inline_styles', false)) {
- st['width'] = formObj.width.value == '' ? '' : formObj.width.value + "px";
- st['height'] = formObj.height.value == '' ? '' : formObj.height.value + "px";
- st['border-width'] = formObj.border.value == '' ? '' : formObj.border.value + "px";
- st['margin-top'] = formObj.vspace.value == '' ? '' : formObj.vspace.value + "px";
- st['margin-bottom'] = formObj.vspace.value == '' ? '' : formObj.vspace.value + "px";
- st['margin-left'] = formObj.hspace.value == '' ? '' : formObj.hspace.value + "px";
- st['margin-right'] = formObj.hspace.value == '' ? '' : formObj.hspace.value + "px";
- } else {
- st['width'] = st['height'] = st['border-width'] = null;
-
- if (st['margin-top'] == st['margin-bottom'])
- st['margin-top'] = st['margin-bottom'] = null;
-
- if (st['margin-left'] == st['margin-right'])
- st['margin-left'] = st['margin-right'] = null;
- }
-
- formObj.style.value = tinyMCE.serializeStyle(st);
-}
-
-function styleUpdated() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
-
- if (st['width'])
- formObj.width.value = st['width'].replace('px', '');
-
- if (st['height'])
- formObj.height.value = st['height'].replace('px', '');
-
- if (st['margin-top'] && st['margin-top'] == st['margin-bottom'])
- formObj.vspace.value = st['margin-top'].replace('px', '');
-
- if (st['margin-left'] && st['margin-left'] == st['margin-right'])
- formObj.hspace.value = st['margin-left'].replace('px', '');
-
- if (st['border-width'])
- formObj.border.value = st['border-width'].replace('px', '');
-}
-
-function changeHeight() {
- var formObj = document.forms[0];
-
- if (!formObj.constrain.checked || !preloadImg) {
- updateStyle();
- return;
- }
-
- if (formObj.width.value == "" || formObj.height.value == "")
- return;
-
- var temp = (parseInt(formObj.width.value) / parseInt(preloadImg.width)) * preloadImg.height;
- formObj.height.value = temp.toFixed(0);
- updateStyle();
-}
-
-function changeWidth() {
- var formObj = document.forms[0];
-
- if (!formObj.constrain.checked || !preloadImg) {
- updateStyle();
- return;
- }
-
- if (formObj.width.value == "" || formObj.height.value == "")
- return;
-
- var temp = (parseInt(formObj.height.value) / parseInt(preloadImg.height)) * preloadImg.width;
- formObj.width.value = temp.toFixed(0);
- updateStyle();
-}
-
-function onSelectMainImage(target_form_element, name, value) {
- var formObj = document.forms[0];
-
- formObj.alt.value = name;
- formObj.title.value = name;
-
- resetImageData();
- showPreviewImage(formObj.elements[target_form_element].value, false);
-}
-
-function showPreviewImage(src, start) {
- var formObj = document.forms[0];
-
- selectByValue(document.forms[0], 'imagelistsrc', src);
-
- var elm = document.getElementById('prev');
- var src = src == "" ? src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src);
-
- if (!start && tinyMCE.getParam("advimage_update_dimensions_onchange", true))
- resetImageData();
-
- if (src == "")
- elm.innerHTML = "";
- else
- elm.innerHTML = ''
-}
-
-function updateImageData() {
- var formObj = document.forms[0];
-
- preloadImg = document.getElementById('previewImg');
-
- if (formObj.width.value == "")
- formObj.width.value = preloadImg.width;
-
- if (formObj.height.value == "")
- formObj.height.value = preloadImg.height;
-
- updateStyle();
-}
-
-function resetImageData() {
- var formObj = document.forms[0];
- formObj.width.value = formObj.height.value = "";
-}
-
-function getSelectValue(form_obj, field_name) {
- var elm = form_obj.elements[field_name];
-
- if (elm == null || elm.options == null)
- return "";
-
- return elm.options[elm.selectedIndex].value;
-}
-
-function getImageListHTML(elm_id, target_form_element, onchange_func) {
- if (typeof(tinyMCEImageList) == "undefined" || tinyMCEImageList.length == 0)
- return "";
-
- var html = "";
-
- html += '';
-
- return html;
-
- // tinyMCE.debug('-- image list start --', html, '-- image list end --');
-}
-
-// While loading
-preinit();
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advimage/langs/en.js
--- a/includes/clientside/tinymce/plugins/advimage/langs/en.js Wed Dec 26 00:37:26 2007 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('advimage',{
-tab_general : 'General',
-tab_appearance : 'Appearance',
-tab_advanced : 'Advanced',
-general : 'General',
-title : 'Title',
-preview : 'Preview',
-constrain_proportions : 'Constrain proportions',
-langdir : 'Language direction',
-langcode : 'Language code',
-long_desc : 'Long description link',
-style : 'Style',
-classes : 'Classes',
-ltr : 'Left to right',
-rtl : 'Right to left',
-id : 'Id',
-image_map : 'Image map',
-swap_image : 'Swap image',
-alt_image : 'Alternative image',
-mouseover : 'for mouse over',
-mouseout : 'for mouse out',
-misc : 'Miscellaneous',
-example_img : 'Appearance preview image',
-missing_alt : 'Are you sure you want to continue without including an Image Description? 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.'
-});
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advimage/langs/en_dlg.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/clientside/tinymce/plugins/advimage/langs/en_dlg.js Thu Dec 27 22:09:33 2007 -0500
@@ -0,0 +1,43 @@
+tinyMCE.addI18n('en.advimage_dlg',{
+tab_general:"General",
+tab_appearance:"Appearance",
+tab_advanced:"Advanced",
+general:"General",
+title:"Title",
+preview:"Preview",
+constrain_proportions:"Constrain proportions",
+langdir:"Language direction",
+langcode:"Language code",
+long_desc:"Long description link",
+style:"Style",
+classes:"Classes",
+ltr:"Left to right",
+rtl:"Right to left",
+id:"Id",
+map:"Image map",
+swap_image:"Swap image",
+alt_image:"Alternative image",
+mouseover:"for mouse over",
+mouseout:"for mouse out",
+misc:"Miscellaneous",
+example_img:"Appearance preview image",
+missing_alt:"Are you sure you want to continue without including an Image Description? 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.",
+dialog_title:"Insert/edit image",
+src:"Image URL",
+alt:"Image description",
+list:"Image list",
+border:"Border",
+dimensions:"Dimensions",
+vspace:"Vertical space",
+hspace:"Horizontal space",
+align:"Alignment",
+align_baseline:"Baseline",
+align_top:"Top",
+align_middle:"Middle",
+align_bottom:"Bottom",
+align_texttop:"Text top",
+align_textbottom:"Text bottom",
+align_left:"Left",
+align_right:"Right",
+image_list:"Image list"
+});
\ No newline at end of file
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advimage/readme.txt
--- a/includes/clientside/tinymce/plugins/advimage/readme.txt Wed Dec 26 00:37:26 2007 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Check the TinyMCE documentation for details on this plugin.
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advlink/css/advlink.css
--- a/includes/clientside/tinymce/plugins/advlink/css/advlink.css Wed Dec 26 00:37:26 2007 -0500
+++ b/includes/clientside/tinymce/plugins/advlink/css/advlink.css Thu Dec 27 22:09:33 2007 -0500
@@ -1,35 +1,8 @@
-/* CSS file for advimage plugin popup */
-
-.mceLinkList, .mceAnchorList, #targetlist {
- width: 280px;
-}
-
-.mceActionPanel {
- margin-top: 7px;
-}
-
-.panel_wrapper div.current {
- height: 320px;
-}
-
-#classlist, #title, #href {
- width: 280px;
-}
-
-#popupurl, #popupname {
- width: 200px;
-}
-
-#popupwidth, #popupheight, #popupleft, #popuptop {
- width: 30px;
- vertical-align: middle;
- text-align: center;
-}
-
-#id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {
- width: 200px;
-}
-
-#events_panel input {
- width: 200px;
-}
+.mceLinkList, .mceAnchorList, #targetlist {width:280px;}
+.mceActionPanel {margin-top:7px;}
+.panel_wrapper div.current {height:320px;}
+#classlist, #title, #href {width:280px;}
+#popupurl, #popupname {width:200px;}
+#popupwidth, #popupheight, #popupleft, #popuptop {width:30px;vertical-align:middle;text-align:center;}
+#id, #style, #classes, #target, #dir, #hreflang, #lang, #charset, #type, #rel, #rev, #tabindex, #accesskey {width:200px;}
+#events_panel input {width:200px;}
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advlink/editor_plugin.js
--- a/includes/clientside/tinymce/plugins/advlink/editor_plugin.js Wed Dec 26 00:37:26 2007 -0500
+++ b/includes/clientside/tinymce/plugins/advlink/editor_plugin.js Thu Dec 27 22:09:33 2007 -0500
@@ -1,1 +1,1 @@
-tinyMCE.importPluginLanguagePack('advlink');var TinyMCE_AdvancedLinkPlugin={getInfo:function(){return{longname:'Advanced link',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){inst.addShortcut('ctrl','k','lang_advlink_desc','mceAdvLink')},getControlHTML:function(cn){switch(cn){case"link":return tinyMCE.getButtonHTML(cn,'lang_link_desc','{$themeurl}/images/link.gif','mceAdvLink')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceAdvLink":var anySelection=false;var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var selectedText=inst.selection.getSelectedText();if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(anySelection||(focusElm!=null&&focusElm.nodeName=="A")){var template=new Array();template['file']='../../plugins/advlink/link.htm';template['width']=480;template['height']=400;template['width']+=tinyMCE.getLang('lang_advlink_delta_width',0);template['height']+=tinyMCE.getLang('lang_advlink_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"})}return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="A"&&tinyMCE.getAttrib(node,'href')!=""){tinyMCE.switchClass(editor_id+'_advlink','mceButtonSelected');return true}}while((node=node.parentNode));if(any_selection){tinyMCE.switchClass(editor_id+'_advlink','mceButtonNormal');return true}tinyMCE.switchClass(editor_id+'_advlink','mceButtonDisabled');return true}};tinyMCE.addPlugin("advlink",TinyMCE_AdvancedLinkPlugin);
\ No newline at end of file
+(function(){tinymce.create('tinymce.plugins.AdvancedLinkPlugin',{init:function(ed,url){this.editor=ed;ed.addCommand('mceAdvLink',function(){var se=ed.selection;if(se.isCollapsed()&&se.getNode().nodeName!='A')return;ed.windowManager.open({file:url+'/link.htm',width:480+ed.getLang('advlink.delta_width',0),height:400+ed.getLang('advlink.delta_height',0),inline:1},{plugin_url:url});});ed.addButton('link',{title:'advlink.link_desc',cmd:'mceAdvLink'});ed.addShortcut('ctrl+k','advlink.advlink_desc','mceAdvLink');ed.onNodeChange.add(function(ed,cm,n,co){cm.setDisabled('link',co&&n.nodeName!='A');cm.setActive('link',n.nodeName=='A');});},getInfo:function(){return{longname:'Advanced link',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advlink',tinymce.plugins.AdvancedLinkPlugin);})();
\ No newline at end of file
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advlink/editor_plugin_src.js
--- a/includes/clientside/tinymce/plugins/advlink/editor_plugin_src.js Wed Dec 26 00:37:26 2007 -0500
+++ b/includes/clientside/tinymce/plugins/advlink/editor_plugin_src.js Thu Dec 27 22:09:33 2007 -0500
@@ -1,88 +1,58 @@
/**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ * $Id: editor_plugin_src.js 482 2007-12-10 16:51:29Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('advlink');
+(function() {
+ tinymce.create('tinymce.plugins.AdvancedLinkPlugin', {
+ init : function(ed, url) {
+ this.editor = ed;
-var TinyMCE_AdvancedLinkPlugin = {
- getInfo : function() {
- return {
- longname : 'Advanced link',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
- },
-
- initInstance : function(inst) {
- inst.addShortcut('ctrl', 'k', 'lang_advlink_desc', 'mceAdvLink');
- },
+ // Register commands
+ ed.addCommand('mceAdvLink', function() {
+ var se = ed.selection;
- getControlHTML : function(cn) {
- switch (cn) {
- case "link":
- return tinyMCE.getButtonHTML(cn, 'lang_link_desc', '{$themeurl}/images/link.gif', 'mceAdvLink');
- }
-
- return "";
- },
+ // No selection and not in link
+ if (se.isCollapsed() && se.getNode().nodeName != 'A')
+ return;
- execCommand : function(editor_id, element, command, user_interface, value) {
- switch (command) {
- case "mceAdvLink":
- var anySelection = false;
- var inst = tinyMCE.getInstanceById(editor_id);
- var focusElm = inst.getFocusElement();
- var selectedText = inst.selection.getSelectedText();
-
- if (tinyMCE.selectedElement)
- anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (selectedText && selectedText.length > 0);
-
- if (anySelection || (focusElm != null && focusElm.nodeName == "A")) {
- var template = new Array();
+ ed.windowManager.open({
+ file : url + '/link.htm',
+ width : 480 + ed.getLang('advlink.delta_width', 0),
+ height : 400 + ed.getLang('advlink.delta_height', 0),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
- template['file'] = '../../plugins/advlink/link.htm';
- template['width'] = 480;
- template['height'] = 400;
-
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_advlink_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_advlink_delta_height', 0);
+ // Register buttons
+ ed.addButton('link', {
+ title : 'advlink.link_desc',
+ cmd : 'mceAdvLink'
+ });
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
- }
+ ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');
- return true;
- }
-
- return false;
- },
+ ed.onNodeChange.add(function(ed, cm, n, co) {
+ cm.setDisabled('link', co && n.nodeName != 'A');
+ cm.setActive('link', n.nodeName == 'A');
+ });
+ },
- handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
- if (node == null)
- return;
-
- do {
- if (node.nodeName == "A" && tinyMCE.getAttrib(node, 'href') != "") {
- tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonSelected');
- return true;
- }
- } while ((node = node.parentNode));
+ getInfo : function() {
+ return {
+ longname : 'Advanced link',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
- if (any_selection) {
- tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonNormal');
- return true;
- }
-
- tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonDisabled');
-
- return true;
- }
-};
-
-tinyMCE.addPlugin("advlink", TinyMCE_AdvancedLinkPlugin);
+ // Register plugin
+ tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);
+})();
\ No newline at end of file
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advlink/js/advlink.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/clientside/tinymce/plugins/advlink/js/advlink.js Thu Dec 27 22:09:33 2007 -0500
@@ -0,0 +1,551 @@
+/* Functions for the advlink plugin popup */
+
+tinyMCEPopup.requireLangPack();
+
+var templates = {
+ "window.open" : "window.open('${url}','${target}','${options}')"
+};
+
+function preinit() {
+ var url;
+
+ if (url = tinyMCEPopup.getParam("external_link_list_url"))
+ document.write('');
+}
+
+function changeClass() {
+ var formObj = document.forms[0];
+ formObj.classes.value = getSelectValue(formObj, 'classlist');
+}
+
+function init() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ var formObj = document.forms[0];
+ var inst = tinyMCEPopup.editor;
+ var elm = inst.selection.getNode();
+ var action = "insert";
+ var html;
+
+ document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');
+ document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');
+ document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href');
+ document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href');
+ document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');
+
+ // Link list
+ html = getLinkListHTML('linklisthref','href');
+ if (html == "")
+ document.getElementById("linklisthrefrow").style.display = 'none';
+ else
+ document.getElementById("linklisthrefcontainer").innerHTML = html;
+
+ // Resize some elements
+ if (isVisible('hrefbrowser'))
+ document.getElementById('href').style.width = '260px';
+
+ if (isVisible('popupurlbrowser'))
+ document.getElementById('popupurl').style.width = '180px';
+
+ elm = inst.dom.getParent(elm, "A");
+ if (elm != null && elm.nodeName == "A")
+ action = "update";
+
+ formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true);
+
+ setPopupControlsDisabled(true);
+
+ if (action == "update") {
+ var href = inst.dom.getAttrib(elm, 'href');
+ var onclick = inst.dom.getAttrib(elm, 'onclick');
+
+ // Setup form data
+ setFormValue('href', href);
+ setFormValue('title', inst.dom.getAttrib(elm, 'title'));
+ setFormValue('id', inst.dom.getAttrib(elm, 'id'));
+ setFormValue('style', inst.dom.getAttrib(elm, "style"));
+ setFormValue('rel', inst.dom.getAttrib(elm, 'rel'));
+ setFormValue('rev', inst.dom.getAttrib(elm, 'rev'));
+ setFormValue('charset', inst.dom.getAttrib(elm, 'charset'));
+ setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang'));
+ setFormValue('dir', inst.dom.getAttrib(elm, 'dir'));
+ setFormValue('lang', inst.dom.getAttrib(elm, 'lang'));
+ setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
+ setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
+ setFormValue('type', inst.dom.getAttrib(elm, 'type'));
+ setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus'));
+ setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur'));
+ setFormValue('onclick', onclick);
+ setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick'));
+ setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown'));
+ setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup'));
+ setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover'));
+ setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove'));
+ setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout'));
+ setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress'));
+ setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown'));
+ setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup'));
+ setFormValue('target', inst.dom.getAttrib(elm, 'target'));
+ setFormValue('classes', inst.dom.getAttrib(elm, 'class'));
+
+ // Parse onclick data
+ if (onclick != null && onclick.indexOf('window.open') != -1)
+ parseWindowOpen(onclick);
+ else
+ parseFunction(onclick);
+
+ // Select by the values
+ selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir'));
+ selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel'));
+ selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev'));
+ selectByValue(formObj, 'linklisthref', href);
+
+ if (href.charAt(0) == '#')
+ selectByValue(formObj, 'anchorlist', href);
+
+ addClassesToList('classlist', 'advlink_styles');
+
+ selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true);
+ selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true);
+ } else
+ addClassesToList('classlist', 'advlink_styles');
+
+ window.focus();
+}
+
+function checkPrefix(n) {
+ if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
+ n.value = 'mailto:' + n.value;
+
+ if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external')))
+ n.value = 'http://' + n.value;
+}
+
+function setFormValue(name, value) {
+ document.forms[0].elements[name].value = value;
+}
+
+function parseWindowOpen(onclick) {
+ var formObj = document.forms[0];
+
+ // Preprocess center code
+ if (onclick.indexOf('return false;') != -1) {
+ formObj.popupreturn.checked = true;
+ onclick = onclick.replace('return false;', '');
+ } else
+ formObj.popupreturn.checked = false;
+
+ var onClickData = parseLink(onclick);
+
+ if (onClickData != null) {
+ formObj.ispopup.checked = true;
+ setPopupControlsDisabled(false);
+
+ var onClickWindowOptions = parseOptions(onClickData['options']);
+ var url = onClickData['url'];
+
+ formObj.popupname.value = onClickData['target'];
+ formObj.popupurl.value = url;
+ formObj.popupwidth.value = getOption(onClickWindowOptions, 'width');
+ formObj.popupheight.value = getOption(onClickWindowOptions, 'height');
+
+ formObj.popupleft.value = getOption(onClickWindowOptions, 'left');
+ formObj.popuptop.value = getOption(onClickWindowOptions, 'top');
+
+ if (formObj.popupleft.value.indexOf('screen') != -1)
+ formObj.popupleft.value = "c";
+
+ if (formObj.popuptop.value.indexOf('screen') != -1)
+ formObj.popuptop.value = "c";
+
+ formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes";
+ formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes";
+ formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes";
+ formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes";
+ formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes";
+ formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes";
+ formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes";
+
+ buildOnClick();
+ }
+}
+
+function parseFunction(onclick) {
+ var formObj = document.forms[0];
+ var onClickData = parseLink(onclick);
+
+ // TODO: Add stuff here
+}
+
+function getOption(opts, name) {
+ return typeof(opts[name]) == "undefined" ? "" : opts[name];
+}
+
+function setPopupControlsDisabled(state) {
+ var formObj = document.forms[0];
+
+ formObj.popupname.disabled = state;
+ formObj.popupurl.disabled = state;
+ formObj.popupwidth.disabled = state;
+ formObj.popupheight.disabled = state;
+ formObj.popupleft.disabled = state;
+ formObj.popuptop.disabled = state;
+ formObj.popuplocation.disabled = state;
+ formObj.popupscrollbars.disabled = state;
+ formObj.popupmenubar.disabled = state;
+ formObj.popupresizable.disabled = state;
+ formObj.popuptoolbar.disabled = state;
+ formObj.popupstatus.disabled = state;
+ formObj.popupreturn.disabled = state;
+ formObj.popupdependent.disabled = state;
+
+ setBrowserDisabled('popupurlbrowser', state);
+}
+
+function parseLink(link) {
+ link = link.replace(new RegExp(''', 'g'), "'");
+
+ var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1");
+
+ // Is function name a template function
+ var template = templates[fnName];
+ if (template) {
+ // Build regexp
+ var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi"));
+ var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\(";
+ var replaceStr = "";
+ for (var i=0; i";
+ } else
+ regExp += ".*";
+ }
+
+ regExp += "\\);?";
+
+ // Build variable array
+ var variables = new Array();
+ variables["_function"] = fnName;
+ var variableValues = link.replace(new RegExp(regExp, "gi"), replaceStr).split('');
+ for (var i=0; i';
+ html += '';
+
+ for (i=0; i' + name + '';
+ }
+
+ html += '';
+
+ return html;
+}
+
+function insertAction() {
+ var inst = tinyMCEPopup.editor;
+ var elm, elementArray, i;
+
+ elm = inst.selection.getNode();
+ checkPrefix(document.forms[0].href);
+
+ elm = inst.dom.getParent(elm, "A");
+ tinyMCEPopup.execCommand("mceBeginUndoLevel");
+
+ // Create new anchor elements
+ if (elm == null) {
+ tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#");
+
+ elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';});
+ for (i=0; i';
+
+ for (var i=0; i' + tinyMCELinkList[i][0] + '';
+
+ html += '';
+
+ return html;
+
+ // tinyMCE.debug('-- image list start --', html, '-- image list end --');
+}
+
+function getTargetListHTML(elm_id, target_form_element) {
+ var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');
+ var html = '';
+
+ html += '';
+
+ return html;
+}
+
+// While loading
+preinit();
+tinyMCEPopup.onInit.add(init);
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advlink/jscripts/functions.js
--- a/includes/clientside/tinymce/plugins/advlink/jscripts/functions.js Wed Dec 26 00:37:26 2007 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,568 +0,0 @@
-/* Functions for the advlink plugin popup */
-
-var templates = {
- "window.open" : "window.open('${url}','${target}','${options}')"
-};
-
-function preinit() {
- // Initialize
- tinyMCE.setWindowArg('mce_windowresize', false);
-
- // Import external list url javascript
- var url = tinyMCE.getParam("external_link_list_url");
- if (url != null) {
- // Fix relative
- if (url.charAt(0) != '/' && url.indexOf('://') == -1)
- url = tinyMCE.documentBasePath + "/" + url;
-
- document.write('');
- }
-}
-
-function changeClass() {
- var formObj = document.forms[0];
- formObj.classes.value = getSelectValue(formObj, 'classlist');
-}
-
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- var formObj = document.forms[0];
- var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
- var elm = inst.getFocusElement();
- var action = "insert";
- var html;
-
- document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');
- document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');
- document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href');
- document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href');
- document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');
-
- // Link list
- html = getLinkListHTML('linklisthref','href');
- if (html == "")
- document.getElementById("linklisthrefrow").style.display = 'none';
- else
- document.getElementById("linklisthrefcontainer").innerHTML = html;
-
- // Resize some elements
- if (isVisible('hrefbrowser'))
- document.getElementById('href').style.width = '260px';
-
- if (isVisible('popupurlbrowser'))
- document.getElementById('popupurl').style.width = '180px';
-
- elm = tinyMCE.getParentElement(elm, "a");
- if (elm != null && elm.nodeName == "A")
- action = "update";
-
- formObj.insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true);
-
- setPopupControlsDisabled(true);
-
- if (action == "update") {
- var href = tinyMCE.getAttrib(elm, 'href');
-
- href = convertURL(href, elm, true);
-
- // Use mce_href if found
- var mceRealHref = tinyMCE.getAttrib(elm, 'mce_href');
- if (mceRealHref != "") {
- href = mceRealHref;
-
- if (tinyMCE.getParam('convert_urls'))
- href = convertURL(href, elm, true);
- }
-
- var onclick = tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onclick'));
-
- // Setup form data
- setFormValue('href', href);
- setFormValue('title', tinyMCE.getAttrib(elm, 'title'));
- setFormValue('id', tinyMCE.getAttrib(elm, 'id'));
- setFormValue('style', tinyMCE.serializeStyle(tinyMCE.parseStyle(tinyMCE.getAttrib(elm, "style"))));
- setFormValue('rel', tinyMCE.getAttrib(elm, 'rel'));
- setFormValue('rev', tinyMCE.getAttrib(elm, 'rev'));
- setFormValue('charset', tinyMCE.getAttrib(elm, 'charset'));
- setFormValue('hreflang', tinyMCE.getAttrib(elm, 'hreflang'));
- setFormValue('dir', tinyMCE.getAttrib(elm, 'dir'));
- setFormValue('lang', tinyMCE.getAttrib(elm, 'lang'));
- setFormValue('tabindex', tinyMCE.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
- setFormValue('accesskey', tinyMCE.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
- setFormValue('type', tinyMCE.getAttrib(elm, 'type'));
- setFormValue('onfocus', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onfocus')));
- setFormValue('onblur', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onblur')));
- setFormValue('onclick', onclick);
- setFormValue('ondblclick', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'ondblclick')));
- setFormValue('onmousedown', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmousedown')));
- setFormValue('onmouseup', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseup')));
- setFormValue('onmouseover', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseover')));
- setFormValue('onmousemove', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmousemove')));
- setFormValue('onmouseout', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onmouseout')));
- setFormValue('onkeypress', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onkeypress')));
- setFormValue('onkeydown', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onkeydown')));
- setFormValue('onkeyup', tinyMCE.cleanupEventStr(tinyMCE.getAttrib(elm, 'onkeyup')));
- setFormValue('target', tinyMCE.getAttrib(elm, 'target'));
- setFormValue('classes', tinyMCE.getAttrib(elm, 'class'));
-
- // Parse onclick data
- if (onclick != null && onclick.indexOf('window.open') != -1)
- parseWindowOpen(onclick);
- else
- parseFunction(onclick);
-
- // Select by the values
- selectByValue(formObj, 'dir', tinyMCE.getAttrib(elm, 'dir'));
- selectByValue(formObj, 'rel', tinyMCE.getAttrib(elm, 'rel'));
- selectByValue(formObj, 'rev', tinyMCE.getAttrib(elm, 'rev'));
- selectByValue(formObj, 'linklisthref', href);
-
- if (href.charAt(0) == '#')
- selectByValue(formObj, 'anchorlist', href);
-
- addClassesToList('classlist', 'advlink_styles');
-
- selectByValue(formObj, 'classlist', tinyMCE.getAttrib(elm, 'class'), true);
- selectByValue(formObj, 'targetlist', tinyMCE.getAttrib(elm, 'target'), true);
- } else
- addClassesToList('classlist', 'advlink_styles');
-
- window.focus();
-}
-
-function setFormValue(name, value) {
- document.forms[0].elements[name].value = value;
-}
-
-function convertURL(url, node, on_save) {
- return eval("tinyMCEPopup.windowOpener." + tinyMCE.settings['urlconverter_callback'] + "(url, node, on_save);");
-}
-
-function parseWindowOpen(onclick) {
- var formObj = document.forms[0];
-
- // Preprocess center code
- if (onclick.indexOf('return false;') != -1) {
- formObj.popupreturn.checked = true;
- onclick = onclick.replace('return false;', '');
- } else
- formObj.popupreturn.checked = false;
-
- var onClickData = parseLink(onclick);
-
- if (onClickData != null) {
- formObj.ispopup.checked = true;
- setPopupControlsDisabled(false);
-
- var onClickWindowOptions = parseOptions(onClickData['options']);
- var url = onClickData['url'];
-
- if (tinyMCE.getParam('convert_urls'))
- url = convertURL(url, null, true);
-
- formObj.popupname.value = onClickData['target'];
- formObj.popupurl.value = url;
- formObj.popupwidth.value = getOption(onClickWindowOptions, 'width');
- formObj.popupheight.value = getOption(onClickWindowOptions, 'height');
-
- formObj.popupleft.value = getOption(onClickWindowOptions, 'left');
- formObj.popuptop.value = getOption(onClickWindowOptions, 'top');
-
- if (formObj.popupleft.value.indexOf('screen') != -1)
- formObj.popupleft.value = "c";
-
- if (formObj.popuptop.value.indexOf('screen') != -1)
- formObj.popuptop.value = "c";
-
- formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes";
- formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes";
- formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes";
- formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes";
- formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes";
- formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes";
- formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes";
-
- buildOnClick();
- }
-}
-
-function parseFunction(onclick) {
- var formObj = document.forms[0];
- var onClickData = parseLink(onclick);
-
- // TODO: Add stuff here
-}
-
-function getOption(opts, name) {
- return typeof(opts[name]) == "undefined" ? "" : opts[name];
-}
-
-function setPopupControlsDisabled(state) {
- var formObj = document.forms[0];
-
- formObj.popupname.disabled = state;
- formObj.popupurl.disabled = state;
- formObj.popupwidth.disabled = state;
- formObj.popupheight.disabled = state;
- formObj.popupleft.disabled = state;
- formObj.popuptop.disabled = state;
- formObj.popuplocation.disabled = state;
- formObj.popupscrollbars.disabled = state;
- formObj.popupmenubar.disabled = state;
- formObj.popupresizable.disabled = state;
- formObj.popuptoolbar.disabled = state;
- formObj.popupstatus.disabled = state;
- formObj.popupreturn.disabled = state;
- formObj.popupdependent.disabled = state;
-
- setBrowserDisabled('popupurlbrowser', state);
-}
-
-function parseLink(link) {
- link = link.replace(new RegExp(''', 'g'), "'");
-
- var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1");
-
- // Is function name a template function
- var template = templates[fnName];
- if (template) {
- // Build regexp
- var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi"));
- var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\(";
- var replaceStr = "";
- for (var i=0; i";
- } else
- regExp += ".*";
- }
-
- regExp += "\\);?";
-
- // Build variable array
- var variables = new Array();
- variables["_function"] = fnName;
- var variableValues = link.replace(new RegExp(regExp, "gi"), replaceStr).split('');
- for (var i=0; i';
- html += '';
-
- for (var i=0; i' + name + '';
- }
-
- html += '';
-
- return html;
-}
-
-function insertAction() {
- var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
- var elm = inst.getFocusElement();
-
- elm = tinyMCE.getParentElement(elm, "a");
-
- tinyMCEPopup.execCommand("mceBeginUndoLevel");
-
- // Create new anchor elements
- if (elm == null) {
- if (tinyMCE.isSafari)
- tinyMCEPopup.execCommand("mceInsertContent", false, '' + inst.selection.getSelectedHTML() + '');
- else
- tinyMCEPopup.execCommand("createlink", false, "#mce_temp_url#");
-
- var elementArray = tinyMCE.getElementsByAttributeValue(inst.getBody(), "a", "href", "#mce_temp_url#");
- for (var i=0; i';
-
- for (var i=0; i' + tinyMCELinkList[i][0] + '';
-
- html += '';
-
- return html;
-
- // tinyMCE.debug('-- image list start --', html, '-- image list end --');
-}
-
-function getTargetListHTML(elm_id, target_form_element) {
- var targets = tinyMCE.getParam('theme_advanced_link_targets', '').split(';');
- var html = '';
-
- html += '';
-
- return html;
-}
-
-// While loading
-preinit();
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advlink/langs/en.js
--- a/includes/clientside/tinymce/plugins/advlink/langs/en.js Wed Dec 26 00:37:26 2007 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('advlink',{
-general_tab : 'General',
-popup_tab : 'Popup',
-events_tab : 'Events',
-advanced_tab : 'Advanced',
-general_props : 'General properties',
-popup_props : 'Popup properties',
-event_props : 'Events',
-advanced_props : 'Advanced properties',
-popup_opts : 'Options',
-anchor_names : 'Anchors',
-target_same : 'Open in this window / frame',
-target_parent : 'Open in parent window / frame',
-target_top : 'Open in top frame (replaces all frames)',
-target_blank : 'Open in new window',
-popup : 'Javascript popup',
-popup_url : 'Popup URL',
-popup_name : 'Window name',
-popup_return : 'Insert \'return false\'',
-popup_scrollbars : 'Show scrollbars',
-popup_statusbar : 'Show status bar',
-popup_toolbar : 'Show toolbars',
-popup_menubar : 'Show menu bar',
-popup_location : 'Show location bar',
-popup_resizable : 'Make window resizable',
-popup_dependent : 'Dependent (Mozilla/Firefox only)',
-popup_size : 'Size',
-popup_position : 'Position (X/Y)',
-id : 'Id',
-style: 'Style',
-classes : 'Classes',
-target_name : 'Target name',
-langdir : 'Language direction',
-target_langcode : 'Target language',
-langcode : 'Language code',
-encoding : 'Target character encoding',
-mime : 'Target MIME type',
-rel : 'Relationship page to target',
-rev : 'Relationship target to page',
-tabindex : 'Tabindex',
-accesskey : 'Accesskey',
-ltr : 'Left to right',
-rtl : 'Right to left'
-});
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advlink/langs/en_dlg.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/clientside/tinymce/plugins/advlink/langs/en_dlg.js Thu Dec 27 22:09:33 2007 -0500
@@ -0,0 +1,52 @@
+tinyMCE.addI18n('en.advlink_dlg',{
+title:"Insert/edit link",
+url:"Link URL",
+target:"Target",
+titlefield:"Title",
+is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",
+is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",
+list:"Link list",
+general_tab:"General",
+popup_tab:"Popup",
+events_tab:"Events",
+advanced_tab:"Advanced",
+general_props:"General properties",
+popup_props:"Popup properties",
+event_props:"Events",
+advanced_props:"Advanced properties",
+popup_opts:"Options",
+anchor_names:"Anchors",
+target_same:"Open in this window / frame",
+target_parent:"Open in parent window / frame",
+target_top:"Open in top frame (replaces all frames)",
+target_blank:"Open in new window",
+popup:"Javascript popup",
+popup_url:"Popup URL",
+popup_name:"Window name",
+popup_return:"Insert 'return false'",
+popup_scrollbars:"Show scrollbars",
+popup_statusbar:"Show status bar",
+popup_toolbar:"Show toolbars",
+popup_menubar:"Show menu bar",
+popup_location:"Show location bar",
+popup_resizable:"Make window resizable",
+popup_dependent:"Dependent (Mozilla/Firefox only)",
+popup_size:"Size",
+popup_position:"Position (X/Y)",
+id:"Id",
+style:"Style",
+classes:"Classes",
+target_name:"Target name",
+langdir:"Language direction",
+target_langcode:"Target language",
+langcode:"Language code",
+encoding:"Target character encoding",
+mime:"Target MIME type",
+rel:"Relationship page to target",
+rev:"Relationship target to page",
+tabindex:"Tabindex",
+accesskey:"Accesskey",
+ltr:"Left to right",
+rtl:"Right to left",
+link_list:"Link list"
+});
\ No newline at end of file
diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/advlink/link.htm
--- a/includes/clientside/tinymce/plugins/advlink/link.htm Wed Dec 26 00:37:26 2007 -0500
+++ b/includes/clientside/tinymce/plugins/advlink/link.htm Thu Dec 27 22:09:33 2007 -0500
@@ -1,32 +1,34 @@
+
- {$lang_insert_link_title}
-
-
-
-
+ {#advlink_dlg.title}
+
+
+
+
+
-
+
|