FCKEditor2.6 for ASP 程序配置

FCKEditor下载地址 http://www.fckeditor.net/download

一、程序瘦身:
下载下来的FCKEditor2.6中,针对我们使用的编程语言很多文件我们不需要
根目录下:editor目录;fckconfig.js;fckeditor.asp;fckeditor.js;fckstyles.xml;fcktemplates.xml这几个保留,其余的全部去除
子目录下:editor/filemanager/connectors目录中把asp目录留下(上传用什么方法就留下什么),其余的方法目录[php、aspx等目录]删除(注意留下test.html 和 uploadtest.html)
editorlang语言目录把en.js;zh.js;zh-cn.js留下,其余全部删除

二、程序配置:
1、默认语言:
打开fckconfig.js文件(相对FCKeditor文件夹,以下同),把自动检测语言改为不检测,把默认语言改为简体中文:
FCKConfig.AutoDetectLanguage = false;
FCKConfig.DefaultLanguage = 'zh-cn';
FCKConfig.TabSpaces = 1;  //在编辑器中是否可以是否TAB键 0 不可用 1 为可用

2、字体列表:
打开fckconfig.js文件,在字体列表中添加常用的“宋体;黑体;隶书;楷体_GB2312”
FCKConfig.FontNames = '宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana';
编辑器域内默认的显示字体为12px,想要修改可以通过修改样式表来达到要求,打开/editor/css/fck_editorarea.css,把body, td下的font-size:14px即可

3、文件上传:
FCKeditor的文件管理程序在filemanager文件夹中,又分为浏览(browser)和上传(upload)两种。浏览是指浏览服务器文件 并可以选择,也可以上传本地文件至服务器;上传是指快速上传(QuickUpload),在窗口中点“上传”选项卡打开就是,跟我们使用的UBB编辑器有 点相似,选择本地文件后上传就行。
也就是说FCKeditor中有一个文件浏览,有两个文件上传,而这些设置有些在一个文件中,有的则在多个文件中。比较复杂,改动比较多,我们再分几个小点儿来说。

①打开和关闭文件浏览和上传功能:

fckconfig.js,以下内容设为true为开,false则为关。
文件浏览和浏览中上传功能:
FCKConfig.LinkBrowser = false;
FCKConfig.ImageBrowser = false;
FCKConfig.FlashBrowser = false;
文件快速上传功能:
FCKConfig.LinkUpload = true;
FCKConfig.ImageUpload = true;
FCKConfig.FlashUpload = true;

editor/filemanager/connectors/asp/config.asp
ConfigIsEnabled = False  //表示文件浏览关闭
ConfigIsEnabled = True  //表示文件快速上传打开

②文件上传:
editorfilemanagerconnectorsaspconfig.asp
ConfigUserFilesPath = "/userfiles/"  //上传的路径设置
我的文件上传目录在根目录下面,就照以上设置。如果在本地测试这个网站在虚拟目录test中,则应该设置为:ConfigUserFilesPath = "/test/userfiles/"

③把默认语言php改成asp
fckconfig.js
var _FileBrowserLanguage = 'asp';  // asp | aspx | cfm | lasso | perl | php | py需要什么改成什么
var _QuickUploadLanguage = 'asp';  // asp | aspx | cfm | lasso | perl | php | py

④可以自己加上重定义文件名的程序

4、表单调用:
asp调用方法:
<!--#include file="FCKEditor/fckeditor.asp" -->
<%
Dim oFCKeditor '定义变量
Set oFCKeditor = New FCKeditor '类的初始化
oFCKeditor.BasePath="FCKeditor/" '定义路径(这是根路径:/FCKeditor/)
oFCKeditor.ToolbarSet="Default" '定义工具条(默认为:Default;Default为完整、Basic为精简)
oFCKeditor.Width="100%" '定义高度(默认高度:200)
oFCKeditor.Height=350 '输入框的初始值
oFCKeditor.Value="" '输入框初始值
oFCKeditor.Create "FCKeditor1"
%>

js调用方法:
<script src="FCKeditor/FCKeditor.js"></script>
<script type="text/javascript">
var oFCKeditor = new FCKeditor('Content');
oFCKeditor.BasePath = 'FCKeditor/';
oFCKeditor.ToolbarSet = 'Basic';
oFCKeditor.Width = '100%';
oFCKeditor.Height = '350';
oFCKeditor.Value = '';
oFCKeditor.Create();
</script>

5、输入框值获取
Request.Form("FCKeditor1")

Fckeditor解决上传中文名称图片出现乱码问

1、修改editor\filemanager\connectors\asp 目录 中的 commands.asp

找到
sFileName = SanitizeFileName( sFileName )
修改为:
sFileName = etNewFileName&"."&sExtension

2、修改editor\filemanager\connectors\asp 目录 中的Io.asp

添加一个重命名函数
Function GetNewFileName()
dim ranNum
dim dtNow
dtNow=Now()
ranNum=int(90000*rnd)+10000
GetNewFileName=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum
End Function

posted @ 2010-03-13 09:55  河塘月色  阅读(264)  评论(0编辑  收藏  举报