FCKEditor 自定義用戶目錄的修改步驟 (附源碼)
由于我這邊的網(wǎng)絡(luò)原因,沒用從FCK的官網(wǎng)下載到源碼...
這套源碼是FCK2.2版反編譯出來的
源碼:點此下載 源碼中主要修改的地方做了注釋
大致的修改如下 :
獲取用戶目錄的源碼: FileWorkerBase.cs
這里主要是做了一些注釋
在程序中可以直接在用戶登錄的時候指定
這個方案只是方便多用戶使用的時候為用戶指定不同的文件目錄
Session["FCKeditor:UserFilesPath"]="用戶文件相對目錄";
/// <summary>
/// 用戶文件目錄
/// </summary>
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;
}
}
這樣指定了之后會發(fā)現(xiàn) FCK需要有Image,Files等文件夾
修改這個文件:Uploader .cs (下載地址)
修改過的上傳文件操作類在這里:(如果你要修改原版的不必去把這個類文件搞到你的Web程序目錄中來,我這里只是為了方便使用我項目中的APP_Code中的方法,下同不再贅述!)
Fckeditor\editor\filemanager\upload\aspx\upload.aspx.cs
修改的時候忘了做記錄..這里貌似沒改什么內(nèi)容 只是做了點注釋
呃找到了在這里 FileBrowserConnector
Fckeditor\editor\filemanager\browser\default\connectors\aspx\connector.aspx.cs(修改后的地址)
/// <summary>
/// 根據(jù)文件類型選擇文件夾
/// </summary>
/// <param name="resourceType"></param>
/// <param name="folderPath"></param>
/// <returns></returns>
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給排除掉了(去掉判斷文件類型)
這個方法將影響選定圖片后的圖片路徑
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("http://","/");//新增
return (p);//新增
}
然后在其他的HTML文件中也修改有部分代碼
1.翻譯了提示信息
這東西就不說了..很簡單你也可以根據(jù)提示信息全文搜索...
2.修改選定圖片后的示例文本為中文
文件位于: 第52行
Fckeditor\editor\dialog\fck_image\fck_image_preview.html
3.修改文件瀏覽器增加了文件預(yù)覽 (效果很粗糙)
高手們修改好看了還望能給小弟發(fā)一份兒..
文件位于:
Fckeditor\editor\filemanager\browser\default\frmresourceslist.html
我這里修改了第63行的js 顯示預(yù)覽效果
當(dāng)然還有自定義表情之類的玩意兒..
但因為目前項目需要的就這么點兒東西.所以也懶得去搞了...
源碼:點此下載
轉(zhuǎn)載請注明出處:http://Qbit.cnblogs.com
相關(guān)文章
fckeditor在ie9中無法彈出對話框的解決方法(彈出層兼容問題)
升級到 IE 9后,fckeditor在IE 9里的彈出浮動層會出現(xiàn)bug,里面的內(nèi)容不會出現(xiàn)2012-04-04ie9后瀏覽器fckeditor無法上傳圖片、彈出浮層內(nèi)容不顯示的解決方法
升級到IE9后,fckeditor在IE9里的彈出浮動層會出現(xiàn)bug,里面的內(nèi)容不會出現(xiàn)。原因是IE9不支持var $=document.getElementById;這樣的寫法了2014-01-01FCKeditor .NET的配置、擴(kuò)展與安全性經(jīng)驗交流
FCKeditor是使用非常廣泛的HTML編輯器,本文從 ASP.NET 的使用場景對 FCKeditor 與 FCKeditor.NET 的配置、功能擴(kuò)展(如自定義文件上傳子目錄、自定義文件名、上傳圖片的后期處理等)、以及安全性進(jìn)行初步的闡述。2011-08-08KindEditor 4.x 在線編輯器常用方法小結(jié)
要修改默認(rèn)后臺程序處理文件,修改plugins(插件文件夾)下的JavaScript內(nèi)容fileManagerJson改為自己使用程序語言2011-11-11