From c59a2a69fb38b92b6c45bcf7431d2b1a3c5dce3c Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sat, 23 Oct 2010 19:46:20 -0400 Subject: added grappelli, filebrowser, chunks and tagging to lcal repo --- .../jscripts/tiny_mce/plugins/template/blank.htm | 12 ++ .../tiny_mce/plugins/template/css/template.css | 23 +++ .../tiny_mce/plugins/template/editor_plugin.js | 137 ++++++++++++++++++ .../tiny_mce/plugins/template/editor_plugin_src.js | 156 +++++++++++++++++++++ .../tiny_mce/plugins/template/js/template.js | 106 ++++++++++++++ .../tiny_mce/plugins/template/langs/de_dlg.js | 15 ++ .../tiny_mce/plugins/template/langs/en_dlg.js | 15 ++ .../tiny_mce/plugins/template/template.htm | 41 ++++++ 8 files changed, 505 insertions(+) create mode 100644 lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/blank.htm create mode 100644 lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/css/template.css create mode 100644 lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin.js create mode 100644 lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin_src.js create mode 100644 lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/js/template.js create mode 100644 lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/langs/de_dlg.js create mode 100644 lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/langs/en_dlg.js create mode 100644 lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/template.htm (limited to 'lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template') diff --git a/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/blank.htm b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/blank.htm new file mode 100644 index 0000000..538a3b1 --- /dev/null +++ b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/blank.htm @@ -0,0 +1,12 @@ + + + blank_page + + + + + + + diff --git a/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/css/template.css b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/css/template.css new file mode 100644 index 0000000..0a03f2e --- /dev/null +++ b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/css/template.css @@ -0,0 +1,23 @@ +#frmbody { + padding: 10px; + background-color: #FFF; + border: 1px solid #CCC; +} + +.frmRow { + margin-bottom: 10px; +} + +#templatesrc { + border: none; + width: 320px; + height: 240px; +} + +.title { + padding-bottom: 5px; +} + +.mceActionPanel { + padding-top: 5px; +} diff --git a/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin.js b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin.js new file mode 100644 index 0000000..280af11 --- /dev/null +++ b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin.js @@ -0,0 +1,137 @@ +/** + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.TemplatePlugin', { + init : function(ed, url) { + var t = this; + t.editor = ed; + + // commands + ed.addCommand('mceTemplate', function(ui) { + ed.windowManager.open({ + file : url + '/template.htm', + width : ed.getParam('template_popup_width', 650), + height : ed.getParam('template_popup_height', 200), + inline : 1 + }, { + plugin_url : url + }); + }); + ed.addCommand('mceInsertTemplate', t._insertTemplate, t); + + // buttons + ed.addButton('template', {title : 'template.desc', cmd : 'mceTemplate'}); + + // insert template is only allowed within a paragraph + ed.onNodeChange.add(function(ed, cm, n, co) { + cm.setDisabled('template', n.nodeName != 'P' || n.firstChild.nodeValue != null || n.parentNode.nodeName != "BODY"); + }); + + // table to div / div to table + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + if (o.set) { + + each(ed.dom.select('div', o.node), function(e) { + if (ed.dom.hasClass(e, 'mce-grid-td')) { + class_el = ed.dom.getAttrib(e, 'class'); + td_el = ed.dom.create('td', {'class': class_el}); + ed.dom.replace(td_el, e, true); + } + }); + + each(ed.dom.select('div', o.node), function(e) { + if (ed.dom.hasClass(e, 'mce-grid-table')) { + class_el = ed.dom.getAttrib(e, 'class'); + table_el = ed.dom.create('table', {'class': class_el, 'cellpadding': '0', 'cellspacing': '10'}); + ed.dom.setHTML(table_el, e.innerHTML); + p_el = ed.dom.create('p', {'class': 'mce-grid-container'}); + p_el.appendChild(table_el); + ed.dom.replace(p_el, e, false); + } + }); + + } + + if (o.save) { + + each(ed.dom.select('td', o.node), function(e) { + if (ed.dom.hasClass(e, 'mce-grid-td')) { + class_el = ed.dom.getAttrib(e, 'class'); + div_el = ed.dom.create('div', {'class': class_el}); + ed.dom.replace(div_el, e, true); + } + }); + + each(ed.dom.select('table', o.node), function(e) { + if (ed.dom.hasClass(e, 'mce-grid-table')) { + class_el = ed.dom.getAttrib(e, 'class'); + div_el = ed.dom.create('div', {'class': class_el}); + ed.dom.replace(div_el, e, true); + } + }); + + each(ed.dom.select('tr', o.node), function(e) { + if (ed.dom.hasClass(e, 'mce-grid-tr')) { + ed.dom.remove(e, true); + } + }); + + each(ed.dom.select('tbody', o.node), function(e) { + if (ed.dom.hasClass(e, 'mce-grid-tbody')) { + ed.dom.remove(e, true); + } + }); + + each(ed.dom.select('p', o.node), function(e) { + if (ed.dom.hasClass(e, 'mce-grid-container')) { + ed.dom.remove(e, true); + } + }); + + } + + }); + + }, + + getInfo : function() { + return { + longname : 'Grid plugin', + author : 'Patrick Kranzlmueller', + authorurl : 'http://vonautomatisch.at', + infourl : 'http:/vonautomatisch.at', + version : '0.1' + }; + }, + + _insertTemplate : function(ui, v) { + var t = this, ed = t.editor, h, el, dom = ed.dom, sel = ed.selection.getContent(); + + // using dom.replace in order to avoid empty paragraph + // after the insert (e.g. with using setContent) + p_el = ed.dom.create('p', {'class': 'mce-grid-container'}, v.content); + ed.dom.replace(p_el, this.editor.selection.getNode(), true); + // cleanup + this.editor.execCommand('mceCleanup'); + // move caret to first paragraph inside the template + n = ed.dom.select('p', p_el)[0]; + tinyMCE.execCommand("mceSelectNode", false, n.firstChild); + + ed.addVisual(); + }, + + }); + + // Register plugin + tinymce.PluginManager.add('template', tinymce.plugins.TemplatePlugin); +})(); \ No newline at end of file diff --git a/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin_src.js b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin_src.js new file mode 100644 index 0000000..0d8825a --- /dev/null +++ b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin_src.js @@ -0,0 +1,156 @@ +/** + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * + * @author Moxiecode + * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.TemplatePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceTemplate', function(ui) { + ed.windowManager.open({ + file : url + '/template.htm', + width : ed.getParam('template_popup_width', 750), + height : ed.getParam('template_popup_height', 600), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceInsertTemplate', t._insertTemplate, t); + + // Register buttons + ed.addButton('template', {title : 'template.desc', cmd : 'mceTemplate'}); + + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + each(dom.select('div', o.node), function(e) { + if (dom.hasClass(e, 'mceTmpl')) { + each(dom.select('*', e), function(e) { + if (dom.hasClass(e, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) + e.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format"))); + }); + + t._replaceVals(e); + } + }); + }); + }, + + getInfo : function() { + return { + longname : 'Template plugin', + author : 'Moxiecode Systems AB', + authorurl : 'http://www.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + _insertTemplate : function(ui, v) { + var t = this, ed = t.editor, h, el, dom = ed.dom, sel = ed.selection.getContent(); + + h = v.content; + + each(t.editor.getParam('template_replace_values'), function(v, k) { + if (typeof(v) != 'function') + h = h.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v); + }); + + el = dom.create('div', null, h); + + // Find template element within div + n = dom.select('.mceTmpl', el); + if (n && n.length > 0) { + el = dom.create('div', null); + el.appendChild(n[0].cloneNode(true)); + } + + function hasClass(n, c) { + return new RegExp('\\b' + c + '\\b', 'g').test(n.className); + }; + + each(dom.select('*', el), function(n) { + // Replace cdate + if (hasClass(n, ed.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|'))) + n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_cdate_format", ed.getLang("template.cdate_format"))); + + // Replace mdate + if (hasClass(n, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) + n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format"))); + + // Replace selection + if (hasClass(n, ed.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|'))) + n.innerHTML = sel; + }); + + t._replaceVals(el); + + ed.execCommand('mceInsertContent', false, el.innerHTML); + ed.addVisual(); + }, + + _replaceVals : function(e) { + var dom = this.editor.dom, vl = this.editor.getParam('template_replace_values'); + + each(dom.select('*', e), function(e) { + each(vl, function(v, k) { + if (dom.hasClass(e, k)) { + if (typeof(vl[k]) == 'function') + vl[k](e); + } + }); + }); + }, + + _getDateTime : function(d, fmt) { + if (!fmt) + return ""; + + function addZeros(value, len) { + var i; + + value = "" + value; + + if (value.length < len) { + for (i=0; i<(len-value.length); i++) + value = "0" + value; + } + + return value; + } + + fmt = fmt.replace("%D", "%m/%d/%y"); + fmt = fmt.replace("%r", "%I:%M:%S %p"); + fmt = fmt.replace("%Y", "" + d.getFullYear()); + fmt = fmt.replace("%y", "" + d.getYear()); + fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2)); + fmt = fmt.replace("%d", addZeros(d.getDate(), 2)); + fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2)); + fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2)); + fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2)); + fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1)); + fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM")); + fmt = fmt.replace("%B", "" + tinyMCE.getLang("template_months_long").split(',')[d.getMonth()]); + fmt = fmt.replace("%b", "" + tinyMCE.getLang("template_months_short").split(',')[d.getMonth()]); + fmt = fmt.replace("%A", "" + tinyMCE.getLang("template_day_long").split(',')[d.getDay()]); + fmt = fmt.replace("%a", "" + tinyMCE.getLang("template_day_short").split(',')[d.getDay()]); + fmt = fmt.replace("%%", "%"); + + return fmt; + } + }); + + // Register plugin + tinymce.PluginManager.add('template', tinymce.plugins.TemplatePlugin); +})(); \ No newline at end of file diff --git a/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/js/template.js b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/js/template.js new file mode 100644 index 0000000..603ccf5 --- /dev/null +++ b/lib/grappelli/media/tinymce/jscripts/tiny_mce/plugins/template/js/template.js @@ -0,0 +1,106 @@ +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, ti) { + var d = window.frames['templatesrc'].document, x, tsrc = this.tsrc; + + if (!u) + return; + + d.body.innerHTML = this.templateHTML = this.getFileContents(u); + + for (x=0; x + + {#template_dlg.title} + + + + + +
+
+
{#template_dlg.desc}
+
+
+
+
+ + +
+
+
+
+
+ +
+
+
+ +
+
+
+
+
    +
  • +
  • +
+
+
+ + -- cgit v1.2.3-70-g09d2