diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/plugins/template/jscripts/template.js --- a/includes/clientside/tinymce/plugins/template/jscripts/template.js Wed Dec 26 00:37:26 2007 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -// Import external list url javascript -var url = tinyMCE.getParam("template_external_list_url"); -if (url != null) { - // Fix relative - if (url.charAt(0) != '/' && url.indexOf('://') == -1) - url = tinyMCE.documentBasePath + "/" + url; - - document.write(''); -} - -var TPU = { //Template Popup Utils - currentTemplateHTML : null, - templates : [], - inst : tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id')), - plugin : tinyMCE.getWindowArg('pluginObj'), - data : tinyMCE.selectedInstance.getData('template'), - - init : function() { - document.forms[0].insert.value = tinyMCE.getLang('lang_' + this.data.currentAction, 'Insert', true); - TPU.loadTemplatePaths(); - - if (this.data.currentAction == "update") - document.getElementById('warning').innerHTML = tinyMCE.getLang('lang_template_warning'); - - this.resizeInputs(); - }, - - loadTemplatePaths : function() { - var tsrc, sel, x, u; - - tsrc = tinyMCE.getParam("template_templates", false); - sel = document.getElementById('tpath'); - - // Setup external template list - if (!tsrc && typeof(tinyMCETemplateList) != 'undefined') { - for (x=0, tsrc = []; x' + - 'blank_page' + - '' + - '' + - '' + - this.currentTemplateHTML + - '' + - ''; - } - - // Write HTML to preview iframe - d.body.innerHTML = this.currentTemplateHTML; - - // Display description - for (x = 0; x < TPU.templates.length; x++) { - if (TPU.templates[x].src == o.value) { - document.getElementById('tmpldesc').innerHTML = TPU.templates[x].description; - break; - } - } - }, - - insertTemplate : function() { - var sel, opt; - - sel = document.getElementById('tpath'); - opt = sel.options[sel.selectedIndex]; - - // Is it a template or snippet - if (TPU.currentTemplateHTML.indexOf('mceTmpl')) - tinyMCEPopup.execCommand('mceTemplate', false, {title : opt.text, tsrc : opt.value, body : TPU.currentTemplateHTML}); - else - tinyMCEPopup.execCommand('mceInsertContent', false, TPU.currentTemplateHTML); - - tinyMCEPopup.close(); - }, - - getFileContents : function(u) { - var x, d, t = 'text/plain'; - - function g(s) { - x = 0; - - try { - x = new ActiveXObject(s); - } catch (s) { - } - - return x; - }; - - x = window.ActiveXObject ? g('Msxml2.XMLHTTP') || g('Microsoft.XMLHTTP') : new XMLHttpRequest(); - - // Synchronous AJAX load file - x.overrideMimeType && x.overrideMimeType(t); - x.open("GET", u, false); - x.send(null); - - return x.responseText; - }, - - resizeInputs : function() { - var wHeight, wWidth, elm; - - if (!self.innerWidth) { - wHeight = document.body.clientHeight - 160; - wWidth = document.body.clientWidth - 40; - } else { - wHeight = self.innerHeight - 160; - wWidth = self.innerWidth - 40; - } - - elm = document.getElementById('templatesrc'); - - if (elm) { - elm.style.height = Math.abs(wHeight) + 'px'; - elm.style.width = Math.abs(wWidth - 5) + 'px'; - } - } -};