tinyMCEPopup.requireLangPack();
var TemplateDialog = {
preInit : function() {
var url = tinyMCEPopup.getParam("template_external_list_url");
if (url != null)
document.write('');
},
init : function() {
var ed = tinyMCEPopup.editor, tsrc, sel, x, u;
tsrc = ed.getParam("template_templates", false);
sel = document.getElementById('tpath');
// Setup external template list
if (!tsrc && typeof(tinyMCETemplateList) != 'undefined') {
for (x=0, tsrc = []; x');
});
},
selectTemplate : function(u) {
var d = window.frames['templatesrc'].document;
if (!u)
return;
d.body.innerHTML = this.templateHTML = this.getFileContents(u);
},
insert : function() {
tinyMCEPopup.execCommand('mceInsertTemplate', false, {
content : this.templateHTML,
selection : tinyMCEPopup.editor.selection.getContent()
});
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;
}
};
TemplateDialog.preInit();
tinyMCEPopup.onInit.add(TemplateDialog.init, TemplateDialog);