Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Lenya Wiki" for change 
notification.

The following page has been changed by BobHarner:
http://wiki.apache.org/lenya/HowToIntegrateFCKEditor

The comment on the change is:
Our initial efforts at integrating FCKEditor with Lenya

New page:
= Integrating FCKeditor with Lenya =

This is still very much a work in progress.  This will get the famous FCKeditor 
(which we have nicknamed "Fred" to reduce snickering) to load with content, but 
the saving usecase has not been implemented yet (maybe next week).  And we've 
only tried this with FCKeditor 2.1 and Lenya 2.2.1.  Full credit for all this 
goes to K. Haenni.

1. Make sure the Fred (the FCK Editor) is in the 
`lenya/webapp/lenya/resource/fckeditor` directory.  This can be downloaded from 
http://www.fckeditor.net/.  Remove any unnecessary folders and files in the 
fckeditor directory (anything that begins with an “_”).

2. Create a new javascript file in `lenya/webapp/lenya/resources/fckeditor` 
called `invokeEditor.js` with the following contents:

{{{
function invoke()
{
    var oFCKeditor = new FCKeditor( 'EditTextArea' ) ;
    oFCKeditor.ReplaceTextarea() ;
}
}}}

3. In `lenya/webapp/lenya/resources/misc/` copy the entire `bxeng` folder to 
`fckeditor`.  Modify the new folder's `index.html` to contain the following:

{{{
<?xml version="1.0"?>
<!-- $Id$-->
    
<html xmlns="http://www.w3.org/1999/xhtml";  >
<head>

<!-- Namespaces are doctype specific and will be added during aggregation -->

<script src="/fckeditor/fckeditor.js"type="text/javascript" />
<script src="/fckeditor/invokeEditor.js" type="text/javascript" />

<title>FCKEditor Editor</title>
        
</head>
</html>
}}}

4. Copy `lenya/webapp/lenya/xslt/bxeng` to `lenya/webapp/lenya/xslt/fckeditor`. 
 Modify `aggregate.xsl` to contain the following:

{{{
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xhtml="http://www.w3.org/1999/xhtml";>

<xsl:template match="/">
<xsl:apply-templates select="fckeditor"/>
</xsl:template>

<xsl:template match="fckeditor">
<html xmlns="http://www.w3.org/1999/xhtml";>
<xsl:apply-templates select="xhtml:html/xhtml:[EMAIL PROTECTED] = 
'EditorHead']"/>
<body onload="invoke();">

<form id="myform" 
action="/default/authoring/index.html?lenya.usecase=fckeditor&amp;lenya.step=save"
 method="POST">
<textarea id="EditTextArea"><xsl:copy-of 
select="xhtml:html/xhtml:body/node()"/></textarea>
</form>

</body>
</html>
</xsl:template>

<xsl:template match="xhtml:head">
<head xmlns="http://www.w3.org/1999/xhtml";>
<xsl:for-each select="/fckeditor/namespaces/xmlns">
<meta name="fckNS" content="{.}"/>
</xsl:for-each>
<xsl:copy-of select="@*|node()"/>
</head>
</xsl:template>

</xsl:stylesheet>
}}}

5. Add the following to `lenya/webapp/global-sitemap.xmap` after  `<!-- Editor 
BXE -->`

{{{
<!-- FCK Editor -->
<map:pipeline>
  <map:match pattern="fckeditor/**">
    <map:read src="lenya/resources/fckeditor/{1}"/>
  </map:match>
</map:pipeline>
}}}

6. Add the following line to `lenya/pubs/pubname/config/menus/generic.xsp` after
`<item wf:event="edit" uc:usecase="bxeng" uc:step="open" 
href="?"><i18n:text>Edit with BXE</i18n:text></item>` (around line 127):

{{{
<item wf:event="edit" uc:usecase="fckeditor" uc:step="open" 
href="?"><i18n:text>FCK Editor</i18n:text></item>
}}}

7. Copy `lenya/pubs/pubname/usecase-bxeng.xmap` to same directory and rename it 
to `usecase-fckeditor.xmap`

a. Modify the `<!-- == Components == -->` section of the document to only 
contain `<map:components/>`

b. Replace `<map:match type="usecase" pattern="bxeng">` with `<map:match 
type="usecase" pattern="fckeditor">`

c. Replace everything under `<!-- Check for BXENG -->` with the following:

{{{
    <!-- Check for FCK Editor -->
        <map:act type="resource-exists" 
src="../../resources/fckeditor/fckeditor.js">
            <map:act type="reserved-checkout">
                <map:generate type="serverpages" 
src="../../content/rc/{exception}.xsp">
                    <map:parameter name="user" value="{user}"/>
                    <map:parameter name="filename" value="{filename}"/>
                    <map:parameter name="date" value="{date}"/>
                    <map:parameter name="message" value="{message}"/>
                </map:generate>
                <map:transform src="../../xslt/rc/rco-exception.xsl"/>
                <map:call resource="style-cms-page"/>
            </map:act>
            <map:aggregate element="fckeditor">
                <map:part src="../../resources/misc/fckeditor/index.xhtml"/>
                <map:part 
src="../../pubs/{page-envelope:publication-id}/content/authoring/{page-envelope:document-path}"/>
                <map:part 
src="../../resources/misc/fckeditor/content-namespaces.xml"/>
            </map:aggregate>
            <map:transform src="../../xslt/fckeditor/aggregate.xsl"/>
            <map:transform src="../../xslt/util/strip_namespaces.xsl"/>
            <map:serialize type="xhtml"/>
        </map:act>
        <map:generate src="../../resources/misc/bxeng/download.xhtml"/>
        <map:call resource="style-cms-page"/>
        <map:serialize type="html"/>
</map:match>
}}}

To get Fred to work with all your pubs, you will need to copy this 
`fckeditor-usecase.xmap` to each publication.

This is still very much a work in progress.  This will get Fred to load with 
content, but the saving usecase has not been implemented yet.  In addition, the 
`fckeditor-usecase.xmap` needs to be cleaned up.  Any suggestions or comments 
are welcome!

Note:  To change the height or width of the editor text area, go to 
`lenya/webapp/lenya/resources/fckeditor/fckeditor.js` and change the `width` 
and `height` properties.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to