/// <summary> /// データを GET し、HatomaruResponse を取得します。 /// </summary> protected override HatomaruResponse GetHtmlResponse(){ HatomaruBbs.SetAllReplaceUrl(Html); BbsThread[] threads = Bbs.GetAllThread(); Pager pg = new Pager(); pg.TotalItem = threads.Length; pg.ItemPerPage = ItemPerPage; pg.CurrentPage = myPageNum; pg.DescOrder = true; if(!pg.ExistsPage){ string mes = string.Format("{0}ページはありません。(記事{1}件/全{2}ページ)", myPageNum, pg.TotalItem, pg.LastPage); return NotFound(mes); } string title = string.Format("{0} ({1}/{2})", Label, pg.CurrentPage, pg.LastPage); Response.SelfTitle = title; if(myPageNum > 1){ Response.AddTopicPath(Path, title); } InsertHeading(2, title); InsertPageNav(pg, myModel.BasePath.Combine(Id)); XmlElement treeDiv = Html.Create("div", "tree"); foreach(int i in pg.ItemIndexes){ BbsThread target = threads[i]; if(target.Count > ThreadMaxLength){ treeDiv.AppendChild(GetThread(target, true)); } else { treeDiv.AppendChild(GetThread(target)); } } Html.Entry.AppendChild(treeDiv); InsertPageNav(pg, myModel.BasePath.Combine(Id)); return Response; }
/// <summary> /// データを GET し、HatomaruResponse を取得します。 /// </summary> protected override HatomaruResponse GetHtmlResponse(){ HatomaruBbs.SetAllReplaceUrl(Html); BbsThread[] threads = Bbs.GetAllThread(); Pager pg = new Pager(); pg.TotalItem = threads.Length; pg.ItemPerPage = ItemPerPage; pg.CurrentPage = myPageNum; pg.DescOrder = true; if(!pg.ExistsPage) return NotFound(); string title = string.Format("{0} ({1}/{2})", Label, pg.CurrentPage, pg.LastPage); Response.SelfTitle = title; Response.AddTopicPath(Path, title); InsertHeading(2, title); InsertPageNav(pg, myModel.BasePath.Combine(Id)); XmlElement treeDiv = Html.Create("div", "rootlist"); XmlElement treeUl = Html.Create("ul"); foreach(int i in pg.ItemIndexes){ int threadNum = threads[i].Id; Article currentArticle = Bbs.GetArticle(threadNum); XmlElement treeLi = Html.Create("li"); treeLi.AppendChild(MakeArticleAnchor(currentArticle)); treeUl.AppendChild(treeLi); } treeDiv.AppendChild(treeUl); Html.Entry.AppendChild(treeDiv); InsertPageNav(pg, myModel.BasePath.Combine(Id)); return Response; }
/// <summary> /// データを GET し、HatomaruResponse を取得します。 /// </summary> protected override HatomaruResponse GetHtmlResponse(){ HatomaruBbs.SetAllReplaceUrl(Html); Article[] articles = Bbs.GetAllArticle(); Pager pg = new Pager(); pg.TotalItem = articles.Length; pg.ItemPerPage = ItemPerPage; pg.CurrentPage = myPageNum; pg.DescOrder = true; if(!pg.ExistsPage) return NotFound(); string title = string.Format("{0} ({1}/{2})", Label, pg.CurrentPage, pg.LastPage); Response.SelfTitle = title; Response.AddTopicPath(Path, title); InsertHeading(2, title); InsertPageNav(pg, myModel.BasePath.Combine(Id)); foreach(int i in pg.ItemIndexes){ Html.Entry.AppendChild(ParseArticle(articles[i])); } InsertPageNav(pg, myModel.BasePath.Combine(Id)); return Response; }
/// <summary> /// 現在のコンテンツにページナビゲーションをセットします。 /// </summary> protected void InsertPageNav(Pager pg, AbsPath path){ if(myPageNav == null){ myPageNav = pg.GetPageNav(Html, path); } Html.Entry.AppendChild(myPageNav.Clone()); }