源码网,源码论坛,源码之家,商业源码,游戏源码下载,discuz插件,棋牌源码下载,精品源码论坛

 找回密码
 立即注册
查看: 653|回复: 19

[网页编辑器] FCKEditor 自定义用户目录的修改步骤 (附源码)

[复制链接]

7万

主题

861

回帖

32万

积分

论坛元老

Rank: 8Rank: 8

积分
329525
发表于 2010-3-30 12:44:54 | 显示全部楼层 |阅读模式
FCKEditor 自定义用户目录的修改步骤 (附源码) ,需要的朋友可以参考下。
        
        
            由于我这边的网络原因,没用从FCK的官网下载到源码...
这套源码是FCK2.2版反编译出来的
源码:点此下载 源码中主要修改的地方做了注释
大致的修改如下 :
获取用户目录的源码: FileWorkerBase.cs
这里主要是做了一些注释
在程序中可以直接在用户登录的时候指定
这个方案只是方便多用户使用的时候为用户指定不同的文件目录
Session["FCKeditor:UserFilesPath"]="用户文件相对目录";
[U]复制代码[/U] 代码如下:
///  
/// 用户文件目录
///  
protected string UserFilesPath
{
get
{
if (this.sUserFilesPath == null)
{
//从APPlictaion 读取
this.sUserFilesPath = (string)base.Application["FCKeditor:UserFilesPath"];
if ((this.sUserFilesPath == null) || (this.sUserFilesPath.Length == 0))
{
//从Session读取
this.sUserFilesPath = (string)this.Session["FCKeditor:UserFilesPath"];
if ((this.sUserFilesPath == null) || (this.sUserFilesPath.Length == 0))
{
//从站点配置文件读取
this.sUserFilesPath = ConfigurationSettings.AppSettings["FCKeditor:UserFilesPath"];
if ((this.sUserFilesPath == null) || (this.sUserFilesPath.Length == 0))
{
this.sUserFilesPath = "/UpLoadFiles/";
}
if ((this.sUserFilesPath == null) || (this.sUserFilesPath.Length == 0))
{
//从URL读取
this.sUserFilesPath = base.Request.QueryString["ServerPath"];
}
}
}
if (!this.sUserFilesPath.EndsWith("/"))
{
this.sUserFilesPath = this.sUserFilesPath + "/";
}
}
return this.sUserFilesPath;
}
}

这样指定了之后会发现 FCK需要有Image,Files等文件夹
修改这个文件:Uploader .cs (下载地址)
修改过的上传文件操作类在这里:(如果你要修改原版的不必去把这个类文件搞到你的Web程序目录中来,我这里只是为了方便使用我项目中的APP_Code中的方法,下同不再赘述!)
Fckeditor\editor\filemanager\upload\aspx\upload.aspx.cs
修改的时候忘了做记录..这里貌似没改什么内容 只是做了点注释
呃找到了在这里 FileBrowserConnector
Fckeditor\editor\filemanager\browser\default\connectors\aspx\connector.aspx.cs(修改后的地址)
[U]复制代码[/U] 代码如下:
///  
/// 根据文件类型选择文件夹
///  
///  
///  
///  
private string ServerMapFolder(string resourceType, string folderPath)
{
//2010-3-29 14:00:56
//string path = Path.Combine(base.UserFilesDirectory, resourceType);
string path = base.UserFilesDirectory;
Util.CreateDirectory(path);
return Path.Combine(path, folderPath.TrimStart(new char[] { '/' }));
}

这里直接把那个resourceType给排除掉了(去掉判断文件类型)
这个方法将影响选定图片后的图片路径
[U]复制代码[/U] 代码如下:
private string GetUrlFromPath(string resourceType, string folderPath)
{
if ((resourceType == null) || (resourceType.Length == 0))
{
return (base.UserFilesPath.TrimEnd(new char[] { '/' }) + folderPath);
}
//2010-3-29 14:00:20 HYZ
//return (base.UserFilesPath + resourceType + folderPath);
string p=base.UserFilesPath + folderPath;//新增
p=p.Replace("//","/");//新增
return (p);//新增
}

然后在其他的HTML文件中也修改有部分代码
1.翻译了提示信息
这东西就不说了..很简单你也可以根据提示信息全文搜索...
2.修改选定图片后的示例文本为中文
文件位于: 第52行
Fckeditor\editor\dialog\fck_image\fck_image_preview.html
3.修改文件浏览器增加了文件预览 (效果很粗糙)
高手们修改好看了还望能给小弟发一份儿..
文件位于:
Fckeditor\editor\filemanager\browser\default\frmresourceslist.html
我这里修改了第63行的js 显示预览效果
当然还有自定义表情之类的玩意儿..
但因为目前项目需要的就这么点儿东西.所以也懒得去搞了...
源码:点此下载
转载请注明出处:http://Qbit.cnblogs.com
回复

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2022-8-28 07:05:07 | 显示全部楼层
66666666666
回复 支持 反对

使用道具 举报

2

主题

1万

回帖

473

积分

中级会员

Rank: 3Rank: 3

积分
473
发表于 2022-12-15 01:24:40 | 显示全部楼层
hi哦回复iOS就看见
回复 支持 反对

使用道具 举报

5

主题

1万

回帖

183

积分

注册会员

Rank: 2

积分
183
发表于 2022-12-23 13:18:55 | 显示全部楼层
66666666666
回复 支持 反对

使用道具 举报

1

主题

1万

回帖

176

积分

注册会员

Rank: 2

积分
176
发表于 2023-4-30 11:04:17 | 显示全部楼层
非常vbcbvcvbvcb
回复 支持 反对

使用道具 举报

2

主题

1万

回帖

99

积分

注册会员

Rank: 2

积分
99
发表于 2023-5-19 23:10:08 | 显示全部楼层
hi哦回复iOS就看见
回复 支持 反对

使用道具 举报

1

主题

1万

回帖

307

积分

中级会员

Rank: 3Rank: 3

积分
307
发表于 2023-9-12 11:39:20 | 显示全部楼层
儿飞飞微风DVD谁vdsvd
回复 支持 反对

使用道具 举报

14

主题

1万

回帖

75

积分

注册会员

Rank: 2

积分
75
发表于 2023-9-17 21:01:26 | 显示全部楼层
抽根烟,下来看看再说
回复 支持 反对

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2023-9-24 10:47:13 | 显示全部楼层
好人好人好人好人
回复 支持 反对

使用道具 举报

4

主题

1万

回帖

107

积分

注册会员

Rank: 2

积分
107
发表于 2023-9-28 17:55:58 | 显示全部楼层
来看看怎么样
回复 支持 反对

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

手机版|小黑屋|网站地图|源码论坛 ( 海外版 )

GMT+8, 2024-9-20 19:54 , Processed in 0.129438 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表