[ Index ] |
PHP Cross Reference of Unnamed Project |
[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 this.tsrc = tsrc; 28 }, 29 30 resize : function() { 31 var w, h, e; 32 33 if (!self.innerWidth) { 34 w = document.body.clientWidth - 50; 35 h = document.body.clientHeight - 160; 36 } else { 37 w = self.innerWidth - 50; 38 h = self.innerHeight - 170; 39 } 40 41 e = document.getElementById('templatesrc'); 42 43 if (e) { 44 e.style.height = Math.abs(h) + 'px'; 45 e.style.width = Math.abs(w - 5) + 'px'; 46 } 47 }, 48 49 loadCSSFiles : function(d) { 50 var ed = tinyMCEPopup.editor; 51 52 tinymce.each(ed.getParam("content_css", '').split(','), function(u) { 53 d.write('<link href="' + ed.documentBaseURI.toAbsolute(u) + '" rel="stylesheet" type="text/css" />'); 54 }); 55 }, 56 57 selectTemplate : function(u, ti) { 58 var d = window.frames['templatesrc'].document, x, tsrc = this.tsrc; 59 60 if (!u) 61 return; 62 63 d.body.innerHTML = this.templateHTML = this.getFileContents(u); 64 65 for (x=0; x<tsrc.length; x++) { 66 if (tsrc[x].title == ti) 67 document.getElementById('tmpldesc').innerHTML = tsrc[x].description || ''; 68 } 69 }, 70 71 insert : function() { 72 tinyMCEPopup.execCommand('mceInsertTemplate', false, { 73 content : this.templateHTML, 74 selection : tinyMCEPopup.editor.selection.getContent() 75 }); 76 77 tinyMCEPopup.close(); 78 }, 79 80 getFileContents : function(u) { 81 var x, d, t = 'text/plain'; 82 83 function g(s) { 84 x = 0; 85 86 try { 87 x = new ActiveXObject(s); 88 } catch (s) { 89 } 90 91 return x; 92 }; 93 94 x = window.ActiveXObject ? g('Msxml2.XMLHTTP') || g('Microsoft.XMLHTTP') : new XMLHttpRequest(); 95 96 // Synchronous AJAX load file 97 x.overrideMimeType && x.overrideMimeType(t); 98 x.open("GET", u, false); 99 x.send(null); 100 101 return x.responseText; 102 } 103 }; 104 105 TemplateDialog.preInit(); 106 tinyMCEPopup.onInit.add(TemplateDialog.init, TemplateDialog);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |