summaryrefslogtreecommitdiff
path: root/public/javascripts/tiny_mce/plugins/template
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/template')
-rw-r--r--public/javascripts/tiny_mce/plugins/template/blank.htm12
-rw-r--r--public/javascripts/tiny_mce/plugins/template/css/template.css23
-rw-r--r--public/javascripts/tiny_mce/plugins/template/editor_plugin.js1
-rw-r--r--public/javascripts/tiny_mce/plugins/template/editor_plugin_src.js156
-rw-r--r--public/javascripts/tiny_mce/plugins/template/js/template.js106
-rw-r--r--public/javascripts/tiny_mce/plugins/template/langs/en_dlg.js15
-rw-r--r--public/javascripts/tiny_mce/plugins/template/template.htm38
7 files changed, 0 insertions, 351 deletions
diff --git a/public/javascripts/tiny_mce/plugins/template/blank.htm b/public/javascripts/tiny_mce/plugins/template/blank.htm
deleted file mode 100644
index ecde53f..0000000
--- a/public/javascripts/tiny_mce/plugins/template/blank.htm
+++ /dev/null
@@ -1,12 +0,0 @@
1<html xmlns="http://www.w3.org/1999/xhtml">
2<head>
3 <title>blank_page</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5 <script type="text/javascript">
6 parent.TemplateDialog.loadCSSFiles(document);
7 </script>
8</head>
9<body id="mceTemplatePreview" class="mceContentBody">
10
11</body>
12</html>
diff --git a/public/javascripts/tiny_mce/plugins/template/css/template.css b/public/javascripts/tiny_mce/plugins/template/css/template.css
deleted file mode 100644
index 2d23a49..0000000
--- a/public/javascripts/tiny_mce/plugins/template/css/template.css
+++ /dev/null
@@ -1,23 +0,0 @@
1#frmbody {
2 padding: 10px;
3 background-color: #FFF;
4 border: 1px solid #CCC;
5}
6
7.frmRow {
8 margin-bottom: 10px;
9}
10
11#templatesrc {
12 border: none;
13 width: 320px;
14 height: 240px;
15}
16
17.title {
18 padding-bottom: 5px;
19}
20
21.mceActionPanel {
22 padding-top: 5px;
23}
diff --git a/public/javascripts/tiny_mce/plugins/template/editor_plugin.js b/public/javascripts/tiny_mce/plugins/template/editor_plugin.js
deleted file mode 100644
index ebe3c27..0000000
--- a/public/javascripts/tiny_mce/plugins/template/editor_plugin.js
+++ /dev/null
@@ -1 +0,0 @@
1(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.TemplatePlugin",{init:function(b,c){var d=this;d.editor=b;b.addCommand("mceTemplate",function(e){b.windowManager.open({file:c+"/template.htm",width:b.getParam("template_popup_width",750),height:b.getParam("template_popup_height",600),inline:1},{plugin_url:c})});b.addCommand("mceInsertTemplate",d._insertTemplate,d);b.addButton("template",{title:"template.desc",cmd:"mceTemplate"});b.onPreProcess.add(function(e,g){var f=e.dom;a(f.select("div",g.node),function(h){if(f.hasClass(h,"mceTmpl")){a(f.select("*",h),function(i){if(f.hasClass(i,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){i.innerHTML=d._getDateTime(new Date(),e.getParam("template_mdate_format",e.getLang("template.mdate_format")))}});d._replaceVals(h)}})})},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(i,j){var k=this,g=k.editor,f,c,d=g.dom,b=g.selection.getContent();f=j.content;a(k.editor.getParam("template_replace_values"),function(l,h){if(typeof(l)!="function"){f=f.replace(new RegExp("\\{\\$"+h+"\\}","g"),l)}});c=d.create("div",null,f);n=d.select(".mceTmpl",c);if(n&&n.length>0){c=d.create("div",null);c.appendChild(n[0].cloneNode(true))}function e(l,h){return new RegExp("\\b"+h+"\\b","g").test(l.className)}a(d.select("*",c),function(h){if(e(h,g.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))){h.innerHTML=k._getDateTime(new Date(),g.getParam("template_cdate_format",g.getLang("template.cdate_format")))}if(e(h,g.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))){h.innerHTML=k._getDateTime(new Date(),g.getParam("template_mdate_format",g.getLang("template.mdate_format")))}if(e(h,g.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))){h.innerHTML=b}});k._replaceVals(c);g.execCommand("mceInsertContent",false,c.innerHTML);g.addVisual()},_replaceVals:function(c){var d=this.editor.dom,b=this.editor.getParam("template_replace_values");a(d.select("*",c),function(f){a(b,function(g,e){if(d.hasClass(f,e)){if(typeof(b[e])=="function"){b[e](f)}}})})},_getDateTime:function(e,b){if(!b){return""}function c(g,d){var f;g=""+g;if(g.length<d){for(f=0;f<(d-g.length);f++){g="0"+g}}return g}b=b.replace("%D","%m/%d/%y");b=b.replace("%r","%I:%M:%S %p");b=b.replace("%Y",""+e.getFullYear());b=b.replace("%y",""+e.getYear());b=b.replace("%m",c(e.getMonth()+1,2));b=b.replace("%d",c(e.getDate(),2));b=b.replace("%H",""+c(e.getHours(),2));b=b.replace("%M",""+c(e.getMinutes(),2));b=b.replace("%S",""+c(e.getSeconds(),2));b=b.replace("%I",""+((e.getHours()+11)%12+1));b=b.replace("%p",""+(e.getHours()<12?"AM":"PM"));b=b.replace("%B",""+this.editor.getLang("template_months_long").split(",")[e.getMonth()]);b=b.replace("%b",""+this.editor.getLang("template_months_short").split(",")[e.getMonth()]);b=b.replace("%A",""+this.editor.getLang("template_day_long").split(",")[e.getDay()]);b=b.replace("%a",""+this.editor.getLang("template_day_short").split(",")[e.getDay()]);b=b.replace("%%","%");return b}});tinymce.PluginManager.add("template",tinymce.plugins.TemplatePlugin)})(); \ No newline at end of file
diff --git a/public/javascripts/tiny_mce/plugins/template/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/template/editor_plugin_src.js
deleted file mode 100644
index 09057ec..0000000
--- a/public/javascripts/tiny_mce/plugins/template/editor_plugin_src.js
+++ /dev/null
@@ -1,156 +0,0 @@
1/**
2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
3 *
4 * @author Moxiecode
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
6 */
7
8(function() {
9 var each = tinymce.each;
10
11 tinymce.create('tinymce.plugins.TemplatePlugin', {
12 init : function(ed, url) {
13 var t = this;
14
15 t.editor = ed;
16
17 // Register commands
18 ed.addCommand('mceTemplate', function(ui) {
19 ed.windowManager.open({
20 file : url + '/template.htm',
21 width : ed.getParam('template_popup_width', 750),
22 height : ed.getParam('template_popup_height', 600),
23 inline : 1
24 }, {
25 plugin_url : url
26 });
27 });
28
29 ed.addCommand('mceInsertTemplate', t._insertTemplate, t);
30
31 // Register buttons
32 ed.addButton('template', {title : 'template.desc', cmd : 'mceTemplate'});
33
34 ed.onPreProcess.add(function(ed, o) {
35 var dom = ed.dom;
36
37 each(dom.select('div', o.node), function(e) {
38 if (dom.hasClass(e, 'mceTmpl')) {
39 each(dom.select('*', e), function(e) {
40 if (dom.hasClass(e, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|')))
41 e.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format")));
42 });
43
44 t._replaceVals(e);
45 }
46 });
47 });
48 },
49
50 getInfo : function() {
51 return {
52 longname : 'Template plugin',
53 author : 'Moxiecode Systems AB',
54 authorurl : 'http://www.moxiecode.com',
55 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template',
56 version : tinymce.majorVersion + "." + tinymce.minorVersion
57 };
58 },
59
60 _insertTemplate : function(ui, v) {
61 var t = this, ed = t.editor, h, el, dom = ed.dom, sel = ed.selection.getContent();
62
63 h = v.content;
64
65 each(t.editor.getParam('template_replace_values'), function(v, k) {
66 if (typeof(v) != 'function')
67 h = h.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v);
68 });
69
70 el = dom.create('div', null, h);
71
72 // Find template element within div
73 n = dom.select('.mceTmpl', el);
74 if (n && n.length > 0) {
75 el = dom.create('div', null);
76 el.appendChild(n[0].cloneNode(true));
77 }
78
79 function hasClass(n, c) {
80 return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
81 };
82
83 each(dom.select('*', el), function(n) {
84 // Replace cdate
85 if (hasClass(n, ed.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|')))
86 n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_cdate_format", ed.getLang("template.cdate_format")));
87
88 // Replace mdate
89 if (hasClass(n, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|')))
90 n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format")));
91
92 // Replace selection
93 if (hasClass(n, ed.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|')))
94 n.innerHTML = sel;
95 });
96
97 t._replaceVals(el);
98
99 ed.execCommand('mceInsertContent', false, el.innerHTML);
100 ed.addVisual();
101 },
102
103 _replaceVals : function(e) {
104 var dom = this.editor.dom, vl = this.editor.getParam('template_replace_values');
105
106 each(dom.select('*', e), function(e) {
107 each(vl, function(v, k) {
108 if (dom.hasClass(e, k)) {
109 if (typeof(vl[k]) == 'function')
110 vl[k](e);
111 }
112 });
113 });
114 },
115
116 _getDateTime : function(d, fmt) {
117 if (!fmt)
118 return "";
119
120 function addZeros(value, len) {
121 var i;
122
123 value = "" + value;
124
125 if (value.length < len) {
126 for (i=0; i<(len-value.length); i++)
127 value = "0" + value;
128 }
129
130 return value;
131 }
132
133 fmt = fmt.replace("%D", "%m/%d/%y");
134 fmt = fmt.replace("%r", "%I:%M:%S %p");
135 fmt = fmt.replace("%Y", "" + d.getFullYear());
136 fmt = fmt.replace("%y", "" + d.getYear());
137 fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2));
138 fmt = fmt.replace("%d", addZeros(d.getDate(), 2));
139 fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2));
140 fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2));
141 fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2));
142 fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1));
143 fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM"));
144 fmt = fmt.replace("%B", "" + this.editor.getLang("template_months_long").split(',')[d.getMonth()]);
145 fmt = fmt.replace("%b", "" + this.editor.getLang("template_months_short").split(',')[d.getMonth()]);
146 fmt = fmt.replace("%A", "" + this.editor.getLang("template_day_long").split(',')[d.getDay()]);
147 fmt = fmt.replace("%a", "" + this.editor.getLang("template_day_short").split(',')[d.getDay()]);
148 fmt = fmt.replace("%%", "%");
149
150 return fmt;
151 }
152 });
153
154 // Register plugin
155 tinymce.PluginManager.add('template', tinymce.plugins.TemplatePlugin);
156})(); \ No newline at end of file
diff --git a/public/javascripts/tiny_mce/plugins/template/js/template.js b/public/javascripts/tiny_mce/plugins/template/js/template.js
deleted file mode 100644
index 24045d7..0000000
--- a/public/javascripts/tiny_mce/plugins/template/js/template.js
+++ /dev/null
@@ -1,106 +0,0 @@
1tinyMCEPopup.requireLangPack();
2
3var 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
105TemplateDialog.preInit();
106tinyMCEPopup.onInit.add(TemplateDialog.init, TemplateDialog);
diff --git a/public/javascripts/tiny_mce/plugins/template/langs/en_dlg.js b/public/javascripts/tiny_mce/plugins/template/langs/en_dlg.js
deleted file mode 100644
index 2471c3f..0000000
--- a/public/javascripts/tiny_mce/plugins/template/langs/en_dlg.js
+++ /dev/null
@@ -1,15 +0,0 @@
1tinyMCE.addI18n('en.template_dlg',{
2title:"Templates",
3label:"Template",
4desc_label:"Description",
5desc:"Insert predefined template content",
6select:"Select a template",
7preview:"Preview",
8warning:"Warning: Updating a template with a different one may cause data loss.",
9mdate_format:"%Y-%m-%d %H:%M:%S",
10cdate_format:"%Y-%m-%d %H:%M:%S",
11months_long:"January,February,March,April,May,June,July,August,September,October,November,December",
12months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
13day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
14day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"
15}); \ No newline at end of file
diff --git a/public/javascripts/tiny_mce/plugins/template/template.htm b/public/javascripts/tiny_mce/plugins/template/template.htm
deleted file mode 100644
index f7bb044..0000000
--- a/public/javascripts/tiny_mce/plugins/template/template.htm
+++ /dev/null
@@ -1,38 +0,0 @@
1<html xmlns="http://www.w3.org/1999/xhtml">
2<head>
3 <title>{#template_dlg.title}</title>
4 <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
5 <script type="text/javascript" src="js/template.js"></script>
6 <link href="css/template.css" rel="stylesheet" type="text/css" />
7</head>
8<body onresize="TemplateDialog.resize();">
9 <form onsubmit="TemplateDialog.insert();return false;">
10 <div id="frmbody">
11 <div class="title">{#template_dlg.desc}</div>
12 <div class="frmRow"><label for="tpath" title="{#template_dlg.select}">{#template_dlg.label}:</label>
13 <select id="tpath" name="tpath" onchange="TemplateDialog.selectTemplate(this.options[this.selectedIndex].value, this.options[this.selectedIndex].text);" class="mceFocus">
14 <option value="">{#template_dlg.select}...</option>
15 </select>
16 <span id="warning"></span></div>
17 <div class="frmRow"><label for="tdesc">{#template_dlg.desc_label}:</label>
18 <span id="tmpldesc"></span></div>
19 <fieldset>
20 <legend>{#template_dlg.preview}</legend>
21 <iframe id="templatesrc" name="templatesrc" src="blank.htm" width="690" height="400" frameborder="0"></iframe>
22 </fieldset>
23 </div>
24
25 <div class="mceActionPanel">
26 <div style="float: left">
27 <input type="submit" id="insert" name="insert" value="{#insert}" />
28 </div>
29
30 <div style="float: right">
31 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
32 </div>
33
34 <br style="clear:both" />
35 </div>
36 </form>
37</body>
38</html>