国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

網頁編輯器FCKEditor自定義用戶目錄的修改步驟 (附源碼)

2024-07-21 02:53:44
字體:
來源:轉載
供稿:網友
FCKEditor 自定義用戶目錄的修改步驟 (附源碼) ,需要的朋友可以參考下。
 

由于我這邊的網絡原因,沒用從FCK的官網下載到源碼... 
這套源碼是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; 


這樣指定了之后會發現 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(修改后的地址) 
復制代碼代碼如下:

/// <summary> 
/// 根據文件類型選擇文件夾 
/// </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("//","/");//新增 
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


注:相關教程知識閱讀請移步到編輯器頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新和县| 冷水江市| 普洱| 湖口县| 泽州县| 安阳县| 页游| 平南县| 论坛| 莆田市| 新邵县| 金山区| 重庆市| 清流县| 册亨县| 搜索| 民乐县| 托克逊县| 大安市| 正定县| 那曲县| 莱阳市| 鹿泉市| 浦东新区| 开封市| 仁怀市| 二连浩特市| 嘉祥县| 南丰县| 镇原县| 平泉县| 怀来县| 东丽区| 长岭县| 普安县| 无极县| 砀山县| 平南县| 昭苏县| 鄂托克前旗| 石楼县|