diff options
author | Nina Vyedin <nina.vyedin@gmail.com> | 2013-03-05 07:49:56 +0400 |
---|---|---|
committer | Nina Vyedin <nina.vyedin@gmail.com> | 2013-03-05 07:49:56 +0400 |
commit | 5f38365589683e07f57bae32cb285ac3ef0bcabf (patch) | |
tree | 74f039cba1ce0b20014ee0f9b51fa526ce7f578e /webdoc | |
parent | 0ca6f3d2bf1b3eebc646240bde1dc8f72b640820 (diff) |
[webdoc] do some initial edits to Global and index to clean up messy, old code
Diffstat (limited to 'webdoc')
-rw-r--r-- | webdoc/common.css | 216 | ||||
-rw-r--r-- | webdoc/index.aspx | 120 | ||||
-rw-r--r-- | webdoc/monodoc.ashx | 197 | ||||
-rw-r--r-- | webdoc/web.config | 11 |
4 files changed, 204 insertions, 340 deletions
diff --git a/webdoc/common.css b/webdoc/common.css index 25ba3848..0feaef4a 100644 --- a/webdoc/common.css +++ b/webdoc/common.css @@ -1,206 +1,30 @@ +/*****Common.css*****/ +/*bare-bones css for most layouts*/ body { - background-color: #ffffff; - margin: 0px; - padding: 0px; + padding: 0; } - -.HeaderTable { - border: 2px solid #99aadd; -} - -body, td, th { - font-family: Verdana, sans-serif; font-size: 12px; - color: black; -} - -.SignatureTable, .MemberSignatureTable { - border: 1px solid #DDDDDD; -} - -.Footer { - border-top: 2px solid #E5E5E5; - padding-left: 1em; -} - -.Footer hr { - display: none; -} - -h1, h2, h3, h4 { - font-family: Verdana,sans-serif; - font-weight: bold; -} - -h1 { -} - -h3 { -} - -h4 { -} - -.MasterNamespaceLink a { - font-weight: bold; - text-decoration: none; -} -.MasterNamespaceDescription { - margin-left: 2em; -} - -img { - border: 0; - vertical-align: top; -} - -.copyright { - border:1px solid black; - padding-left:5px; - padding-right:5px; - padding-top:5px; - padding-bottom:5px; - background-color:#BEBAA8; - font-size:9px; - margin-top: 10pt; - margin-left: -15pt; - margin-right: -15pt; -} - -.important { - padding-left:2px; - padding-right:2px; - padding-top:2px; - padding-bottom:2px; - background-color:#000000; - color:#ffffff; -} - -.menu { - font-family:Arial, Verdana; - font-size:12px; - font-weight:bold; -} - -.navbar{ - color:black; - font-family:Arial, Verdana; - font-size:10px; - border-bottom:1px solid #000000; - border-left:1px solid black; - border-right:1px solid black; - background-color:#efefef; - padding-left:2px; - padding-right:2px; - padding-top:2px; - padding-bottom:2px; - margin-left: -15pt; - margin-right: -15pt; +html { + padding: 0; + margin: 0 auto; } - -.topframe { - background-image:url(images/backbig.png); - border:1px solid #000000; - background-color:#BEBAA8; - margin-left: -15pt; - margin-right: -15pt; -} - -.chapter { - font-size:14px; - font-weight:bold; - color:#444444; - padding-left:0px; - padding-right:0px; - padding-top:0px; - padding-bottom:0px; -} - -.table { - padding-left:2px; - padding-right:2px; - padding-top:0px; - padding-bottom:0px; - background-color:#efefef; - border:1px solid #c0c0c0; -} - -.elementOn { - color:#a40000; -} - -.element { - color:#0000a4; -} - .code { - font-size: small; - font-family: "Courier New", Courier; - line-height:110%; -} - -.box { - padding:15px; - font-size: small; - background:whitesmoke; - border: solid 1px silver; -} - -.console { - border-style: solid; - background: whitesmoke; - border-width: 1px; - padding: 2pt; - margin:15px; + font-family: "Courier New", Courier; } - -.headerlink { - vertical-align:bottom; -} - -a { - color: blue; -} -a:visited { - color: blue; -} - -td a { - text-decoration: none; -} - -.HeaderTable a { - color: black; - text-decoration: underline; +.table { + padding-left:2px; + padding-right:2px; + padding-top:0px; + padding-bottom:0px; } - div.Content { - margin-right: 1em; -} - -div.related ul { - list-type: none; - padding-left: 1em; + margin-right: 1em; } - -.native-browser { - font-family: "Lucida Grande", Geneva, Helvetica, Arial, Verdana, Sans-Serif; - display: inline-block; - color: #333 !important; - text-decoration:none !important; - font-size: 88%; - padding: 4px 10px 4px 10px; - border: 1px solid silver; - border-bottom-color: #bcbcbc; - border-radius: 3px; - background: #f2f2f2; -} - -.native-browser:hover { - background: #ddd; - color: black; +iframe { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; } -.native-browser img { - vertical-align: center; - margin-right: 3px; -}
\ No newline at end of file diff --git a/webdoc/index.aspx b/webdoc/index.aspx index 28511e4f..12b7a7e0 100644 --- a/webdoc/index.aspx +++ b/webdoc/index.aspx @@ -1,45 +1,47 @@ <%@ Page Language="C#" ClassName="Mono.Website.Index" %> <%@ Import Namespace="System.Web" %> <%@ Import Namespace="System.Collections.Specialized" %> +<%@ Import Namespace="System.Configuration" %> <%@ Assembly name="monodoc" %> <html> <head> + <title runat="server"><%= ConfigurationManager.AppSettings["Page Title"] %></title> + <link href="favicon.ico" type="image/png" rel="icon"> <meta http-equiv="X-UA-Compatible" content="IE=edge" > - <title><%=GetTitle ()%></title> - <link rel="stylesheet" type="text/css" href="common.css" media="all" title="Default Style"/> - <link rel="stylesheet" type="text/css" href="main.css" media="all" /> - <link type="text/css" rel="stylesheet" href="ptree/tree.css"/> - <link type="text/css" rel="stylesheet" href="sidebar.css"/> + <link type="text/css" rel="stylesheet" href="plugins/sidebar/ptree/tree.css"/> + <link type="text/css" rel="stylesheet" href="plugins/sidebar/sidebar.css"/> + <link type="text/css" rel="stylesheet" href="reset.css"/> <% = Global.IncludeExternalHeader (Global.ExternalResourceType.Css) %> <% = Global.IncludeExternalFooter (Global.ExternalResourceType.Css) %> </head> <body> + + <!--Do our c# scripts here to generate iframe/monodoc magic--> <script language="c#" runat="server"> -public string GetTitle () -{ - return "Monodoc"; -// return Global.help_tree.GetTitle (Request.QueryString ["link"]); -} + public string GetTitle () + { + return Global.help_tree.GetTitle (Request.QueryString ["link"]); + } -// 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; -} + // 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; + } +/* void Page_Load (object sender, EventArgs e) { if (User.Identity.IsAuthenticated){ @@ -47,34 +49,26 @@ void Page_Load (object sender, EventArgs e) login.Text = "Logged in as " + User.Identity.Name; } else { login.NavigateUrl = "javascript:parent.content.login (parent.content.window.location)"; - //login.Text = "Sign in / create account"; + login.Text = "Sign in / create account"; } -} - </script> - <% = Global.IncludeExternalHeader (Global.ExternalResourceType.Html) %> - <div id="banner" style="color: rgb(255, 255, 255);"> - <div id="rightSide"> - <label for="search">Search: </label> - <input id="fsearch" type="search" placeholder="Enter search request" style="width:19em; margin-right: 10px"/> - <a href="#" onclick="document.getElementById ('content_frame').contentWindow.print ()"><img class="toolbar" src="images/print.png" width="24" height="24" alt="Print" title="Print this document"/></a> - <a id="pageLink" href="/"> - <img class="toolbar" src="images/link.png" width="24" height="24" alt="Link to this document" title="Link to this document"/> - </a> - </div> +}*/ + </script> - <div id="header"> - <h1>Mono Documentation</h1> - </div> - <div id="dlogin"> +<!--HTML goes here--> + <% = Global.IncludeExternalHeader (Global.ExternalResourceType.Html) %> + <!-- <div id="dlogin"> <asp:HyperLink id="login" runat="server"/> </div> <div id="fsearch_companion"></div> <div id="fsearch_window"></div> </div> +--> <div id="main_part"> <div id="side"> - <div id="contents" class="activeTab"> + <a class="doc-sidebar-toggle shrink" href="#"></a> + <a class="doc-sidebar-toggle expand" href="#"></a> + <div id="contents" class="activeTab"> <div id="contentList"></div> </div> </div> @@ -82,16 +76,31 @@ void Page_Load (object sender, EventArgs e) </div> <% = Global.IncludeExternalFooter (Global.ExternalResourceType.Html) %> -<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> -<script src="search.js"></script> -<script src="xtree/xmlextras.js"></script> -<script src="ptree/tree.js"></script> -<script src="sidebar.js"></script> + + + +<!--javascript goes here--> +<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> +<script src="plugins/search-plugin/search.js"></script> +<script src="plugins/sidebar/xtree/xmlextras.js"></script> +<script src="plugins/sidebar/ptree/tree.js"></script> +<script src="plugins/sidebar/sidebar.js"></script> + <script type="text/javascript"> +var content_frame = $('#content_frame'); +var page_link = $('#pageLink'); + +change_page = function (pagename) { + content_frame.attr ('src', 'monodoc.ashx?link=' + pagename); + page_link.attr ('href', '?link=' + pagename); + if (window.history && window.history.pushState) + window.history.pushState (null, '', '/?link=' + pagename); +}; + var tree = new PTree (); tree.strSrcBase = 'monodoc.ashx?tree='; tree.strActionBase = '?link='; -tree.strImagesBase = 'xtree/images/msdn2/'; +tree.strImagesBase = 'plugins/sidebar/xtree/images/msdn2/'; tree.strImageExt = '.gif'; tree.onClickCallback = function (url) { change_page (url); }; var content = document.getElementById ('contentList'); @@ -117,17 +126,12 @@ add_native_browser_link = function () { } }; add_native_browser_link (); -change_window_title = function () { - var contentTitle = $('#content_frame').contents ().find ('title').text (); - var title = contentTitle + "- Monodoc"; - $('title').text (title); -}; -change_window_title (); content_frame.load (update_tree); content_frame.load (add_native_browser_link); -content_frame.load (change_window_title); </script> + +<!--include external javascript--> <% = Global.IncludeExternalHeader (Global.ExternalResourceType.Javascript) %> <% = Global.IncludeExternalFooter (Global.ExternalResourceType.Javascript) %> </body> diff --git a/webdoc/monodoc.ashx b/webdoc/monodoc.ashx index a877ff20..2fea9d37 100644 --- a/webdoc/monodoc.ashx +++ b/webdoc/monodoc.ashx @@ -69,40 +69,43 @@ namespace Mono.Website.Handlers } void IHttpHandler.ProcessRequest (HttpContext context) - { - string s; - - s = (string) context.Request.Params["link"]; - if (s != null){ - HandleMonodocUrl (context, s); - return; - } - - s = (string) context.Request.Params["tree"]; - Console.WriteLine ("tree request: '{0}'", s); - if (s != null){ - HandleTree (context, s); - return; - } - - s = (string) context.Request.Params["fsearch"]; - Console.WriteLine ("Fast search requested for query {0}", s); - if (s != null) { - HandleFastSearchRequest (context, s); - return; - } - - s = (string) context.Request.Params["search"]; - Console.WriteLine ("Full search requested for query {0}", s); - if (s != null) { - HandleFullSearchRequest (context, s); - return; - } - - context.Response.Write ("<html><body>Unknown request</body></html>"); - context.Response.ContentType = "text/html"; - } - + { + string s; + string callback; + + s = (string) context.Request.Params["link"]; + if (s != null){ + HandleMonodocUrl (context, s); + return; + } + + s = (string) context.Request.Params["tree"]; + Console.WriteLine ("tree request: '{0}'", s); + if (s != null){ + HandleTree (context, s); + return; + } + + s = (string) context.Request.Params["fsearch"]; + callback = (string) context.Request.Params["callback"]; + Console.WriteLine ("Fast search requested for query {0}", s); + if (s != null) { + HandleFastSearchRequest (context, s, callback); + return; + } + + s = (string) context.Request.Params["search"]; + callback = (string) context.Request.Params["callback"]; + Console.WriteLine ("Full search requested for query {0}", s); + if (s != null) { + HandleFullSearchRequest (context, s, callback); + return; + } + + context.Response.Write ("<html><body>Unknown request</body></html>"); + context.Response.ContentType = "text/html"; + } + void HandleTree (HttpContext context, string tree) { context.Response.ContentType = "text/xml"; @@ -231,61 +234,69 @@ namespace Mono.Website.Handlers PrintDocs (content, n, context, GetHelpSource (n)); } - void HandleFastSearchRequest (HttpContext context, string request) - { - if (string.IsNullOrWhiteSpace (request) || request.Length < 3) { - // Unprocessable entity - context.Response.StatusCode = 422; - return; - } - var searchIndex = Global.GetSearchIndex (); - var result = searchIndex.FastSearch (request, 15); - // return Json corresponding to the results - var answer = result == null || result.Count == 0 ? "[]" : "[" + - Enumerable.Range (0, result.Count) + void HandleFastSearchRequest (HttpContext context, string request, string callback) + { + if (string.IsNullOrWhiteSpace (request) || request.Length < 3) { + // Unprocessable entity + context.Response.StatusCode = 422; + return; + } + + + var searchIndex = Global.GetSearchIndex (); + var result = searchIndex.FastSearch (request, 15); + // return Json corresponding to the results + var answer = result == null || result.Count == 0 ? "[]" : "[" + + Enumerable.Range (0, result.Count) .Select (i => string.Format ("{{ \"name\" : \"{0}\", \"url\" : \"{1}\", \"fulltitle\" : \"{2}\" }}", result.GetTitle (i), result.GetUrl (i), result.GetFullTitle (i))) .Aggregate ((e1, e2) => e1 + ", " + e2) + "]"; - Console.WriteLine ("answer is {0}", answer); - - context.Response.ContentType = "application/json"; - context.Response.Write (answer); - } - - void HandleFullSearchRequest (HttpContext context, string request) - { - if (string.IsNullOrWhiteSpace (request)) { - // Unprocessable entity - context.Response.StatusCode = 422; - return; - } - int start = 0, count = 0; - var searchIndex = Global.GetSearchIndex (); - Result result = null; - if (int.TryParse (context.Request.Params["count"], out count)) { - if (int.TryParse (context.Request.Params["start"], out start)) - result = searchIndex.Search (request, count, start); - else - result = searchIndex.Search (request, count); - } else { - count = 20; - result = searchIndex.Search (request, count); - } - // return Json corresponding to the results - var answer = result == null || result.Count == 0 ? "[]" : "[" + - Enumerable.Range (0, result.Count) + if (!string.IsNullOrWhiteSpace (callback)) + answer = callback + "(" + answer + ")"; + + Console.WriteLine ("answer is {0}", answer); + + context.Response.ContentType = "application/json"; + context.Response.Write (answer); + } + + void HandleFullSearchRequest (HttpContext context, string request, string callback) + { + if (string.IsNullOrWhiteSpace (request)) { + // Unprocessable entity + context.Response.StatusCode = 422; + return; + } + int start = 0, count = 0; + var searchIndex = Global.GetSearchIndex (); + Result result = null; + if (int.TryParse (context.Request.Params["count"], out count)) { + if (int.TryParse (context.Request.Params["start"], out start)) + result = searchIndex.Search (request, count, start); + else + result = searchIndex.Search (request, count); + } else { + count = 20; + result = searchIndex.Search (request, count); + } + // return Json corresponding to the results + var answer = result == null || result.Count == 0 ? "[]" : "[" + + Enumerable.Range (0, result.Count) .Select (i => string.Format ("{{ \"name\" : \"{0}\", \"url\" : \"{1}\", \"fulltitle\" : \"{2}\" }}", result.GetTitle (i), result.GetUrl (i), result.GetFullTitle (i))) .Aggregate ((e1, e2) => e1 + ", " + e2) + "]"; - answer = string.Format ("{{ \"count\": {0}, \"start\": {1}, \"result\": {2} }}", count, start, answer); + if(!string.IsNullOrWhiteSpace (callback)) { + answer = string.Format ("{0}({{ \"count\": {1}, \"start\": {2}, \"result\": {3} }})", callback, count, start, answer); + } + Console.WriteLine ("answer is {0}", answer); - context.Response.ContentType = "application/json"; - context.Response.Write (answer); - } - + context.Response.ContentType = "application/json"; + context.Response.Write (answer); + } + HelpSource GetHelpSource (Node n) { if (n != null) @@ -312,11 +323,33 @@ namespace Mono.Website.Handlers <html> <head> <link type='text/css' rel='stylesheet' href='common.css' media='all' title='Default style' /> - <meta name='TreePath' value='"); + <link type='text/css' rel='stylesheet' href='xamarin-external/MyFontsWebfontsKit.css' media='all' /> + <meta name='TreePath' value='"); ctx.Response.Write (tree_path); ctx.Response.Write (@"' /> +<style type='text/css'> + body, h1, h2, h3, h4, h5, h6, .named-header { + font-family: 'Myriad Pro', 'myriad pro', Helvetica, Verdana, Arial !important; + } + p, li, span, table, pre, .Content { + font-family: Helvetica, Verdana, Arial !important; + } + .named-header { padding: 8px 0 20px 10px !important; font-weight: 600 !important; font-size: 2.3em !important; margin: 0.3em 0 0.6em 0 !important; margin-top: 0 !important; font-size: 2.3em !important; } + h2 { padding-top: 1em !important; margin-top: 0 !important; font-weight: 600 !important; font-size: 1.8em !important; color: #333 !important; } + p { margin: 0 0 1.3em !important; color: #555753 !important; line-height: 1.8 !important; } + body, table, pre { line-height: 1.8 !important; color: #55753 !important; } + .breadcrumb { font-size: 12px !important; } +</style> +<script src='//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js'></script> <script type='text/javascript'> +function printFrame() { + window.print(); + return false; +} +//pass the function object to parent +parent.printFrame = printFrame; + function try_change_page (link, e) { if (!e) @@ -366,9 +399,9 @@ function makeLink (link) default: if(document.all) { - return '/monodoc.ashx?link=' + link.replace(/\+/g, '%2B').replace(/file:\/\/\//, ''); + return 'monodoc.ashx?link=' + link.replace(/\+/g, '%2B').replace(/file:\/\/\//, ''); } - return '/monodoc.ashx?link=' + link.replace(/\+/g, '%2B'); + return 'monodoc.ashx?link=' + link.replace(/\+/g, '%2B'); } }"); if (!string.IsNullOrEmpty (Global.ua)) { diff --git a/webdoc/web.config b/webdoc/web.config index 5a50857b..0b556ab7 100644 --- a/webdoc/web.config +++ b/webdoc/web.config @@ -24,13 +24,16 @@ </mono.aspnet> <appSettings> - <add key="MonoServerDefaultIndexFiles" - value="index.aspx, Default.aspx, default.aspx, index.html, index.htm" /> + <add key="Title" value="Xamarin API Documentation" /> + <add key="MonoServerDefaultIndexFiles" value="index.aspx, Default.aspx, default.aspx, index.html, index.htm" /> + <add key="MonodocRootDir" value="/mono/lib/monodoc/" /> + <add key="ExternalHeader" value="external-header.def" /> + <add key="ExternalFooter" value="external-footer.def" /> </appSettings> - <location path="edit.aspx"> + <location path="plugins/contribution-plugin/edit.aspx"> <system.web> <authentication mode="Forms"> - <forms name=".MONOAUTH" loginUrl="login.aspx"/> + <forms name=".MONOAUTH" loginUrl="plugins/contribution-plugin/login.aspx"/> </authentication> <authorization> <deny users="?" /> |