public void Index() { target(Save); ForumApp app = ctx.app.obj as ForumApp; bindSettings(app.GetSettingsObj()); }
public void TopList() { ForumApp app = ctx.app.obj as ForumApp; set("recentTopicLink", to(new RecentController().Topic)); set("recentPostLink", to(new RecentController().Post)); set("recentHotLink", to(new RecentController().Replies)); set("recentPickedImgLink", to(new RecentController().ImgTopic)); ForumSetting s = app.GetSettingsObj(); List <ForumPickedImg> pickedImg = db.find <ForumPickedImg>("AppId=" + ctx.app.Id).list(s.HomeImgCount); bindImgs(pickedImg); //List<ForumTopic> newPosts = topicService.GetByApp( ctx.app.Id, s.HomeListCount ); //bindTopics( newPosts, "topic" ); //List<ForumTopic> hots = topicService.GetByAppAndReplies( ctx.app.Id, s.HomeListCount, s.HomeHotDays ); //bindTopics( hots, "hot" ); //List<ForumPost> posts = postService.GetRecentByApp( ctx.app.Id, s.HomeListCount ); //bindPosts( posts, "post" ); List <ForumTopic> newPosts = topicService.GetByApp(ctx.app.Id, 30); List <MergedData> results = pickService.GetAll(newPosts, ctx.app.Id); bindCustomList(results); }
public override int GetImgCount() { ForumApp app = ctx.app.obj as ForumApp; ForumSetting s = app.GetSettingsObj(); return(s.HomeImgCount); }
public override IPageList GetPage() { ForumApp app = ctx.app.obj as ForumApp; ForumSetting s = app.GetSettingsObj(); return(ndb.findPage(typeof(ForumPickedImg), "AppId=" + ctx.app.Id, s.HomeImgCount)); }
private void updateSettings(ForumApp forum) { ForumSetting s = forum.GetSettingsObj(); // 配置:隐藏头条新帖 s.IsHideTop = 1; forum.Settings = Json.ToString(s); forum.update(); }
public static Boolean IsIntervalShort(MvcContext ctx) { Object objLast = ctx.web.SessionGet("__forumLastPublish"); if (objLast == null) { return(false); } ForumApp app = ctx.app.obj as ForumApp; ForumSetting setting = app.GetSettingsObj(); return(DateTime.Now.Subtract((DateTime)objLast).TotalSeconds <= setting.ReplyInterval); }
private bool isIntervalShort() { Object objLast = ctx.web.SessionGet("__forumLastReplied"); if (objLast == null) { return(false); } ForumApp app = ctx.app.obj as ForumApp; ForumSetting setting = app.GetSettingsObj(); return(DateTime.Now.Subtract((DateTime)objLast).Seconds <= setting.ReplyInterval); }
private void bindStats() { ForumApp forum = ctx.app.obj as ForumApp; ForumSetting s = forum.GetSettingsObj(); set("forum.IsHideStats_Style", s.IsHideStats == 1 ? "display:none" : ""); set("forum.IsHideTop_Style", s.IsHideTop == 1 ? "display:none" : ""); set("forum.IsHideOnline_Style", s.IsHideOnline == 1 ? "display:none" : ""); set("forum.IsHideLink_Style", s.IsHideLink == 1 ? "display:none" : ""); String newUserLink = ctx.link.T2(new wojilu.Web.Controller.Users.MainController().ListAll); String lastUserName = userService.GetLastUserName(); set("newUserLink", newUserLink); set("newUserName", lastUserName); String lnkAll = t2(new wojilu.Web.Controller.Users.MainController().OnlineAll); String lnkMembers = t2(new wojilu.Web.Controller.Users.MainController().OnlineUser); set("onlineLink", lnkAll); set("onlineMemberLink", lnkMembers); set("forum.VisitCount", forum.VisitCount); set("forum.TodayVisitCount", forum.TodayVisitCount); set("forum.YestodayPostCount", forum.YestodayPostCount); int userCount = userService.GetUserCount(); set("forum.MemberCount", userCount); set("forum.TopicCount", forum.TopicCount); set("forum.PostCount", forum.AllPostCount); set("forum.TodayTopic", forum.TodayTopicCount); set("forum.TodayPost", forum.AllTodayPostCount); set("forum.PeakPostCount", forum.PeakPostCount); set("forum.LastUpdatePostUrl", strUtil.Join(sys.Path.Root, forum.LastUpdatePostUrl)); set("forum.LastUpdatePostTitle", forum.LastUpdatePostTitle); //set( "forum.LastUpdateMemberUrl", memberUtil.GetUrlFull( forum.LastUpdateMemberUrl ) ); set("forum.LastUpdateMemberUrl", toUser(forum.LastUpdateMemberUrl)); set("forum.LastUpdateMemberName", forum.LastUpdateMemberName); set("forum.LastUpdateTime", forum.LastUpdateTime); }
public void Index() { List <ForumBoard> categories = getTree().GetRoots(); List <ForumLink> linkList = linkService.GetByApp(ctx.app.Id, ctx.owner.Id); ForumApp forum = ctx.app.obj as ForumApp; ForumSetting setting = forum.GetSettingsObj(); ctx.Page.Title = ctx.app.Name; ctx.Page.Keywords = setting.MetaKeywords; ctx.Page.Description = setting.MetaDescription; String notice = strUtil.HasText(forum.Notice) ? "<div class=\"forumPanel\" id=\"forumNotice\">" + forum.Notice + "</div>" : ""; set("forumNotice", notice); bindAll(categories, linkList); }
private void bindTopicOne(IBlock block, ForumTopic topic, Boolean isAdmin, Boolean isSticky, int replySize) { if (topic.Creator == null) { return; } String stickyIconName = topic.IsGlobalSticky ? "gsticky" : "sticky"; if (isSticky) { block.Set("stickyIconName", stickyIconName); } String rewardInfo = string.Empty; if (topic.Reward > 0) { rewardInfo = getRewardInfo(topic, rewardInfo); } String lblNew = string.Empty; ForumApp app = ctx.app.obj as ForumApp; int newDays = app.GetSettingsObj().NewDays; if (DateTime.Now.Subtract(topic.Created).Days < newDays) { lblNew = "<span class=\"supNew\">new</span>"; } String lblCategory = string.Empty; if (topic.Category != null && topic.Category.Id > 0) { String lnkCategory = to(new BoardController().Category, topic.ForumBoard.Id) + "?categoryId=" + topic.Category.Id; lblCategory = string.Format("<a href=\"{0}\" target=\"_blank\"><span style=\"color:{2}\">[{1}]</span></a> ", lnkCategory, topic.Category.Name, topic.Category.NameColor); } String typeImg = string.Empty; if (strUtil.HasText(topic.TypeName)) { typeImg = string.Format("<img src=\"{0}apps/forum/{1}.gif\">", sys.Path.Skin, topic.TypeName); } String priceInfo = string.Empty; if (topic.Price > 0) { priceInfo = alang("price") + " :" + topic.Price + " "; } String permissionInfo = string.Empty; if (topic.ReadPermission > 0) { permissionInfo = alang("readPermission") + ":" + topic.ReadPermission + ""; } //String chkId = ""; //if (isAdmin) chkId = "<input type=\"checkbox\" name=\"postSelect\" id=\"checkbox" + topic.Id + "\" value=\"" + topic.Id + "\" />"; String chkId = "<input type=\"checkbox\" name=\"postSelect\" id=\"checkbox" + topic.Id + "\" value=\"" + topic.Id + "\" />"; block.Set("p.CheckBox", chkId); block.Set("p.Id", topic.Id); block.Set("p.Category", lblCategory); block.Set("p.TypeImg", typeImg); block.Set("p.Reward", rewardInfo); block.Set("p.Price", priceInfo); block.Set("p.ReadPermission", permissionInfo); block.Set("p.Titile", strUtil.CutString(topic.Title, 40)); block.Set("p.TitleStyle", topic.TitleStyle); block.Set("p.LabelNew", lblNew); String lnk = LinkUtil.appendListPage(to(new TopicController().Show, topic.Id), ctx); block.Set("p.Url", lnk); block.Set("p.Pages", getPostPagesString(alink.ToAppData(topic), topic.Replies, replySize)); block.Set("p.MemberName", topic.Creator.Name); block.Set("p.MemberUrl", toUser(topic.Creator)); block.Set("p.CreateTime", topic.Created.ToShortDateString()); block.Set("p.ReplyCount", topic.Replies); block.Set("p.Hits", topic.Hits); block.Set("p.LastUpdate", topic.Replied.GetDateTimeFormats('g')[0]); block.Set("p.LastReplyUrl", toUser(topic.RepliedUserFriendUrl)); block.Set("p.LastReplyName", topic.RepliedUserName); String attachments = topic.Attachments > 0 ? "<img src='" + sys.Path.Img + "attachment.gif'/>" : ""; block.Set("p.Attachments", attachments); String statusImg; if (topic.IsLocked == 1) { statusImg = sys.Path.Skin + "apps/forum/lock.gif"; } else if (topic.IsPicked == 1) { statusImg = sys.Path.Skin + "apps/forum/pick.gif"; } else { statusImg = sys.Path.Skin + "apps/forum/topic.gif"; } block.Set("postStatusImage", statusImg); block.Next(); }
private void updateSettings( ForumApp forum ) { ForumSetting s = forum.GetSettingsObj(); // 配置:隐藏头条新帖 s.IsHideTop = 1; forum.Settings = Json.ToString( s ); forum.update(); }