|
Cookbook /
FCKEditorSummary: How to implement FCKEdit in PmWiki
Version: 1.1
Prerequisites:
Status: unsupported and buggy -- read all notes below, and be prepared to experiment and test; this may or may not work for you.
Maintainer:
Categories: Editing
Discussion: FCKEditor-Talk
WHY An FCKEditor Cookbook in PMWIKI ? For those who are not able to use Wiki syntax, this cookbook makes it possible to edit in WYSYWYG or in Native PmWiki Syntax. The Cookbook.FCKEditorDesign? is where you can discuss functions that should be covered by the FCKEditor for Pmwiki and those that should not. The FCKeditor cookbook is released under GPL (FCKeditor is under LGPL). The test page is based at http://pmwiki.anakrys.biz/index.php?n=Main.WikiSandbox (404 Not Found!) Download and documentation are found below: Last version : Installation documentation (also in the RAR file) : Detailed documentation (in French): Contact : JLP Comments (Jan 25 2006) The current password is billboard - sorry for the inconvenience! and transform it into: <p class="vspace"><span style="color: blue;">The current password is</span> <span style="color: red;">billboard</span> - sorry for the inconvenience! </p> But when I press submit in FCKEditor, the span tags are erased. Apart from tiny issues, I love this combination. (Please do not close this cookbook.) JTJohnston (Jan 22 2006) (Jan 19 2006) (December 20, 2006) 1) A fresh install from pmwiki-fckeditor-1.0.tar.gz asks me to over-write 3 or 4 files. I cannot tell which ones though. 2) When I unzip, your directory structure spells /FCKeditor/ as /FCKEditor/. You have to come to a decision on that. 3) I got a "does not exist" error on Dec 19th, this was the URL in the frame: http://www.foo.com/~user/wiki/pub/fckeditor/FCKeditor/editor/fckeditor.html?InstanceName=FCKeditor1&Toolbar=Default for this directory structure: /home/user/public_html/wiki/pub/fckeditor/FCKEditor/editor So to help the siutation, now that I have FCKeditor working, I have created my own zip which works if you follow your installation instructions. I basically renamed pub/fckeditor/FCKEditor/ to pub/fckeditor/FCKeditor/ and made a few changes in my config.php. I have even included enough of my local/config.php file to copy and paste from. I would not use it as-is. You can find it at: http://www.cegepsherbrooke.qc.ca/~languesmodernes/Nouveau%20dossier.zip John (December 19, 2006) cookbook/edit_fckeditor.php needs to be edited. Change <? ... ?> (depreciated) to: <?php ... ?> Also, in your config.php file, you need to use this: include_once(" NOT:
include_once(" Note the upper case in ".../FCKEditor/..." Problem:
When I click on "Editer en mode visuel" I get "Ce document n'existe pas." I live and work in French. I don't know whether this is PmWiki speaking, or my server. So far it is not working as distributed and installed. I still have hopes. At least I have ironed out these two bugs. John
(dec 2 2006) Giving this a try, thanks for the hard work and making it available!! (mar 11 2008) This turned out to be simply a missing php in the first line of the edit_fckeditor.php. If you are seeing the screen full of code. Edit the edit_fckeditor.php file and change the first line from "<?" to "<?php" (without the quotes). This solved the problem for me. John mentioned this above, but I didn't catch that until I had been through this a few times. I just wanted to make it very explicit. (03/12/2006) I succesfully set up this cookbook on my PmWiki, and I noticed a lot of problems when saving pages originally created in PmWiki syntax after editing them with FCKEditor. Where can we give you a feedback of the bugs/problems noticed ? (30/01/2007) How to set up FCKEditor within pmwiki's farm structure using separate upload directories for each farm.
1) Install the FckEditor as described above into /pmwiki-latest/pub/fckeditor/. 2) Copy the following code into each /pmwiki-share/farms/farmname/index.php: /*- FarmName */
// Get farm name from script name (url).
$sScriptName = $_SERVER['SCRIPT_NAME'];
$pregPattern = '/farms\/([a-z0-9]+)\//';
preg_match($pregPattern, $sScriptName, $aMatches);
/*- Save farm name in cookie */
if (isset($_COOKIE['sfarmname']))
{
$sFarmName = $_COOKIE['sfarmname'];
//$string = stripslashes($string);
//$sFarmName = unserialize($string);
//setcookie('sfarmname','',0,'/');
if ($sFarmName != $aMatches[1])
{
setcookie('sfarmname',$aMatches[1],0,'/');
}
}
else
{
setcookie('sfarmname',$aMatches[1],0,'/');
}
/*- pmWiki */ 3) Copy this into /pmwiki-latest/pub/fckeditor/FCKEditor/editor/filemanager/browser/default/connectors/php/config.php (and into the upload connector's config.php): // SECURITY: You must explicitelly enable this "connector". (Set it to "true").$Config['Enabled'] = true ; // Set sFarmName and get cookie value for this php script.
$sFarmName = '';
if (isset($_COOKIE['sfarmname']))
{
$sFarmName = $_COOKIE['sfarmname'];
}
// Path to user files relative to the document root. // Fill the following value it you prefer to specify the absolute path for the 4) Then copy this into /pmwiki-latest/pub/fckeditor/FCKEditor/editor/browser/default/frmresourcelist.html which displays the folder(s) and file(s) of your farms separate upload directory: // Set sFarmName and get cookie value for this javascript.
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length);
}
return null;
}
var sFarmName = readCookie('sfarmname');
5) In the same file as in 4) alter the function GetFoldersAndFilesCallBack by modifying the var sFileUrl: // Get the optional "url" attribute. If not available, build the url. If you got any questions, please feel free to contact me at geez18 (at) yahoo (dot) com. (02/02/2007) Today I find out, that the FckEditor has not been fully integrated into PmWiki, e.g. if you create a new page by setting a hyperlink to the non-existent page you want to create, PmWiki creates a hyperlink with a question mark (?) as you know, but it still points to the simple text editor with action=edit instead of using action=editfck. Pragmatically I just changed the links in pmwiki.php, but that's definitly not the elegant way. Anyway to please the wiki user one should add the wikilib.d/Site.EditQuickReference to the editors form, with an advice on how to use the enter key or the shift + enter key and an option to switch back to the simple text editor - some might be scared as they see the FckEditor's way of coding. (03/02/2007) I wanted the default editing mode to use fckeditor, and I eventually figured it out. Here's how I did it: I found my skin (I'm using the monobook skin), and replaced all instances of "action=edit" with "action=editfck". Then I edited the page in my wiki called Site.PageActions I removed the line that said * %item rel=nofollow class=edit accesskey='$[ak_edit]'%[[{$FullName}?action=edit | $[Edit] ]] and replaced it with two that said: * %item rel=nofollow class=edit accesskey='$[ak_edit]'%[[{$FullName}?action=editfck | $[Edit] ]] (5-MAR-2007) To the editor above, please be aware that you have assigned two separate actions to the action key "edit". This is what happens when you press ALT-E (assuming English in a Windows environment). You should have stripped the "accesskey='e' from one or the other of those lines (you choose which one is accessible by the hotkey). (24-MAR-2007) I get the following err msg when attempting to use FCKeditor: The requested URL /pub/fckeditor/FCKeditor/editor/fckeditor.html was not found on this server.
Does anyone have a solution for this? QUESTION REGARDING LINKS: (1) I can find no way to keep links as I enter them. If I enter a wiki link (relative or absolute) it always gets turned into an http link. If I use the + nomenclature ( (24-MAR-2007) Links regularly get mixed up, comments are lost, conditionals are lost, special characters are all changed into their named versions, links are messed up (as in confused - not just as with the question above), etc. This is a tool which MAYBE could be used in a GUI-ONLY environment, but don't even think about it if any pages will be edited in PMWiki markup again. Also, links getting re-assigned to something they weren't before is a show-stopper. --- I had to change some paths in edit_fckeditor.php SDVA($PmFCK, array( 'EditFckAction' => 'editfck', 'Width' => '100%', 'Height' => '400', 'BaseImagePath' => 'http://'.$_SERVER[HTTP_HOST], 'BasePath' =>'/pmwiki/pub/fckeditor/FCKEditor/', 'UserFilesPath' => '/pmwiki/uploads/', 'ToolBar'=> 'PmWiki', 'EditorAreaCSS' => '/pmwiki/pub/fckeditor/pm_fckstyles.css', 'StylesXmlPath' => '/pmwiki/pub/fckeditor/pm_fckstyles.xml', 'CustomConfigurationsPath' => '/pmwiki/pub/fckeditor/pm_fckconfig.js', 'TextTranslation' => array(summary => 'Summary:', author => 'Author:', minor => 'This is a minor edit', editfck => "WysIsWyg Edit") )); For example the typo in Basepath oder the absolute paths in EditorAreaCSS and so on.... regards Tobias H. CSS formatingI try to use CSS formating for the buttons like save, save&edit, preview and cancel. Therefore I attached css-links like ( :input e_savebutton class=button_editform:) to Site.EditForm. This works fine for the normal editmode but not for the editmode with FCK. I would be happy if you can give me a hint about that. (eMail: baronvonowski [a] gmail.com) Greetings (9-APR-2008) This works very well for me. Thanks! (26-APR-2008) Help! This doesn't work, even after adding PHP, etc. Does anyone have a sample pmwiki install that is downloadable that has FCKeditor working? I'm at mguhlin at gmail.com. Thanks in advance! (30-APR-2008) I'm still struggling with that Dey reported above (Jan 19 2006) regarding simultaneous edits. Just tested a page with a colleague and my edits overwrote his -- neither of us received that default notice you see when in the regular editor ("The page you are editing has been modified since you started editing it..."). I realize that replicating that exact message in the visual editor environment might be tricky, but is there any other way to note that someone else is editing the page in the visual editor environment? This is pretty make-or-break for the wikis I admin (used with large classes, therefore there's a high likelihood of simultaneous edits!). Thanks a bunch, amanda (etchesa AT mcmaster DOT ca). im having problems uploading images in fckeditor, i can upload and see the image but when i click on save, the image is replace by the link of the image any ideas on this? thanks Dani The links are broken. Anyone can give new links please ? Valinor Hello image solution: for using the upload and image functions you can change the following lines in "edit_fckeditor.php". i have created a var called $wikiImageTag, which replaces the attach directive against the relative path directive. /*wikiImageTag = "Attach:Image Δ.";*/ /* old string value*/ $wikiImageTag = "Path:"; $wikisrc = (substr($listattr['src'],0,7)=='http://') ? $listattr['src']:$wikiImageTag.str_replace($PmFCK['UserFilesPath'],"",$listattr['src']); $wikisrc = (substr($wikisrc,0,strlen($PmFCK['BaseImagePath'].$PmFCK['UserFilesPath']))!=$PmFCK['BaseImagePath'].$PmFCK['UserFilesPath']) ? $wikisrc:$wikiImageTag.str_replace($PmFCK['BaseImagePath'].$PmFCK['UserFilesPath'],"",$wikisrc); the following line allows using the align dropdown list in imageeditor: 'img' => array( 'type' => 'block', 'autorizedparam' => array('width', 'height', 'border', 'vspace', 'hspace', 'align')) bye Florian 29/08/2010 : I have updated the download links. Dranakan 30/08/2010 : Thank you for the updated. I have tried to enable (copy files, update the config.php) but I get "Warning: Cannot modify header information - headers already sent by (output started at D:\Actiwiki\myWiki\cookbook\edit_fckeditor.php:479) in D:\Actiwiki\myWiki\pmwiki.php on line 1079). Do you know where is the problem ? Thanks
User notes? : If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date * (-) Optional negative comment. Name, date These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |