diff options
author | Nina Vyedin <nina.vyedin@gmail.com> | 2013-03-05 02:42:20 +0400 |
---|---|---|
committer | Nina Vyedin <nina.vyedin@gmail.com> | 2013-03-05 07:52:26 +0400 |
commit | 899b10630d823be7fdb6f464db7bcf7b2609fb3e (patch) | |
tree | 54459527420967ba9af3e76b03889c946cd9b0d4 | |
parent | e04fd14ce7fcd1686cf655c3ef0783f3a416bda8 (diff) |
[webdoc] update jquery version and get rid of some old css. Add the new wiring for plugins to Global and index.
-rw-r--r-- | webdoc/Global.asax | 72 | ||||
-rw-r--r-- | webdoc/index.aspx | 9 | ||||
-rw-r--r-- | webdoc/monodoc.ashx | 3 |
3 files changed, 22 insertions, 62 deletions
diff --git a/webdoc/Global.asax b/webdoc/Global.asax index a29361b3..32a73247 100644 --- a/webdoc/Global.asax +++ b/webdoc/Global.asax @@ -7,27 +7,33 @@ <%@ Assembly name="monodoc" %> <script runat="server" language="c#" > - public static RootTree help_tree; [ThreadStatic] static SearchableIndex search_index; public static string ua = null; -// These are dictionary of path for external couple (html, css, js) files that should get included -static Dictionary<ExternalResourceType, string> externalHeader = null; -static Dictionary<ExternalResourceType, string> externalFooter = null; +static string Plugins = null; void Application_Start () { + HelpSource.use_css = true; + HelpSource.FullHtml = false; + HelpSource.UseWebdocCache = true; var rootDir = WebConfigurationManager.AppSettings["MonodocRootDir"]; if (!string.IsNullOrEmpty (rootDir)) help_tree = RootTree.LoadTree (rootDir); else help_tree = RootTree.LoadTree (); + + //Google analytics if we want em ua = WebConfigurationManager.AppSettings["GoogleAnalytics"]; - externalHeader = ParseExternalDefinition (WebConfigurationManager.AppSettings["ExternalHeader"]); - externalFooter = ParseExternalDefinition (WebConfigurationManager.AppSettings["ExternalFooter"]); + + //grab the Plugins def value from web.config + Plugins = WebConfigurationManager.AppSettings["Plugins"]; + + SettingsHandler.Settings.EnableEditing = false; } +/*----------------TREE BUILDING----------------*/ public static readonly string kipunji_root_url = "http://docs.go-mono.com/"; private static readonly string prefixes = "TNCFEMP"; @@ -85,8 +91,8 @@ public static string CreateTreeBootFragment () { var fragment = new System.Text.StringBuilder (); - for (int i = 0; i < help_tree.RootNode.Nodes.Count; i++){ - Node n = (Node)help_tree.RootNode.Nodes [i]; + for (int i = 0; i < help_tree.Nodes.Count; i++){ + Node n = (Node)help_tree.Nodes [i]; string url = n.PublicUrl; @@ -100,7 +106,7 @@ public static string CreateTreeBootFragment () else fragment.Append ("null"); - if (i == help_tree.RootNode.Nodes.Count-1) + if (i == help_tree.Nodes.Count-1) fragment.Append (", true"); else fragment.Append (", false"); @@ -112,6 +118,7 @@ public static string CreateTreeBootFragment () return fragment.ToString (); } +/*------------SEARCH------------*/ public static SearchableIndex GetSearchIndex () { if (search_index != null) @@ -119,51 +126,4 @@ public static SearchableIndex GetSearchIndex () return (search_index = help_tree.GetSearchIndex ()); } -public enum ExternalResourceType { - Unknown, - Html, - Css, - Javascript -} - -public static string IncludeExternalHeader (ExternalResourceType type) -{ - return IncludeExternalFile (type, externalHeader); -} - -public static string IncludeExternalFooter (ExternalResourceType type) -{ - return IncludeExternalFile (type, externalFooter); -} - -static string IncludeExternalFile (ExternalResourceType type, Dictionary<ExternalResourceType, string> paths) -{ - string path; - if (paths == null || !paths.TryGetValue (type, out path) || !File.Exists (path)) - return string.Empty; - if (type == ExternalResourceType.Javascript) { - return string.Format ("{1}script type='text/javascript' src='{0}'{2}{1}/script{2}", path, '<', '>'); - } else if (type == ExternalResourceType.Css) { - return string.Format ("{1}link type='text/css' rel='stylesheet' href='{0}' /{2}", path, '<', '>'); - } else { - return File.ReadAllText (path); - } -} - -static Dictionary<ExternalResourceType, string> ParseExternalDefinition (string definitionPath) -{ - if (string.IsNullOrEmpty (definitionPath) || !File.Exists (definitionPath)) - return null; - // A definition file is a simple file with a line for each resource type in a key value fashion - var lines = File.ReadAllLines (definitionPath); - var result = lines.Where (l => !string.IsNullOrEmpty (l) && l[0] != '#') // Take non-empty, non-comment lines - .Select (l => l.Split ('=')) - .Where (a => a != null && a.Length == 2) - .Select (a => { ExternalResourceType t; return Tuple.Create (Enum.TryParse (a[0].Trim (), true, out t) ? t : ExternalResourceType.Unknown, a[1].Trim ()); }) - .Where (t => t.Item1 != ExternalResourceType.Unknown) - .ToDictionary (t => t.Item1, t => t.Item2); - - return result; -} - </script> diff --git a/webdoc/index.aspx b/webdoc/index.aspx index ef419816..591c6080 100644 --- a/webdoc/index.aspx +++ b/webdoc/index.aspx @@ -2,6 +2,7 @@ <%@ Import Namespace="System.Web" %> <%@ Import Namespace="System.Collections.Specialized" %> <%@ Import Namespace="System.Web.Configuration" %> +<%@ Import Namespace="Mono.Website" %> <%@ Assembly name="monodoc" %> <html> @@ -10,11 +11,11 @@ <link href="favicon.ico" type="image/png" rel="icon"> <meta http-equiv="X-UA-Compatible" content="IE=edge" > <link type="text/css" rel="stylesheet" href="reset.css"/> - <% = Global.Plugin (Global.PluginContent.Css) %> + <% = Plugin.GetPluginContent (Plugin.PluginContent.Css) %> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> </head> <body> - <% = Global.Plugin (Global.PluginContent.Header) %> + <% = Plugin.GetPluginContent (Plugin.PluginContent.Header) %> <!--Do our c# scripts here to generate iframe/monodoc magic--> <script language="c#" runat="server"> public string GetTitle () @@ -71,9 +72,9 @@ void Page_Load (object sender, EventArgs e) </div> <div id="content_frame_wrapper"><iframe id="content_frame" src="<% =getContentFrame() %>"></iframe></div> </div> - <% = Global.Plugin (Global.PluginContent.Footer) %> + <% = Plugin.GetPluginContent (Plugin.PluginContent.Footer) %> <!--include external javascript--> <% = Global.CreateTreeBootFragment () %> -<% = Global.Plugin (Global.PluginContent.Javascript) %> +<% = Plugin.GetPluginContent (Plugin.PluginContent.Javascript) %> </body> </html> diff --git a/webdoc/monodoc.ashx b/webdoc/monodoc.ashx index 2fea9d37..236785d1 100644 --- a/webdoc/monodoc.ashx +++ b/webdoc/monodoc.ashx @@ -323,7 +323,6 @@ namespace Mono.Website.Handlers <html> <head> <link type='text/css' rel='stylesheet' href='common.css' media='all' title='Default style' /> - <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 (@"' /> @@ -340,7 +339,7 @@ namespace Mono.Website.Handlers 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 src='//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script> <script type='text/javascript'> function printFrame() { |