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:
Added several attachments rather than showing all code in-line

------------------------------------------------------------------------------
  
  1. Make sure that Fred (the FCK Editor) is in the 
`lenya/webapp/lenya/resources/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. Download [attachment:invokeEditor.js] to 
`lenya/webapp/lenya/resources/fckeditor`
- 2. Create a new javascript file in `lenya/webapp/lenya/resources/fckeditor` 
called `invokeEditor.js` with the following contents:
- 
- {{{
- function invoke()
- {
- //Need to store pub id and doc id in cookie so fred can use 
- //in connector url with inserting assets. If don't then Lenya has 
- //no way of knowing what pub and document the user is in.
- 
- var url = document.URL;
- var urlArray = url.split("/");
- var finalValue = '';
- var isDocId = 'false';
- for(var i=0; i < urlArray.length; i++){
-       if(isDocId == 'true'){
-               finalValue = finalValue + urlArray[i];
-               if(i < urlArray.length-1){
-                       finalValue = finalValue + "/";
-               }
-       }
-       
-       if(urlArray[i] == 'authoring'){
-               finalValue = value + "/";
-               isDocId = 'true'
-       }
-       var value = urlArray[i];
- }
- var period = finalValue.indexOf(".");
- var finalValue = finalValue.substring(0,period);
- document.cookie = "url=" + finalValue + "; path=/";
- var oFCKeditor = new FCKeditor( 'content' ) ;
- oFCKeditor.ReplaceTextarea() ;
- }
- }}}
  
  3. Add the following to `lenya/webapp/lenya/resources/fckeditor/fckconfig.js` 
after the line `FCKConfig.ImageDlgHideAdvanced` (around line 112):
  
@@ -150, +117 @@

  
  }}}
  
- 8. Copy `lenya/pubs/pubname/usecase-bxeng.xmap` to same directory and rename 
it to `usecase-fckeditor.xmap`
+ 8. Copy `lenya/pubs/pubname/usecase-bxeng.xmap` to `usecase-fckeditor.xmap` 
in the same directory, and make the following changes:
  
  a. Modify `<map:match pattern="request2document">` to contain the following:
  
@@ -249, +216 @@

  <item wf:event="edit" uc:usecase="fckeditor" uc:step="open" 
href="?"><i18n:text>Edit with FCKeditor</i18n:text></item>
  }}}
  
- 10. Copy `lenya/webapp/lenya/xslt/bxeng/aggregate.xsl` to 
`lenya/webapp/lenya/xslt/fckeditor/`.  
+ 10. Copy `lenya/webapp/lenya/xslt/bxeng/aggregate.xsl` to 
`lenya/webapp/lenya/xslt/fckeditor/`.
  
  a. Modify `aggregate.xsl` to contain the following:
  
@@ -304, +271 @@

  
  }}}
  
- b. Modify asset.xsl to containt the following:
+ b. Modify `asset.xsl` to containt the following:
  
  {{{
  <?xml version="1.0" encoding="UTF-8"?>
@@ -340, +307 @@

  
  }}}
  
- c. Add a file called change-image-path.xsl that contains the following:
+ c. Download the following files to lenya/webapp/lenya/xslt/fckeditor/
  
+  * [attachment:change-image-path.xsl] 
- {{{
- <?xml version="1.0" encoding="UTF-8"?>
  
+  * [attachment:uploadAssetComplete.xsl]
- <xsl:stylesheet version="1.0"
-     xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
-     xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0";
-     xmlns:xhtml="http://www.w3.org/1999/xhtml";
-     >
-   <xsl:param name="documentid" />
-   <xsl:param name="publicationid" />
-   
-   <xsl:template match="img/@src[not(starts-with(., '/'))]">
-     <xsl:attribute name="src">
-       <xsl:value-of select="concat('/',$publicationid,'/authoring/',.)" />
-     </xsl:attribute>
-   </xsl:template>
-   
-   
-   <xsl:template match="@*|node()">
-     <xsl:copy>
-       <xsl:apply-templates select="@*|node()" />
-     </xsl:copy>
-   </xsl:template>
-   
- </xsl:stylesheet>
- }}}
  
- d. Add a file called uploadAssetComplete.xsl that contains the following:
+  * [attachment:savedContent.xsl]
  
- {{{
- <?xml version="1.0" encoding="UTF-8"?>
- 
- <xsl:stylesheet version="1.0"
-     xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
-     xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0";
-     xmlns:xhtml="http://www.w3.org/1999/xhtml";
-     xmlns:lxslt="http://xml.apache.org/xslt";
-     >
- 
- <xsl:param name="errorCode" />
- <xsl:param name="name" />
-   
- <xsl:template match="html">
- <html>
- <script type="text/javascript">
- var errorCode = <xsl:value-of select="$errorCode"/>;
- var name = "<xsl:value-of select="$name"/>";
- window.parent.frames['frmUpload'].OnUploadCompleted(0,name);
- </script>
- </html>
-     
- </xsl:template>
- </xsl:stylesheet>
- }}}
- 
- e. Add a new xsl file called savedContent.xsl.  It should look like the 
following:
- 
- {{{
- <?xml version="1.0"?>
- 
- <xsl:stylesheet version="1.0"
-     xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
-     xmlns="http://www.w3.org/1999/xhtml";
-     xmlns:xhtml="http://www.w3.org/1999/xhtml";
-     xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0";
-     xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"; 
-     xmlns:dc="http://purl.org/dc/elements/1.1/";
-     xmlns:dcterms="http://purl.org/dc/terms/";
-     xmlns:i18n="http://apache.org/cocoon/i18n/2.1";
-     exclude-result-prefixes="page xhtml"
- >
- 
- <xsl:param name="title"/>
- <xsl:param name="creator"/>
- <xsl:param name="subject"/>
- <xsl:param name="publisher"/>
- <xsl:param name="contributor"/>
- <xsl:param name="date"/>
- <xsl:param name="type"/>
- <xsl:param name="format"/>
- <xsl:param name="identifier"/>
- <xsl:param name="source"/>
- <xsl:param name="language"/>
- <xsl:param name="relation"/>
- <xsl:param name="coverage"/>
- <xsl:param name="rights"/>
- <xsl:param name="issued"/>
- <xsl:param name="modified"/>
- 
- <xsl:template match="/">
- <html xmlns="http://www.w3.org/1999/xhtml";>
-       <lenya:meta>
-               <dc:title><xsl:value-of select="$title"/></dc:title>
-               <dc:creator><xsl:value-of select="$creator"/></dc:creator>
-               <dc:subject><xsl:value-of select="$subject"/></dc:subject>
-               <dc:publisher><xsl:value-of select="$publisher"/></dc:publisher>
-               <dc:contributor><xsl:value-of 
select="$contributor"/></dc:contributor>
-               <dc:date><xsl:value-of select="$date"/></dc:date>
-               <dc:type><xsl:value-of select="$type"/></dc:type>
-               <dc:format><xsl:value-of select="$format"/></dc:format>
-               <dc:identifier><xsl:value-of 
select="$identifier"/></dc:identifier>
-               <dc:source><xsl:value-of select="$source"/></dc:source>
-               <dc:language><xsl:value-of select="$language"/></dc:language>
-               <dc:relation><xsl:value-of select="$relation"/></dc:relation>
-               <dc:coverage><xsl:value-of select="$coverage"/></dc:coverage>
-               <dc:rights><xsl:value-of select="$rights"/></dc:rights>
-               <dcterms:issued><xsl:value-of 
select="$issued"/></dcterms:issued>
-               <dcterms:modified><xsl:value-of 
select="$modified"/></dcterms:modified>
-       </lenya:meta>   
-       <head>
-     <title><xsl:value-of select="$title"/></title>
-       </head>
-       <xsl:copy-of select="body"/>
- </html>       
- </xsl:template>
-  
- </xsl:stylesheet>  
- 
- }}}  
- 
- 11. Copy the attached [attachment:FredSaveAction.class FredSaveAction.class] 
(source [attachment:FredSaveAction.java FredSaveAction.java]) to 
WEB-INF/classes/org/apache/lenya/cms/cocoon/acting/ to make a new Action that 
saves the content to a temporary file.
+ 11. Download [attachment:FredSaveAction.class] (source 
[attachment:FredSaveAction.java]) to 
WEB-INF/classes/org/apache/lenya/cms/cocoon/acting/ to make a new Action that 
saves the content to a temporary file.
  
  This code is basically the same as 
`org.apache.lenya.cms.cocoon.acting.OneFormEditorSaveAction.java`, with a few 
modifications.  Validation needs to be added here.
  
- 12. Copy the attached [attachment:UploadFredAsset.class 
UploadFredAsset.class] (source [attachment:UploadFredAsset.java 
UploadFredAsset.java]) to WEB-INF/classes/org/apache/lenya/cms/cocoon/acting/ 
to make a new Action that uploads an asset to the page's asset directory.  When 
creating the Publication, one of the parameters required is the context.  Right 
now, this is hard coded.  I have yet to figure out a way to get this.  
Obviously, hard coding is not the solution - still working on this.  Thinking 
about putting the context in a properties files somewhere.  Most of this code 
was taken from the action 
`org.apache.lenya.cms.cocoon.acting.UploadAction.java` and modified to work 
with Fred.
+ 12. Download [attachment:UploadFredAsset.class] (source 
[attachment:UploadFredAsset.java]) to 
WEB-INF/classes/org/apache/lenya/cms/cocoon/acting/ to make a new Action that 
uploads an asset to the page's asset directory.  When creating the Publication, 
one of the parameters required is the context.  Right now, this is hard coded.  
I have yet to figure out a way to get this.  Obviously, hard coding is not the 
solution - still working on this.  Thinking about putting the context in a 
properties files somewhere.  Most of this code was taken from the action 
`org.apache.lenya.cms.cocoon.acting.UploadAction.java` and modified to work 
with Fred.
  
  To get Fred to work with all your pubs, you will need to copy 
`usecase-fckeditor.xmap` to each publication.  (Or can we put 
usecase-fckeditor.xmap into a lenya/usecases/fckeditor directory for all 
publications???)
  

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

Reply via email to