| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 tinyMCEPopup.requireLangPack(); 2 3 var TemplateDialog = { 4 preInit : function() { 5 var url = tinyMCEPopup.getParam("template_external_list_url"); 6 7 if (url != null) 8 document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></sc'+'ript>'); 9 }, 10 11 init : function() { 12 var ed = tinyMCEPopup.editor, tsrc, sel, x, u; 13 14 tsrc = ed.getParam("template_templates", false); 15 sel = document.getElementById('tpath'); 16 17 // Setup external template list 18 if (!tsrc && typeof(tinyMCETemplateList) != 'undefined') { 19 for (x=0, tsrc = []; x<tinyMCETemplateList.length; x++) 20 tsrc.push({title : tinyMCETemplateList[x][0], src : tinyMCETemplateList[x][1], description : tinyMCETemplateList[x][2]}); 21 } 22 23 for (x=0; x<tsrc.length; x++) 24 sel.options[sel.options.length] = new Option(tsrc[x].title, tinyMCEPopup.editor.documentBaseURI.toAbsolute(tsrc[x].src)); 25 26 this.resize(); 27 }, 28 29 resize : function() { 30 var w, h, e; 31 32 if (!self.innerWidth) { 33 w = document.body.clientWidth - 50; 34 h = document.body.clientHeight - 160; 35 } else { 36 w = self.innerWidth - 50; 37 h = self.innerHeight - 170; 38 } 39 40 e = document.getElementById('templatesrc'); 41 42 if (e) { 43 e.style.height = Math.abs(h) + 'px'; 44 e.style.width = Math.abs(w - 5) + 'px'; 45 } 46 }, 47 48 loadCSSFiles : function(d) { 49 var ed = tinyMCEPopup.editor; 50 51 tinymce.each(ed.getParam("content_css", '').split(','), function(u) { 52 d.write('<link href="' + ed.documentBaseURI.toAbsolute(u) + '" rel="stylesheet" type="text/css" />'); 53 }); 54 }, 55 56 selectTemplate : function(u) { 57 var d = window.frames['templatesrc'].document; 58 59 if (!u) 60 return; 61 62 d.body.innerHTML = this.templateHTML = this.getFileContents(u); 63 }, 64 65 insert : function() { 66 tinyMCEPopup.execCommand('mceInsertTemplate', false, { 67 content : this.templateHTML, 68 selection : tinyMCEPopup.editor.selection.getContent() 69 }); 70 71 tinyMCEPopup.close(); 72 }, 73 74 getFileContents : function(u) { 75 var x, d, t = 'text/plain'; 76 77 function g(s) { 78 x = 0; 79 80 try { 81 x = new ActiveXObject(s); 82 } catch (s) { 83 } 84 85 return x; 86 }; 87 88 x = window.ActiveXObject ? g('Msxml2.XMLHTTP') || g('Microsoft.XMLHTTP') : new XMLHttpRequest(); 89 90 // Synchronous AJAX load file 91 x.overrideMimeType && x.overrideMimeType(t); 92 x.open("GET", u, false); 93 x.send(null); 94 95 return x.responseText; 96 } 97 }; 98 99 TemplateDialog.preInit(); 100 tinyMCEPopup.onInit.add(TemplateDialog.init, TemplateDialog);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed May 23 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |