示例#1
0
		public MessageCollection GetByTopicId(int id)
		{
			MessageCollection messages = new MessageCollection();
			SharePointListDescriptor postItems = Provider.GetListItemsByField(ForumConstants.Lists_Posts, "TopicID", id.ToString());
			foreach (SharePointListItem postItem in postItems.SharePointListItems)
			{
				messages.Add(MessageMapper.CreateDomainObject(postItem));
			}
			return messages;
		}
示例#2
0
		/// <summary>
		/// Gets all.
		/// </summary>
		/// <returns></returns>
		public MessageCollection GetAll()
		{
			MessageCollection messages = new MessageCollection();
			SharePointListDescriptor postItems = Provider.GetAllListItems(ForumConstants.Lists_Posts);
			foreach (SharePointListItem postItem in postItems.SharePointListItems)
			{
				messages.Add(MessageMapper.CreateDomainObject(postItem));
			}
			return messages;
		}
示例#3
0
		public MessageCollection FindByDate(DateTime dateCriteria)
		{
			string isoDate = SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateCriteria);			
			SharePointListDescriptor listItems = Provider.GetListItemsByField(ForumConstants.Lists_Posts, "Modified", isoDate);
			MessageCollection messages = new MessageCollection();
			foreach (SharePointListItem item in listItems.SharePointListItems)
			{
				messages.Add(MessageMapper.CreateDomainObject(item));
			}
			return messages;
		}
示例#4
0
		public MessageCollection FindByKeywords(string keywords)
		{
			// TODO this is broken and needs to use CAML instead
			MessageCollection messages = new MessageCollection();
			if (keywords == null)
				return messages;
			
			SPSearchResultCollection searchResults = ForumApplication.Instance.SpWeb.SearchListItems(keywords);
			foreach(SPSearchResult result in searchResults)
			{
				if(result.ListName.ToUpper() == ForumConstants.Lists_Posts.ToUpper())
				{
					Message message = new Message(0);
					message.Name = result.Title;
					messages.Add(message);
				}
			}

			return messages;
		}
示例#5
0
		protected void DisplayMessages(MessageCollection messages, Forum forum)
		{
			foreach (Message post in messages)
			{
				Controls.Add(new LiteralControl("<tr>"));

				Controls.Add(new LiteralControl("<td class=\"ms-TPHeader\" width=140px>"));
				Controls.Add(new LiteralControl(string.Format("{0}", HtmlUtility.CreateProfileLink(post.Author))));
				Controls.Add(new LiteralControl("</td>"));

				Controls.Add(new LiteralControl("<td class=\"ms-TPHeader\" width=80%>"));
				Controls.Add(new LiteralControl("<table cellspacing=0 cellpadding=0 width=100%>"));
				Controls.Add(new LiteralControl("<tr>"));
				Controls.Add(new LiteralControl(string.Format("<td><strong>{0}:&nbsp;</strong>{1}</td>", this.WebPartParent.LoadResource("Text.Posted"), post.Created)));
				Controls.Add(new LiteralControl(string.Format("<td align=right>")));

				if(forum != null)
				{
					BuildReplyLinkUI(forum, post);
					BuildEditLinkUI(forum, post);
					BuildQuoteLinkUI(forum, post);
				}

				Controls.Add(new LiteralControl(string.Format("</td>")));
				Controls.Add(new LiteralControl("</tr>"));
				Controls.Add(new LiteralControl("</table>"));
				Controls.Add(new LiteralControl("</td>"));

				Controls.Add(new LiteralControl("</tr>"));

				Controls.Add(new LiteralControl("<tr class=\"ms-alternating\">"));
				Controls.Add(new LiteralControl(string.Format("<td valign=\"top\">{0}</td>", FillUserInfoBox(post.Author))));
				Controls.Add(new LiteralControl(string.Format("<td valign=\"top\">{0}</td>", post.Body)));
				Controls.Add(new LiteralControl("</tr>"));

				Controls.Add(new LiteralControl("<tr>"));
				Controls.Add(new LiteralControl("<td colspan=2 class=\"ms-ToolPaneTitle\" style=\"height:5px\"></td>"));
				Controls.Add(new LiteralControl("</tr>"));
			}
		}
示例#6
0
		protected void DisplayMessages(MessageCollection messages)
		{
			DisplayMessages(messages, null);
		}