[Mono-docs-list] Monodoc web browser patch
Fawad Halim
fawad@fawad.net
Thu, 09 Oct 2003 16:55:59 -0500
This is a multi-part message in MIME format.
--------------030009060500030307040208
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
Attached is a tiny patch to the monodoc web browser. It's an effort
to mimic the behavior of MSDN library docs, i.e. each doc gets a unique
URL and that gets rendered in the frameset.
* index.aspx is a replacement of index.html: If passed any arguments on
the querystring, they are passed on to the content frame in it's
frameset. If no arguments are passed, it loads the root document like
index.html
* monodoc.ashx.diff: Diff against the monodoc handler in CVS. I've added
3 lines in the javascript for the tlink: handler that uses index.aspx to
put itself in the frameset. For example, if we browse to
http://localhost:8080/monodoc.ashx?tlink=6@N%3ASystem in a new window,
it loads http://localhost:8080/index.aspx?tlink=6@N%3ASystem with
http://localhost:8080/monodoc.ashx?tlink=6@N%3ASystem in the contents frame.
TODO: Get the navigation tree to open up to the selected element.
Regards
-fawad
--------------030009060500030307040208
Content-Type: text/plain;
name="monodoc.ashx.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="monodoc.ashx.diff"
Index: monodoc.ashx
===================================================================
RCS file: /mono/monodoc/browser/web/monodoc.ashx,v
retrieving revision 1.18
diff -r1.18 monodoc.ashx
206a207,211
> if (top.location == document.location)
> {
> top.location.href = 'index.aspx'+document.location.search;
> }
>
--------------030009060500030307040208
Content-Type: text/plain;
name="index.aspx"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="index.aspx"
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Collections.Specialized" %>
<html>
<head>
<title>Mono Documentation</title>
</head>
<script language="c#" runat="server">
// Get the path to be shown in the content fram
string getContentFrame()
{
// Docs get shown from monodoc.ashx
string monodocUrl="monodoc.ashx";
string defaultParams="?link=root:";
NameValueCollection qStringParams=Request.QueryString;
// If no querystring params, show root link
if(!qStringParams.HasKeys())
return(monodocUrl+defaultParams);
// else, build query for the content frame
string nQueryString=monodocUrl+"?";
foreach(string key in qStringParams)
nQueryString+=(HttpUtility.UrlEncode(key)+"="+HttpUtility.UrlEncode(qStringParams[key]));
return nQueryString;
}
</script>
<frameset cols="20%,80%">
<frame src="monodoc.ashx?tree=boot">
<frame src="<% =getContentFrame() %>" name="content">
</frameset>
</html>
--------------030009060500030307040208--