...
Code Block | ||||
---|---|---|---|---|
| ||||
<textarea id="myeditor" name="myeditor" cols="80" rows="24" wrap="virtual/> <script type="text/javascript"> var name = 'myeditor'; var base_url = window.location.href; base_url = base_url.substring(0,base_url.indexOf('/tag.')); var editor = new FCKeditor(name,'100%','400','Default') ; editor.BasePath= base_url + '/fckeditor/'; var worker_url = '<xsl:value-of select="$baseWorkerURL"/>'; editor.Width = '400px'; editor.Height = 400px'; editor.Config['BaseHref'] = base_url + '/' + worker_url + '<xsl:value-of select="$base"/>'; editor.Config['CustomConfigurationsPath'] = editor.BasePath + 'myconfig.js'; var link_url = worker_url + '&ServerPath=<xsl:value-of select="$base"/>'; var image_url = link_url + '&Type=Image'; image_url = image_url.replace(/amp;/gi,''); link_url = link_url.replace(/amp;/gi,''); editor.Config['ImageBrowserURL'] = editor.BasePath + 'editor/filemanager/browser/default/browser.html?Connector=../../../../../' + image_url; editor.Config['LinkBrowserURL'] = editor.BasePath + 'editor/filemanager/browser/default/browser.html?Connector=../../../../../' + link_url; editor.ReplaceTextarea() ; </script> |
...
Initial fonts, pulldown items and colors can all be specified in this file.
Image and Link Browsing
The FCKEditor Image and Link tools include file browsers to browse files in directories on the portal. Follow these steps to configure your channel to supply these browsing functions:
- Use the following Javascript in your HTML code:
Code Block title Javascript to implement file browsing borderStyle solid <textarea id="myeditor" name="myeditor" cols="80" rows="24" wrap="virtual/> <script type="text/javascript"> var name = 'myeditor'; var base_url = window.location.href; base_url = base_url.substring(0,base_url.indexOf('/tag.')); var editor = new FCKeditor(name,'100%','400','Default') ; editor.BasePath= base_url + '/fckeditor/'; var worker_url = '<xsl:value-of select="$baseWorkerURL"/>'; editor.Width = '400px'; editor.Height = 400px'; editor.Config['CustomConfigurationsPath'] = editor.BasePath + 'myconfig.js'; var link_url = worker_url + '&ServerPath='; var image_url = link_url + '&Type=Image'; // hack to convert to ampersands due to xslt processing image_url = image_url.replace(/amp;/gi,''); link_url = link_url.replace(/amp;/gi,''); editor.Config['ImageBrowserURL'] = editor.BasePath + 'editor/filemanager/browser/default/browser.html?Connector=../../../../../' + image_url; editor.Config['LinkBrowserURL'] = editor.BasePath + 'editor/filemanager/browser/default/browser.html?Connector=../../../../../' + link_url; editor.ReplaceTextarea() ; </script>
You will need to supply the baseWorkerURL to your XSLT and configure your channel to support IMimeResponse or IMultithreadedMimeResponse. When the Link or Image browser button in the FCKEditor is clicked the ImageBrowserURL or LinkBrowserURL will be called. This will display the editor/filemanager/browser/default/browser.html. In turn, a command will be sent using the value specified by the Connector. The parameters sent back to your channel via the BaseWorkerURL may include
- Command (GetFolder,GetFolderAndFiles,CreateFolder,FileUpload)
- Type (Image etc.)
- ServerPath (possible subdirectory to work from)
- CurrentFolder (current folder selected when file browsing)
- NewFolderName
In the channel, I have code in SetRuntimeData to detect when a request is being made by looking for one of the above parameters. I then call connector(rd) to handle the request. Attached are connector.java and DownloadWorker.java that
handle these requests. This code will not run unmodified because file environments are different (this code is based on Hypercontent1.3). If you already have DownloadWorker code, you can replace these calls with your own. In most cases, this code will return an XML file as response. The formats are explained on the FCKEditor site.