public override string OnMouduleLoad(string content) { UserPrefsSaved userprefs = new UserPrefsSaved(this.Module.UserPref); int topiccount = Utils.StrToInt(userprefs.GetValueByName("topiccount"), 10); bool iselite = Utils.StrToInt(userprefs.GetValueByName("iselite"), 0) > 0; DataTable topics = Focuses.GetTopicList(topiccount, 0, 0, "", TopicTimeType.All, TopicOrderType.ID, iselite, 30, false); StringBuilder sb = new StringBuilder(StaticFileProvider.GetContent(jsFile).Replace("${forumpath}", BaseConfigs.GetForumPath).Replace("${themepath}", this.SpaceConfig.ThemePath)); GeneralConfigInfo config = GeneralConfigs.GetConfig(); sb.Append("\r\n<div class='dnt-theme'><ul>\r\n"); foreach (DataRow r in topics.Rows) { string img = string.Format("<img onerror='this.src=\"{0}space/modules/builtin/forum/images/item_extend.gif\";' src='{0}space/skins/themes/{1}/images/item_extend.gif' id='imgButton_{2}' onclick='showtree({2},10);' title='展开' alt='展开' style='cursor:pointer;'/>", BaseConfigs.GetForumPath, this.SpaceConfig.ThemePath, r["tid"]); if (Utils.StrToInt(r["replies"], 0) < 1) { img = string.Format("<img onerror='this.src=\"{0}space/modules/builtin/forum/images/item_collapsed.gif\";' src='{0}space/skins/themes/{1}/images/item_collapsed.gif' />", BaseConfigs.GetForumPath, this.SpaceConfig.ThemePath); } if (config.Aspxrewrite == 1) { sb.AppendFormat("<li>{0}<a href='" + BaseConfigs.GetForumPath + "showtopic-{1}.aspx' title='{2}' target='_blank'>{2}</a></li>", img, r["tid"], r["title"]); } else { sb.AppendFormat("<li>{0}<a href='" + BaseConfigs.GetForumPath + "showtopic.aspx?topicid={1}' title='{2}' target='_blank'>{2}</a></li>", img, r["tid"], r["title"]); } sb.AppendFormat("<div id='divTopic{0}'></div>", r["tid"]); } sb.Append("\r\n</ul></div>\r\n"); content = sb.ToString(); return(base.OnMouduleLoad(content)); }
protected void OutPutNewSpacePosts(string template, string alternatingTemplate) { if (SpacePluginProvider.GetInstance() == null) { Response.Write("document.write('未安装空间插件');"); return; } StringBuilder result = new StringBuilder(); int i = 0; string title = ""; foreach (DataRow dr in Focuses.GetNewSpacePosts(count, cachetime).Rows) { title = dr["title"].ToString().Trim(); result.AppendFormat((i % 2 == 0 ? template : alternatingTemplate), "", (length == -1 ? title : Utils.GetUnicodeSubString(title, length, "")), "", "", title, "", spacerooturl + "?uid=" + dr["uid"].ToString(), spacerooturl + "viewspacepost.aspx?postid=" + dr["postid"].ToString()); i++; } Response.Write("document.write('" + result.ToString().Replace("'", "\\'") + "');"); }
public EntityList <Topic> GetForumTopicList(int count, int views, int forumid, TopicTimeType timeType, TopicOrderType orderType, bool isDigest, bool onlyImg) { return(Focuses.GetTopicList(count, views, forumid, "", timeType, orderType, isDigest, 5, onlyImg, "")); }
/// <summary> /// 获取论坛主题列表 /// </summary> /// <param name="count">主题数</param> /// <param name="views">浏览量</param> /// <param name="forumid">版块ID</param> /// <param name="timetype">时间类型</param> /// <param name="ordertype">排序字段</param> /// <param name="isdigest">是否精化</param> /// <param name="onlyimg">是否包含附件</param> /// <returns></returns> public DataTable GetForumTopicList(int count, int views, int forumid, TopicTimeType timetype, TopicOrderType ordertype, bool isdigest, bool onlyimg) { return(Focuses.GetTopicList(count, views, forumid, timetype, ordertype, isdigest, 5, onlyimg)); }
protected override void ShowPage() { pagetitle = "首页"; score = Scoresets.GetValidScoreName(); if (config.Rssstatus == 1) { AddLinkRss("tools/rss.aspx", string.Format("{0} 最新主题", config.Forumtitle)); } OnlineUsers.UpdateAction(olid, UserAction.IndexShow.ActionID, 0, config.Onlinetimeout); if (newpmcount > 0) { pmlist = PrivateMessages.GetPrivateMessageCollectionForIndex(userid, 5, 1, 1); } userinfo = new ShortUserInfo(); if (userid != -1) { userinfo = Discuz.Forum.Users.GetShortUserInfo(userid); if (userinfo.Newpm == 0) { base.newpmcount = 0; } lastvisit = userinfo.Lastvisit.ToString(); showpmhint = Convert.ToInt32(userinfo.Newsletter) > 4; } Statistics.GetPostCountFromForum(0, out totaltopic, out totalpost, out todayposts); digesttopiclist = Focuses.GetDigestTopicList(16); hottopiclist = Focuses.GetHotTopicList(16, 30); forumlinklist = Caches.GetForumLinkList(); forumlinkcount = forumlinklist.Rows.Count; // 获得统计信息 totalusers = Utils.StrToInt(Statistics.GetStatisticsRowItem("totalusers"), 0); lastusername = Statistics.GetStatisticsRowItem("lastusername"); lastuserid = Utils.StrToInt(Statistics.GetStatisticsRowItem("lastuserid"), 0); totalonline = onlineusercount; showforumonline = false; if (totalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes") { showforumonline = true; onlineuserlist = OnlineUsers.GetOnlineUserList(onlineusercount, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser); onlineiconlist = Caches.GetOnlineGroupIconList(); } if (DNTRequest.GetString("showonline") == "no") { showforumonline = false; } highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount"); highestonlineusertime = Statistics.GetStatisticsRowItem("highestonlineusertime"); // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); announcementcount = 0; if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } ///得到广告列表 headerad = Advertisements.GetOneHeaderAd("indexad", 0); footerad = Advertisements.GetOneFooterAd("indexad", 0); pagewordad = Advertisements.GetPageWordAd("indexad", 0); doublead = Advertisements.GetDoubleAd("indexad", 0); floatad = Advertisements.GetFloatAd("indexad", 0); }