function LoadTemplates()
{
//document.Form1.ddTemp defSel sel
//delete all options
for(var j = 0; j < document.Form1.ddTemp.options.length; ++j)
document.Form1.ddTemp.options[j] = null;
//var opt = new Option('text', 'value'); //, true, true); optional params
var items = new Array(38);
items[0] = new Option('--- Links ---', '');
items[1] = new Option('Document link in this project', '1');
items[2] = new Option('Document link in another project', '2');
items[3] = new Option('Parent document link', '3');
items[4] = new Option('Child document link', '4');
items[5] = new Option('Web page link', '5');
items[6] = new Option('Email link', '6');
items[7] = new Option('--- Tables ---', '');
items[8] = new Option('3 x 3 plain', '8');
items[9] = new Option('3 x 3 with header', '9');
items[10] = new Option('3 x 3 with header and footer', '10');
items[11] = new Option('--- Headers ---', '');
items[12] = new Option('Header 1', '12');
items[13] = new Option('Header 2', '13');
items[14] = new Option('Header 3', '14');
items[15] = new Option('--- Indents ---', '');
items[16] = new Option('Indent level 1', '16');
items[17] = new Option('Indent level 2', '17');
items[18] = new Option('Indent level 3', '18');
items[19] = new Option('--- Images ---', '');
items[20] = new Option('Image inline with text', '20');
items[21] = new Option('Image right aligned', '21');
items[22] = new Option('Image left aligned', '22');
items[23] = new Option('Image right aligned with caption', '23');
items[24] = new Option('Image left aligned with caption', '24');
items[25] = new Option('--- Image Links ---', '');
items[26] = new Option('Image link inline with text', '26');
items[27] = new Option('Image link right aligned', '27');
items[28] = new Option('Image left aligned', '28');
items[29] = new Option('Image right aligned with caption', '29');
items[30] = new Option('Image left aligned with caption', '30');
items[31] = new Option('--- Other ---', '');
items[32] = new Option('Code section', '32');
items[33] = new Option('Horizontal line', '33');
items[34] = new Option('Bold words', '34');
items[35] = new Option('Italic words', '35');
items[36] = new Option('Suppress formatting', '36');
items[37] = new Option('Typewriter text', '37');
for(var i = 0; i < items.length; ++i)
document.Form1.ddTemp.options[i] = items[i];
}
function templateSelected(form)
{
var sel = form.ddTemp.options[form.ddTemp.selectedIndex].value;
//1, 3, 6 - parseInt the val and get array string
if(sel.length > 0)
{
var tmp = GetTemplate(sel);
insertCursor(form.txtBody, ' ' + tmp + '');
}
document.Form1.txtBody.focus();
}
function GetTemplate(sel)
{
var items = new Array(38);
items[0] = '';
items[1] = ' [[document name|link caption]] ';
items[2] = ' [[project name/document name|link caption]] ';
items[3] = ' ^[[document name]] ';
items[4] = ' +[[document name]] ';
items[5] = ' [[http://www.msn.com|link caption]] ';
items[6] = ' [[mailto:user@domain.com|link caption]] ';
items[7] = '';
items[8] = '\n++++(W680,H100,CENTER)'
+ '\n||'
+ '\nRow 1 cell 1 text'
+ '\n||'
+ '\nRow 1 cell 2 text'
+ '\n||'
+ '\nRow 1 cell 3 text'
+ '\n~~~~'
+ '\n||'
+ '\nRow 2 cell 1 text'
+ '\n||'
+ '\nRow 2 cell 2 text'
+ '\n||'
+ '\nRow 2 cell 3 text'
+ '\n~~~~'
+ '\n||'
+ '\nRow 3 cell 1 text'
+ '\n||'
+ '\nRow 3 cell 2 text'
+ '\n||'
+ '\nRow 3 cell 3 text'
+ '\n++++'
+ '\n';
items[9] = '\n++++(W680,H100,CENTER)'
+ '\n@@'
+ '\nHead cell 1 text'
+ '\n@@'
+ '\nHead cell 2 text'
+ '\n@@'
+ '\nHead cell 3 text'
+ '\n~~~~'
+ '\n||'
+ '\nRow 1 cell 1 text'
+ '\n||'
+ '\nRow 1 cell 2 text'
+ '\n||'
+ '\nRow 1 cell 3 text'
+ '\n~~~~'
+ '\n||'
+ '\nRow 2 cell 1 text'
+ '\n||'
+ '\nRow 2 cell 2 text'
+ '\n||'
+ '\nRow 2 cell 3 text'
+ '\n~~~~'
+ '\n||'
+ '\nRow 3 cell 1 text'
+ '\n||'
+ '\nRow 3 cell 2 text'
+ '\n||'
+ '\nRow 3 cell 3 text'
+ '\n++++'
+ '\n';
items[10] = '\n++++(W680,H100,CENTER)'
+ '\n@@'
+ '\nHead cell 1 text'
+ '\n@@'
+ '\nHead cell 2 text'
+ '\n@@'
+ '\nHead cell 3 text'
+ '\n~~~~'
+ '\n||'
+ '\nRow 1 cell 1 text'
+ '\n||'
+ '\nRow 1 cell 2 text'
+ '\n||'
+ '\nRow 1 cell 3 text'
+ '\n~~~~'
+ '\n||'
+ '\nRow 2 cell 1 text'
+ '\n||'
+ '\nRow 2 cell 2 text'
+ '\n||'
+ '\nRow 2 cell 3 text'
+ '\n~~~~'
+ '\n||'
+ '\nRow 3 cell 1 text'
+ '\n||'
+ '\nRow 3 cell 2 text'
+ '\n||'
+ '\nRow 3 cell 3 text'
+ '\n~~~~'
+ '\n##'
+ '\nFooter cell 1 text'
+ '\n##'
+ '\nFooter cell 2 text'
+ '\n##'
+ '\nFooter cell 3 text'
+ '\n++++'
+ '\n';
items[11] = '';
items[12] = '\n== Header Text ==\n';
items[13] = '\n=== Header Text ===\n';
items[14] = '\n==== Header Text ====\n';
items[15] = '';
items[16] = '\n: Indented text level 1\n';
items[17] = '\n:: Indented text level 2\n';
items[18] = '\n::: Indented text level 3\n';
items[19] = '';
items[20] = ' [[image:imgfile.jpg]] ';
items[21] = ' [[image:imgfile.gif|right|100px]] ';
items[22] = ' [[image:imgfile.gif|left|100px]] ';
items[23] = ' [[image:imgfile.gif|right|100px|frame|caption text]] ';
items[24] = ' [[image:imgfile.gif|left|100px|frame|caption text]] ';
items[25] = '';
items[26] = ' [[imagelink:imgfile.jpg|topic or url]] ';
items[27] = ' [[imagelink:imgfile.gif|topic or url|right|100px]] ';
items[28] = ' [[imagelink:imgfile.gif|topic or url|left|100px]] ';
items[29] = ' [[imagelink:imgfile.gif|topic or url|right|100px|frame|caption text]] ';
items[30] = ' [[imagelink:imgfile.gif|topic or url|left|100px|frame|caption text]] ';
items[31] = '';
items[32] = '\n::code::\nyour code here\n::code::\n';
items[33] = '\n----\n';
items[34] = ' \'\'\'bold words here\'\'\' ';
items[35] = ' \'\'italic words here\'\' ';
items[36] = '\n; formatting suppressed on this line';
items[37] = '\n<tt>typewriter text here</tt>';
var idx = parseInt(sel);
return items[idx];
}
/*
items[0] = new Option('Document link in this project', '0');
items[1] = new Option('Document link in another project', '1');
items[2] = new Option('Parent document link ', '2');
items[3] = new Option('Child document link ', '3');
--- Links ---
Document link in this project
Document link in another project
Parent document link
Child document link
Web page link
Email link
--- Tables ---
3 x 3 plain
3 x 3 with header
3 x 3 with header and footer
--- Headers ---
Header 1
Header 2
Header 3
--- Indents ---
Indent level 1
Indent level 2
Indent level 3
--- Images ---
Image inline with text
Image right aligned
Image left aligned
Image right aligned with caption
Image left aligned with caption
--- Image Links ---
Image link inline with text
Image link right aligned imagelink
Image left aligned
Image right aligned with caption
Image left aligned with caption
--- Other ---
Code section ::code:: ::code::
Horizontal line ----
Bold words
Italic words
Suppress formatting
++++(W360,H100%,CENTER)
@@
Here is a the first table data row. With column header style.
@@
Here is the second column with header style.
====
##
Here is the first column data
## (W60,H90)
Here is the second column data with width=60 and height=90
====
##
Here is the first column data
##
Here is the second column data
====
##
Here is the first column data
##
Here is the second column data
====
..
Here is a the first table data row. With column footer style.
..
Here is the second column with footer style.
++++
++++ begin and end table
++++(W360,H100%,B1) = width=360px and height=100% border=1
*/