public static string HotImagesArray(ForumHotItemInfo fi) { //string format = "<li><a href=\"{0}\" target=\"_blank\"><img src=\"{1}\" alt=\"{2}\"/></a></li>"; //string format2 = "<a href=\"#\" rel=\"{0}\">{0}</a>"; var sb = new StringBuilder(); var sb2 = new StringBuilder(); var thum = (BaseConfigs.GetForumPath + "cache/rotatethumbnail/").EnsureDirectory(); //string fidlist = string.IsNullOrEmpty(fi.Forumlist) ? Forums.GetVisibleForum() : fi.Forumlist; var fidlist = fi.Forumlist; if (fidlist.IsNullOrWhiteSpace()) { fidlist = Forums.GetVisibleForum(); } int num = 1; // 热点图片 var list = ForumHots.HotImages(fi.Dataitemcount, fi.Cachetimeout, fi.Sorttype, fi.Id, fidlist, fi.Enabled); foreach (var att in list) { //int topicid = att["tid"].ToInt(); string filename = (att.FileName + "").Trim(); string title = (att.Title + "").Trim(); title = Utils.JsonCharFilter(title).Replace("'", "\\'"); string format = "<li><a href=\"{0}\" target=\"_blank\"><img src=\"{1}\" alt=\"{2}\"/></a></li>"; if (!att.IsLocal) { ForumHots.DeleteCacheImageFile(); var file = Path.GetFileName(filename); Thumbnail.MakeRemoteThumbnailImage(filename, thum.CombinePath("r_" + file), 360, 240); sb.AppendFormat(format, Urls.ShowTopicAspxRewrite(att.Tid, 0), "cache/rotatethumbnail/r_" + file, title); } else { string file = att.FullFileName.Replace('\\', '/').Trim(); string str = "cache/rotatethumbnail/r_" + Utils.GetFilename(file); var newFile = Utils.GetMapPath(BaseConfigs.GetForumPath + str); if (!File.Exists(newFile) && File.Exists(file)) { ForumHots.DeleteCacheImageFile(); Thumbnail.MakeThumbnailImage(file, newFile, 360, 240); } sb.AppendFormat(format, Urls.ShowTopicAspxRewrite(att.Tid, 0), str, title); } sb2.AppendFormat("<a href=\"#\" rel=\"{0}\">{0}</a>", num); num++; } return("<div class=\"image_reel\"><ul>" + sb.ToString() + "</ul></div><div class=\"paging\"><span></span>" + sb2.ToString() + "</div>"); }
//protected string ShowDebateAspxRewrite(string topicid) //{ // return this.ShowDebateAspxRewrite(topicid.ToInt(0)); //} //protected string ShowDebateAspxRewrite(int topicid) //{ // return Urls.ShowDebateAspxRewrite(topicid); //} //protected string ShowBonusAspxRewrite(string topicid, int pageid) //{ // return this.ShowBonusAspxRewrite(topicid.ToInt(0), (pageid <= 0) ? 0 : pageid); //} //protected string ShowBonusAspxRewrite(int topicid, int pageid) //{ // return Urls.ShowBonusAspxRewrite(topicid, pageid); //} protected string UserInfoAspxRewrite(int userid) { return(Urls.UserInfoAspxRewrite(userid)); }
protected string ShowForumAspxRewrite(int forumid, int pageid, string rewritename) { return(Urls.ShowForumAspxRewrite(forumid, pageid, rewritename)); }
protected string ShowTopicAspxRewrite(int topicid, int pageid) { return(Urls.ShowTopicAspxRewrite(topicid, pageid)); }
protected string ShowForumAspxRewrite(string pathlist, int forumid, int pageid) { return(Urls.ShowForumAspxRewrite(pathlist, forumid, pageid)); }
public static string GetUserRankHtml(IUser[] users, string type, int maxrows) { var sb = new StringBuilder(); string text = ""; int num = maxrows; //int i = 0; //while (i < users.Length) for (int i = 0; i < users.Length; i++, num--) { var user = users[i]; if (user == null) { continue; } string str = string.Empty; if (type != null) { switch (type) { case "credits": str = user.Credits + ""; break; case "extcredits1": str = user.ExtCredits1 + ""; text = Scoresets.GetValidScoreUnit()[1]; break; case "extcredits2": str = user.ExtCredits2 + ""; text = Scoresets.GetValidScoreUnit()[2]; break; case "extcredits3": str = user.ExtCredits3 + ""; text = Scoresets.GetValidScoreUnit()[3]; break; case "extcredits4": str = user.ExtCredits4 + ""; text = Scoresets.GetValidScoreUnit()[4]; break; case "extcredits5": str = user.ExtCredits5 + ""; text = Scoresets.GetValidScoreUnit()[5]; break; case "extcredits6": str = user.ExtCredits6 + ""; text = Scoresets.GetValidScoreUnit()[6]; break; case "extcredits7": str = user.ExtCredits7 + ""; text = Scoresets.GetValidScoreUnit()[7]; break; case "extcredits8": str = user.ExtCredits8 + ""; text = Scoresets.GetValidScoreUnit()[8]; break; case "digestposts": str = user.DigestPosts + ""; break; case "onlinetime": str = Math.Round(user["OnlineTime"].ToDouble() / 60.0, 2).ToString(); text = "小时"; break; default: //goto IL_259; break; } } //IL_259: str = user.Posts.ToString(); // goto IL_26A; //IL_26A: sb.AppendFormat("<li><em>{0}</em><a href=\"{1}\" target=\"_blank\">{2}</a></li>", str + ((text == string.Empty) ? string.Empty : (" " + text)), Urls.UserInfoAspxRewrite(user.ID), user.Name); //num--; //i++; //continue; } for (int j = 0; j < num; j++) { sb.Append("<li> </li>"); } return(sb.ToString()); }
public static string GetForumsRankHtml(List <XForum> forums, string type, int maxrows) { var sb = new StringBuilder(); foreach (IXForum current in forums) { sb.AppendFormat("<li><em>{0}</em><a href=\"{1}\" target=\"_blank\">{2}</a></li>", (type == "topics") ? current.Topics : current.Posts, Urls.ShowForumAspxRewrite(current.Fid, 0), current.Name); maxrows--; } for (int i = 0; i < maxrows; i++) { sb.Append("<li> </li>"); } return(sb.ToString()); }
public static string GetHotReplyTopicsHtml() { var sb = new StringBuilder(); foreach (var item in Topic.GetHotReplyTopics(20)) { sb.AppendFormat("<li><em>{0}</em><a href=\"{1}\">{2}</a>\r\n", item.Replies, Urls.ShowTopicAspxRewrite(item.ID, 0), item.Title); } return(sb.ToString()); }
//public static string GetForumListBoxOptionsCache() //{ // return Caches.GetForumListBoxOptionsCache(false); //} public static string GetForumListMenuDivCache(int usergroupid, int userid, string extname) { var cacheService = XCache.Current; string text = cacheService.RetrieveObject(CacheKeys.FORUM_FORUM_LIST_MENU_DIV) as string; if (text.IsNullOrEmpty()) { var sb = new StringBuilder(); var forumList = XForum.Root.Childs; if (forumList.Count > 0) { sb.Append("<div class=\"popupmenu_popup\" id=\"forumlist_menu\" style=\"overflow-y: auto; display:none\">"); foreach (var item in forumList) { if (item.Visible && item.AllowView(7) && item.Layer == 0) { sb.AppendFormat("<dl><dt><a href=\"{0}\">{1}</a></dt><dd><ul>", BaseConfigs.GetForumPath + Urls.ShowForumAspxRewrite(item.ID, 0, item.Field.RewriteName), item.Name); foreach (var elm in item.Childs) { if (elm.Layer == 1 && elm.Visible) { sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", BaseConfigs.GetForumPath + Urls.ShowForumAspxRewrite(elm.ID, 0, elm.Field.RewriteName), elm.Name); } } sb.Append("</ul></dd></dl>"); } } } sb.Append("</div>"); text = sb.ToString().Replace("<dd><ul></ul></dd>", ""); XCache.Add(CacheKeys.FORUM_FORUM_LIST_MENU_DIV, text); } return(text); }