<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>RTFM WikiText Format Toolbar</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>

<P><FONT SIZE=2>Wanted to integrate a simple way to format the "WikiText" Custom field in RTFM.<BR>
<BR>
------------------------------------------------------------------------<BR>
<BR>
Copy: /opt/rt3/share/html/Elements/EditCustomFieldWikitext to<BR>
      /opt/rt3/local/html/Elements/EditCustomFieldWikitext<BR>
Edit: /opt/rt3/local/html/Elements/EditCustomFieldWikitext<BR>
<BR>
Add before "% while":<BR>
<BR>
% my $wiki_textarea_value = $NamePrefix .$CustomField->id .'-Values';<BR>
<BR>
% my $wiki_format_toolbar = qq(<BR>
% <div><BR>
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','bold');" style="font-weight: bold;" value="B"><BR>
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','italic');" style="font-weight: bold;" value="I"><BR>
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','bold_italic');" style="font-weight: bold;font-style: italic;" value="BI"><BR>
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','heading');" value="H1"><BR>
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','subheading');" value="H2"><BR>
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','subsubheading');" value="H3"><BR>
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','list');" value="List"><BR>
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','link');" value="Link"><BR>
% </div><BR>
% );<BR>
<BR>
% print $wiki_format_toolbar;<BR>
<BR>
Add in both "textarea" tags:<BR>
<BR>
<textarea ... id="<%$NamePrefix%><%$CustomField->Id%>-Values">...</textarea><BR>
<BR>
------------------------------------------------------------------------<BR>
<BR>
Copy: /opt/rt3/share/html/RTFM/Article/Edit.html to<BR>
      /opt/rt3/local/html/RTFM/Article/Edit.html<BR>
<BR>
Add before "form":<BR>
<BR>
<script type="text/javascript"><BR>
<BR>
function lbc(e, objname, theTag) {<BR>
        var el = document.getElementById(objname);<BR>
       <BR>
        var enclosingTag;<BR>
        var spaceTag = '\ ';<BR>
       <BR>
        if(theTag == 'bold'){<BR>
                startTag = '\'\'\'';<BR>
                endTag = '\'\'\'';<BR>
                spaceTag = '';<BR>
        }<BR>
        if(theTag == 'italic'){<BR>
                startTag = '\'\'';<BR>
                endTag = '\'\'';<BR>
                spaceTag = '';<BR>
        }<BR>
        if(theTag == 'bold_italic'){<BR>
                startTag = '\'\'\'\'\'';<BR>
                endTag = '\'\'\'\'\'';<BR>
                spaceTag = '';<BR>
        }<BR>
        if(theTag == 'heading'){<BR>
                startTag = '=';<BR>
                endTag = '=';<BR>
        }<BR>
        if(theTag == 'subheading'){<BR>
                startTag = '==';<BR>
                endTag = '==';<BR>
        }<BR>
        if(theTag == 'subsubheading'){<BR>
                startTag = '=====';<BR>
                endTag = '=====';<BR>
        }<BR>
        if(theTag == 'link'){<BR>
                startTag = '[';<BR>
                endTag = ']';<BR>
        }<BR>
        if(theTag == 'list'){<BR>
                startTag = '\ \ \ \ *\ ';<BR>
                endTag = '';<BR>
        }<BR>
<BR>
        if (el.setSelectionRange) {<BR>
<BR>
                //Mozilla or FireFox Code<BR>
<BR>
                var st = el.scrollTop;<BR>
                var ss = el.selectionStart;<BR>
                var se = e.selectionEnd;<BR>
                el.value = el.value.substring(0,el.selectionStart) + startTag + spaceTag + el.value.substring(el.selectionStart,el.selectionEnd) + spaceTag + endTag + el.value.substring(el.selectionEnd,el.value.length);<BR>
                el.selectionStart = ss;<BR>
                el.selectionEnd = ss;<BR>
                el.scrollTop = st;<BR>
        }<BR>
        else if (document.selection && document.selection.createRange) {<BR>
               <BR>
                //Internet Explorer Code<BR>
               <BR>
                el.focus(); //Makes sure tags are being added to the textarea<BR>
                var range = document.selection.createRange();<BR>
                range.text = startTag + spaceTag + range.text + spaceTag + endTag; //Adds beginning and end tags.<BR>
        }<BR>
        el.focus();<BR>
}<BR>
<BR>
</script><BR>
<BR>
------------------------------------------------------------------------<BR>
<BR>
Miguel Rivera<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>