Re: [Mono-dev] [PATCH] Monodoc: Add contribution links to home page

2005-08-26 Thread Mario Sopena
Hi,

 Restore is less frightening than Delete, but it works better for
 changes than for additions so I feel the
 The dialog helps filter unintended or not ready contributions (either
 changes and additions). I the dialog you'd need to have a way to
 Restore/Delete unintended contributions and other to Select those
 to be uploaded, as they may yeld different sets.
 
 This dialog, or some other derived from it, may help also in
 navigating through the pending contributions (the ones not yet ready
 to be uploaded) as the work on them may span many sessions inside the
 documentation browser.
 

I've added to the patch the dialog thing, to see an screenshot look
here: 
http://msopena.blogspot.com/2005/08/contributor-experiencetm-revisited.html

There is the possibility to:
- open selected contribution
- restore/delete selected contribution
- upload only the marked ones

Of course that only works with contributions writen after the patch.
The old ones are automatically sent in the first upload being made (at
least the program shows at the root page how many of those
contributions are left, as well as new contributions with a link).

I've tried several times the upload process and everything seems ok
(sorry if I have sent several mini-contributions to the docs).

Ok to commit?

Mario
Index: docbrowser/GeckoHtmlRender.cs
===
--- docbrowser/GeckoHtmlRender.cs	(revision 48726)
+++ docbrowser/GeckoHtmlRender.cs	(working copy)
@@ -48,7 +48,6 @@
 	protected void OnOpenUri (object o, OpenUriArgs args)
 	{
 		url = CheckUrl (args.AURI);
-		System.Console.WriteLine (Abriendo:{0}:{1}:, url, args.AURI);
 		if (UrlClicked != null)
 			UrlClicked (this, new EventArgs());
 		args.RetVal = true; //this prevents Gecko to continue processing
Index: docbrowser/ChangeLog
===
--- docbrowser/ChangeLog	(revision 48726)
+++ docbrowser/ChangeLog	(working copy)
@@ -1,3 +1,16 @@
+2005-08-22 Mario Sopena Novales [EMAIL PROTECTED]
+	* browser.cs:
+		- Update the treeview everytime we change the tab
+		- Added a new CurrentNode property to Tabs
+		- Added a new class Contributions (Contributions window)
+		- update the save process to include the new NodeUrl property
+		- update the serial of not uploaded changes after a successful upload
+		- dont set the browser mode to viewer every time a row is activated
+	* browser.glade: 
+		- Change the upload contributions menu to Contributions
+		- Add the Contributions window
+	* GeckoHtmlRender.cs: cleaned
+	
 2005-08-17 Mario Sopena Novales [EMAIL PROTECTED]
 	* browser.cs: Added Menu Items for changing the font size when using 
 	gecko. Also added a Reload function.
Index: docbrowser/browser.cs
===
--- docbrowser/browser.cs	(revision 48726)
+++ docbrowser/browser.cs	(working copy)
@@ -307,6 +307,9 @@
 		} else {
 			paste1.Sensitive = true;
 		}
+		
+		if (tree_browser.SelectedNode != CurrentTab.CurrentNode)
+			tree_browser.ShowNode (CurrentTab.CurrentNode);
 	}
 	//
 	// Reload current page
@@ -451,6 +454,7 @@
 	public void Render (string text, Node matched_node, string url)
 	{
 		CurrentUrl = url;
+		CurrentTab.CurrentNode = matched_node;
 		CurrentTab.html.Render(text);
 		if (matched_node != null) {
 			if (tree_browser.SelectedNode != matched_node)
@@ -740,7 +744,124 @@
 		About.Show (this);
 	}
 
-	void OnUpload (object sender, EventArgs a)
+	void OnContrib (object sender, EventArgs a) 
+	{
+		Contributions.Show (this);
+	}
+
+	class Contributions {
+		[Glade.Widget] Window contribs;
+		[Glade.Widget] TreeView contrib_tree;
+		[Glade.Widget] Button contrib_open;
+		[Glade.Widget] Button contrib_restore;
+		ListStore contrib_store;
+
+		static Contributions ContribBox;
+		Browser parent;
+		GlobalChangeset chgs;
+
+		Contributions (Browser parent)
+		{
+			Glade.XML ui = new Glade.XML (null, browser.glade, contribs, null);
+			ui.Autoconnect (this);
+			this.parent = parent;
+			contribs.TransientFor = parent.window1;
+
+			contrib_store = new ListStore (typeof (bool), typeof (string), typeof (Change));
+
+			chgs = EditingUtils.changes;
+			contrib_tree.Selection.Changed += new EventHandler (OnSelectionChg);
+
+			contrib_tree.Model = contrib_store;
+			
+			// columns
+			CellRendererToggle toggle_cell = new CellRendererToggle ();
+			toggle_cell.Toggled += new ToggledHandler (OnToggleCell);
+			contrib_tree.AppendColumn (upload, toggle_cell, active, 0);
+			contrib_tree.AppendColumn (node_url, new CellRendererText (), text, 1);
+		}
+		static public void Show (Browser parent)
+		{
+			if (ContribBox == null)
+ContribBox = new Contributions (parent);
+
+			ContribBox.Load ();
+			ContribBox.contribs.ShowAll ();
+
+		}
+		void Load ()
+		{
+			contrib_store.Clear ();
+			foreach (DocSetChangeset dscs in chgs.DocSetChangesets) 
+foreach (FileChangeset fcs in dscs.FileChangesets) 
+	

[Mono-dev] [PATCH] Monodoc: Add contribution links to home page

2005-08-22 Thread Mario Sopena
Hey,

   here is the patch to add links to contributions at the home page.
When there are no contributions a text is shown (please someone revise
it since I'm not english spoken person). To add the links I've added a
new NodeUrl property to Change objects. That means that contributions
made before this patch will not show a link (although the text saying
the number of contributions left to send does include them).

 I've added a new GetNiceUrl method to obtain url of the type
T:System.String from a node, since I didn't found a better way to get
the contribution url.

  I'm thinking now in a method to delete contributions and I have two ideas:
  * a delete link at the home page
  * When you are editing a node, a new button called Restore
  * A new Menu entry that pops up a dialog showing a table with your
contributions that lets you delete them and select which ones do you
want to upload
Which one do you think is better? All of them?

Mario.
Index: browser/editing.cs
===
--- browser/editing.cs	(revision 48386)
+++ browser/editing.cs	(working copy)
@@ -80,7 +80,7 @@
 
 		}
 		
-		public static void SaveChange (string url, RootTree tree, XmlNode node)
+		public static void SaveChange (string url, RootTree tree, XmlNode node, string node_url)
 		{
 			string [] uSplit = ParseEditUrl (url);
 		
@@ -91,7 +91,7 @@
 int prov = int.Parse (uSplit [0].Substring(monodoc://.Length));
 HelpSource hs = tree.GetHelpSourceFromId (prov);
 
-changes.AddChange (hs.Name, hs.GetRealPath (id), xp, node);
+changes.AddChange (hs.Name, hs.GetRealPath (id), xp, node, node_url);
 changes.Save ();
 			} else if (uSplit[0].StartsWith(file:)) {
 uSplit[0] = uSplit[0].Substring(5);
@@ -265,11 +265,12 @@
 			}
 		}
 
-		Change NewChange (string xpath, XmlNode new_node)
+		Change NewChange (string xpath, XmlNode new_node, string node_url)
 		{
 			Change new_change = new Change ();
 			new_change.XPath = xpath;
 			new_change.NewNode = new_node;
+			new_change.NodeUrl = node_url;
 
 			Console.WriteLine (New serial: + SettingsHandler.Settings.SerialNumber);
 			new_change.Serial = SettingsHandler.Settings.SerialNumber;
@@ -277,10 +278,10 @@
 			return new_change;
 		}
 		
-		public void AddChange (string doc_set, string real_file, string xpath, XmlNode new_node)
+		public void AddChange (string doc_set, string real_file, string xpath, XmlNode new_node, string node_url)
 		{
 			FileChangeset new_file_change_set;
-			Change new_change = NewChange (xpath, new_node);
+			Change new_change = NewChange (xpath, new_node, node_url);
 			
 			if (real_file == null)
 throw new Exception (Could not find real_file. Please talk to Miguel or Ben about this);
@@ -391,6 +392,7 @@
 	public class Change {
 		[XmlAttribute] public string XPath;
 		[XmlAttribute] public int FromVersion = RootTree.MonodocVersion;
+		[XmlAttribute] public string NodeUrl;
 		
 		public XmlNode NewNode;
 
Index: browser/provider.cs
===
--- browser/provider.cs	(revision 48618)
+++ browser/provider.cs	(working copy)
@@ -1086,6 +1086,7 @@
 		return (HelpSource) help_sources [id];
 	}
 	
+	string home_cache;
 	/// summary
 	///Allows every HelpSource to try to provide the content for this
 	///URL.
@@ -1095,12 +1096,69 @@
 		lastHelpSourceTime = DateTime.MinValue;
 		if (url == root:) {
 			match_node = this;
-			StringBuilder sb = new StringBuilder (table bgcolor=\#b0c4de\ width=\100%\ cellpadding=\5\trtdh3Mono Documentation Library/h3/td/tr/table);
+
+			// look whether there are contribs
+			GlobalChangeset chgs = GlobalChangeset.Load ();
+			string contrib = chgs.Count == 1?There is {0} contribution:There are {0} contributions;
+			StringBuilder con = new StringBuilder ();
+			con.Append (String.Format (contrib, chgs.Count) +  for uploading i(Menu -- Upload Contributions)/i);
+			//add links to the contrib
+			con.Append (ul);
+			foreach (DocSetChangeset dscs in chgs.DocSetChangesets) 
+foreach (FileChangeset fcs in dscs.FileChangesets) 
+	foreach (Change c in fcs.Changes) 
+		if (c.NodeUrl != null)
+			con.Append (String.Format (lia href=\{0}\{0}/a/li, c.NodeUrl));
+		
+			con.Append (/ul);
+			if (!HelpSource.use_css) {
+StringBuilder sb = new StringBuilder (table bgcolor=\#b0c4de\ width=\100%\ cellpadding=\5\trtdh3Mono Documentation Library/h3/td/tr/table);
 			
-			foreach (Node n in Nodes)
-sb.AppendFormat (a href='{0}'{1}/abr/, n.Element, n.Caption);
+foreach (Node n in Nodes)
+	sb.AppendFormat (a href='{0}'{1}/abr/, n.Element, n.Caption);
 			
-			return sb.ToString ();	
+//contributions
+sb.Append (brtable bgcolor=\#fff3f3\ width=\100%\ cellpadding=\5\trtd);
+sb.Append (h5Contributions/h5br);
+if (chgs.Count == 0) {
+	sb.Append (pbYou don't have any contribution yet./b/p);
+	sb.Append (pThe Documentation of the libraries is not complete and 

Re: [Mono-dev] [PATCH] Monodoc: Add contribution links to home page

2005-08-22 Thread Rafael Teixeira
Hi Mario,

On 8/22/05, Mario Sopena [EMAIL PROTECTED] wrote:
 
   I'm thinking now in a method to delete contributions and I have two ideas:
   * a delete link at the home page
   * When you are editing a node, a new button called Restore
   * A new Menu entry that pops up a dialog showing a table with your
 contributions that lets you delete them and select which ones do you
 want to upload
 Which one do you think is better? All of them?

I would like to have the last two. 

Rationales:
Restore is less frightening than Delete, but it works better for
changes than for additions so I feel the
The dialog helps filter unintended or not ready contributions (either
changes and additions). I the dialog you'd need to have a way to
Restore/Delete unintended contributions and other to Select those
to be uploaded, as they may yeld different sets.

This dialog, or some other derived from it, may help also in
navigating through the pending contributions (the ones not yet ready
to be uploaded) as the work on them may span many sessions inside the
documentation browser.

Thanks for your hard work,

-- 
Rafael Monoman Teixeira
---
I'm trying to become a Rosh Gadol before my own eyes. 
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list