diff -r 902822492a68 -r fe660c52c48f includes/clientside/tinymce/plugins/xhtmlxtras/jscripts/element_common.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/includes/clientside/tinymce/plugins/xhtmlxtras/jscripts/element_common.js Wed Jun 13 16:07:17 2007 -0400 @@ -0,0 +1,241 @@ + /** + * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $ + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. + */ + +function initCommonAttributes(elm) { + var formObj = document.forms[0]; + + // Setup form data for common element attributes + setFormValue('title', tinyMCE.getAttrib(elm, 'title')); + setFormValue('id', tinyMCE.getAttrib(elm, 'id')); + selectByValue(formObj, 'class', tinyMCE.getAttrib(elm, 'class'), true); + setFormValue('style', tinyMCE.getAttrib(elm, 'style')); + selectByValue(formObj, 'dir', tinyMCE.getAttrib(elm, 'dir')); + setFormValue('lang', tinyMCE.getAttrib(elm, 'lang')); + setFormValue('onfocus', tinyMCE.getAttrib(elm, 'onfocus')); + setFormValue('onblur', tinyMCE.getAttrib(elm, 'onblur')); + setFormValue('onclick', tinyMCE.getAttrib(elm, 'onclick')); + setFormValue('ondblclick', tinyMCE.getAttrib(elm, 'ondblclick')); + setFormValue('onmousedown', tinyMCE.getAttrib(elm, 'onmousedown')); + setFormValue('onmouseup', tinyMCE.getAttrib(elm, 'onmouseup')); + setFormValue('onmouseover', tinyMCE.getAttrib(elm, 'onmouseover')); + setFormValue('onmousemove', tinyMCE.getAttrib(elm, 'onmousemove')); + setFormValue('onmouseout', tinyMCE.getAttrib(elm, 'onmouseout')); + setFormValue('onkeypress', tinyMCE.getAttrib(elm, 'onkeypress')); + setFormValue('onkeydown', tinyMCE.getAttrib(elm, 'onkeydown')); + setFormValue('onkeyup', tinyMCE.getAttrib(elm, 'onkeyup')); +} + +function setFormValue(name, value) { + if(document.forms[0].elements[name]) document.forms[0].elements[name].value = value; +} + +function insertDateTime(id) { + document.getElementById(id).value = getDateTime(new Date(), "%Y-%m-%dT%H:%M:%S"); +} + +function getDateTime(d, fmt) { + fmt = fmt.replace("%D", "%m/%d/%y"); + fmt = fmt.replace("%r", "%I:%M:%S %p"); + fmt = fmt.replace("%Y", "" + d.getFullYear()); + fmt = fmt.replace("%y", "" + d.getYear()); + fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2)); + fmt = fmt.replace("%d", addZeros(d.getDate(), 2)); + fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2)); + fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2)); + fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2)); + fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1)); + fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM")); + fmt = fmt.replace("%%", "%"); + + return fmt; +} + +function addZeros(value, len) { + var i; + + value = "" + value; + + if (value.length < len) { + for (i=0; i<(len-value.length); i++) + value = "0" + value; + } + + return value; +} + +function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { + if (!form_obj || !form_obj.elements[field_name]) + return; + + var sel = form_obj.elements[field_name]; + + var found = false; + for (var i=0; i 0) { + tagName = element_name; + + if (tinyMCE.isIE && !tinyMCE.isOpera && element_name.indexOf('html:') == 0) + element_name = element_name.substring(5).toLowerCase(); + + h = '<' + tagName + ' id="#sxe_temp_' + element_name + '#">' + s + ''; + + tinyMCEPopup.execCommand('mceInsertContent', false, h); + + var elementArray = tinyMCE.getElementsByAttributeValue(SXE.inst.getBody(), element_name, 'id', '#sxe_temp_' + element_name + '#'); + for (var i=0; i -1) ? true : false; +} + +SXE.removeClass = function(elm,cl) { + if(elm.className == null || elm.className == "" || !SXE.containsClass(elm,cl)) { + return true; + } + var classNames = elm.className.split(" "); + var newClassNames = ""; + for (var x = 0, cnl = classNames.length; x < cnl; x++) { + if (classNames[x] != cl) { + newClassNames += (classNames[x] + " "); + } + } + elm.className = newClassNames.substring(0,newClassNames.length-1); //removes extra space at the end +} + +SXE.addClass = function(elm,cl) { + if(!SXE.containsClass(elm,cl)) elm.className ? elm.className += " " + cl : elm.className = cl; + return true; +} \ No newline at end of file