[Mono-docs-list] Monodoc aspx .1

Ben Maurer bmaurer@users.sourceforge.net
13 Jul 2003 21:01:16 -0500


--=-eNU8A1IJvUUAuuG2QRIX
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Ok, here are some new install instructions. It is much easier this time
;-).

     1. Install all attached patches
     2. In website-handler.cs change my install path to yours
     3. make install in monodoc, then xsp
     4. cd xsp/server/test
     5. mono server.exe
     6. Visit localhost:8080/web.mdoc
-- Ben

--=-eNU8A1IJvUUAuuG2QRIX
Content-Disposition: attachment; filename=monodoc-root-urls.patch
Content-Type: text/x-patch; name=monodoc-root-urls.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

Index: .cvsignore
===================================================================
RCS file: /cvs/public/monodoc/browser/.cvsignore,v
retrieving revision 1.3
diff -u -r1.3 .cvsignore
--- .cvsignore	14 Jul 2003 00:40:30 -0000	1.3
+++ .cvsignore	14 Jul 2003 01:39:07 -0000
@@ -1,3 +1,4 @@
+*.dll
 *dbg
 *tree
 Makefile
Index: ChangeLog
===================================================================
RCS file: /cvs/public/monodoc/browser/ChangeLog,v
retrieving revision 1.46
diff -u -r1.46 ChangeLog
--- ChangeLog	11 Jul 2003 02:00:07 -0000	1.46
+++ ChangeLog	14 Jul 2003 01:39:07 -0000
@@ -1,3 +1,14 @@
+2003-07-13  Ben Maurer <bmaurer@users.sourceforge.net>
+	* browser.cs: Added support for visiting nodes from the root tree.
+	ie, the root: urls.
+	* ecma-provider.cs: Render the root: url with a list of namespaces
+	* provider.cs: Send the root:/xxx to the help sources. Handle
+	root:
+	* xhtml-provider.cs: handle root:. Returns the inner html of <body> like
+	other providers
+	* monohb-provider.cs: Fix typo that makes header purple in moz. return
+	the <body> node, not <html>. 
+
 2003-07-10  Ben Maurer <bmaurer@users.sourceforge.net>
 
 	* mono-ecma.xsl: Don't generate the excess monodoc namespaces.
Index: browser.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/browser.cs,v
retrieving revision 1.38
diff -u -r1.38 browser.cs
--- browser.cs	13 Jul 2003 22:23:21 -0000	1.38
+++ browser.cs	14 Jul 2003 01:39:07 -0000
@@ -530,10 +530,16 @@
 
 		public override void Go ()
 		{
+			string res;
 			Node x;
 			
-			string res = n.tree.HelpSource.GetText (url, out x);
-			((Browser)browser).Render (res, n, url);
+			// The root tree has no help source
+			if (n.tree.HelpSource != null)
+				res = n.tree.HelpSource.GetText (url, out x);
+			else
+				res = ((RootTree)n.tree).RenderUrl (url, out x);
+					
+			browser.Render (res, n, url);
 		}
 	}
 
@@ -555,23 +561,25 @@
 
 		if (tree_view.Selection.GetSelected (out model, ref iter)){
 			Node n = (Node) iter_to_node [iter];
-
-			if (n.tree.HelpSource == null)
-				return;
-
-			string url = n.URL;
 			
-			//
-			// Try the tree-based urls first.
-			//
+			string url = n.URL;
 			Node match;
-			string s = n.tree.HelpSource.GetText (url, out match);
-			if (s != null){
-				((Browser)browser).Render (s, null, url);
-				browser.history.AppendHistory (new NodePageVisit (browser, n, url));
-				return;
+			string s;
+			
+			if (n.tree.HelpSource != null)
+			{
+				//
+				// Try the tree-based urls first.
+				//
+				
+				s = n.tree.HelpSource.GetText (url, out match);
+				if (s != null){
+					((Browser)browser).Render (s, null, url);
+					browser.history.AppendHistory (new NodePageVisit (browser, n, url));
+					return;
+				}
 			}
-
+			
 			//
 			// Try the url resolver next
 			//
Index: ecma-provider.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/ecma-provider.cs,v
retrieving revision 1.52
diff -u -r1.52 ecma-provider.cs
--- ecma-provider.cs	13 Jul 2003 22:23:21 -0000	1.52
+++ ecma-provider.cs	14 Jul 2003 01:39:07 -0000
@@ -385,6 +385,17 @@
 	public override string GetText (string url, out Node match_node)
 	{
 		match_node = null;
+		
+		if (url == "root:")
+		{
+			StringBuilder sb = new StringBuilder ();
+			
+			foreach (Node ns_node in Tree.Nodes)
+				sb.AppendFormat ("<a href='{0}'>{1}</a></br>", ns_node.Element, ns_node.Element.Substring (2));				
+				
+			return sb.ToString ();
+		}
+		
 		if (url.StartsWith ("ecma:"))
 			return GetTextFromUrl (url);
 
Index: monohb-provider.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/monohb-provider.cs,v
retrieving revision 1.5
diff -u -r1.5 monohb-provider.cs
--- monohb-provider.cs	13 Jul 2003 22:23:21 -0000	1.5
+++ monohb-provider.cs	14 Jul 2003 01:39:07 -0000
@@ -29,7 +29,7 @@
 			string cssClass = ((XmlElement)node).GetAttribute("class");
 			if (cssClass != null && (cssClass == "topframe" || cssClass == "navbar" || cssClass == "copyright"))
 			{
-				node.RemoveAll();
+				node.ParentNode.RemoveChild (node);
 			}
                                                                                 
 		}
@@ -62,7 +62,7 @@
 		bodynode.RemoveChild(firstheading);
 
 	bodynode.InnerXml =	"<table width=\"100%\">" +
-			"<tr bgcolor=\"#b0c4dae\"><td><i></i>Mono Handbook<h3>" + headinginner + "</h3></td></tr></table><p />" +
+			"<tr bgcolor=\"#b0c4de\"><td><i></i>Mono Handbook<h3>" + headinginner + "</h3></td></tr></table><p />" +
 	bodynode.InnerXml;
 }
 catch {
@@ -126,7 +126,9 @@
 
 		}
 	}
-		return docToProcess;
+		XmlDocument ret = new XmlDocument ();
+		ret.LoadXml (docToProcess.GetElementsByTagName("body")[0].OuterXml);
+		return ret;
 	}
 }
 }
Index: provider.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/provider.cs,v
retrieving revision 1.36
diff -u -r1.36 provider.cs
--- provider.cs	13 Jul 2003 22:23:21 -0000	1.36
+++ provider.cs	14 Jul 2003 01:39:07 -0000
@@ -644,6 +644,7 @@
 				if (hs == null)
 					continue;
 				root.help_sources.Add (hs);
+				root.name_to_hs [path] = hs;
 
 				Node parent = (Node) root.name_to_node [path];
 				if (parent == null){
@@ -664,6 +665,7 @@
 	// Maintains the name to node mapping
 	//
 	Hashtable name_to_node = new Hashtable ();
+	Hashtable name_to_hs = new Hashtable ();
 	
 	void Populate (Node parent, XmlNodeList xml_node_list)
 	{
@@ -681,7 +683,7 @@
 			}
 			string name = e.InnerText;
 
-			Node n = parent.LookupNode (label, name);
+			Node n = parent.LookupNode (label, "root:/" + name);
 			n.EnsureNodes ();
 			name_to_node [name] = n;
 			XmlNodeList children = xml_node.SelectNodes ("./node");
@@ -815,7 +817,20 @@
 	///    URL.
 	/// </summary>
 	public string RenderUrl (string url, out Node match_node)
-	{
+	{	
+		if (url.StartsWith ("root:"))
+		{
+			match_node = null;
+			if (url == "root:") {
+				StringBuilder sb = new StringBuilder ("<h1>Welcome to Monodoc</h1>");
+				foreach (Node n in Nodes)
+					sb.AppendFormat ("<a href='{0}'>{1}</a></br>", n.Element, n.Caption);
+				return sb.ToString ();
+				
+			} else
+				return ((HelpSource)name_to_hs [url.Substring (6)]).GetText ("root:", out match_node);
+		}
+		
 		if (url.StartsWith ("source-id:")){
 			string rest = url.Substring (10);
 			int p = rest.IndexOf (":");
Index: xhtml-provider.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/xhtml-provider.cs,v
retrieving revision 1.12
diff -u -r1.12 xhtml-provider.cs
--- xhtml-provider.cs	13 Jul 2003 22:23:21 -0000	1.12
+++ xhtml-provider.cs	14 Jul 2003 01:39:07 -0000
@@ -56,6 +56,27 @@
 	public override string GetText (string url, out Node match_node)
 	{
 		match_node = null;
+		
+		if (url == "root:") {
+			StringBuilder sb = new StringBuilder ();
+			foreach (Node n in Tree.Nodes) {
+				if (n.IsLeaf) { 
+					sb.AppendFormat ("<a href='{0}'>{1}</a></br>", 
+						n.Element.Replace ("source-id:NNN", "source-id:" + SourceID), 
+						n.Caption);
+				} else {
+					sb.AppendFormat ("<h2>{0}</h2>", n.Caption);
+					foreach (Node subNode in n.Nodes) {
+						sb.AppendFormat ("<a href='{0}'>{1}</a></br>", 
+							subNode.Element.Replace ("source-id:NNN", "source-id:" + SourceID), 
+							subNode.Caption);
+					}
+				}
+			}
+			
+			return sb.ToString ();
+		}
+		
 		if (url.IndexOf (XHTML_PREFIX) > -1)
 			return GetTextFromUrl (url);
 
@@ -228,7 +249,7 @@
 			
 			XmlDocument processedDoc = ProcessContent(newdoc);
 			XmlDocument docForMonodoc = RewriteLinks(processedDoc, url);
-			return docForMonodoc.InnerXml;
+			return docForMonodoc.DocumentElement.InnerXml; // get rid of <body>
 		}
 
 		else if (s != null && (fname.EndsWith (".gif") || fname.EndsWith (".jpeg") || fname.EndsWith (".jpg")  || fname.EndsWith(".png")))

--=-eNU8A1IJvUUAuuG2QRIX
Content-Disposition: attachment; filename=xml-dont-freeze-in-aspx.patch
Content-Type: text/x-patch; name=xml-dont-freeze-in-aspx.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

Index: XmlUrlResolver.cs
===================================================================
RCS file: /cvs/public/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs,v
retrieving revision 1.7
diff -u -r1.7 XmlUrlResolver.cs
--- XmlUrlResolver.cs	19 Jun 2003 20:00:43 -0000	1.7
+++ XmlUrlResolver.cs	14 Jul 2003 01:40:06 -0000
@@ -42,6 +42,9 @@
 		[MonoTODO("Use Credentials; Uri must be absolute.")]
 		public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn)
 		{
+			if (absoluteUri.Scheme == "file")
+				return new FileStream (absoluteUri.LocalPath, FileMode.Open, FileAccess.Read, FileShare.Read);
+
 			// (MS documentation says) parameter role isn't used yet.
 			Stream s = null;
 			using (s) {

--=-eNU8A1IJvUUAuuG2QRIX
Content-Disposition: attachment; filename=xsp-use-mdoc.patch
Content-Type: text/x-patch; name=xsp-use-mdoc.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

Index: web.config
===================================================================
RCS file: /cvs/public/xsp/test/web.config,v
retrieving revision 1.1
diff -u -r1.1 web.config
--- web.config	9 Jul 2003 19:22:39 -0000	1.1
+++ web.config	14 Jul 2003 01:48:34 -0000
@@ -10,6 +10,9 @@
 		</webServices>
 		<authentication mode= "Forms">
 	    </authentication>
+	    <httpHandlers>
+			<add verb="*" path="monodoc.web" type="Mono.Website.Handlers.MonodocHandler,Mono.Website.Handlers" />
+		</httpHandlers> 
     </system.web>
     <appSettings>
 	<add key="MonoServerDefaultIndexFiles"

--=-eNU8A1IJvUUAuuG2QRIX--