Integrate FCKeditor with Image-Upload feature in Magnolia
Preface
The following customization requires re-compilation of your Magnolia Distribution.
This means, you have to be able to recompile your Magnolia to follow the steps below.
(Use eclipse and everything that goes with it)
Get FCKeditor Java Integration package
First of all, you will need to download the FCKeditor Java Integration package.
This ZIP-file contains an sample web-application, we won't use it! (Remember: we want to use FCKeditor within our Magnolia-Webapp)
We just need the "src" Directory of the zip-file.
Copy src/com/fredck/FCKeditor/connector/ConnecterServlet.java to the appropriate place in your Magnolia-Sourcetree.
(I copied it to: info.magnolia.cms.fckeditor.connector.ConnectorServlet - this isn't a very logic place, I know )
Add the Servlet Handler to web.xml
The following lines have to be added to the web.xml of the webapplication.
<servlet>
<servlet-name>Connector</servlet-name>
<servlet-class>info.magnolia.cms.FCKeditor.connector.ConnectorServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/admindocroot/fckeditor/UserFiles/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>/admindocroot/fckeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
</servlet-mapping>
Note, <servlet-class> depends on your naming definition of the Connector-Servlet.
Changes in fckconfig.js of FCKeditor
FCKConfig.LinkBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Connector=connectors/jsp/connector";}}
FCKConfig.ImageBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector";}}
FCKConfig.FlashBrowserURL = FCKConfig.BasePath + "filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector";
Either add these lines or change existing ones.
Changes to ConnectorServlet.java
Magnolia parses the request, so you don't have directly access to the MultiPart attachement of the request-Object.
But thats ok, Magnolia stored it for us.
Use the attached File (ConnectorServlet.java).
Recompile
Recompile your sources if it's working, everything went right!
Conclusion
This Wiki Article has to be corrected and written in more detail.
It is meant to be just a hint.
Note: This customization works quite well but I bet the Document Management System would do a much better job here! (As you can add some Meta Infos etc)
In its previous incarnation on JspWiki, this page was last edited on Feb 9, 2007 10:12:11 AM by FlorianFuchs
Other known authors include :