ASP.NET Forums 2.0 本地化修改(三)
今天这一部分比较简单,主要是一些细节的修改,过几天会推出一个新的模块,用户上传附件的管理:
下面先来说说今天要说的内容:
1、附件部分:如果附件为Flash,那么直接显示:
修改AspNetForums.Controls.PostDisplay.TextPost:
增加一方法:
private string ShowFlash(string FlashFileUrl)
{
string temp = "<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0">"
+ "<param name="movie" value="" + FlashFileUrl + "">"
+ "<param name="quality" value="high">"
+ "<embed src="" + FlashFileUrl + "" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>"
+ "</object>";
return temp;
}
private string ShowFlash(string FlashFileUrl, int Width)
{
string temp = "<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="" + Width.ToString() + "">"
+ "<param name="movie" value="" + FlashFileUrl + "">"
+ "<param name="quality" value="high">"
+ "<embed src="" + FlashFileUrl + "" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="" + Width.ToString() + ""></embed>"
+ "</object>";
return temp;
}
private string ShowFlash(string FlashFileUrl, int Width, int Height)
{
string temp = "<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="" + Width.ToString() + "" height="" + Height.ToString() + "">"
+ "<param name="movie" value="" + FlashFileUrl + "">"
+ "<param name="quality" value="high">"
+ "<embed src="" + FlashFileUrl + "" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="" + Width.ToString() + "" height="" + Height.ToString() + ""></embed>"
+ "</object>";
return temp;
}
{
string temp = "<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0">"
+ "<param name="movie" value="" + FlashFileUrl + "">"
+ "<param name="quality" value="high">"
+ "<embed src="" + FlashFileUrl + "" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>"
+ "</object>";
return temp;
}
private string ShowFlash(string FlashFileUrl, int Width)
{
string temp = "<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="" + Width.ToString() + "">"
+ "<param name="movie" value="" + FlashFileUrl + "">"
+ "<param name="quality" value="high">"
+ "<embed src="" + FlashFileUrl + "" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="" + Width.ToString() + ""></embed>"
+ "</object>";
return temp;
}
private string ShowFlash(string FlashFileUrl, int Width, int Height)
{
string temp = "<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="" + Width.ToString() + "" height="" + Height.ToString() + "">"
+ "<param name="movie" value="" + FlashFileUrl + "">"
+ "<param name="quality" value="high">"
+ "<embed src="" + FlashFileUrl + "" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="" + Width.ToString() + "" height="" + Height.ToString() + ""></embed>"
+ "</object>";
return temp;
}
在原来的第二篇文章的修改的基础上,在判断是否为图片后,增加如下判断:
//判断是否为Flash,如果为Flash,那么直接显示
//added by jacky 2004-9-4
if (contentType == "application/x-shockwave-flash")
{
body.Text += Globals.HtmlNewLine + ShowFlash(Globals.GetSiteUrls().PostAttachment(post.PostID) + "&guid=" + attachment.CheckGuid,600,450);
}
//added by jacky 2004-9-4
if (contentType == "application/x-shockwave-flash")
{
body.Text += Globals.HtmlNewLine + ShowFlash(Globals.GetSiteUrls().PostAttachment(post.PostID) + "&guid=" + attachment.CheckGuid,600,450);
}
补充:别忘了在后台设置中增加swf文件的上传设置;
注意代码可能会缺少\,代码着色的时候被自动过滤掉了