Skip to content

Commit 48a657e

Browse files
committed
Introduced bare bones Host project
As with other projects, we want each web library to include a `Host` project so we can do local testing in a simplified environment. This one isn't yet functional, but this commit helps establish the test structure.
1 parent e47fd32 commit 48a657e

14 files changed

Lines changed: 635 additions & 4 deletions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,7 @@ FakesAssemblies/
200200
**/Common/Fonts
201201
**/Common/Scripts/ckeditor
202202
**/Common/Scripts/Vendor
203-
**/Images/Vendor/jQueryUI
203+
**/Images/Vendor/jQueryUI
204+
205+
# Excluded secret files
206+
**/Configuration/connectionStrings.config
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Layout.master.cs" Inherits="OnTopic.Editor.Web.Host.Common.Templates.Layout" %>
2+
3+
<html>
4+
<head runat="server">
5+
<meta charset="UTF-8">
6+
<title></title>
7+
<meta name="keywords" content="<%# PageTopic.Attributes.GetValue("MetaKeywords") %>" />
8+
<meta name="description" content="<%# PageTopic.Attributes.GetValue("MetaDescription") %>" />
9+
<asp:ContentPlaceHolder ID="Head" runat="server"></asp:ContentPlaceHolder>
10+
</head>
11+
<body vocab="http://schema.org/" typeof="WebPage">
12+
13+
<!-- Site Navigation Area -->
14+
<navigation id="SiteNavigation">
15+
<vc:menu />
16+
</navigation>
17+
<!-- /Site Navigation Area -->
18+
19+
<!-- Main Site Content Area -->
20+
<main id="MainContentArea" class="page content" role="main">
21+
22+
<!-- Page Header Area -->
23+
<section id="PageHeaderSection">
24+
<vc:page-level-navigation />
25+
</section>
26+
<!-- /Page Header Area -->
27+
28+
<article itemscope itemtype="http://schema.org/WebPageElement" itemprop="mainContentOfPage" class="grid-container">
29+
<h1><%# PageTopic.Title %></h1>
30+
<p class="subtitle"><%# PageTopic.Attributes.GetValue("Subtitle") %></p>
31+
<section class="body">
32+
33+
<asp:ContentPlaceHolder ID="Content" runat="server"></asp:ContentPlaceHolder>
34+
35+
<h2>Attributes</h2>
36+
<asp:Repeater ID="Attributes" runat="server">
37+
<ItemTemplate>
38+
<li><b><%# ((AttributeValue)Container.DataItem).Key %>:</b> <%# ((AttributeValue)Container.DataItem).Value %></li>
39+
</ItemTemplate>
40+
</asp:Repeater>
41+
42+
<h2>Relationships</h2>
43+
<asp:Repeater ID="Relationships" runat="server">
44+
<ItemTemplate>
45+
<h3><%# ((NamedTopicCollection)Container.DataItem).Name %></h3>
46+
<asp:Repeater ID="Relationship" DataSource=<%# ((NamedTopicCollection)Container.DataItem) %> runat="server">
47+
<ItemTemplate>
48+
<li><b><%# ((Topic)Container.DataItem).Title %></b> (<%# ((Topic)Container.DataItem).GetUniqueKey() %></li>
49+
</ItemTemplate>
50+
</asp:Repeater>
51+
52+
</ItemTemplate>
53+
</asp:Repeater>
54+
55+
<h2>Body</h2>
56+
<%# PageTopic.Attributes.GetValue("Body") %>
57+
58+
</section>
59+
</article>
60+
</main>
61+
<!-- /Main Site Content Area -->
62+
63+
<asp:ContentPlaceHolder ID="Scripts" runat="server"></asp:ContentPlaceHolder>
64+
65+
</body>
66+
</html>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*==============================================================================================================================
2+
| Author Ignia, LLC
3+
| Client Ignia, LLC
4+
| Project OnTopicSample OnTopic Site
5+
\=============================================================================================================================*/
6+
using System;
7+
using System.Linq;
8+
using System.Web.UI;
9+
10+
namespace OnTopic.Editor.Web.Host.Common.Templates {
11+
12+
/*============================================================================================================================
13+
| CLASS: LAYOUT MASTER
14+
\---------------------------------------------------------------------------------------------------------------------------*/
15+
/// <summary>
16+
/// Provides properties and functionality necessary for use with the master page template and dependent pages.
17+
/// </summary>
18+
public partial class Layout: System.Web.UI.MasterPage {
19+
20+
21+
/*==========================================================================================================================
22+
| PAGE LOAD
23+
\-------------------------------------------------------------------------------------------------------------------------*/
24+
void Page_Load(Object Src, EventArgs E) {
25+
26+
/*------------------------------------------------------------------------------------------------------------------------
27+
| Set page title
28+
\-----------------------------------------------------------------------------------------------------------------------*/
29+
Page.Title = Page.Title;
30+
31+
/*------------------------------------------------------------------------------------------------------------------------
32+
| Set data sources
33+
\-----------------------------------------------------------------------------------------------------------------------*/
34+
Attributes.DataSource = PageTopic.Attributes.Where(t => t.Key != "Body");
35+
Relationships.DataSource = PageTopic.Relationships;
36+
37+
/*------------------------------------------------------------------------------------------------------------------------
38+
| Ensure data binding
39+
\-----------------------------------------------------------------------------------------------------------------------*/
40+
this.DataBind();
41+
42+
}
43+
44+
/*==========================================================================================================================
45+
| PROPERTY: PAGE TOPIC
46+
\-------------------------------------------------------------------------------------------------------------------------*/
47+
/// <summary>
48+
/// Identifies the topic associated with the page based on the RouteData. If the topic cannot be identified then a null
49+
/// reference is returned.
50+
/// </summary>
51+
public Topic PageTopic {
52+
get {
53+
if (Page is TopicPage) {
54+
return ((TopicPage)Page).Topic;
55+
}
56+
return TopicRepository.DataProvider.Load("Web");
57+
}
58+
}
59+
60+
}
61+
}

OnTopic.Editor.Web.Host/Common/Templates/Layout.master.designer.cs

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Templates/Layout.master" AutoEventWireup="true" Inherits="OnTopic.Web.TopicPage" %>
2+
3+
<%@ MasterType virtualPath="~/Common/Templates/Layout.Master" %>
4+
5+
<asp:Content ID="Content" ContentPlaceHolderID="Content" runat="server">
6+
</asp:Content>
7+
8+
<asp:Content ID="Head" ContentPlaceHolderID="head" runat="server">
9+
</asp:Content>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ Application Codebehind="Global.asax.cs" Inherits="OnTopic.Editor.Web.Host.Global" Language="C#" %>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*==============================================================================================================================
2+
| Author Ignia, LLC
3+
| Client Ignia, LLC
4+
| Project OnTopicSample OnTopic Site
5+
\=============================================================================================================================*/
6+
using System;
7+
using System.Configuration;
8+
using System.Web.Routing;
9+
using OnTopic.Data.Caching;
10+
using OnTopic.Data.Sql;
11+
12+
namespace OnTopic.Editor.Web.Host {
13+
14+
/*============================================================================================================================
15+
| CLASS: GLOBAL
16+
\---------------------------------------------------------------------------------------------------------------------------*/
17+
/// <summary>
18+
/// Provides default configuration for the application, including any special processing that needs to happen relative to
19+
/// application events (such as <see cref="Application_Start"/> or <see cref="System.Web.HttpApplication.Error"/>.
20+
/// </summary>
21+
public class Global : System.Web.HttpApplication {
22+
23+
/*==========================================================================================================================
24+
| EVENT: APPLICATION START
25+
>===========================================================================================================================
26+
| Runs once when the first page of your application is run for the first time by any user
27+
\-------------------------------------------------------------------------------------------------------------------------*/
28+
[Obsolete]
29+
protected void Application_Start(object sender, EventArgs e) {
30+
31+
/*------------------------------------------------------------------------------------------------------------------------
32+
| CONFIGURE REPOSITORY
33+
\-----------------------------------------------------------------------------------------------------------------------*/
34+
var connectionString = ConfigurationManager.ConnectionStrings["OnTopic"].ConnectionString;
35+
var sqlTopicRepository = new SqlTopicRepository(connectionString);
36+
var topicRepository = new CachedTopicRepository(sqlTopicRepository);
37+
38+
TopicRepository.DataProvider = topicRepository;
39+
40+
/*------------------------------------------------------------------------------------------------------------------------
41+
| REGISTER ROUTES
42+
\-----------------------------------------------------------------------------------------------------------------------*/
43+
RegisterRoutes(RouteTable.Routes);
44+
45+
}
46+
47+
/*==========================================================================================================================
48+
| METHOD: REGISTER ROUTES
49+
>===========================================================================================================================
50+
| Establishes URL routes and maps them to the appropriate page handlers.
51+
\-------------------------------------------------------------------------------------------------------------------------*/
52+
void RegisterRoutes(RouteCollection routes) {
53+
routes.Add(
54+
"TopicUrl",
55+
new Route(
56+
"{rootTopic}/{*path}",
57+
new TopicsRouteHandler()
58+
)
59+
);
60+
}
61+
62+
} //Class
63+
} //Namespace

0 commit comments

Comments
 (0)