1 <html xmlns="http://www.w3.org/1999/xhtml">
\r
3 <title>Template plugin example</title>
\r
5 <script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce_dev.js"></script>
\r
6 <script language="javascript" type="text/javascript">
\r
7 function exampleTemplateFunction(elm) {
\r
8 elm.innerHTML = prompt("Please enter your favourite colour.", "Color");
\r
12 calculate : function(table) {
\r
13 var _n = function(s) {
\r
14 var n = parseFloat(s.replace(/[^-\d\.]/g,''));
\r
15 return isNaN(n) ? 0 : n;
\r
19 var r = table.tBodies[0].rows;
\r
21 for(var x = 0; x < r.length; x++) {
\r
23 var t = _n(c[1].innerHTML)*_n(c[2].innerHTML);
\r
25 c[3].innerHTML = '$' + t;
\r
28 table.tFoot.rows[0].cells[1].innerHTML = '$' + total;
\r
33 getText : function() {
\r
34 var inst = tinyMCE.selectedInstance;
\r
36 tinyMCE.getNodeTree(inst.getBody(), na, 3);
\r
37 for(var x = 0; x < na.length; x++) {
\r
38 if(na[x].nodeValue && na[x].nodeValue.length > 3) {
\r
39 na[x] = na[x].nodeValue;
\r
47 count : function(elm) {
\r
48 var s = WordCount.getText();
\r
49 elm.innerHTML = '' + s.split(' ').length;
\r
52 charCount : function(elm) {
\r
53 var s = WordCount.getText();
\r
54 elm.innerHTML = '' + s.length;
\r
61 plugins : "devkit,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
\r
62 theme_advanced_buttons1_add_before : "save,newdocument,separator",
\r
63 theme_advanced_buttons1_add : "fontselect,fontsizeselect",
\r
64 theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor,advsearchreplace",
\r
65 theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
\r
66 theme_advanced_buttons3_add_before : "tablecontrols,separator",
\r
67 theme_advanced_buttons3_add : "emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
\r
68 theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,|,visualchars,nonbreaking,|,template,|,code",
\r
69 theme_advanced_toolbar_location : "top",
\r
70 theme_advanced_toolbar_align : "left",
\r
71 theme_advanced_path_location : "bottom",
\r
72 content_css : "example_full.css",
\r
73 plugin_insertdate_dateFormat : "%Y-%m-%d",
\r
74 plugin_insertdate_timeFormat : "%H:%M:%S",
\r
75 extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style|title|tsrc],*[mcetmpldtesrc]",
\r
76 external_link_list_url : "example_link_list.js",
\r
77 external_image_list_url : "example_image_list.js",
\r
78 flash_external_list_url : "example_flash_list.js",
\r
79 media_external_list_url : "example_media_list.js",
\r
80 file_browser_callback : "fileBrowserCallBack",
\r
81 theme_advanced_resize_horizontal : false,
\r
82 theme_advanced_resizing : true,
\r
83 nonbreaking_force_tab : true,
\r
84 apply_source_formatting : true,
\r
85 template_cdate_classes : "cdate creationdate",
\r
86 template_mdate_classes : "mdate somedate",
\r
87 template_selected_content_classes : "selcontent",
\r
88 template_cdate_format : "%m/%d/%Y : %H:%M:%S",
\r
89 template_mdate_format : "%m/%d/%Y : %H:%M:%S",
\r
90 template_replace_values : {
\r
91 username : "Andrew Tetlaw",
\r
92 "invoice-items" : Invoice.calculate,
\r
93 "word-count" : WordCount.count,
\r
94 "char-count" : WordCount.charCount
\r
96 template_templates : [
\r
98 title : 'Editing Details',
\r
99 src : 'templates/editing_details.htm',
\r
100 description : "Timestamps, editor's name and a comment area"
\r
103 title : 'Invoice Template',
\r
104 src : 'templates/invoice.htm',
\r
105 description : 'Fill in the rows and the totals are calculated automatically'
\r
108 title : 'Word Count',
\r
109 src : 'templates/count.htm',
\r
110 description : 'Word count for editor content'
\r
113 title : 'Editors Comment',
\r
114 src : 'templates/editors_comment.htm',
\r
115 description : 'Add a comment about the selected text'
\r
126 <a href="example_full.htm">[Full featured example]</a> <a href="example_advanced.htm">[Advanced example]</a> <a href="example_simple.htm">[Simple example]</a> <a href="example_word.htm">[Word example]</a>
\r
127 <form method="get" action="">
\r
128 <h3>Template example</h3>
\r
129 This example shows how to make more advanced templates that execute logic.<br /><br />
\r
130 <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 100%">
\r
131 <span class="example1">Test header 1</span><br />
\r
132 <span class="example2">Test header 2</span><br />
\r
133 <span class="example3">Test header 3</span><br />
\r
134 Some <b>element</b>, this is to be editor 1. <br /> This editor instance has a 100% width to it.
\r
135 <p>Some paragraph. <a href="http://www.sourceforge.net">Some link</a></p>
\r
136 <img src="logo.jpg">
\r
139 <input type="submit" name="save" value="Submit" />
\r
140 <input type="reset" name="reset" value="Reset" />
\r