Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGratsas committed Oct 5, 2023
1 parent 5f14ec6 commit 9aa958b
Show file tree
Hide file tree
Showing 173 changed files with 4,870 additions and 0 deletions.
Binary file added docs/CloseSearch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/CollapseAll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Collapsed.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Expanded.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
157 changes: 157 additions & 0 deletions docs/FillNode.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<%@ Page Language="C#" EnableViewState="False" %>

<script runat="server">
//===============================================================================================================
// System : Sandcastle Help File Builder
// File : FillNode.aspx
// Author : Eric Woodruff ([email protected])
// Updated : 04/09/2014
// Note : Copyright 2007-2014, Eric Woodruff, All rights reserved
// Compiler: Microsoft C#
//
// This file contains the code used to dynamically load a parent node with its child table of content nodes when
// first expanded.
//
// This code is published under the Microsoft Public License (Ms-PL). A copy of the license should be
// distributed with the code. It can also be found at the project website: https://GitHub.com/EWSoftware/SHFB. This
// notice, the author's name, and all copyright notices must remain intact in all applications, documentation,
// and source files.
//
// Date Who Comments
// ==============================================================================================================
// 06/21/2007 EFW Created the code
// 07/17/2013 EFW Merged code contributed by Procomp Solutions Oy that improves performance for large TOCs by
// using XML serialization and caching.
//===============================================================================================================
private static readonly TocNode[] NoChildNodes = new TocNode[0];
private static readonly object TocLoadSyncObject = new object();
// This is used to contain the serialized table of contents
[XmlRoot("HelpTOC")]
public sealed class TableOfContents
{
[XmlElement("HelpTOCNode")]
public TocNode[] ChildNodes;
[XmlIgnore]
public IDictionary<string, TocNode> NodesById;
internal void IndexNodes()
{
this.NodesById = new Dictionary<string, TocNode>();
AddToIndex(this.NodesById, this.ChildNodes);
}
private static void AddToIndex(IDictionary<string, TocNode> nodesById, TocNode[] nodes)
{
foreach(TocNode node in nodes)
if(!String.IsNullOrEmpty(node.Id))
{
nodesById.Add(node.Id, node);
AddToIndex(nodesById, node.ChildNodes);
}
}
}
// This represents a single node in the table of contents
public sealed class TocNode
{
[XmlAttribute("Id")]
public string Id;
[XmlAttribute("Title")]
public string Title;
[XmlAttribute("Url")]
public string Url;
[XmlElement("HelpTOCNode")]
public TocNode[] ChildNodes;
}
// Load the TOC info and store it in the cache on first use
private TableOfContents GetToc()
{
string tocPath = Server.MapPath("WebTOC.xml");
string tocCacheKey = tocPath;
lock(TocLoadSyncObject)
{
TableOfContents toc = this.Cache[tocCacheKey] as TableOfContents;
if(toc == null)
{
CacheDependency cacheDependency = new CacheDependency(tocPath);
using(XmlReader reader = XmlReader.Create(tocPath))
{
toc = (TableOfContents)new XmlSerializer(typeof(TableOfContents)).Deserialize(reader);
toc.IndexNodes();
}
this.Cache.Insert(tocCacheKey, toc, cacheDependency);
}
return toc;
}
}
// Load the requested node with its children
protected override void Render(HtmlTextWriter writer)
{
StringBuilder sb = new StringBuilder(10240);
TableOfContents toc = this.GetToc();
// The ID to use should be passed in the query string
string expandedId = this.Request.QueryString["Id"];
TocNode expandedNode;
if(toc.NodesById.TryGetValue(expandedId, out expandedNode))
{
foreach(TocNode childNode in expandedNode.ChildNodes ?? NoChildNodes)
{
if(childNode.ChildNodes != null && childNode.ChildNodes.Length != 0)
{
// Write out a parent TOC entry
string childUrl = childNode.Url;
string childTarget;
if(!String.IsNullOrEmpty(childUrl))
childTarget = " target=\"TopicContent\"";
else
{
childUrl = "#";
childTarget = String.Empty;
}
sb.AppendFormat("<div class=\"TreeNode\">\r\n" +
"<img class=\"TreeNodeImg\" onclick=\"javascript: Toggle(this);\" src=\"Collapsed.gif\"/>" +
"<a class=\"UnselectedNode\" onclick=\"javascript: return Expand(this);\" " +
"href=\"{0}\"{1}>{2}</a>\r\n" +
"<div id=\"{3}\" class=\"Hidden\"></div>\r\n" +
"</div>\r\n", HttpUtility.HtmlEncode(childUrl), childTarget, HttpUtility.HtmlEncode(childNode.Title),
childNode.Id);
}
else
{
string childUrl = childNode.Url;
if(String.IsNullOrEmpty(childUrl))
childUrl = "about:blank";
// Write out a TOC entry that has no children
sb.AppendFormat("<div class=\"TreeItem\">\r\n" +
"<img src=\"Item.gif\"/><a class=\"UnselectedNode\" " +
"onclick=\"javascript: return SelectNode(this);\" href=\"{0}\" " +
"target=\"TopicContent\">{1}</a>\r\n" +
"</div>\r\n", HttpUtility.HtmlEncode(childUrl), HttpUtility.HtmlEncode(childNode.Title));
}
}
writer.Write(sb.ToString());
}
else
writer.Write("<b>TOC node not found!</b>");
}
</script>
52 changes: 52 additions & 0 deletions docs/FillNode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?
// Contributed to the Sandcastle Help File Builder project by Thomas Levesque

header("Content-Type: text/html; charset=utf-8");
$toc = new DOMDocument();
$toc->load('WebTOC.xml');
$xpath = new DOMXPath($toc);
$id = $_GET["Id"];
$nodes = $xpath->query("//HelpTOCNode[@Id='$id']/*");
if ($nodes->length == 0)
{
?>
<b>TOC node not found!</b>
<?
die();
}
foreach($nodes as $node)
{
$id = $node->getAttribute("Id");
$url = $node->getAttribute("Url");
$title = $node->getAttribute("Title");
if (empty($url))
{
$url = "#";
$target = "";
}
else
{
$target = " target=\"TopicContent\"";
}

if ($node->hasChildNodes())
{
?>
<div class="TreeNode">
<img class="TreeNodeImg" onclick="javascript: Toggle(this);" src="Collapsed.gif"/>
<a class="UnselectedNode" onclick="javascript: Expand(this);" href="<?= $url ?>"<?= $target ?>><?= $title ?></a>
<div id="<?= $id ?>" class="Hidden"></div>
</div>
<?
}
else
{
?>
<div class="TreeItem">
<img src="Item.gif"/>
<a class="UnselectedNode" onclick="javascript: SelectNode(this);" href="<?= $url ?>"<?= $target ?>><?= $title ?></a>
</div>
<?
}
}
?>
153 changes: 153 additions & 0 deletions docs/Index.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<%@ Page Language="C#" EnableViewState="False" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head runat="server">
<title>Sharp IMG Viewer Help - Table of Content</title>
<link rel="stylesheet" href="TOC.css" />
<link rel="shortcut icon" href="favicon.ico"/>
<script type="text/javascript" src="TOC.js"></script>
</head>

<body onload="javascript: Initialize('.aspx');" onresize="javascript: ResizeTree();">
<form id="IndexForm" runat="server">

<div id="TOCDiv" class="TOCDiv">

<div id="divSearchOpts" class="SearchOpts" style="height: 100px; display: none;">
<img class="TOCLink" onclick="javascript: ShowHideSearch(false);"
src="CloseSearch.png" height="17" width="17" alt="Hide search" style="float: right;"/>
Keyword(s) for which to search:
<input id="txtSearchText" type="text" style="width: 100%;"
onkeypress="javascript: return OnSearchTextKeyPress(event);" /><br />
<input id="chkSortByTitle" type="checkbox" /><label for="chkSortByTitle">&nbsp;Sort results by title</label><br />
<input type="button" value="Search" onclick="javascript: return PerformSearch();" />
</div>

<div id="divIndexOpts" class="IndexOpts" style="height: 25px; display: none;">
<img class="TOCLink" onclick="javascript: ShowHideIndex(false);"
src="CloseSearch.png" height="17" width="17" alt="Hide index" style="float: right;"/>
Keyword Index
</div>

<div id="divNavOpts" class="NavOpts" style="height: 20px;">
<img class="TOCLink" onclick="javascript: SyncTOC();" src="SyncTOC.gif"
height="16" width="16" alt="Sync to TOC"/>
<img class="TOCLink" onclick="javascript: ExpandOrCollapseAll(false);"
src="CollapseAll.png" height="16" width="16" alt="Collapse all" />
<img class="TOCLink" onclick="javascript: ShowHideIndex(true);"
src="Index.gif" height="16" width="16" alt="Index" />
<img class="TOCLink" onclick="javascript: ShowHideSearch(true);"
src="Search.gif" height="16" width="16" alt="Search" />
<a href="#" title="Click to obtain a direct link to the displayed topic"
style="margin-left: 10px; vertical-align: top;"
onclick="javascript: ShowDirectLink();">Direct Link</a>
</div>

<div class="Tree" id="divSearchResults" style="display: none;"
onselectstart="javascript: return false;">
</div>

<div class="Tree" id="divIndexResults" style="display: none;"
onselectstart="javascript: return false;">
</div>

<div class="Tree" id="divTree" onselectstart="javascript: return false;">
<asp:Literal ID="lcTOC" runat="server" />
</div>

</div>

<div id="TOCSizer" class="TOCSizer" onmousedown="OnMouseDown(event)" onselectstart="javascript: return false;"></div>

<iframe id="TopicContent" name="TopicContent" class="TopicContent" src="html/d036e989-7203-4e85-bd7f-51b8b27ccc92.htm">
This page uses an IFRAME but your browser does not support it.
</iframe>

</form>

</body>

</html>

<script runat="server">
//===============================================================================================================
// System : Sandcastle Help File Builder
// File : Index.aspx
// Author : Eric Woodruff ([email protected])
// Updated : 04/09/2014
// Note : Copyright 2007-2014, Eric Woodruff, All rights reserved
// Compiler: Microsoft C#
//
// This file contains the code used to display the index page for a website produced by the help file builder.
// The root nodes are loaded for the table of content. Child nodes are loaded dynamically when first expanded
// using an Ajax call.
//
// This code is published under the Microsoft Public License (Ms-PL). A copy of the license should be
// distributed with the code. It can also be found at the project website: https://GitHub.com/EWSoftware/SHFB. This
// notice, the author's name, and all copyright notices must remain intact in all applications, documentation,
// and source files.
//
// Date Who Comments
// ==============================================================================================================
// 06/21/2007 EFW Created the code
// 02/18/2012 EFW Merged code from tom103 to show direct link
//===============================================================================================================
protected void Page_Load(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder(10240);
string id, url, target, title;
XPathDocument toc = new XPathDocument(Server.MapPath("WebTOC.xml"));
XPathNavigator navToc = toc.CreateNavigator();
XPathNodeIterator root = navToc.Select("HelpTOC/*");
foreach(XPathNavigator node in root)
{
if(node.HasChildren)
{
// Write out a parent TOC entry
id = node.GetAttribute("Id", String.Empty);
title = node.GetAttribute("Title", String.Empty);
url = node.GetAttribute("Url", String.Empty);
if(!String.IsNullOrEmpty(url))
target = " target=\"TopicContent\"";
else
{
url = "#";
target = String.Empty;
}
sb.AppendFormat("<div class=\"TreeNode\">\r\n" +
"<img class=\"TreeNodeImg\" " +
"onclick=\"javascript: Toggle(this);\" " +
"src=\"Collapsed.gif\"/><a class=\"UnselectedNode\" " +
"onclick=\"javascript: return Expand(this);\" " +
"href=\"{0}\"{1}>{2}</a>\r\n" +
"<div id=\"{3}\" class=\"Hidden\"></div>\r\n</div>\r\n",
HttpUtility.HtmlEncode(url), target, HttpUtility.HtmlEncode(title), id);
}
else
{
title = node.GetAttribute("Title", String.Empty);
url = node.GetAttribute("Url", String.Empty);
if(String.IsNullOrEmpty(url))
url = "about:blank";
// Write out a TOC entry that has no children
sb.AppendFormat("<div class=\"TreeItem\">\r\n" +
"<img src=\"Item.gif\"/>" +
"<a class=\"UnselectedNode\" " +
"onclick=\"javascript: return SelectNode(this);\" " +
"href=\"{0}\" target=\"TopicContent\">{1}</a>\r\n" +
"</div>\r\n", HttpUtility.HtmlEncode(url), HttpUtility.HtmlEncode(title));
}
}
lcTOC.Text = sb.ToString();
}
</script>
Binary file added docs/Index.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Item.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9aa958b

Please sign in to comment.