Esempio n. 1
0
		/// <summary>
		/// Answer an enumeration of all topic in the ContentBase, sorted using the supplied IComparer (does not include imports)
		/// </summary>
		/// <param name="comparer">Used to sort the topics in the answer</param>
		/// <returns>Enumeration of AbsoluteTopicNames</returns>
		protected IEnumerable AllTopicsSorted(IComparer comparer)
		{
			ArrayList answer = new ArrayList();
			ArrayList all = new ArrayList();
			Set present = new Set();
			foreach (SqlInfoForTopic each in SqlHelper.GetSqlTopicInfoForNonArchiveTopics(Namespace, comparer != null, _ConnectionString))
			{
				SqlInfoTopicData td = new SqlInfoTopicData(each, Namespace);
				all.Add(td);
				present.Add(td.Name);
			}
			bool sortAgain = false;
			foreach (BackingTopic each in BackingTopics.Values)
			{
				BackingTopicTopicData td = new BackingTopicTopicData(each);
				if (present.Contains(td.Name))
					continue;
				sortAgain = true;
				all.Add(td);				
			}
			if (comparer != null && sortAgain)
				all.Sort(comparer);
			foreach (TopicData each in all)
			{
				AbsoluteTopicName name = new AbsoluteTopicName(each.Name, each.Namespace);
				answer.Add(name);
			}
			return answer;
		}
Esempio n. 2
0
		/// <summary>
		/// Answer the identify of the author who last modified a given topic
		/// </summary>
		/// <param name="topic"></param>
		/// <returns>a user name</returns>
		public override string GetTopicLastAuthor(LocalTopicName topic)
		{
			SqlInfoForTopic latestVersionInfo = SqlHelper.GetSqlTopicInfoForLatestTopicVersion(Namespace, topic.Name, _ConnectionString );

			if (latestVersionInfo == null)
			{
				BackingTopic back = GetBackingTopicNamed(topic);
				if (back != null)
					return back.LastAuthor;
				return AnonymousUserName;
			}

			TopicData info = new SqlInfoTopicData(latestVersionInfo, Namespace);
			string auth = info.Author;
			if (auth == null)
				return AnonymousUserName;
			return auth;

		}