升级到FreeTextBox 3.0

1、修改web.config ,增加下面的,

None.gif < add verb = " GET "  path = " FtbWebResource.axd "  type = " FreeTextBoxControls.AssemblyResourceHandler, FreeTextBox "   />

要加在

None.gif <!--  Can not see to load asmx like .aspx, since we will grap all requests later, make sure these are processed by their  default  factory  -->
None.gif            
< add verb = " * "  path = " *.asmx "  type = " System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a "
None.gif                validate
= " false "   />

的上面。

2、移除admin和dottextweb引用中的freetextbox。
3、下载freetextbox,并覆盖freetextbox目录。
4、在DottextWeb\Emoticons目录建立一个msn目录,把msn表情放到此目录下面。
5、把FreeTextBox.dll拷贝到bin目录下。在admin和dottextweb添加freetextbox引用。
修改EntryEditor.ascx.cs和LoginPostComment.ascx.cs文件。
在namespace Dottext.Web.Admin.UserControls添加两行:
 using FreeTextBoxControls;
 using System.Text;
并用下面的代码替换SetFreeTextBox部分。

ContractedBlock.gif ExpandedBlockStart.gif SetFreeTextBox #region SetFreeTextBox
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif  
插入QQ/MSN表情#region 插入QQ/MSN表情
InBlock.gif
InBlock.gif  
protected FreeTextBoxControls.ToolbarButton FTB_InsertFlash()
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   FreeTextBoxControls.ToolbarButton FTB_InsertFlashButton 
= new FreeTextBoxControls.ToolbarButton("插入Flash","FTB_InsertFlash","flash");
InBlock.gif   
return FTB_InsertFlashButton;
ExpandedSubBlockEnd.gif  }

InBlock.gif
InBlock.gif  
protected FreeTextBoxControls.ToolbarButton CreateQQEmoticon()
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   FreeTextBoxControls.ToolbarButton qqButton 
= new FreeTextBoxControls.ToolbarButton("插入QQ表情","FTB_InsertQQEmoticon","qq");
InBlock.gif   
return qqButton;
ExpandedSubBlockEnd.gif  }

InBlock.gif
InBlock.gif  
protected FreeTextBoxControls.ToolbarButton CreateMSNEmoticon()
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   FreeTextBoxControls.ToolbarButton msnButton 
= new FreeTextBoxControls.ToolbarButton("插入MSN表情","FTB_InsertMSNEmoticon","msn");
InBlock.gif   
return msnButton;
ExpandedSubBlockEnd.gif  }

InBlock.gif
InBlock.gif
InBlock.gif  
protected void CreateEmoticon()
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   FreeTextBoxControls.Toolbar tb
=new FreeTextBoxControls.Toolbar();
InBlock.gif   tb.Items.Add(CreateMSNEmoticon());
InBlock.gif   tb.Items.Add(CreateQQEmoticon());
InBlock.gif   tb.Items.Add(FTB_InsertFlash());
InBlock.gif
//   ftbBody.Toolbars.Add(tb); 
ExpandedSubBlockEnd.gif
  }

InBlock.gif 
ExpandedSubBlockEnd.gif  
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif  
插入msn表情#region 插入msn表情
InBlock.gif  
protected void CreateMSNEmoticonOld()
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   
InBlock.gif   FreeTextBoxControls.ToolbarButton tbButton;
InBlock.gif   
string imageName;
InBlock.gif   FreeTextBoxControls.Toolbar msntb
=new FreeTextBoxControls.Toolbar();
InBlock.gif   XmlDocument myxml
=new XmlDocument();
InBlock.gif   myxml.Load(Server.MapPath(
"~/Emoticons/")+"emoticons.xml");
InBlock.gif   XmlNodeList nodes
=myxml.SelectNodes("/emoticons/emoticon");
InBlock.gif   
foreach(XmlNode node in nodes)
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    tbButton
=new FreeTextBoxControls.ToolbarButton();
InBlock.gif    tbButton.Title
=node.Attributes["title"].InnerText;
InBlock.gif    tbButton.ButtonImage
="Emoticons/"+node.Attributes["name"].InnerText;
InBlock.gif    imageName 
= Globals.WebPathCombine(Request.ApplicationPath,"/Emoticons/")+node.Attributes["name"].InnerText+".gif";
InBlock.gif    tbButton.FunctionName
="FTB_InsertMSNEmoticon_"+node.Attributes["name"].InnerText;
InBlock.gif    tbButton.ScriptBlock 
= @"<script language=""JavaScript"">
ExpandedSubBlockStart.gifContractedSubBlock.gif
      function "+tbButton.FunctionName+@"(ftbName) dot.gif{
InBlock.gif      editor
=eval(ftbName + '_Editor');
InBlock.gif      
ExpandedSubBlockEnd.gif      }

InBlock.gif      
</script>";
InBlock.gif
    msntb.Items.Add(tbButton);
ExpandedSubBlockEnd.gif   }

InBlock.gif   ftbBody.Toolbars.Add(msntb);
ExpandedSubBlockEnd.gif  }

ExpandedSubBlockEnd.gif  
#endregion

InBlock.gif
InBlock.gif  
public void SetFreeTextBox()
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{
InBlock.gif   
string app=Request.ApplicationPath;
InBlock.gif   
if(!app.EndsWith("/"))
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    app
+="/";
ExpandedSubBlockEnd.gif   }

InBlock.gif   FreeTextBoxControls.Toolbar tb
=new FreeTextBoxControls.Toolbar();
InBlock.gif   ftbBody.SupportFolder 
= app+"FreeTextBox/";
InBlock.gif   ftbBody.ImageGalleryPath
="~/Images/";
InBlock.gif  
InBlock.gif   
string rif = "";
InBlock.gif   
string cif = ""
InBlock.gif   rif 
= System.Text.RegularExpressions.Regex.Replace(Dottext.Framework.Configuration.Config.CurrentBlog(Context).ImagePath,Dottext.Framework.Configuration.Config.Settings.AggregateUrl,string.Empty,System.Text.RegularExpressions.RegexOptions.IgnoreCase);
InBlock.gif   rif
="~/"+rif;
InBlock.gif   rif 
= rif.Replace("//","/");
InBlock.gif   
if(rif.EndsWith("/"))
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    rif 
= rif.Substring(0,rif.Length-1);
ExpandedSubBlockEnd.gif   }

InBlock.gif   cif 
= rif;
InBlock.gif   
if (cif != "" && rif != ""
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif    ftbBody.ImageGalleryPath
=rif;
InBlock.gif
//    RootImagesFolder.Value = rif;
InBlock.gif
//    CurrentImagesFolder.Value = cif;
ExpandedSubBlockEnd.gif
   }
 
InBlock.gif   
else 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif{
InBlock.gif
//    RootImagesFolder.Value = DefaultImageFolder;
InBlock.gif
//    CurrentImagesFolder.Value = DefaultImageFolder; 
ExpandedSubBlockEnd.gif
   }

InBlock.gif   FreeTextBoxControls.Toolbar myToolbar 
= new Toolbar();
InBlock.gif
InBlock.gif   FreeTextBoxControls.ToolbarButton myButton 
= new ToolbarButton("插入代码""code""Code");
InBlock.gif
InBlock.gif   StringBuilder scriptBlock 
= new StringBuilder();
InBlock.gif   scriptBlock.AppendFormat(
"var codescript = '{0}';", ftbBody.SupportFolder + "ftb.insertcode.aspx");
InBlock.gif   scriptBlock.Append(
"code = showModalDialog(codescript,window,'dialogWidth:500px; dialogHeight:400px;help:0;status:0;resizeable:1;');");
InBlock.gif   scriptBlock.Append(
"if (code  != null) {");
InBlock.gif   scriptBlock.Append(
" this.ftb.InsertHtml(code);");
InBlock.gif   scriptBlock.Append(
"}");
InBlock.gif
InBlock.gif   myButton.ScriptBlock 
= scriptBlock.ToString();
InBlock.gif
InBlock.gif  
InBlock.gif
InBlock.gif
InBlock.gif   FreeTextBoxControls.ToolbarButton qqButton 
= new ToolbarButton("插入QQ表情""qq""qq");
InBlock.gif   StringBuilder qqscriptBlock 
= new StringBuilder();
InBlock.gif   qqscriptBlock.Append(
"var folder = 'Emoticons/qq';");
InBlock.gif   qqscriptBlock.AppendFormat(
"var galleryscript ='../../EmoticonsGallery.aspx?rif='+folder+'&cif='+folder;");
InBlock.gif   qqscriptBlock.Append(
"imgArr = showModalDialog(galleryscript,window,'dialogWidth:200px; dialogHeight:200px;help:0;status:0;resizeable:1;');");
InBlock.gif   qqscriptBlock.Append(
"if (imgArr != null&&typeof(imgArr)=='object')  {");
InBlock.gif   qqscriptBlock.Append(
" this.ftb.InsertHtml('<img src='+imgArr['filename']+' BORDER=0>');");
InBlock.gif   qqscriptBlock.Append(
"}");
InBlock.gif
InBlock.gif   qqButton.ScriptBlock 
= qqscriptBlock.ToString();
InBlock.gif
InBlock.gif
InBlock.gif   FreeTextBoxControls.ToolbarButton msnButton 
= new ToolbarButton("插入msn表情""msn""msn");
InBlock.gif   StringBuilder msnscriptBlock 
= new StringBuilder();
InBlock.gif   msnscriptBlock.Append(
"var folder = 'Emoticons/msn';");
InBlock.gif   msnscriptBlock.AppendFormat(
"var galleryscript ='../../EmoticonsGallery.aspx?rif='+folder+'&cif='+folder;");
InBlock.gif   msnscriptBlock.Append(
"imgArr = showModalDialog(galleryscript,window,'dialogWidth:200px; dialogHeight:200px;help:0;status:0;resizeable:1;');");
InBlock.gif   msnscriptBlock.Append(
"if (imgArr != null&&typeof(imgArr)=='object')  {");
InBlock.gif   msnscriptBlock.Append(
" this.ftb.InsertHtml('<img src='+imgArr['filename']+' BORDER=0>');");
InBlock.gif   msnscriptBlock.Append(
"}");
InBlock.gif
InBlock.gif   msnButton.ScriptBlock 
= msnscriptBlock.ToString();
InBlock.gif
InBlock.gif   myToolbar.Items.Add(qqButton);
InBlock.gif   myToolbar.Items.Add(msnButton);
InBlock.gif   myToolbar.Items.Add(myButton);
InBlock.gif   ftbBody.Toolbars.Add(myToolbar);
InBlock.gif
InBlock.gif
//   string code = @"
InBlock.gif
//   returnstr=showModalDialog( '../../InsertCode.aspx',window,'dialogWidth:500px; dialogHeight:400px;help:0;status:0;resizeable:1;');
InBlock.gif
//   if(returnstr!=null&&returnstr!='')
InBlock.gif
//   { 
InBlock.gif
//   FTB_InsertText('"+ftbBody.ClientID+"',returnstr)}";
InBlock.gif
//   FreeTextBoxControls.ToolbarButton CodeButton = new FreeTextBoxControls.ToolbarButton("插入代码",code,"Code");
InBlock.gif
//   CodeButton.ButtonImage="Code";
InBlock.gif
//   tb.Items.Add(CodeButton);
InBlock.gif
//   FreeTextBoxControls.ToolbarButton RestoreButton = new FreeTextBoxControls.ToolbarButton("恢复上次提交","Restore","Restore");
InBlock.gif
//   tb.Items.Add(RestoreButton);
InBlock.gif
//   CreateEmoticon();
InBlock.gif
//   ftbBody.Toolbars.Add(tb);
ExpandedSubBlockEnd.gif
  }

InBlock.gif  
InBlock.gif
ExpandedBlockEnd.gif  
#endregion

None.gif
None.gif


6、修改EntryEditor.ascx
<ftb:FreeTextBox....>部分。

None.gif < ftb:FreeTextBox language = " zh-cn "  id = " ftbComment "  runat = " server "  Visible = " true "  ToolbarStyleConfiguration = " Office2003 "
None.gif     Height
= " 400 "  Width = " 98% "  ToolbarLayout = " ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,Cut,Copy,Paste,Undo,Redo,Print;Bold,Italic,Underline,fontforecolorpicker,fontbackcolorpicker,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,insertdate,inserttime,WordClean,preview,InsertRule " ></ ftb:FreeTextBox >



7、替换LoginPostComment.ascx里面:

None.gif < ftb:FreeTextBox language = " zh-cn "  id = " ftbComment "  runat = " server "  Visible = " true "  ToolbarStyleConfiguration = " Office2003 "
None.gif     Height
= " 400 "  Width = " 98% "  ToolbarLayout = " ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,Cut,Copy,Paste,Undo,Redo,Print;Bold,Italic,Underline,fontforecolorpicker,fontbackcolorpicker,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,insertdate,inserttime,WordClean,preview,InsertRule " ></ ftb:FreeTextBox >


8、替换admin目录下ftb.imagegallery.aspx里面的

None.gif < iframe style = " width:100%;height:100%;border:0; "  border = 0  frameborder = 0  src = " ftb.imagegallery.aspx?frame=1&<%=Request.QueryString%> " ></ iframe >



  

None.gif   < form id = " Form1 "  runat = " server "  enctype = " multipart/form-data " >
None.gif   
< FTB:ImageGallery id = " ImageGallery1 "  AllowImageUpload = true  AllowImageDelete = true  AllowDirectoryCreate = true  AllowDirectoryDelete = true  runat = " Server "   />
None.gif  
</ form >
None.gif

并在最上部添加:
None.gif <% @ Register TagPrefix = " FTB "  Namespace = " FreeTextBoxControls "  Assembly = " FreeTextBox "   %>

编译之后,如果没有意外即可升级到FreeTextBox 3.0。

转载于:https://www.cnblogs.com/zihui69/archive/2005/02/16/104893.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值