# HG changeset patch # User Dan # Date 1210033693 14400 # Node ID 81b4499a963e5e5145d1cedc0e0c81b7e230e5c4 # Parent dffcbfbc4e591fa3d82247800e8adf5b2f0010a3 Added TinyMCE compression support and made some supporting modifications to common.php diff -r dffcbfbc4e59 -r 81b4499a963e includes/clientside/static/editor.js --- a/includes/clientside/static/editor.js Mon May 05 20:08:44 2008 -0400 +++ b/includes/clientside/static/editor.js Mon May 05 20:28:13 2008 -0400 @@ -35,6 +35,15 @@ content_css : css_url }; +var enano_tinymce_gz_options = { + plugins : 'table,save,safari,pagebreak,style,layer,advhr,insertdatetime,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras' + do_popups, + themes : 'advanced', + languages : 'en', + disk_cache : true, + debug : false +}; + + // Check tinyMCE to make sure its init is finished function tinymce_preinit_check() { diff -r dffcbfbc4e59 -r 81b4499a963e includes/clientside/static/enano-lib-basic.js --- a/includes/clientside/static/enano-lib-basic.js Mon May 05 20:08:44 2008 -0400 +++ b/includes/clientside/static/enano-lib-basic.js Mon May 05 20:28:13 2008 -0400 @@ -269,7 +269,11 @@ { var script = document.createElement('script'); script.type="text/javascript"; - script.src=scriptPath+"/includes/clientside/tinymce/tiny_mce.js"; + script.src=scriptPath+"/includes/clientside/tinymce/tiny_mce_gzip.js"; + script.onload = function(e) + { + tinyMCE_GZ.init(enano_tinymce_gz_options); + } head.appendChild(script); } } diff -r dffcbfbc4e59 -r 81b4499a963e includes/clientside/tinymce/tiny_mce_gzip.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/includes/clientside/tinymce/tiny_mce_gzip.js Mon May 05 20:28:13 2008 -0400 @@ -0,0 +1,185 @@ +var tinyMCE_GZ = { + settings : { + themes : '', + plugins : '', + languages : '', + disk_cache : true, + page_name : 'tiny_mce_gzip.php', + debug : false, + suffix : '' + }, + + init : function(s, cb, sc) { + var t = this, n, i, nl = document.getElementsByTagName('script'); + + for (n in s) + t.settings[n] = s[n]; + + s = t.settings; + + for (i=0; i 10000) { + w.clearInterval(ti); + + if (c < 10000 && x.status == 200) { + t.loaded = 1; + t.eval(x.responseText); + tinymce.dom.Event.domLoaded = true; + cb.call(sc || t, x); + } + + ti = x = null; + } + }, 10); + } else + t.eval(x.responseText); + }, + + start : function() { + var t = this, each = tinymce.each, s = t.settings, sl, ln = s.languages.split(','); + + tinymce.suffix = s.suffix; + + // Extend script loader + tinymce.create('tinymce.compressor.ScriptLoader:tinymce.dom.ScriptLoader', { + loadScripts : function(sc, cb, s) { + var ti = this, th = [], pl = [], la = []; + + each(sc, function(o) { + var u = o.url; + + if ((!ti.lookup[u] || ti.lookup[u].state != 2) && u.indexOf(t.baseURL) === 0) { + // Collect theme + if (u.indexOf('editor_template') != -1) { + th.push(/\/themes\/([^\/]+)/.exec(u)[1]); + load(u, 1); + } + + // Collect plugin + if (u.indexOf('editor_plugin') != -1) { + pl.push(/\/plugins\/([^\/]+)/.exec(u)[1]); + load(u, 1); + } + + // Collect language + if (u.indexOf('/langs/') != -1) { + la.push(/\/langs\/([^.]+)/.exec(u)[1]); + load(u, 1); + } + } + }); + + if (th.length + pl.length + la.length > 0) { + if (sl.settings.strict_mode) { + // Async + t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s); + return; + } else + t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s); + } + + return ti.parent(sc, cb, s); + } + }); + + sl = tinymce.ScriptLoader = new tinymce.compressor.ScriptLoader(); + + function load(u, sp) { + var o; + + if (!sp) + u = t.baseURL + u; + + o = {url : u, state : 2}; + sl.queue.push(o); + sl.lookup[o.url] = o; + }; + + // Add core languages + each (ln, function(c) { + if (c) + load('/langs/' + c + '.js'); + }); + + // Add themes with languages + each(s.themes.split(','), function(n) { + if (n) { + load('/themes/' + n + '/editor_template' + s.suffix + '.js'); + + each (ln, function(c) { + if (c) + load('/themes/' + n + '/langs/' + c + '.js'); + }); + } + }); + + // Add plugins with languages + each(s.plugins.split(','), function(n) { + if (n) { + load('/plugins/' + n + '/editor_plugin' + s.suffix + '.js'); + + each (ln, function(c) { + if (c) + load('/plugins/' + n + '/langs/' + c + '.js'); + }); + } + }); + }, + + end : function() { + }, + + eval : function(co) { + var w = window; + + // Evaluate script + if (!w.execScript) { + if (/Gecko/.test(navigator.userAgent)) + eval(co, w); // Firefox 3.0 + else + eval.call(w, co); + } else + w.execScript(co); // IE + } +}; diff -r dffcbfbc4e59 -r 81b4499a963e includes/clientside/tinymce/tiny_mce_gzip.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/includes/clientside/tinymce/tiny_mce_gzip.php Mon May 05 20:28:13 2008 -0400 @@ -0,0 +1,187 @@ + \ No newline at end of file diff -r dffcbfbc4e59 -r 81b4499a963e includes/common.php --- a/includes/common.php Mon May 05 20:08:44 2008 -0400 +++ b/includes/common.php Mon May 05 20:28:13 2008 -0400 @@ -32,6 +32,13 @@ exit; } +// only do this if it hasn't been done yet +if ( !defined('ENANO_COMMON_ROOT_LOADED') ) +{ + +// log this +define('ENANO_COMMON_ROOT_LOADED', 1); + // Our version number // This needs to match the version number in the database. This number should // be the expected output of enano_version(), which will always be in the @@ -104,6 +111,24 @@ // List of scheduled tasks (don't change this manually, use register_cron_task()) $cron_tasks = array(); +} // check for ENANO_COMMON_ROOT_LOADED +else +{ + // loading a second time + if ( !defined('ENANO_COMMON_ROOT_LOADED_MULTI') ) + { + define('ENANO_COMMON_ROOT_LOADED_MULTI', 1); + } +} + +// If all we really need is the root directory, just leave now +// checking for ENANO_COMMON_ROOT_LOADED_MULTI here means that if common +// is included a second time, the rest of Enano will load. +if ( defined('ENANO_COMMON_ROOTONLY') && !defined('ENANO_COMMON_ROOT_LOADED_MULTI') ) +{ + return true; +} + // Start including files. LOTS of files. Yeah! require_once(ENANO_ROOT.'/includes/constants.php'); require_once(ENANO_ROOT.'/includes/functions.php');