fckeditor for mediawiki1.10-
xtykc 09月 27th, 2009
在上图服务百科上安装好fckeditor好久了,记下备忘之。
FCKeditor一直被认为是一个庞大复杂的重量级可视化编辑器,可以用在各种CMS系统中,功能很强大,但初次安装起来都不会一帆风顺,drupal中的安装已经算是不够傻瓜,在mediawiki中则更为复杂,mediawiki1.10以上的版本可安装集成版的fckeditor for mediwiki,官网上有安装说明,比较简单。我安装的mediawiki是1.9.3的汉化版,安装好这个集成版的fckeditor for mediwiki后,出现了与当前版本不兼容的问题,只能自己手工来做这部分集成工作了,严格按照以下步骤进行,其实也很简单:
1:到fckeditor官网( http://www.fckeditor.net)下载最新版的FckEditor;
2:在MediaWiki根安装目录下新建文件夹FCKeditor,把FckEditor安装包解压到这个新文件夹中,注意FCKeditor文件夹的路径,一定要在mediawiki的根目录下,而不是在extensions目录下,否则在wiki网站的页面上启用了FCKeditor之后,页面上会报“FCKeditor未定义”的错误,这是一般是因为系统找不到FCKeditor安装包的正确路径;
3:在/FCKeditor/fckconfig.js末尾添加:
FCKConfig.ToolbarSets["Wiki"] = [
['Source','-','Save','NewPage','-'],
['Cut','Copy','Paste','PasteText','PasteWord','-','Print'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Table','Rule','Smiley','SpecialChar','PageBreak'],
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['About']
] ;
4:在mediawiki的extensions目录中添加FCKeditor.php文件。进入mediawiki根目录下extensions文件夹,新建文件命名为FCKeditor.php,编辑它,把http://codex.wordpress.org.cn/MediaWiki%E6%89%A9%E5%B1%95%EF%BC%9AFCKeditor#Extension_FCKeditor.php上的代码拷贝到该文件中保存。
5:引用FCKeditor.php,在localsetting.php末尾的?>之前添加:
/* Installing this extension may lead to security and technical problems
* as well as data corruption.
*/
require_once(”extensions/FCKeditor.php”);
$wgFCKUseEditor = false; // When set to ‘true’ the FCKeditor is the default editor.
$wgFCKEditorDir = “FCKeditor”;
$wgFCKEditorToken = “__USE_EDITOR__”;
$wgFCKEditorToolbarSet = “Wiki”;
$wgFCKEditorHeight = “600″;
$wgFCKEditorAllow_a_tags = false; // <a> </a>
$wgFCKEditorAllow_img_tags = false; // <img />
$wgFCKexcludedNamespaces = array(); // eg. “8″ for disabling the editor within the MediaWiki namespace.
注意这一行$wgFCKEditorToken = “__USE_EDITOR__”;中的__USE_EDITOR__是在wiki页面中启用fckeditor的标识,可以修改,比如我就修改成了“–USEFCKEDITOR–”在上图服务百科上,新建一个页面,在页面开始处加上“–USEFCKEDITOR–”,就可以看到我们熟悉的FCKeditor那豪华的可视化编辑界面。
问题:对于mediawiki来说,如果在已有的页面上启用FCKeditor会有一定的风险,破坏原有的页面结构,因此最好在空白的新建页面上启用。
参考:http://hi.baidu.com/xletian/blog/item/ce618e0245c3b6094afb5167.html/cmtid/4bb56760b18a4a4feaf8f833