/// <summary> /// Restores the passed in Topic version as the current version /// </summary> /// <param name="topic">Topic Version to Restore</param> /// <returns></returns> protected TopicName RestorePreviousVersion(AbsoluteTopicName topic) { LogEvent e = TheFederation.LogEventFactory.CreateAndStartEvent(Request.UserHostAddress, VisitorIdentityString, topic.ToString(), LogEvent.LogEventType.WriteTopic); try { AbsoluteTopicName newVersionName = new AbsoluteTopicName(topic.Name, topic.Namespace); newVersionName.Version = TopicName.NewVersionStringForUser(VisitorIdentityString); ContentBase cb = TheFederation.ContentBaseForNamespace(topic.Namespace); cb.WriteTopicAndNewVersion(newVersionName.LocalName, TheFederation.Read(topic)); } finally { e.Record(); } return new AbsoluteTopicName(topic.Name, topic.Namespace); }
/// <summary> /// Answer a list of the wikitext components (IBELObjects) of the given border. If nothing specifies any border; answer the system default /// </summary> /// <param name="name"></param> /// <param name="border"></param> /// <param name="rule"></param> /// <returns></returns> private IEnumerable BorderText(AbsoluteTopicName name, Border border, CompositeCacheRule rule) { ArrayList answer = new ArrayList(); ContentBase cb; string bordersTopicsProperty = "Borders"; ArrayList borderTopics = new ArrayList(); // Start with whatever the namespace defines if (Borders != null) { foreach (string at in ParseListPropertyValue(Borders)) { AbsoluteTopicName abs = new AbsoluteTopicName(at); cb = ContentBaseForTopic(abs); if (abs == null || cb == null) { throw new Exception("Unknown namespace listed in border topic (" + at +") listed in federation configuration Borders property."); } borderTopics.Add(at); } } // If the namespace, specifies border topics, get them cb = ContentBaseForTopic(name); if (cb != null) { borderTopics.AddRange(GetTopicListPropertyValue(cb.DefinitionTopicName, bordersTopicsProperty)); rule.Add(cb.CacheRuleForAllPossibleInstancesOfTopic(cb.DefinitionTopicName)); } // If there are no border topics specified for the federation or the namespace, add the default (_NormalBorders from the local namespace) if (borderTopics.Count == 0) { borderTopics.Add("_NormalBorders"); } // Finally, any border elements form the topic itself (skip the def topic so we don't get double borders!) if (cb == null || cb.DefinitionTopicName.ToString() != name.ToString()) { borderTopics.AddRange(GetTopicListPropertyValue(name, bordersTopicsProperty)); } Set done = new Set(); foreach (string borderTopicName in borderTopics) { // Figure out what the absolute topic name is that we're going to get this topic from RelativeTopicName rel = new RelativeTopicName(borderTopicName); if (rel.Namespace == null) { rel.Namespace = name.Namespace; } AbsoluteTopicName abs = new AbsoluteTopicName(rel.Name, rel.Namespace); if (done.Contains(abs)) { continue; } done.Add(abs); IBELObject s = BorderPropertyFromTopic(name, abs, border, rule); if (s != null) { answer.Add(s); } } return answer; }