string IEditServiceProxy.GetTextForTopic(LocalTopic topic) { AbsoluteTopicName atn = new AbsoluteTopicName(); atn.Namespace = topic.Namespace.Name; atn.Name = topic.Name; return base.GetTextForTopic(atn); }
private CacheRule GetCacheRuleForTopic(string topic) { AbsoluteTopicName tn = new AbsoluteTopicName(topic); CompositeCacheRule rule = new CompositeCacheRule(); Formatter.FormattedTopic(tn, OutputFormat.Testing, null, Federation, _lm, rule); return rule; }
[Test] public void TestFederationPropagationOfContentBaseFederationUpdates() { AbsoluteTopicName tn = new AbsoluteTopicName("EventTest", _base.Namespace); _base.WriteTopic(tn.LocalName, @"Stay1: hello Stay2: foo Go1: foo Go2: foo Change1: blag Change2: blag "); FederationUpdate expected = new FederationUpdate(); expected.RecordPropertyChange(tn, "_ModificationTime", FederationUpdate.PropertyChangeType.PropertyUpdate); expected.RecordPropertyChange(tn, "_Body", FederationUpdate.PropertyChangeType.PropertyUpdate); expected.RecordPropertyChange(tn, "Go1", FederationUpdate.PropertyChangeType.PropertyRemove); expected.RecordPropertyChange(tn, "Go2", FederationUpdate.PropertyChangeType.PropertyRemove); expected.RecordPropertyChange(tn, "Change1", FederationUpdate.PropertyChangeType.PropertyUpdate); expected.RecordPropertyChange(tn, "Change2", FederationUpdate.PropertyChangeType.PropertyUpdate); StartMonitoringFederationEvents(); _base.WriteTopic(tn.LocalName, @"Stay1: hello Stay2: foo Change1: new value Change2: new value "); StopMonitoringFederationEvents(); ContentBaseTests.CompareFederationUpdates(expected, _Events, false, true); }
public static Hashtable RawGetProductsFromWiki() { #if WIKI string topicName = "Orionsbelt.Shop"; AbsoluteTopicName topic = new AbsoluteTopicName(topicName); ContentBase cb = GetFederation().ContentBaseForNamespace(topic.Namespace); Hashtable categories = new Hashtable(); ArrayList current = null; using (TextReader sr = cb.TextReaderForTopic(topic)) { string line = null; while ((line = sr.ReadLine()) != null) { if (line.StartsWith("!!!")) { current = new ArrayList(); string category = line.Replace("!!!", "").Trim(); categories.Add(category, current); } if (line.StartsWith("||")) { line = line.Replace("||", "|"); string[] parts = line.Split('|'); current.Add(new ShopItem(parts[1], parts[2], parts[3])); } } return(categories); } #else return(new Hashtable()); #endif }
/// <summary> /// Adds the elements of an array to the end of this AbsoluteTopicNameCollection. /// </summary> /// <param name="items"> /// The array whose elements are to be added to the end of this AbsoluteTopicNameCollection. /// </param> public virtual void AddRange(AbsoluteTopicName[] items) { foreach (AbsoluteTopicName item in items) { this.List.Add(item); } }
private void WriteSearchResults(HtmlTextWriter writer) { string search = WikiSearch; if (search != null) { writer.WriteLine("<p>Referncias Encontradas para <b>{0}</b>:</p>", search); TopicName topicName = new AbsoluteTopicName(search); if (topicName == null) { OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.ResearchManagement, "Procura sobre " + search); } else { OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.ResearchManagement, "Procura sobre " + topicName.FormattedName); } Hashtable searchTopics = new Hashtable(); ArrayList uniqueNamespaces = new ArrayList(GetFederation().Namespaces); foreach (string ns in uniqueNamespaces) { ContentBase cb = GetFederation().ContentBaseForNamespace(ns); if (cb == null) { continue; } searchTopics[cb] = cb.AllTopics(false); } foreach (ContentBase cb in searchTopics.Keys) { string ns = cb.Namespace; writer.WriteLine("<ul>"); foreach (AbsoluteTopicName topic in (ArrayList)(searchTopics[cb])) { string s = cb.Read(topic); string bodyWithTitle = topic.ToString() + s; if (Regex.IsMatch(bodyWithTitle, search, RegexOptions.IgnoreCase)) { writer.WriteLine("<li>"); writer.WriteLine("<a title='" + topic.Fullname + "' href='" + GetUrl(topic) + "'>"); writer.WriteLine(GetDisplay(topic)); writer.WriteLine("</a>"); writer.WriteLine("</li>"); } } writer.WriteLine("</ul>"); } } else { writer.WriteLine("Pedido Invlido"); } }
private void CheckPreviewImage(HtmlTextWriter writer, AbsoluteTopicName topic) { string preview = GetTopicField(topic, "PreviewImage"); if (preview == null) { return; } writer.WriteLine("<img src='{0}' class='PreviewImage' />", preview); }
protected void DoPage() { LinkMaker lm = TheLinkMaker; string body = Request.Form["body"]; string ns = Request.Form["defaultNamespace"]; string tn = Request.Form["topic"]; AbsoluteTopicName topicName = new AbsoluteTopicName(tn, ns); Response.Write("<div class='PreviewMain'>"); Response.Write(Formatter.FormattedString(topicName, body, OutputFormat.HTML, TheFederation.ContentBaseForNamespace(ns), TheLinkMaker, null)); Response.Write("</div>"); Response.Write(@"<div id='TopicTip' class='TopicTip' ></div>"); }
public AbsoluteTopicName[] GetAllTopics(ContentBase cb) { Hashtable ns = (Hashtable) namespaces[cb.Namespace]; ArrayList atns = new ArrayList(); foreach (string topic in ns.Keys) { AbsoluteTopicName atn = new AbsoluteTopicName(); atn.Namespace = cb.Namespace; atn.Name = topic; atn.Version = GetLatestVersion((Hashtable) ns[topic]); atns.Add(atn); } return (AbsoluteTopicName[]) atns.ToArray(typeof(AbsoluteTopicName)); }
protected void ShowPage() { string topicString = Request.QueryString["topic"]; AbsoluteTopicName topic = new AbsoluteTopicName(topicString); Response.Write("<h1>All Versions for " + topic.Fullname + "</h1>"); IEnumerable changeList = TheFederation.GetTopicChanges(topic); // Now generate the page! bool first = true; string mostRecentVersion = null; foreach (TopicChange change in changeList) { if (first) mostRecentVersion = change.Version; string s = ""; if (change.Version == topic.Version || (first && topic.Version == null)) { s += "→ "; } else s += " "; if (change.Timestamp.Date == DateTime.Now.Date) s += change.Timestamp.ToString("HH:mm"); else { if (change.Timestamp.Date.Year == DateTime.Now.Date.Year) s += change.Timestamp.ToString("MMM d H:mm"); else s += change.Timestamp.ToString("MMM d yyyy H:mm"); } s += " (" + change.Author + ")"; AbsoluteTopicName linkTo = change.Topic; if (first) linkTo.Version = null; // don't include the version for the latest one Response.Write("<li><a href='" + TheLinkMaker.LinkToTopic(linkTo) + "'>" + s + "</a>"); first = false; } }
public static ArrayList GetTopicSpacedLines(string topicName) { #if WIKI AbsoluteTopicName topic = new AbsoluteTopicName(topicName); ContentBase cb = GetFederation().ContentBaseForNamespace(topic.Namespace); using (TextReader sr = cb.TextReaderForTopic(topic)) { ArrayList lines = new ArrayList(); string line = null; while ((line = sr.ReadLine()) != null) { if (line.StartsWith(" ")) { lines.Add(line.Trim()); } } return(lines); } #else return(new ArrayList()); #endif }
public void TestTopicUpdateWhenAuthorChanges() { AbsoluteTopicName tn = new AbsoluteTopicName("AuthorEventTest", _base.Namespace); FederationUpdate expected = new FederationUpdate(); expected.RecordPropertyChange(tn, "_LastModifiedBy", FederationUpdate.PropertyChangeType.PropertyUpdate); expected.RecordPropertyChange(tn, "_Body", FederationUpdate.PropertyChangeType.PropertyUpdate); expected.RecordPropertyChange(tn, "_ModificationTime", FederationUpdate.PropertyChangeType.PropertyUpdate); WriteTestTopicAndNewVersion(_base, tn.Name, "this is the original text", "pre modern man"); StartMonitoringEvents(_base); AbsoluteTopicName versioned = WriteTestTopicAndNewVersion(_base, tn.Name, "this is a change", "post modern man"); StopMonitoringEvents(_base); expected.RecordPropertyChange(versioned, "_LastModifiedBy", FederationUpdate.PropertyChangeType.PropertyAdd); expected.RecordPropertyChange(versioned, "_Body", FederationUpdate.PropertyChangeType.PropertyAdd); expected.RecordPropertyChange(versioned, "_ModificationTime", FederationUpdate.PropertyChangeType.PropertyAdd); expected.RecordPropertyChange(versioned, "_TopicName", FederationUpdate.PropertyChangeType.PropertyAdd); expected.RecordPropertyChange(versioned, "_TopicFullName", FederationUpdate.PropertyChangeType.PropertyAdd); expected.RecordPropertyChange(versioned, "_CreationTime", FederationUpdate.PropertyChangeType.PropertyAdd); CompareFederationUpdates(expected, _Events, false, true); }
/// <summary> /// Initializes a new instance of the AbsoluteTopicNameCollection class, containing elements /// copied from an array. /// </summary> /// <param name="items"> /// The array whose elements are to be added to the new AbsoluteTopicNameCollection. /// </param> public AbsoluteTopicNameCollection(AbsoluteTopicName[] items) { this.AddRange(items); }
/// <summary> /// Removes the first occurrence of a specific AbsoluteTopicName from this AbsoluteTopicNameCollection. /// </summary> /// <param name="value"> /// The AbsoluteTopicName value to remove from this AbsoluteTopicNameCollection. /// </param> public virtual void Remove(AbsoluteTopicName value) { this.List.Remove(value); }
/// <summary> /// Inserts an element into the AbsoluteTopicNameCollection at the specified index /// </summary> /// <param name="index"> /// The index at which the AbsoluteTopicName is to be inserted. /// </param> /// <param name="value"> /// The AbsoluteTopicName to insert. /// </param> public virtual void Insert(int index, AbsoluteTopicName value) { this.List.Insert(index, value); }
public void RestoreTopic(AbsoluteTopicName topicName, string visitorIdentityString, string version) { this.Invoke("RestoreTopic", new object[] { topicName, visitorIdentityString, version}); }
public string GetTextForTopic(AbsoluteTopicName topicName) { object[] results = this.Invoke("GetTextForTopic", new object[] { topicName}); return ((string)(results[0])); }
public string GetHtmlForTopicVersion(AbsoluteTopicName topicName, string version) { object[] results = this.Invoke("GetHtmlForTopicVersion", new object[] { topicName, version}); return ((string)(results[0])); }
/// <remarks/> public System.IAsyncResult BeginRestoreTopic(AbsoluteTopicName topicName, string visitorIdentityString, string version, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("RestoreTopic", new object[] { topicName, visitorIdentityString, version}, callback, asyncState); }
/// <remarks/> public System.IAsyncResult BeginGetPreviewForTopic(AbsoluteTopicName topicName, string textToFormat, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetPreviewForTopic", new object[] { topicName, textToFormat}, callback, asyncState); }
/// <summary> /// Adds an instance of type AbsoluteTopicName to the end of this AbsoluteTopicNameCollection. /// </summary> /// <param name="value"> /// The AbsoluteTopicName to be added to the end of this AbsoluteTopicNameCollection. /// </param> public virtual void Add(AbsoluteTopicName value) { this.List.Add(value); }
public void TestTopicUpdateEvent() { AbsoluteTopicName tn = new AbsoluteTopicName("EventTest", _base.Namespace); FederationUpdate expected = new FederationUpdate(); expected.RecordUpdatedTopic(tn); _base.WriteTopic(tn.LocalName, "hello"); StartMonitoringEvents(_base); _base.WriteTopic(tn.LocalName, "second should be an update"); StopMonitoringEvents(_base); CompareFederationUpdates(expected, _Events, true, false); }
/// <remarks/> public System.IAsyncResult BeginGetHtmlForTopicVersion(AbsoluteTopicName topicName, string version, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetHtmlForTopicVersion", new object[] { topicName, version}, callback, asyncState); }
static void ComparePropertyUpdatesForVerb(AbsoluteTopicName t, IList expectedProperties, IList gotProperties, string verb) { foreach (string propertyName in expectedProperties) { bool found = gotProperties.Contains(propertyName); if (!found) System.Diagnostics.Debug.WriteLine("ACK!"); Assert.IsTrue(found, "Missing " + verb + " property (" + propertyName + " in " + t.FullnameWithVersion + ") from fired event(s)"); gotProperties.Remove(propertyName); } if (gotProperties.Count == 0) return; // good -- there should be none left string s = ""; foreach (string p in gotProperties) { if (s != "") s += ", "; s += p; } Assert.Fail("Unexpected " + verb + " property notifications for: " + s); }
/// <remarks/> public System.IAsyncResult BeginGetVersionsForTopic(AbsoluteTopicName topicName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetVersionsForTopic", new object[] { topicName}, callback, asyncState); }
private void GetVersionsForTopic(AbsoluteTopicName topicName) { flatComboBoxVersion.Items.Clear(); buttonItemRestore.Enabled = false; string[] versions = editService.GetVersionsForTopic(topicName); if (versions.Length > 0) { foreach (string s in versions) { flatComboBoxVersion.Items.Add(s); } flatComboBoxVersion.SelectedIndex = 0; } }
/// <remarks/> public System.IAsyncResult BeginSetTextForTopic(AbsoluteTopicName topicName, string postedTopicText, string visitorIdentityString, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("SetTextForTopic", new object[] { topicName, postedTopicText, visitorIdentityString}, callback, asyncState); }
private void htmlEditor1_BeforeNavigate(object s, onlyconnect.BeforeNavigateEventArgs e) { Console.WriteLine(e.NewTarget); string[] splitUrl = e.Target.Split('/'); string fullName = splitUrl[splitUrl.Length-1]; string[] split = fullName.Split('.'); if (split.Length == 2) { AbsoluteTopicName currentTopicName = new AbsoluteTopicName(); currentTopicName.Fullname = fullName; currentTopicName.Namespace = split[0]; currentTopicName.Name = split[1]; if (currentTopicName.Namespace == currentContentBase.Namespace) { foreach (ListViewItem lvi in listViewTopicNames.Items) { AbsoluteTopicName topicName = (AbsoluteTopicName)lvi.Tag; if (currentTopicName.Name == topicName.Name) { lvi.Selected = true; e.Cancel = true; break; } } } else { foreach(ContentBase cb in contentBases) { if (cb.Namespace == currentTopicName.Namespace ) { comboBoxContentBase.SelectedValue = currentTopicName.Namespace; foreach (ListViewItem lvi in listViewTopicNames.Items) { AbsoluteTopicName topicName = (AbsoluteTopicName)lvi.Tag; if (currentTopicName.Name == topicName.Name) { lvi.Selected = true; e.Cancel = true; break; } } } } } } }
public string GetPreviewForTopic(AbsoluteTopicName topicName, string textToFormat) { object[] results = this.Invoke("GetPreviewForTopic", new object[] { topicName, textToFormat}); return ((string)(results[0])); }
private void LoadTopic(AbsoluteTopicName topicName) { isLoading = true; currentTopicName = topicName; // HACK: need to add this div tag so that the ToolTip's work. htmlEditor1.LoadDocument("<div id='TopicTip' class='TopicTip' ></div>" + editService.GetHtmlForTopic(topicName)); richTextBox1.Text = editService.GetTextForTopic(topicName); GetVersionsForTopic(topicName); isLoading = false; }
public string[] GetVersionsForTopic(AbsoluteTopicName topicName) { object[] results = this.Invoke("GetVersionsForTopic", new object[] { topicName}); return ((string[])(results[0])); }
/// <summary> /// Determines whether a specfic AbsoluteTopicName value is in this AbsoluteTopicNameCollection. /// </summary> /// <param name="value"> /// The AbsoluteTopicName value to locate in this AbsoluteTopicNameCollection. /// </param> /// <returns> /// true if value is found in this AbsoluteTopicNameCollection; /// false otherwise. /// </returns> public virtual bool Contains(AbsoluteTopicName value) { return this.List.Contains(value); }
public void SetTextForTopic(AbsoluteTopicName topicName, string postedTopicText, string visitorIdentityString) { this.Invoke("SetTextForTopic", new object[] { topicName, postedTopicText, visitorIdentityString}); }
/// <summary> /// Return the zero-based index of the first occurrence of a specific value /// in this AbsoluteTopicNameCollection /// </summary> /// <param name="value"> /// The AbsoluteTopicName value to locate in the AbsoluteTopicNameCollection. /// </param> /// <returns> /// The zero-based index of the first occurrence of the _ELEMENT value if found; /// -1 otherwise. /// </returns> public virtual int IndexOf(AbsoluteTopicName value) { return this.List.IndexOf(value); }