前面写过Freetextbox1.63的基本使用,
现在基于boss的特殊要求,上传附件.相关附件主要为doc,或者war格式.
首先,找到freetextbox源码,在ToolbarItems类里面添加静态属性如下:
///
第二步,在ToolbarGenerator 类里面,添加相关上传控件的识别代码public static string DefaultConfigString = "Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|FontFacesMenu,FontSizesMenu,FontForeColorsMenu|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImageFromGallery,InsertFileFromGallery,InsertTable,InsertRule|Cut,Copy,Paste;Undo,Redo,Print,ieSpellCheck"; public static string AlternateConfigString = "Save,Print,Undo,Redo,WordClean,InsertTable|ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorPicker,FontBackColorPicker,SymbolsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImageFromGallery,InsertFileFromGallery,InsertRule|Cut,Copy,Paste,ieSpellCheck"; public static string EnableAllConfigString = "ParagraphMenu,FontFacesMenu,FontSizesMenu|FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker|Bold,Italic,Underline,Strikethrough,Superscript,Subscript;InsertImageFromGallery,InsertFileFromGallery,CreateLink,Unlink,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent|Cut,Copy,Paste,Delete;Undo,Redo,Print,Save|StyleMenu,SymbolsMenu,InsertHtmlMenu|InsertRule,InsertDate,InsertTime,WordCount,ieSpellCheck,WordClean,InsertTable";
为方法,添加识别
public static ToolbarItem ToolbarItemFromString(string StringName) { switch (StringName.ToLower()) { case "insertfilefromgallery": return ToolbarItems.InsertFileFromGallery; }}
第三步.在FreeTextBox类里,
更改方法ProcessToolbarButton(ToolbarButton myButton) public virtual void ProcessToolbarButton(ToolbarButton myButton) { myButton.Function = myButton.Function.Replace("CLIENTID",this.ID); myButton.ScriptBlock = myButton.ScriptBlock.Replace("CLIENTID",this.ID); myButton.ScriptBlock = Regex.Replace(myButton.ScriptBlock,"
添加属性
///
第四步.. 貌似忘了点啥.想不起来了. ....
第五步. 使用的项目前台增加ftb.filegallery.aspx文件, 用来上传与选取附件.
页面主要代码与ftb.imagegallery.aspx 基本一致,在显示方式有所不同,
比如获取不同类型文件,显示该文件类型的gif.
保存方式与image 一直,在前台生成files文件夹, 根据登陆人id创建个人专属文件夹.
这里具体要操作的相当琐碎, 就不赘述了.
至此,完成boss要求...
总结:对freetextbox的核心更加的了解,受益良多...
在研究源码的时候比较费时,而且第五步相当繁琐,需要认真细心.
时间估算有误,下次应该更客观的分析问题与需求.
PS:I hate vs2003... 至少因为它浪费了2个多小时....