private void LoadPosts(List<BlogEngine.Core.Post> postList, Obout.Ajax.UI.TreeView.Node refNode) { foreach (BlogEngine.Core.Post pst in postList) { Obout.Ajax.UI.TreeView.Node nod = new Obout.Ajax.UI.TreeView.Node(pst.Title, "img/fav_icon.png"); nod.Value = "POST-" + pst.Id.ToString(); nod.NavigateUrl = pst.AbsoluteLink.ToString(); String postText = pst.Content; if (postText.Length > 200) { postText = postText.Substring(0, 200); } Obout.Ajax.UI.TreeView.Node nodResumen = new Obout.Ajax.UI.TreeView.Node(BlogEngine.Core.Utils.StripHtml(postText) + " ..."); nodResumen.SelectMode = Obout.Ajax.UI.TreeView.NodeSelectMode.Expand; nod.ChildNodes.Add(nodResumen); refNode.ChildNodes.Add(nod); nod.ExpandAll(); } }
protected void date_Changed(object sender, EventArgs e) { if (!bRecursive) { bRecursive = true; OboutInc.Calendar2.Calendar cal = (OboutInc.Calendar2.Calendar)sender; DateTime calendarDate = cal.SelectedDate; if (!calendarDate.Year.ToString().Equals(this.drplYears.SelectedItem.Text)) { this.drplYears.SelectedIndex = -1; ListItem item = this.drplYears.Items.FindByText(calendarDate.Year.ToString()); item.Selected = true; } string nodeValue = calendarDate.Year.ToString() + "-" + calendarDate.Month.ToString() + "-1"; Boolean bExistingNode = false; for (int i = 0; i <= this.treePosts.Nodes.Count - 1; i++) { if (this.treePosts.Nodes[i].Value.Equals(nodeValue)) { bExistingNode = true; break; } } if (!bExistingNode) { String nodeName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(calendarDate.Month).ToUpper(); nodeName += " - " + calendarDate.Year.ToString(); Obout.Ajax.UI.TreeView.Node nod = new Obout.Ajax.UI.TreeView.Node(nodeName, "img/TextBoxHS.png"); nod.Value = nodeValue; nod.ExpandMode = Obout.Ajax.UI.TreeView.NodeExpandMode.ServerSideCallback; this.treePosts.Nodes.Add(nod); nod.ExpandAll(); this.LoadMonthPosts(nod); } bRecursive = false; } }
private void LoadDates() { DateTime curDate = DateTime.Now; DateTime endDate = curDate.AddMonths(-6); while (endDate < curDate) { String nodeName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(curDate.Month).ToUpper(); nodeName += " - " + curDate.Year.ToString(); Obout.Ajax.UI.TreeView.Node nod = new Obout.Ajax.UI.TreeView.Node(nodeName, "img/TextBoxHS.png"); nod.Value = curDate.Year.ToString() + "-" + curDate.Month.ToString() + "-1"; nod.ExpandMode = Obout.Ajax.UI.TreeView.NodeExpandMode.ServerSideCallback; this.treePosts.Nodes.Add(nod); if (curDate == DateTime.Now) { LoadMonthPosts(nod); nod.ExpandAll(); } curDate = curDate.AddMonths(-1); } }