0)
return string.Format(" | ",iIndent*32,Data.ForumRoot);
else
return "";
}
protected string GetIndentSpan()
{
if(!IsThreaded || (int)DataRow["Indent"]==0)
return "2";
else
return "1";
}
protected string GetPostClass()
{
if(this.IsAlt)
return "post_alt";
else
return "post";
}
protected string FormatUserBox()
{
System.Data.DataRowView row = DataRow;
string html = "";
// Avatar
if(ForumPage.BoardSettings.AvatarUpload && row["HasAvatarImage"]!=null && long.Parse(row["HasAvatarImage"].ToString())>0)
{
html += String.Format("
",row["UserID"],Data.ForumRoot);
}
else if(row["Avatar"].ToString().Length>0) // Took out ForumPage.BoardSettings.AvatarRemote
{
//html += String.Format("
",row["Avatar"]);
html += String.Format("
",
Server.UrlEncode(row["Avatar"].ToString()),
ForumPage.BoardSettings.AvatarWidth,
ForumPage.BoardSettings.AvatarHeight,
Data.ForumRoot
);
}
// Rank Image
if(row["RankImage"].ToString().Length>0)
html += String.Format("
",Data.ForumRoot,row["RankImage"]);
// Rank
html += String.Format("{0}: {1}
",ForumPage.GetText("rank"),row["RankName"]);
// Groups
if(ForumPage.BoardSettings.ShowGroups)
{
using(DataTable dt = DB.usergroup_list(row["UserID"]))
{
html += String.Format("{0}: ",ForumPage.GetText("groups"));
bool bFirst = true;
foreach(DataRow grp in dt.Rows)
{
if(bFirst)
{
html += grp["Name"].ToString();
bFirst = false;
}
else
{
html += String.Format(", {0}",grp["Name"]);
}
}
html += "
";
}
}
// Extra row
html += "
";
// Joined
html += String.Format("{0}: {1}
",ForumPage.GetText("joined"),ForumPage.FormatDateShort((DateTime)row["Joined"]));
// Posts
html += String.Format("{0}: {1:N0}
",ForumPage.GetText("posts"),row["Posts"]);
// Location
if(row["Location"].ToString().Length>0)
html += String.Format("{0}: {1}
",ForumPage.GetText("location"),FormatMsg.RepairHtml(ForumPage,row["Location"].ToString(),false));
return html;
}
protected string FormatBody()
{
DataRowView row = DataRow;
string html2 = FormatMsg.FormatMessage(ForumPage,row["Message"].ToString(),new MessageFlags(Convert.ToInt32(row["Flags"])));
// define valid image extensions
string[] aImageExtensions = {"jpg","gif","png"};
if (long.Parse(row["HasAttachments"].ToString()) > 0)
{
string stats = ForumPage.GetText("ATTACHMENTINFO");
string strFileIcon = ForumPage.GetThemeContents("ICONS","ATTACHED_FILE");
html2 += "";
using(DataTable dt = DB.attachment_list(row["MessageID"],null,null))
{
// show file then image attachments...
int tmpDisplaySort = 0;
while (tmpDisplaySort <= 1)
{
bool bFirstItem = true;
foreach(DataRow dr in dt.Rows)
{
string strFilename = Convert.ToString(dr["FileName"]).ToLower();
bool bShowImage = false;
// verify it's not too large to display (might want to make this a board setting)
if (Convert.ToInt32(dr["Bytes"]) <= 262144)
{
// is it an image file?
for (int i=0;i";
html2 += String.Format(ForumPage.GetText("IMAGE_ATTACHMENT_TEXT"),Convert.ToString(row["UserName"]));
html2 += "
";
bFirstItem = false;
}
html2 += String.Format("
",Data.ForumRoot,dr["AttachmentID"],Server.HtmlEncode(Convert.ToString(dr["FileName"])));
}
else if (!bShowImage && tmpDisplaySort == 0)
{
if (bFirstItem)
{
html2 += String.Format("{0}
",ForumPage.GetText("ATTACHMENTS"));
bFirstItem = false;
}
// regular file attachment
int kb = (1023 + (int)dr["Bytes"]) / 1024;
html2 += String.Format("
{3} {4}
",strFileIcon,Data.ForumRoot,dr["AttachmentID"],dr["FileName"],String.Format(stats,kb,dr["Downloads"]));
}
}
// now show images
tmpDisplaySort++;
html2 += "
";
}
}
}
if(row["Signature"] != DBNull.Value && row["Signature"].ToString().ToLower() != "
" && ForumPage.BoardSettings.AllowSignatures)
{
// don't allow any HTML on signatures
MessageFlags tFlags = new MessageFlags();
tFlags.IsHTML = false;
html2 += "
" + FormatMsg.FormatMessage(ForumPage,row["Signature"].ToString(),tFlags);
}
return html2;
}
private void Delete_Click(object sender,EventArgs e)
{
if(!CanDeletePost)
return;
// CHANGED BAI 30.01.2004
//Create objects for easy access
object tmpMessageID = DataRow["MessageID"];
object tmpForumID = DataRow["ForumID"];
object tmpTopicID = DataRow["TopicID"];
// Delete message. If it is the last message of the topic, the topic is also deleted
DB.message_delete(tmpMessageID);
// retrieve topic information.
DataRow topic = DB.topic_info(tmpTopicID);
//If topic has been deleted, redirect to topic list for active forum, else show remaining posts for topic
if (topic == null)
Forum.Redirect(Pages.topics,"f={0}",tmpForumID);
else
Forum.Redirect(Pages.posts,"t={0}",tmpTopicID);
// END CHANGED BAI 30.01.2004
}
private void PopMenu1_ItemClick(object sender, PopEventArgs e)
{
switch(e.Item)
{
case "userprofile":
Forum.Redirect(Pages.profile,"u={0}",DataRow["UserID"]);
break;
case "edituser":
Forum.Redirect(Pages.admin_edituser,"u={0}",DataRow["UserID"]);
break;
}
}
}
}
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="DisplayPost.ascx.cs" Inherits="yaf.controls.DisplayPost" EnableViewState="false" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="yaf" Namespace="yaf.controls" Assembly="yaf" %>
>
|
<%# FormatUserBox() %>
|
<%# FormatBody() %>
|
|