On Sep 29, 2006, at 11:48 AM, Ben Avery wrote:

sorry guys, up against the wall today with a launch, then on holiday for 2 weeks, so don't have time to do an FCK editor installation guide, as I'd promised.

but basically:

1. download files from http://www.fckeditor.net/download/:
        a. FCKeditor 2.3.1 - the core FCK code
        b. FCKeditor.Java  - the Java files

2. unpack a. then unpack b. into a.

3. copy the whole directory into $roller_base/roller-ui/authoring/ editors


4. in $roller_base/roller-ui/authoring/editors, create an editor- fck.jsp file from the samples, e.g. 01sample.jsp (I think), look at how e.g. editor-txt.jsp works.

5. in the web interface, general system configuration, add editor- fck.jsp to the list of editors, then in the blog's settings, choose this as the default.

6. play around till it works!

hopefully someone can expand on this, or I'll have another bash when I'm back in a fortnight.

Ben

I have done just this. Below is editor-fck.jsp code. I sent out an archive a long time ago with everything installed, but that was for the 2.X base, and not the 3.0 What follows is the 3.0 version. Works really well.

Note a few changes I made:
  oFCKeditor.ToolbarSet="D20Forum";
  oFCKeditor.Height=400;

The height is set to 400 px, which is good. Likely I will increase it to 600 because for longer posts it does get annoying. I have also set a default editor that I like in fckconfig.js.

FCKConfig.ToolbarSets["D20Forum"] = [
        ['Source','-','Cut','Copy','Paste','PasteText','PasteWord'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Link','Unlink','Anchor'], ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscrip t'],['Image','Table','Rule','SpecialChar','UniversalKey','Smiley'],
        ['OrderedList','UnorderedList','-','Outdent','Indent'],
        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
        ['FontFormat','-','FontName','-','FontSize','-','TextColor']
] ;

I inserted it right after the following text:
FCKConfig.ToolbarSets["Basic"] = [
['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink',' -','About']
] ;

Just make certain that the bold words match! If you want, you can change the toolbar set to "Basic" or "Default" and it will work without needing to edit fckconfig.js.

Also I have the following code in the editor-fck.jsp:
String entryText = text.replaceAll("'", "'" );
entryText = entryText.replaceAll("\r\n", " " );
entryText = entryText.replaceAll("\r", " " );
entryText = entryText.replaceAll("\n", " " );

This fixes anomalous carriage returns (leaving a single space instead) and apostrophes that cause problem and allow for a single space to be inserted. Many posts in the early editors relied on carriage returns, and the end-of-line characters will in fact break the javascript code. I am definitely up for suggestions too by the way!

Christian

--
           _,--"
cws        `-._        ________-_______         "----
       _----'--'--------------------------------'--'----_
      //_| | \ Christian Stone, Software Engineer / | |_\\
     (_____|_|__=     [EMAIL PROTECTED]     =__|_|_____)
     _\_____=__   http://xtian.stonescape.net/        ___/_
       \/-(o)-~~-(o)-~~-(o)-`------'-(o)-~~-(o)-~~-(o)-\/


editor-fck.jsp follows:
----------------------------

<%-- This page is designed to be included in edit-weblog.jsp --%>
<%@ page import="org.apache.roller.ui.authoring.struts.formbeans.WeblogEntryFormE x" %>
<%@ include file="/taglibs.jsp" %>

<script type="text/javascript">
<!--
function postWeblogEntry(publish)
{
document.weblogEntryFormEx.text.value = FCKeditorAPI.GetInstance ("richMessage").GetXHTML();
    if (publish)
        document.weblogEntryFormEx.publishEntry.value = "true";
    document.weblogEntryFormEx.submit();
}
-->
</script>

<html:hidden property="text" />

<%-- Use the FCKEditor DHTL editor --%>

<%
String text = "";
WeblogEntryFormEx form = (WeblogEntryFormEx) request.getAttribute ("weblogEntryFormEx");
if (form.getText() != null) {
    text = form.getText();
}
String entryText = text.replaceAll("'", "&apos;" );
entryText = entryText.replaceAll("\r\n", " " );
entryText = entryText.replaceAll("\r", " " );
entryText = entryText.replaceAll("\n", " " );
%>
<script type="text/javascript" src="<%= request.getContextPath() %>/ roller-ui/authoring/editors/FCKeditor/fckeditor.js"></script>
<script type="text/javascript">
<!--
  var oFCKeditor = new FCKeditor( 'richMessage' ) ;
oFCKeditor.BasePath = "<%= request.getContextPath() %>/roller-ui/ authoring/editors/FCKeditor/";
  oFCKeditor.Value='<%=entryText%>';
  oFCKeditor.Height=400;
  oFCKeditor.ToolbarSet="D20Forum";
  oFCKeditor.Create() ;
//-->
</script>

<br /><a href="http://www.fckeditor.net/";>FCKEditor</a> by Frederico Caldeira Knabben.<br />
<br />





Reply via email to