2 | @if (!Model.Any())
3 | {
4 | No posts have been published yet.
5 | if (ViewData.IsLoggedIn())
6 | {
7 |
8 | Use the @Html.AdminActionLink("New Post", "Edit", "WikiAdmin") link at the top of
9 | the page to create a post.
10 | }
11 | }
12 | else
13 | {
14 |
15 | @foreach (var entry in Model)
16 | {
17 | @Html.DisplayFor(x => entry)
18 | }
19 |
20 |
21 |
22 | }
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Shared/DisplayTemplates/FacebookLike.cshtml:
--------------------------------------------------------------------------------
1 | @using FunnelWeb.Utilities
2 | @model bool
3 |
4 | @if (Model)
5 | {
6 |
7 |
9 |
10 | }
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Shared/DisplayTemplates/Paginator.cshtml:
--------------------------------------------------------------------------------
1 | @model FunnelWeb.Web.Models.Paginator
2 | @if (Model.TotalPages > 1) {
3 |
4 | Page:
5 | @for (var i = 0; i < Model.TotalPages; i++)
6 | {
7 |
8 | @if (i == Model.CurrentPage)
9 | {
10 | @MvcHtmlString.Create((i + 1).ToString())
11 | }
12 | else if (i == 0)
13 | {
14 | @Html.ActionLink((i + 1).ToString(), Model.ActionName)
15 | }
16 | else
17 | {
18 | @Html.ActionLink((i + 1).ToString(), Model.ActionName, new { pageNumber = i })
19 | }
20 |
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Shared/DisplayTemplates/Pingbacks.cshtml:
--------------------------------------------------------------------------------
1 | @using FunnelWeb.Model.Strings
2 | @model IList
3 |
4 | @if (Model.Count > 0)
5 | {
6 |
7 |
Trackbacks
8 |
14 | @if ((int)ViewData["PingbackCount"] > Model.Count)
15 | {
16 | @Html.ActionLink(string.Format("View all {0} Trackbacks", (int)ViewData["PingbackCount"]), "Pingbacks", "Wiki", new { page = (PageName)ViewData["Name"] }, null)
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Shared/DisplayTemplates/PublishedDate.cshtml:
--------------------------------------------------------------------------------
1 | @model DateTime
2 |
3 |
4 | @Model.ToLocalTime().ToString("MMM d")
5 | @Model.ToLocalTime().ToString("yyyy")
6 |
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Shared/DisplayTemplates/TagsList.cshtml:
--------------------------------------------------------------------------------
1 | @model string
2 |
3 | @foreach (var tag in (Model??"").Split(new[]{","}, StringSplitOptions.RemoveEmptyEntries))
4 | {
5 | @Html.ActionLink(tag, "Index", "Tagged", new { tag }, new { title = "Posts tagged " + tag, @class = "tag " + @Html.CssKeywordsForTag(tag) })
6 | }
7 |
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Shared/EditorTemplates/Markdown.cshtml:
--------------------------------------------------------------------------------
1 | @model String
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Shared/EditorTemplates/Tags.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | @Scripts.Render("~/bundles/jquery")
5 | @Scripts.Render("~/bundles/jqueryui")
6 | @Scripts.Render("~/bundles/taggy")
7 | }
8 |
9 |
21 |
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Shared/_Disqus.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
10 | Please enable JavaScript to view the comments powered by Disqus.
11 | blog comments powered by
12 |
13 |
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Shared/_PrivateEntryNotification.cshtml:
--------------------------------------------------------------------------------
1 | @using FunnelWeb.Model.Strings
2 | @model PageName
3 |
4 |
5 | This is a private page. Only logged in users will be able to see
6 | it.
7 | @Html.ActionLink("Edit this page ", "Edit", "WikiAdmin", new { Area = "Admin", page = Model }, new { })
8 | to make it public.
9 |
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Tagged/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @using System.Linq
4 |
5 | Posts tagged with @ViewBag.Tag
6 |
7 | @if (@Model.Any())
8 | {
9 | @Html.DisplayFor(x => Model)
10 | }
11 | else {
12 | Aww snap! That tag isn't being used anyway
13 | }
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Wiki/Page.cshtml:
--------------------------------------------------------------------------------
1 | @model FunnelWeb.Web.Views.Wiki.PageModel
2 | @{
3 | ViewBag.Title = Model.Entry.MetaTitle;
4 | }
5 |
6 |
7 | @Html.RenderTrusted(Model.Entry.Body, Model.Entry.Format)
8 |
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Wiki/Pingbacks.cshtml:
--------------------------------------------------------------------------------
1 | @model Entry
2 | @{
3 | ViewBag.Title = string.Format("Trackbacks for {0}", Model.MetaTitle);
4 | }
5 |
6 | @Model.Title - Trackbacks
7 |
13 |
14 | @Html.ActionLink("Back to post", "Page", "Wiki", new{page = Model.Name}, null)
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Wiki/Recent.cshtml:
--------------------------------------------------------------------------------
1 | @model FunnelWeb.Web.Views.Wiki.RecentModel
2 | @section Meta
3 | {
4 |
5 |
6 | }
7 | @section Summary
8 | {
9 | @Html.RenderTrusted(Html.Settings().Introduction, Formats.Markdown)
10 | }
11 |
12 | @Model.Title
13 |
14 | @Html.DisplayFor(x => x.Results)
15 |
16 | @Html.DisplayFor(x => x.Paginator)
17 |
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Wiki/RecentModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.DataAnnotations;
3 | using FunnelWeb.Model;
4 | using FunnelWeb.Repositories;
5 | using FunnelWeb.Web.Models;
6 |
7 | namespace FunnelWeb.Web.Views.Wiki
8 | {
9 | public class RecentModel
10 | {
11 | public RecentModel(string title, PagedResult results, string actionName)
12 | {
13 | Title = title;
14 | Results = results;
15 | ActionName = actionName;
16 |
17 | Paginator = new Paginator
18 | {
19 | ActionName = actionName,
20 | CurrentPage = Results.Page,
21 | TotalPages = Results.TotalPages
22 | };
23 | }
24 |
25 | public string Title { get; set; }
26 | [UIHint("EntrySummaries")]
27 | public PagedResult Results { get; set; }
28 | public string ActionName { get; set; }
29 |
30 | public Paginator Paginator { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Wiki/RevisionsModel.cs:
--------------------------------------------------------------------------------
1 | using FunnelWeb.Model;
2 | using FunnelWeb.Model.Strings;
3 |
4 | namespace FunnelWeb.Web.Views.Wiki
5 | {
6 | public class RevisionsModel
7 | {
8 | public RevisionsModel(PageName page, Entry entry)
9 | {
10 | Page = page;
11 | Entry = entry;
12 | }
13 |
14 | public PageName Page { get; set; }
15 | public Entry Entry { get; set; }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Wiki/SearchModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using FunnelWeb.Model;
3 | using FunnelWeb.Repositories;
4 |
5 | namespace FunnelWeb.Web.Views.Wiki
6 | {
7 | public class SearchModel
8 | {
9 | public SearchModel(string searchText, bool is404, PagedResult results)
10 | {
11 | SearchText = searchText;
12 | Is404 = is404;
13 | Results = results;
14 | }
15 |
16 | public string SearchText { get; set; }
17 | public bool Is404 { get; set; }
18 | public PagedResult Results { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/Views/Wiki/SiteMap.cshtml:
--------------------------------------------------------------------------------
1 |
2 | @model FunnelWeb.Web.Views.Wiki.SiteMapModel
3 | @{
4 | Layout = "";
5 | }
6 |
7 |
8 | @Html.Qualify("/")
9 | @DateTime.UtcNow.ToString("yyyy-MM-dd")
10 | daily
11 | 1.0
12 |
13 | @foreach (var item in Model.Entries) {
14 |
15 | @Html.Qualify(Html.ActionUrl("Page", "Wiki", new { page = item.Name }))
16 | @item.Revised.ToString("yyyy-MM-dd")
17 | @Model.GetChangeFrequency(item)
18 | @Model.Prioritize(item).ToString("n3")
19 |
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/Microsoft.VC90.CRT/README_ENU.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/Microsoft.VC90.CRT/README_ENU.txt
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/Microsoft.VC90.CRT/msvcr90.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/Microsoft.VC90.CRT/msvcr90.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlceca40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlceca40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlcecompact40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlcecompact40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlceer40EN.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlceer40EN.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlceme40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlceme40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlceqp40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlceqp40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlcese40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/amd64/sqlcese40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/README_ENU.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/README_ENU.txt
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/msvcr90.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/msvcr90.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlceca40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlceca40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlcecompact40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlcecompact40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlceer40EN.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlceer40EN.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlceme40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlceme40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlceqp40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlceqp40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlcese40.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/funnelweblog/FunnelWeb/32f561e9bf991c141edd485905a6212ba194bd91/src/FunnelWeb.Web/_bin_deployableAssemblies/x86/sqlcese40.dll
--------------------------------------------------------------------------------
/src/FunnelWeb.ncrunchsolution:
--------------------------------------------------------------------------------
1 |
2 | 1
3 | False
4 | false
5 | UseDynamicAnalysis
6 | UseStaticAnalysis
7 | UseStaticAnalysis
8 | UseStaticAnalysis
9 | Run all tests automatically:BFRydWU=;Run all tests manually:BUZhbHNl;Run impacted tests automatically, others manually (experimental!):CklzSW1wYWN0ZWQ=;Run pinned tests automatically, others manually:CElzUGlubmVk
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/FunnelWeb.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AaBb_AaBb" /><ExtraRule Prefix="" Suffix="" Style="aa_bb" /></Policy>
3 | <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
4 | <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
--------------------------------------------------------------------------------
/src/FunnelWeb/Authentication/IAuthenticator.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Authentication
2 | {
3 | public interface IAuthenticator
4 | {
5 | string GetName();
6 | bool AuthenticateAndLogin(string username, string password);
7 | void Logout();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Authentication/IFunnelWebMembership.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using FunnelWeb.Model.Authentication;
4 |
5 | namespace FunnelWeb.Authentication
6 | {
7 | public interface IFunnelWebMembership
8 | {
9 | bool HasAdminAccount();
10 | User CreateAccount(string name, string email, string username, string password);
11 | IEnumerable GetUsers();
12 | }
13 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Authentication/IRoleProvider.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Authentication
2 | {
3 | public interface IRoleProvider
4 | {
5 | bool IsUserInRole(string username, string roleName);
6 | string[] GetRolesForUser(string username);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Authentication/Internal/FormsRoleProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FunnelWeb.Authentication.Internal
4 | {
5 | public class FormsRoleProvider : IRoleProvider
6 | {
7 | public bool IsUserInRole(string username, string roleName)
8 | {
9 | return true;
10 | }
11 |
12 | public string[] GetRolesForUser(string username)
13 | {
14 | return new[] {"Admin", "Moderator"};
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/DatabaseModule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Autofac;
3 |
4 | namespace FunnelWeb.DatabaseDeployer
5 | {
6 | public class DatabaseModule : Module
7 | {
8 | protected override void Load(ContainerBuilder builder)
9 | {
10 | base.Load(builder);
11 |
12 | builder.RegisterType()
13 | .As()
14 | .SingleInstance();
15 |
16 | builder
17 | .RegisterType()
18 | .As()
19 | .SingleInstance();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/IConnectionStringSettings.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.DatabaseDeployer
2 | {
3 | public interface IConnectionStringSettings
4 | {
5 | string DatabaseProvider { get; set; }
6 | string ConnectionString { get; set; }
7 | string Schema { get; set; }
8 | string ReadOnlyReason { get; }
9 | }
10 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/IDatabaseUpgradeDetector.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.DatabaseDeployer
2 | {
3 | public interface IDatabaseUpgradeDetector
4 | {
5 | bool UpdateNeeded();
6 | void Reset();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/ScriptedExtension.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using DbUp.Engine;
3 |
4 | namespace FunnelWeb.DatabaseDeployer
5 | {
6 | public class ScriptedExtension
7 | {
8 | private readonly string sourceIdentifier;
9 | private readonly Assembly sourceAssembly;
10 | private readonly IScriptProvider scriptProvider;
11 |
12 | public ScriptedExtension(string sourceIdentifier, Assembly sourceAssembly, IScriptProvider scriptProvider)
13 | {
14 | this.sourceIdentifier = sourceIdentifier;
15 | this.sourceAssembly = sourceAssembly;
16 | this.scriptProvider = scriptProvider;
17 | }
18 |
19 | public Assembly SourceAssembly
20 | {
21 | get { return sourceAssembly; }
22 | }
23 |
24 | public string SourceIdentifier
25 | {
26 | get { return sourceIdentifier; }
27 | }
28 |
29 | public IScriptProvider ScriptProvider
30 | {
31 | get { return scriptProvider; }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0001.sql:
--------------------------------------------------------------------------------
1 | create table $schema$.[SchemaVersions] (
2 | [SchemaVersionID] int identity(1,1) not null constraint [PK_SchemaVersions_SchemaVersionID] primary key,
3 | [VersionNumber] int not null,
4 | [SourceIdentifier] nvarchar(255) not null,
5 | [ScriptName] nvarchar(255) not null,
6 | [Applied] datetime not null
7 | )
8 | go
9 |
10 | create procedure $schema$.[GetCurrentVersionNumber]
11 | as
12 | begin
13 | select max([VersionNumber]) from $schema$.[SchemaVersions]
14 | end
15 | go
16 |
17 | create procedure $schema$.[RecordVersionUpgrade]
18 | (
19 | @versionNumber int,
20 | @sourceIdentifier nvarchar(255),
21 | @scriptName nvarchar(255)
22 | )
23 | as
24 | begin
25 | insert into $schema$.[SchemaVersions]([VersionNumber], [SourceIdentifier], [ScriptName], [Applied])
26 | values (@versionNumber, @sourceIdentifier, @scriptName, getdate())
27 | end
28 | go
29 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0001_sqlce.sql:
--------------------------------------------------------------------------------
1 | create table $schema$.[SchemaVersions] (
2 | [SchemaVersionID] int identity(1,1) not null constraint [PK_SchemaVersions_SchemaVersionID] primary key nonclustered,
3 | [VersionNumber] int not null,
4 | [SourceIdentifier] nvarchar(255) not null,
5 | [ScriptName] nvarchar(255) not null,
6 | [Applied] datetime not null
7 | )
8 | go
9 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0003.sql:
--------------------------------------------------------------------------------
1 | -- Initial setup data
2 |
3 | insert into $schema$.[Feed]([Name], [Title]) values ('default', 'Blog Feed');
4 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0005.sql:
--------------------------------------------------------------------------------
1 | -- Settings and Statistics
2 |
3 | create table $schema$.[Redirect]
4 | (
5 | [Id] int identity(1,1) not null constraint [PK_Redirect_Id] primary key,
6 | [From] nvarchar(255) not null,
7 | [To] nvarchar(255) not null
8 | )
9 | go
10 |
11 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0006.sql:
--------------------------------------------------------------------------------
1 | -- Ability to enable/disable discussion on certain threads
2 |
3 | alter table $schema$.[Entry]
4 | add [IsDiscussionEnabled] bit not null default(1)
5 | go
6 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0007.sql:
--------------------------------------------------------------------------------
1 | -- Ability to manually set the description and keywords for META tags in the final pages
2 |
3 | alter table $schema$.[Entry]
4 | add [MetaDescription] nvarchar(500) not null default('')
5 | go
6 |
7 | alter table $schema$.[Entry]
8 | add [MetaKeywords] nvarchar(500) not null default('')
9 | go
10 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0008.sql:
--------------------------------------------------------------------------------
1 | declare @hasFullText int
2 | select @hasFullText = convert(int, SERVERPROPERTY('IsFullTextInstalled'))
3 |
4 | if (@hasFullText = 1)
5 | begin
6 | begin try
7 | exec sp_fulltext_catalog 'FTCatalog', 'create'
8 | exec sp_fulltext_table '$schema$.[Entry]', 'create', 'FTCatalog', 'PK_Entry_Id'
9 | exec sp_fulltext_column '$schema$.[Entry]', 'Name', 'add', 0x0409
10 | exec sp_fulltext_column '$schema$.[Entry]', 'Title', 'add', 0x0409
11 | exec sp_fulltext_column '$schema$.[Entry]', 'Summary', 'add', 0x0409
12 | exec sp_fulltext_column '$schema$.[Entry]', 'MetaDescription', 'add', 0x0409
13 | exec sp_fulltext_column '$schema$.[Entry]', 'MetaKeywords', 'add', 0x0409
14 | exec sp_fulltext_table '$schema$.[Entry]', 'activate'
15 | exec sp_fulltext_catalog 'FTCatalog', 'start_full'
16 | exec sp_fulltext_table '$schema$.[Entry]', 'start_change_tracking'
17 | exec sp_fulltext_table '$schema$.[Entry]', 'start_background_updateindex'
18 | end try
19 | begin catch
20 | --Full text not installed
21 | PRINT 'Full text catalog not installed'
22 | end catch
23 | end
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0008_sqlce.sql:
--------------------------------------------------------------------------------
1 | --Script 8 sets up full text index which is not supported by sql ce, need to have something in script, so leave select 1 in
2 | select 1
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0009.sql:
--------------------------------------------------------------------------------
1 | alter table $schema$.[Entry]
2 | add [MetaTitle] nvarchar(255) not null default('')
3 | go
4 |
5 | update $schema$.[Entry] set [MetaTitle] = [Title]
6 | go
7 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0010.sql:
--------------------------------------------------------------------------------
1 | declare @hasFullText bit
2 | declare @hasFullTextIndex bit
3 | select @hasFullText = convert(int, SERVERPROPERTY('IsFullTextInstalled'))
4 | SELECT @hasFullTextIndex = OBJECTPROPERTY(OBJECT_ID('$schema$.[Entry]'), 'TableHasActiveFulltextIndex')
5 | if (@hasFullText = 1 AND @hasFullTextIndex = 1)
6 | begin
7 | begin try
8 | exec sp_fulltext_table '$schema$.[Revision]', 'create', 'FTCatalog', 'PK_Revision_Id'
9 | exec sp_fulltext_column '$schema$.[Revision]', 'Body', 'add', 0x0409
10 | exec sp_fulltext_table '$schema$.[Revision]', 'activate'
11 | exec sp_fulltext_catalog 'FTCatalog', 'start_full'
12 | exec sp_fulltext_table '$schema$.[Revision]', 'start_change_tracking'
13 | exec sp_fulltext_table '$schema$.[Revision]', 'start_background_updateindex'
14 | end try
15 | begin catch
16 | --Full text not installed
17 | PRINT 'Full text catalog not installed'
18 | end catch
19 | end
20 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0010_sqlce.sql:
--------------------------------------------------------------------------------
1 | --Script 10 works on FullTextIndex, need to have something in script, so leave select 1 in
2 | select 1
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0011.sql:
--------------------------------------------------------------------------------
1 | create table $schema$.Pingback
2 | (
3 | [Id] int identity(1,1) not null constraint [PK_Pingback_Id] primary key,
4 | [EntryId] int not null,
5 | [TargetUri] nvarchar(255) not null,
6 | [TargetTitle] nvarchar(255) not null,
7 | [IsSpam] bit not null
8 | )
9 | go
10 |
11 | alter table $schema$.[Pingback] add constraint [FK_Pingback_Entry] foreign key([EntryId])
12 | references $schema$.[Entry] ([Id])
13 | go
14 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0012.sql:
--------------------------------------------------------------------------------
1 | insert into $schema$.[Setting]([Name], [DisplayName], [Value], [Description]) values ('spam-blacklist', 'Spam Blacklist', 'casino', 'Comments with these words (case-insensitive) will automatically be marked as spam, in addition to Akismet.');
2 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0013.sql:
--------------------------------------------------------------------------------
1 | insert into $schema$.[Setting]([Name], [DisplayName], [Value], [Description]) values ('default-page', 'Default Page', 'blog', 'Page name: When users visit the root (/) of your site, it will be equivalent to visiting the page you specify here.');
2 | go
3 | insert into $schema$.[Setting]([Name], [DisplayName], [Value], [Description]) values ('ui-footer', 'Footer', 'Powered by FunnelWeb , the blog engine of real developers.
', 'HTML: This will appear at the bottom of the page - use it to add copyright information, links to any web hosts, people or technologies that helped you to build the site, and so on.');
4 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0014.sql:
--------------------------------------------------------------------------------
1 | insert into $schema$.[Setting]([Name], [DisplayName], [Value], [Description]) values ('ui-theme', 'Theme', 'Clean', 'Theme being used by the blog at the moment');
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0015.sql:
--------------------------------------------------------------------------------
1 | alter table $schema$.[Revision]
2 | add [Format] nvarchar(20) not null default('Markdown')
3 | go
4 |
5 | alter table $schema$.[Entry]
6 | add [HideChrome] bit not null default(0)
7 | go
8 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0017.sql:
--------------------------------------------------------------------------------
1 | -- This table records the status of a long-running task
2 | create table $schema$.[TaskState]
3 | (
4 | [Id] int identity not null constraint [PK_LongRunningTask_Id] primary key,
5 | [TaskName] nvarchar(50) not null,
6 | [Arguments] nvarchar(max) not null,
7 | [ProgressEstimate] int,
8 | [Status] nvarchar(30),
9 | [OutputLog] nvarchar(max) not null,
10 | [Started] datetime not null,
11 | [Updated] datetime not null
12 | )
13 | go
14 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0018.sql:
--------------------------------------------------------------------------------
1 | -- Can't even remember what these columns were meant to be used for...
2 |
3 | alter table $schema$.[Entry]
4 | drop column [IsVisible]
5 | go
6 |
7 | alter table $schema$.[Revision]
8 | drop column [IsVisible]
9 | go
10 |
11 | alter table $schema$.[Revision]
12 | drop column [ChangeSummary]
13 | go
14 |
15 | alter table $schema$.[Comment]
16 | drop column [AuthorCompany]
17 | go
18 |
19 | -- 50 was a nice size, but when we import from other blog engines they may have used large URL's
20 | alter table $schema$.[Entry]
21 | alter column [Name] nvarchar(100)
22 | go
23 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0019.sql:
--------------------------------------------------------------------------------
1 | alter table $schema$.[Entry]
2 | add [PageTemplate] nvarchar(20) null
3 | go
4 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0020.sql:
--------------------------------------------------------------------------------
1 | drop procedure $schema$.[GetCurrentVersionNumber]
2 | go
3 |
4 | create procedure $schema$.[GetCurrentVersionNumber]
5 | @sourceIdentifier nvarchar(255)
6 | as
7 | begin
8 | select max(VersionNumber) from $schema$.[SchemaVersions] where [SourceIdentifier] = @sourceIdentifier
9 | end
10 | go
11 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0020_sqlce.sql:
--------------------------------------------------------------------------------
1 | --SqlCe support added after journal no longer uses procedures to keep track of scripts, don't need this script
2 | select 1
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0021.sql:
--------------------------------------------------------------------------------
1 | --Latest Revision Id already exists, lets just extend it a little and make use of it
2 |
3 | alter table $schema$.[Entry] add
4 | [RevisionNumber] int NULL,
5 | [Body] nvarchar(max) NULL
6 | go
7 |
8 | update $schema$.[Entry] set
9 | [LatestRevisionId] = (select top 1 [Id] from $schema$.[Revision] where [EntryId] = [Entry].[Id] order by [Revised] desc),
10 | [RevisionNumber] = (select top 1 [RevisionNumber] from $schema$.[Revision] where [EntryId] = [Entry].[Id] order by [Revised] desc),
11 | [Body] = (select top 1 [Body] from $schema$.[Revision] where [EntryId] = [Entry].[Id] order by [Revised] desc)
12 | go
13 |
14 | alter table $schema$.[Entry] alter column [LatestRevisionId] int not null
15 | go
16 | alter table $schema$.[Entry] alter column [RevisionNumber] int not null
17 | go
18 | alter table $schema$.[Entry] alter column [Body] nvarchar(max) not null
19 | go
20 |
21 | alter table $schema$.[Revision]
22 | drop column [Tags]
23 | go
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0021_sqlce.sql:
--------------------------------------------------------------------------------
1 | --SqlCe support was added after this script was created, no data migration necessary
2 |
3 | alter table $schema$.[Revision]
4 | drop column [Tags]
5 | go
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0022.sql:
--------------------------------------------------------------------------------
1 | declare @hasFullText bit
2 | declare @hasFullTextIndex bit
3 | select @hasFullText = convert(int, SERVERPROPERTY('IsFullTextInstalled'))
4 | select @hasFullTextIndex = OBJECTPROPERTY(OBJECT_ID('$schema$.[Entry]'), 'TableHasActiveFulltextIndex')
5 |
6 | if (@hasFullText = 1 AND @hasFullTextIndex = 1)
7 | begin
8 | begin try
9 | exec sp_fulltext_column '$schema$.[Entry]', 'Body', 'add', 0x0409
10 | end try
11 | begin catch
12 | --Full text not installed
13 | print 'Full text catalog not installed'
14 | end catch
15 | end
16 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0022_sqlce.sql:
--------------------------------------------------------------------------------
1 | --SqlCe doesnt support full text indexes
2 | select 1
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0024.sql:
--------------------------------------------------------------------------------
1 | alter table $schema$.[Entry] add
2 | [Author] varchar(100) null,
3 | [RevisionAuthor] varchar(100) null
4 | go
5 | alter table $schema$.[Revision] add
6 | [Author] varchar(100) null
7 | go
8 |
9 | update $schema$.[Entry] set
10 | [Author] = (select top 1 [Value] from $schema$.[Setting] where [Name] = 'search-author'),
11 | [RevisionAuthor] = (select top 1 [Value] from $schema$.[Setting] where [Name] = 'search-author')
12 | go
13 |
14 | update $schema$.[Revision] set
15 | [Author] = (select top 1 [Value] from $schema$.[Setting] where [Name] = 'search-author')
16 | go
17 |
18 | alter table $schema$.[Entry] alter column [Author] varchar(100) not null
19 | go
20 |
21 | alter table $schema$.[Entry] alter column [RevisionAuthor] varchar(100) not null
22 | go
23 |
24 | alter table $schema$.[Revision] alter column [Author] varchar(100) not null
25 | go
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0024_sqlce.sql:
--------------------------------------------------------------------------------
1 | --Script 29 will set these columns to not null (sqlce support added when script 29 was created)
2 | alter table $schema$.[Entry] add
3 | [Author] nvarchar(100) null,
4 | [RevisionAuthor] nvarchar(100) null
5 | go
6 | alter table $schema$.[Revision] add
7 | [Author] nvarchar(100) null
8 | go
9 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0025_sqlce.sql:
--------------------------------------------------------------------------------
1 | alter table $schema$.[Comment] drop constraint [FK_Comment_Comment]
2 | go
3 |
4 | create table $schema$.[Tmp_Comment]
5 | (
6 | [Id] int NOT NULL IDENTITY (1, 1),
7 | [Body] nvarchar(MAX) NOT NULL,
8 | [AuthorName] nvarchar(100) NOT NULL,
9 | [AuthorEmail] nvarchar(100) NOT NULL,
10 | [AuthorUrl] nvarchar(100) NOT NULL,
11 | [AuthorIp] nvarchar(39) NULL,
12 | [Posted] datetime NOT NULL,
13 | [EntryId] int NOT NULL,
14 | [EntryRevisionNumber] int NULL,
15 | [Status] int NOT NULL
16 | )
17 | go
18 |
19 | --SqlCe doesnt need data migration at this point, or fixes that are in Script25 for normal Sql
20 |
21 | drop table $schema$.[Comment]
22 | go
23 |
24 | execute sp_rename N'$schema$.Tmp_Comment', N'Comment', 'OBJECT'
25 | go
26 |
27 |
28 | alter table $schema$.[Comment] add constraint
29 | PK_Comment_Id primary key ([Id])
30 | go
31 |
32 | alter table $schema$.[Comment] add constraint
33 | FK_Comment_Comment foreign key ([EntryId]) references $schema$.[Entry]([Id])
34 | on update no action
35 | on delete no action
36 | go
37 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0027_sqlce.sql:
--------------------------------------------------------------------------------
1 | --Adding in a few other revision fields into entry table
2 | alter table $schema$.[Entry] add
3 | [LastRevised] datetime null,
4 | [LatestRevisionFormat] nvarchar(20) null,
5 | [TagsCommaSeparated] nvarchar(255) null
6 | go
7 |
8 | --sqlce doesnt need data migration yet
9 |
10 | update $schema$.[Entry] set [TagsCommaSeparated] = '' where [TagsCommaSeparated] is null
11 | go
12 |
13 | alter table $schema$.[Entry] alter column [LastRevised] datetime not null
14 | go
15 | alter table $schema$.[Entry] alter column [LatestRevisionFormat] nvarchar(20) not null
16 | go
17 | alter table $schema$.[Entry] alter column [TagsCommaSeparated] nvarchar(255) not null
18 | go
19 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0028.sql:
--------------------------------------------------------------------------------
1 | alter table $schema$.[Pingback] add
2 | [Received] datetime null
3 | go
4 |
5 | update $schema$.[Pingback] set
6 | [Received] = getdate()
7 | go
8 |
9 | alter table $schema$.[Pingback] alter column [Received] datetime not null
10 | go
11 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0029.sql:
--------------------------------------------------------------------------------
1 | alter table $schema$.[Entry] alter column [Author] nvarchar(100) not null
2 | go
3 |
4 | alter table $schema$.[Entry] alter column [RevisionAuthor] nvarchar(100) not null
5 | go
6 |
7 | alter table $schema$.[Revision] alter column [Author] nvarchar(100) not null
8 | go
9 |
10 | alter table $schema$.[Entry] add
11 | [CommentCount] int null
12 | go
13 |
14 | update $schema$.[Entry] set [CommentCount] = 0
15 | go
16 |
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0030.sql:
--------------------------------------------------------------------------------
1 | UPDATE $schema$.[Tag] SET Name = REPLACE(Name, ' ', '')
2 | go
3 | UPDATE $schema$.[Entry] SET [TagsCommaSeparated] = REPLACE([TagsCommaSeparated], ' ', '')
4 | go
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0031.sql:
--------------------------------------------------------------------------------
1 | insert into $schema$.[Setting](
2 | [Name],
3 | [DisplayName],
4 | [Value],
5 | [Description]
6 | )
7 | values (
8 | 'enable-disqus-comments',
9 | 'Enable Disque Comments',
10 | 'False',
11 | 'Enable the Disqus commenting system. Note - this will still require the theme to also use Disqus.'
12 | );
--------------------------------------------------------------------------------
/src/FunnelWeb/DatabaseDeployer/Scripts/Script0032.sql:
--------------------------------------------------------------------------------
1 | insert into $schema$.[Setting](
2 | [Name],
3 | [DisplayName],
4 | [Value],
5 | [Description]
6 | )
7 | values (
8 | 'disqus-shortname',
9 | 'Shortname for Disqus',
10 | '',
11 | 'The shortname of your Disqus comments, configured on the Disqus website.'
12 | );
--------------------------------------------------------------------------------
/src/FunnelWeb/Eventing/EventingModule.cs:
--------------------------------------------------------------------------------
1 | using Autofac;
2 |
3 | namespace FunnelWeb.Eventing
4 | {
5 | public class EventingModule : Module
6 | {
7 | protected override void Load(ContainerBuilder builder)
8 | {
9 | base.Load(builder);
10 |
11 | builder.RegisterType().As().InstancePerLifetimeScope();
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/FunnelWeb/FunnelWeb.ncrunchproject:
--------------------------------------------------------------------------------
1 |
2 | false
3 | false
4 | false
5 | true
6 | false
7 | false
8 | false
9 | false
10 | true
11 | true
12 | false
13 | true
14 | true
15 | 60000
16 |
17 |
18 | AutoDetect
19 |
--------------------------------------------------------------------------------
/src/FunnelWeb/FunnelWebExtensionAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.Composition;
3 |
4 | namespace FunnelWeb
5 | {
6 | [MetadataAttribute]
7 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
8 | public class FunnelWebExtensionAttribute : ExportAttribute
9 | {
10 | public FunnelWebExtensionAttribute()
11 | : base(typeof(IFunnelWebExtension))
12 | {
13 |
14 | }
15 |
16 | public string FullName { get; set; }
17 | public string SupportLink { get; set; }
18 | public string Publisher { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/IFunnelWebExtension.cs:
--------------------------------------------------------------------------------
1 | using Autofac;
2 |
3 | namespace FunnelWeb
4 | {
5 | ///
6 | /// An extensibility point for FunnelWeb
7 | ///
8 | public interface IFunnelWebExtension
9 | {
10 | ///
11 | /// Initializes the extension, the Autofac container is also provided so that you can include items for DI
12 | ///
13 | /// The builder.
14 | void Initialize(ContainerBuilder builder);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/FunnelWeb/IFunnelWebExtensionMetaData.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb
2 | {
3 | public interface IFunnelWebExtensionMetaData
4 | {
5 | string FullName { get; }
6 | string SupportLink { get; }
7 | string Publisher { get; }
8 | }
9 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/IRequireDatabaseScripts.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb
2 | {
3 | public interface IRequireDatabaseScripts
4 | {
5 | ///
6 | /// This identifier is used to figure out which of your scripts have already been run. Once you set this,
7 | /// never, never, never change it.
8 | ///
9 | string SourceIdentifier { get; }
10 |
11 | ///
12 | /// For example FunnelWeb.Extensions.MYEXTENSION.Scripts.Script{0}.sql
13 | /// Script version will have 4 digits.
14 | ///
15 | string ScriptNameFormat { get; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Authentication/Mappings/RoleMapping.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentNHibernate.Mapping;
3 |
4 | namespace FunnelWeb.Model.Authentication.Mappings
5 | {
6 | public class RoleMapping : ClassMap
7 | {
8 | public RoleMapping()
9 | {
10 | Id(x => x.Id).GeneratedBy.Identity();
11 | Map(x => x.Name);
12 |
13 | HasManyToMany(x => x.Users)
14 | .AsBag()
15 | .Table("UserRoles")
16 | .ParentKeyColumn("RoleId")
17 | .ChildKeyColumn("UserId")
18 | .Cascade.All();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Authentication/Mappings/UserMapping.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentNHibernate.Mapping;
3 |
4 | namespace FunnelWeb.Model.Authentication.Mappings
5 | {
6 | public class UserMapping : ClassMap
7 | {
8 | public UserMapping()
9 | {
10 | Id(x => x.Id).GeneratedBy.Identity();
11 | Map(x => x.Name);
12 | Map(x => x.Username);
13 | Map(x => x.Email);
14 | Map(x => x.Password);
15 | HasManyToMany(x => x.Roles)
16 | .AsBag()
17 | .Table("UserRoles")
18 | .ParentKeyColumn("UserId")
19 | .ChildKeyColumn("RoleId")
20 | .Inverse()
21 | .Cascade.None();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Authentication/Role.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace FunnelWeb.Model.Authentication
5 | {
6 | public class Role
7 | {
8 | public virtual int Id { get; protected set; }
9 | public virtual string Name { get; set; }
10 | public virtual IList Users { get; protected set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Authentication/User.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace FunnelWeb.Model.Authentication
5 | {
6 | public class User
7 | {
8 | public User()
9 | {
10 | Roles = new List();
11 | }
12 |
13 | public virtual int Id { get; protected set; }
14 | public virtual string Name { get; set; }
15 | public virtual string Email { get; set; }
16 | public virtual string Username { get; set; }
17 | public virtual string Password { get; set; }
18 | public virtual IList Roles { get; protected set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Comment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FunnelWeb.Model
4 | {
5 | public class Comment
6 | {
7 | public virtual int Id { get; set; }
8 |
9 | public virtual string Body { get; set; }
10 | public virtual string AuthorName { get; set; }
11 | public virtual string AuthorUrl { get; set; }
12 | public virtual string AuthorEmail { get; set; }
13 | public virtual string AuthorIp { get; set; }
14 | public virtual Entry Entry { get; set; }
15 | public virtual DateTime Posted { get; set; }
16 | public virtual int Status { get; set; }
17 | public virtual int EntryRevisionNumber { get; set; }
18 |
19 | public virtual bool IsSpam
20 | {
21 | get { return Status == 0; }
22 | set { Status = value ? 0 : 1; }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/EntryStatus.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Model
2 | {
3 | public static class EntryStatus
4 | {
5 | public static readonly string All = "All";
6 | public static readonly string Private = "Private";
7 | public static readonly string PublicBlog = "Public-Blog";
8 | public static readonly string PublicPage = "Public-Page";
9 | }
10 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/EntrySummary.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.DataAnnotations;
3 | using FunnelWeb.Model.Strings;
4 |
5 | namespace FunnelWeb.Model
6 | {
7 | public class EntrySummary
8 | {
9 | public virtual int Id { get; set; }
10 |
11 | public virtual PageName Name { get; set; }
12 | public virtual string Title { get; set; }
13 |
14 | [DataType("Markdown")]
15 | public virtual string Summary { get; set; }
16 |
17 | public virtual string Status { get; set; }
18 |
19 | public virtual int CommentCount { get; set; }
20 | public virtual string MetaDescription { get; set; }
21 | [DataType("PublishedDate")]
22 | public virtual DateTime Published { get; set; }
23 | public virtual DateTime LastRevised { get; set; }
24 |
25 | [DataType("TagsList")]
26 | public virtual string TagsCommaSeparated { get; set; }
27 |
28 | }
29 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/FileItem.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Model
2 | {
3 | public class FileItem
4 | {
5 | public string Image { get; set; }
6 | public string Name { get; set; }
7 | public string Path { get; set; }
8 | public bool IsDirectory { get; set; }
9 | public string Extension { get; set; }
10 | public string FileSize { get; set; }
11 | public string Modified { get; set; }
12 | public bool IsPathAbsolute { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Formats.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Model
2 | {
3 | public static class Formats
4 | {
5 | public static readonly string Markdown = "Markdown";
6 | public static readonly string Html = "Html";
7 | }
8 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Mappings/CommentMapping.cs:
--------------------------------------------------------------------------------
1 | using FluentNHibernate.Mapping;
2 |
3 | namespace FunnelWeb.Model.Mappings
4 | {
5 | public class CommentMapping : ClassMap
6 | {
7 | public CommentMapping()
8 | {
9 | Id(x => x.Id);
10 | Map(x => x.AuthorEmail);
11 | Map(x => x.AuthorName);
12 | Map(x => x.AuthorUrl);
13 | Map(x => x.Body);
14 | Map(x => x.Status);
15 | Map(x => x.Posted);
16 | Map(x => x.AuthorIp);
17 | Map(x => x.EntryRevisionNumber);
18 |
19 | References(x => x.Entry, "EntryId");
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Mappings/PingbackMapping.cs:
--------------------------------------------------------------------------------
1 | using FluentNHibernate.Mapping;
2 |
3 | namespace FunnelWeb.Model.Mappings
4 | {
5 | public class PingbackMapping : ClassMap
6 | {
7 | public PingbackMapping()
8 | {
9 | Id(x => x.Id);
10 | Map(x => x.IsSpam);
11 | Map(x => x.TargetTitle);
12 | Map(x => x.TargetUri);
13 | Map(x => x.Received);
14 | References(x => x.Entry, "EntryId");
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Mappings/RedirectMapping.cs:
--------------------------------------------------------------------------------
1 | using FluentNHibernate.Mapping;
2 |
3 | namespace FunnelWeb.Model.Mappings
4 | {
5 | public class RedirectMapping : ClassMap
6 | {
7 | public RedirectMapping()
8 | {
9 | Id(x => x.Id);
10 | Map(x => x.From, "[From]");
11 | Map(x => x.To, "[To]");
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Mappings/RevisionFilter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using FluentNHibernate.Mapping;
4 |
5 | namespace FunnelWeb.Model.Mappings
6 | {
7 | public class RevisionFilter : FilterDefinition
8 | {
9 | public RevisionFilter()
10 | {
11 | WithName("RevisionFilter")
12 | .AddParameter("revisionNumber", NHibernate.NHibernateUtil.Int32);
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Mappings/RevisionMapping.cs:
--------------------------------------------------------------------------------
1 | using FluentNHibernate.Mapping;
2 |
3 | namespace FunnelWeb.Model.Mappings
4 | {
5 | public class RevisionMapping : ClassMap
6 | {
7 | public RevisionMapping()
8 | {
9 | Id(x => x.Id);
10 | Map(x => x.Body).Length(int.MaxValue);
11 | Map(x => x.Reason);
12 | Map(x => x.Revised);
13 | Map(x => x.RevisionNumber);
14 | Map(x => x.Status);
15 | Map(x => x.Format);
16 | Map(x => x.Author);
17 | References(x => x.Entry, "EntryId");
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Mappings/SettingMapping.cs:
--------------------------------------------------------------------------------
1 | using FluentNHibernate.Mapping;
2 | using FunnelWeb.Model.Mappings.UserTypes;
3 |
4 | namespace FunnelWeb.Model.Mappings
5 | {
6 | public class SettingMapping : ClassMap
7 | {
8 | public SettingMapping()
9 | {
10 | Id(x => x.Id);
11 | Map(x => x.Description);
12 | Map(x => x.DisplayName);
13 | Map(x => x.Name).CustomType();
14 | Map(x => x.Value);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Mappings/TagMapping.cs:
--------------------------------------------------------------------------------
1 | using FluentNHibernate.Mapping;
2 |
3 | namespace FunnelWeb.Model.Mappings
4 | {
5 | public class TagMapping : ClassMap
6 | {
7 | public TagMapping()
8 | {
9 | Id(x => x.Id);
10 | Map(x => x.Name);
11 | HasManyToMany(x => x.Entries)
12 | .Table("TagItem")
13 | .ParentKeyColumn("TagId")
14 | .ChildKeyColumn("EntryId")
15 | .Inverse()
16 | .LazyLoad();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Mappings/TaskStateMapping.cs:
--------------------------------------------------------------------------------
1 | using FluentNHibernate.Mapping;
2 |
3 | namespace FunnelWeb.Model.Mappings
4 | {
5 | public class TaskStateMapping : ClassMap
6 | {
7 | public TaskStateMapping()
8 | {
9 | Id(x => x.Id);
10 | Map(x => x.TaskName);
11 | Map(x => x.Status);
12 | Map(x => x.Started);
13 | Map(x => x.ProgressEstimate);
14 | Map(x => x.OutputLog);
15 | Map(x => x.Updated);
16 | Map(x => x.Arguments);
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Pingback.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FunnelWeb.Model
4 | {
5 | public class Pingback
6 | {
7 | public virtual int Id { get; protected set; }
8 | public virtual Entry Entry { get; set; }
9 | public virtual string TargetUri { get; set; }
10 | public virtual string TargetTitle { get; set; }
11 | public virtual bool IsSpam { get; set; }
12 | public virtual DateTime Received { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Redirect.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Model
2 | {
3 | public class Redirect
4 | {
5 | public virtual int Id { get; set; }
6 | public virtual string From { get; set; }
7 | public virtual string To { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Repositories/IAdminRepository.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Collections.Generic;
3 |
4 | namespace FunnelWeb.Model.Repositories
5 | {
6 | public interface IAdminRepository
7 | {
8 | IQueryable GetSettings();
9 |
10 | void Save(IEnumerable settings);
11 | void UpdateCommentCountFor(int entryId);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Repositories/ITaskStateRepository.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | namespace FunnelWeb.Model.Repositories
4 | {
5 | public interface ITaskStateRepository
6 | {
7 | TaskState Get(int id);
8 | IQueryable GetAll();
9 | void Save(TaskState state);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Repositories/Internal/TaskStateRepository.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using NHibernate;
3 | using NHibernate.Linq;
4 |
5 | namespace FunnelWeb.Model.Repositories.Internal
6 | {
7 | public class TaskStateRepository : ITaskStateRepository
8 | {
9 | private readonly ISession session;
10 |
11 | public TaskStateRepository(ISession session)
12 | {
13 | this.session = session;
14 | }
15 |
16 | public TaskState Get(int id)
17 | {
18 | return session.Load(id);
19 | }
20 |
21 | public IQueryable GetAll()
22 | {
23 | return session.Query();
24 | }
25 |
26 | public void Save(TaskState state)
27 | {
28 | session.SaveOrUpdate(state);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Setting.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FunnelWeb.Model.Strings;
3 |
4 | namespace FunnelWeb.Model
5 | {
6 | public class Setting
7 | {
8 | public virtual int Id { get; set; }
9 | public virtual PageName Name { get; set; }
10 | public virtual string DisplayName { get; set; }
11 | public virtual string Description { get; set; }
12 | public virtual string Value { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/Strings/EnforcedStringLengthAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.DataAnnotations;
3 |
4 | namespace FunnelWeb.Model.Strings
5 | {
6 | ///
7 | /// StringLength does a explicit cast to string, so it will not work with FunnelWeb's EnforcedString class
8 | ///
9 | [AttributeUsage(AttributeTargets.Property)]
10 | public class EnforcedStringLengthAttribute : StringLengthAttribute
11 | {
12 | public EnforcedStringLengthAttribute(int maximumLength) : base(maximumLength)
13 | {
14 | }
15 |
16 | public override bool IsValid(object value)
17 | {
18 | var enforcedString = (EnforcedString)value;
19 |
20 | return base.IsValid(enforcedString.ToString());
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Model/TaskStatus.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Model
2 | {
3 | public enum TaskStatus
4 | {
5 | Running = 1,
6 | Failed = 2,
7 | Success = 3
8 | }
9 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Mvc/HintSize.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FunnelWeb.Mvc
4 | {
5 | public enum HintSize
6 | {
7 | Small,
8 | Medium,
9 | Large
10 | }
11 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Mvc/HintSizeAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FunnelWeb.Mvc
4 | {
5 | [AttributeUsage(AttributeTargets.Property)]
6 | public class HintSizeAttribute : Attribute
7 | {
8 | public HintSizeAttribute(HintSize size)
9 | {
10 | Size = size;
11 | }
12 |
13 | public HintSize Size { get; private set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | [assembly: AssemblyTitle("FunnelWeb")]
4 | [assembly: AssemblyDescription("Code domain model, repositories and extensbility support for FunnelWeb")]
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/Database/Sql/ProfiledClientBatchingBatcherFactory.cs:
--------------------------------------------------------------------------------
1 | using NHibernate;
2 | using NHibernate.AdoNet;
3 | using NHibernate.Engine;
4 |
5 | namespace FunnelWeb.Providers.Database.Sql
6 | {
7 | public class ProfiledClientBatchingBatcherFactory : IBatcherFactory
8 | {
9 | public virtual IBatcher CreateBatcher(ConnectionManager connectionManager, IInterceptor interceptor)
10 | {
11 | return new ProfiledSqlClientBatchingBatcher(connectionManager, interceptor);
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/Database/Sql/ProfiledSqlClientBatchingBatcherFactory.cs:
--------------------------------------------------------------------------------
1 | using NHibernate;
2 | using NHibernate.AdoNet;
3 | using NHibernate.Engine;
4 |
5 | namespace FunnelWeb.Providers.Database.Sql
6 | {
7 | public class ProfiledSqlClientBatchingBatcherFactory : IBatcherFactory
8 | {
9 | public virtual IBatcher CreateBatcher(ConnectionManager connectionManager, IInterceptor interceptor)
10 | {
11 | return new ProfiledSqlClientBatchingBatcher(connectionManager, interceptor);
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/Database/Sql/ProfiledSqlClientDriver.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 | using System.Data.SqlClient;
4 | using NHibernate.AdoNet;
5 | using NHibernate.Driver;
6 | using StackExchange.Profiling;
7 |
8 | namespace FunnelWeb.Providers.Database.Sql
9 | {
10 | public class ProfiledSqlClientDriver : Sql2008ClientDriver, IEmbeddedBatcherFactoryProvider
11 | {
12 | public override IDbConnection CreateConnection()
13 | {
14 | return new ProfiledSqlDbConnection(
15 | new SqlConnection(),
16 | MiniProfiler.Current);
17 | }
18 |
19 | public override IDbCommand CreateCommand()
20 | {
21 | return new ProfiledSqlDbCommand(
22 | new SqlCommand(),
23 | null,
24 | MiniProfiler.Current);
25 | }
26 |
27 | Type IEmbeddedBatcherFactoryProvider.BatcherFactoryClass
28 | {
29 | get { return typeof(ProfiledClientBatchingBatcherFactory); }
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/Database/Sql/ProfiledSqlDbCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Data.Common;
2 | using System.Data.SqlClient;
3 | using StackExchange.Profiling;
4 | using StackExchange.Profiling.Data;
5 |
6 | namespace FunnelWeb.Providers.Database.Sql
7 | {
8 | public class ProfiledSqlDbCommand : ProfiledDbCommand
9 | {
10 | public ProfiledSqlDbCommand(SqlCommand cmd, DbConnection conn, MiniProfiler profiler)
11 | : base(cmd, conn, profiler)
12 | {
13 | Command = cmd;
14 | }
15 |
16 | public SqlCommand Command { get; set; }
17 |
18 | private DbTransaction trans;
19 |
20 | protected override DbTransaction DbTransaction
21 | {
22 | get { return trans; }
23 | set
24 | {
25 | trans = value;
26 | var profiledSqlDbTransaction = value as ProfiledSqlDbTransaction;
27 | Command.Transaction = profiledSqlDbTransaction == null ? (SqlTransaction)value : profiledSqlDbTransaction.Transaction;
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/Database/Sql/ProfiledSqlDbConnection.cs:
--------------------------------------------------------------------------------
1 | using System.Data;
2 | using System.Data.Common;
3 | using System.Data.SqlClient;
4 | using StackExchange.Profiling;
5 | using StackExchange.Profiling.Data;
6 |
7 | namespace FunnelWeb.Providers.Database.Sql
8 | {
9 | public class ProfiledSqlDbConnection : ProfiledDbConnection
10 | {
11 | public ProfiledSqlDbConnection(SqlConnection connection, MiniProfiler profiler)
12 | : base(connection, profiler)
13 | {
14 | Connection = connection;
15 | }
16 |
17 | public SqlConnection Connection { get; set; }
18 |
19 | protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
20 | {
21 | return new ProfiledSqlDbTransaction(Connection.BeginTransaction(isolationLevel), this);
22 | }
23 |
24 | }
25 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/Database/Sql/ProfiledSqlDbTransaction.cs:
--------------------------------------------------------------------------------
1 | using System.Data.SqlClient;
2 | using StackExchange.Profiling.Data;
3 |
4 | namespace FunnelWeb.Providers.Database.Sql
5 | {
6 | public class ProfiledSqlDbTransaction : ProfiledDbTransaction
7 | {
8 | public ProfiledSqlDbTransaction(SqlTransaction transaction, ProfiledDbConnection connection)
9 | : base(transaction, connection)
10 | {
11 | Transaction = transaction;
12 | }
13 |
14 | public SqlTransaction Transaction { get; set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/Database/SqlCe/FunnelWebCe40Dialect.cs:
--------------------------------------------------------------------------------
1 | using NHibernate;
2 | using NHibernate.Dialect;
3 | using NHibernate.Dialect.Function;
4 |
5 | namespace FunnelWeb.Providers.Database.SqlCe
6 | {
7 | public class FunnelWebMsSqlCe40Dialect : MsSqlCe40Dialect
8 | {
9 | public FunnelWebMsSqlCe40Dialect()
10 | {
11 | RegisterFunction("concat", new VarArgsSQLFunction(NHibernateUtil.String, "(", "+", ")"));
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/Database/SqlCe/FunnelWebSqlServerCeDriver.cs:
--------------------------------------------------------------------------------
1 | using System.Data;
2 | using System.Data.SqlServerCe;
3 | using NHibernate.Driver;
4 | using NHibernate.SqlTypes;
5 |
6 | namespace FunnelWeb.Providers.Database.SqlCe
7 | {
8 |
9 | ///
10 | /// Overridden Nhibernate SQL CE Driver,
11 | /// so that ntext fields are not truncated at 4000 characters
12 | ///
13 | public class FunnelWebSqlServerCeDriver : SqlServerCeDriver
14 | {
15 | protected override void InitializeParameter(IDbDataParameter dbParam,string name,SqlType sqlType)
16 | {
17 | base.InitializeParameter(dbParam, name, sqlType);
18 |
19 | var stringType = sqlType as StringSqlType;
20 | if (stringType != null && stringType.LengthDefined && stringType.Length > 4000)
21 | {
22 | var parameter = (SqlCeParameter)dbParam;
23 | parameter.SqlDbType = SqlDbType.NText;
24 | }
25 |
26 | }
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/File/IFileRepository.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Web.Mvc;
3 | using FunnelWeb.Model;
4 |
5 | namespace FunnelWeb.Providers.File
6 | {
7 | public interface IFileRepository
8 | {
9 | bool IsFile(string path);
10 | FileItem[] GetItems(string path);
11 |
12 | void Move(string oldPath, string newPath);
13 | void Delete(string filePath);
14 |
15 | void CreateDirectory(string path, string name);
16 | void Save(Stream inputStream, string path, bool unzip);
17 | ActionResult Render(string path);
18 | }
19 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/IProviderInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace FunnelWeb.Providers
4 | {
5 | public interface IProviderInfo
6 | {
7 | IEnumerable Keys { get; }
8 | T GetProviderByName(string key);
9 | IProviderMetadata GetMetaData(string key);
10 | }
11 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Providers/ProviderMetaData.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Providers
2 | {
3 | public interface IProviderMetadata
4 | {
5 | string Name { get; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/Alias.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FunnelWeb.Repositories
4 | {
5 | public static class Alias
6 | {
7 | public static T For()
8 | {
9 | return default(T);
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/EntriesSortColumn.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FunnelWeb.Repositories
4 | {
5 | public enum EntriesSortColumn
6 | {
7 | Slug,
8 | Title,
9 | Comments,
10 | Published
11 | }
12 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/Filters.cs:
--------------------------------------------------------------------------------
1 | using FunnelWeb.Model;
2 | using NHibernate;
3 |
4 | namespace FunnelWeb.Repositories
5 | {
6 | public static class Filters
7 | {
8 | public static IQueryOver ApplyEntryStatusFilter(this IQueryOver query, string entryStatus)
9 | {
10 | if (entryStatus != EntryStatus.All)
11 | {
12 | if (entryStatus == null)
13 | query.Where(e => e.Status != EntryStatus.Private);
14 | else
15 | query.Where(e => e.Status == entryStatus);
16 | }
17 |
18 | return query;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/ICommand.cs:
--------------------------------------------------------------------------------
1 | using NHibernate;
2 |
3 | namespace FunnelWeb.Repositories
4 | {
5 | public interface ICommand
6 | {
7 | void Execute(ISession session);
8 | }
9 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/IPagedQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FunnelWeb.Providers.Database;
3 | using NHibernate;
4 |
5 | namespace FunnelWeb.Repositories
6 | {
7 | public interface IPagedQuery
8 | {
9 | PagedResult Execute(ISession session, IDatabaseProvider databaseProvider, int skip, int take);
10 | }
11 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/IQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using FunnelWeb.Providers.Database;
3 | using NHibernate;
4 |
5 | namespace FunnelWeb.Repositories
6 | {
7 | public interface IQuery
8 | {
9 | IEnumerable Execute(ISession session, IDatabaseProvider databaseProvider);
10 | }
11 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/IRepository.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace FunnelWeb.Repositories
4 | {
5 | public interface IRepository
6 | {
7 | TEntity Get(object id);
8 | IEnumerable FindAll() where TEntity : class;
9 | IEnumerable Find(IQuery query) where TEntity : class;
10 | PagedResult Find(IPagedQuery query, int pageNumber, int itemsPerPage) where TEntity : class;
11 | TEntity FindFirst(IQuery query) where TEntity : class;
12 | TEntity FindFirstOrDefault(IQuery query) where TEntity : class;
13 | TEntity FindFirstOrDefault(IPagedQuery query) where TEntity : class;
14 | void Execute(ICommand command);
15 | void Add(object entity);
16 | void Remove(object entity);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/Queries/GetAllCommentsQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FunnelWeb.Model;
3 | using FunnelWeb.Providers.Database;
4 | using NHibernate;
5 | using NHibernate.Criterion;
6 |
7 | namespace FunnelWeb.Repositories.Queries
8 | {
9 | public class GetAllCommentsQuery : IPagedQuery
10 | {
11 | public PagedResult Execute(ISession session, IDatabaseProvider databaseProvider, int skip, int take)
12 | {
13 | var total = session
14 | .QueryOver()
15 | .ToRowCountQuery()
16 | .FutureValue();
17 |
18 | var results = session
19 | .QueryOver()
20 | .Fetch(x => x.Entry).Eager()
21 | .OrderBy(x => x.Posted).Desc()
22 | .Skip(skip)
23 | .Take(take)
24 | .List();
25 |
26 | return new PagedResult(results, total.Value, skip, take);
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/Queries/GetCommentsQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FunnelWeb.Model;
3 | using FunnelWeb.Providers.Database;
4 | using NHibernate;
5 | using NHibernate.Criterion;
6 |
7 | namespace FunnelWeb.Repositories.Queries
8 | {
9 | public class GetCommentsQuery : IPagedQuery
10 | {
11 | public PagedResult Execute(ISession session, IDatabaseProvider databaseProvider, int skip, int take)
12 | {
13 | var total = session
14 | .QueryOver()
15 | .ToRowCountQuery()
16 | .FutureValue();
17 |
18 | var results = session
19 | .QueryOver()
20 | .Fetch(x => x.Entry).Eager()
21 | .OrderBy(x => x.Posted).Desc()
22 | .Where(x => x.Status != 0)
23 | .Skip(skip)
24 | .Take(take)
25 | .List();
26 |
27 | return new PagedResult(results, total.Value, skip, take);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/Queries/GetEntryWithPingbacksQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using FunnelWeb.Model;
4 | using FunnelWeb.Providers.Database;
5 | using NHibernate;
6 |
7 | namespace FunnelWeb.Repositories.Queries
8 | {
9 | public class GetEntryWithPingbacksQuery : IQuery
10 | {
11 | private readonly string name;
12 |
13 | public GetEntryWithPingbacksQuery(string name)
14 | {
15 | this.name = name;
16 | }
17 |
18 | public IEnumerable Execute(ISession session, IDatabaseProvider databaseProvider)
19 | {
20 | return session
21 | .QueryOver()
22 | .Where(e => e.Name == name)
23 | .JoinQueryOver(p => p.Pingbacks)
24 | .List();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/Queries/GetSpamQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using FunnelWeb.Model;
4 | using FunnelWeb.Providers.Database;
5 | using NHibernate;
6 | using NHibernate.Linq;
7 |
8 | namespace FunnelWeb.Repositories.Queries
9 | {
10 | public class GetSpamQuery : IQuery
11 | {
12 | public IEnumerable Execute(ISession session, IDatabaseProvider databaseProvider)
13 | {
14 | return session
15 | .Query()
16 | .Where(x => x.Status == 0);
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Repositories/Queries/SearchTagsByNameQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using FunnelWeb.Model;
4 | using FunnelWeb.Providers.Database;
5 | using NHibernate;
6 | using NHibernate.Criterion;
7 |
8 | namespace FunnelWeb.Repositories.Queries
9 | {
10 | public class SearchTagsByNameQuery :IQuery
11 | {
12 | private readonly string tagName;
13 |
14 | public SearchTagsByNameQuery(string tagName)
15 | {
16 | this.tagName = tagName;
17 | }
18 |
19 | public string TagName
20 | {
21 | get { return tagName; }
22 | }
23 |
24 | public IEnumerable Execute(ISession session, IDatabaseProvider databaseProvider)
25 | {
26 | return session
27 | .QueryOver()
28 | .WhereRestrictionOn(tag => tag.Name).IsLike(TagName, MatchMode.Anywhere)
29 | .List();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Settings/AppHarborSettings.cs:
--------------------------------------------------------------------------------
1 | using System.Configuration;
2 | using System.Web.Configuration;
3 |
4 | namespace FunnelWeb.Settings
5 | {
6 | public class AppHarborSettings : IAppHarborSettings
7 | {
8 | public string SqlServerConnectionString
9 | {
10 | get
11 | {
12 | var apphbConnectionString = ConfigurationManager.AppSettings["SQLSERVER_CONNECTION_STRING"];
13 |
14 | if (string.IsNullOrWhiteSpace(apphbConnectionString))
15 | return null;
16 |
17 | return apphbConnectionString;
18 | }
19 | set
20 | {
21 | var config = WebConfigurationManager.OpenWebConfiguration("~");
22 | config.AppSettings.Settings["SQLSERVER_CONNECTION_STRING"].Value = value;
23 | config.Save(ConfigurationSaveMode.Modified);
24 | ConfigurationManager.RefreshSection("appSettings");
25 | }
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Settings/IAppHarborSettings.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Settings
2 | {
3 | public interface IAppHarborSettings
4 | {
5 | string SqlServerConnectionString { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Settings/ISettings.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Settings
2 | {
3 | public interface ISettings
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Settings/ISettingsProvider.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Settings
2 | {
3 | public interface ISettingsProvider
4 | {
5 | T GetSettings() where T : ISettings;
6 | T GetDefaultSettings() where T : ISettings;
7 | void SaveSettings(T settings) where T : ISettings;
8 | }
9 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Settings/SettingStorageAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace FunnelWeb.Settings
4 | {
5 | [AttributeUsage(AttributeTargets.Property)]
6 | public class SettingStorageAttribute : Attribute
7 | {
8 | private readonly StorageLocation location;
9 | private readonly string key;
10 |
11 | public SettingStorageAttribute(StorageLocation location) : this(location, null)
12 | {
13 | }
14 |
15 | public SettingStorageAttribute(StorageLocation location, string key)
16 | {
17 | this.location = location;
18 | this.key = key;
19 | }
20 |
21 | public StorageLocation Location
22 | {
23 | get { return location; }
24 | }
25 |
26 | public string Key
27 | {
28 | get { return key; }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Settings/SqlAuthenticationSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 |
4 | namespace FunnelWeb.Settings
5 | {
6 | public class SqlAuthSettings : ISettings
7 | {
8 | [DisplayName("Sql Authentication Enabled")]
9 | [DefaultValue(false)]
10 | [Description("True if sql authentication is enabled")]
11 | [SettingStorage(StorageLocation.Database, "sql-authentication")]
12 | public bool SqlAuthenticationEnabled { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Settings/StorageLocation.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Settings
2 | {
3 | public enum StorageLocation
4 | {
5 | Database
6 | }
7 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Tasks/ITask.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace FunnelWeb.Tasks
4 | {
5 | public interface ITask
6 | {
7 | IEnumerable Execute(Dictionary properties);
8 | }
9 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Tasks/ITaskExecutor.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Tasks
2 | {
3 | public interface ITaskExecutor where TTask : ITask
4 | {
5 | int Execute(object arguments);
6 | }
7 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Tasks/TaskModule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Autofac;
3 |
4 | namespace FunnelWeb.Tasks
5 | {
6 | public class TasksModule : Module
7 | {
8 | protected override void Load(ContainerBuilder builder)
9 | {
10 | base.Load(builder);
11 |
12 | builder.RegisterAssemblyTypes(typeof (TasksModule).Assembly)
13 | .AssignableTo()
14 | .InstancePerDependency();
15 |
16 | builder.RegisterGeneric(typeof (TaskExecutor<>)).As(typeof (ITaskExecutor<>))
17 | .SingleInstance();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Tasks/TaskStep.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Tasks
2 | {
3 | public class TaskStep
4 | {
5 | private readonly int? progressEstimate;
6 | private readonly string logMessage;
7 |
8 | public TaskStep(string logMessageFormat, params object[] args) : this(null, logMessageFormat, args)
9 | {
10 | }
11 |
12 | public TaskStep(int? progressEstimate, string logMessageFormat, params object[] args)
13 | {
14 | this.progressEstimate = progressEstimate;
15 | logMessage = string.Format(logMessageFormat, args);
16 | }
17 |
18 | public int? ProgressEstimate
19 | {
20 | get { return progressEstimate; }
21 | }
22 |
23 | public string LogMessage
24 | {
25 | get { return logMessage; }
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/src/FunnelWeb/Utilities/IMimeTypeLookup.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Utilities
2 | {
3 | public interface IMimeTypeLookup
4 | {
5 | string GetMimeType(string fileNameOrPathWithExtension);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Utilities/NumericExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace FunnelWeb.Utilities
2 | {
3 | public static class NumericExtensions
4 | {
5 | private const long Kilobyte = 1024;
6 | private const long Megabyte = 1024 * Kilobyte;
7 | private const long Gigabyte = 1024 * Megabyte;
8 | private const long Terabyte = 1024 * Gigabyte;
9 |
10 | public static string ToFileSizeString(this long bytes)
11 | {
12 | if (bytes > Terabyte) return (bytes / Terabyte).ToString("0.00 TB");
13 | if (bytes > Gigabyte) return (bytes / Gigabyte).ToString("0.00 GB");
14 | if (bytes > Megabyte) return (bytes / Megabyte).ToString("0.00 MB");
15 | if (bytes > Kilobyte) return (bytes / Kilobyte).ToString("0.00 KB");
16 | return bytes + " bytes";
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/FunnelWeb/Utilities/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Text.RegularExpressions;
2 |
3 | namespace FunnelWeb.Utilities
4 | {
5 | public static class StringExtensions
6 | {
7 | public static string Slugify(this string value)
8 | {
9 | // http://stackoverflow.com/questions/2920744/url-slugify-alrogithm-in-c
10 |
11 | var bytes = System.Text.Encoding.GetEncoding("Cyrillic").GetBytes(value);
12 | value = System.Text.Encoding.ASCII.GetString(bytes).ToLower();
13 |
14 | //// invalid chars
15 | value = Regex.Replace(value, @"[^a-z0-9\s-]", "");
16 | //// convert multiple spaces into one space
17 | value = Regex.Replace(value, @"\s+", " ").Trim();
18 | //// cut and trim
19 | value = value.Substring(0, value.Length <= 45 ? value.Length : 45).Trim();
20 | value = Regex.Replace(value, @"\s", "-"); // hyphens
21 | return value;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/FunnelWeb/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/Information/SolutionInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyConfiguration("")]
5 | [assembly: AssemblyCompany("FunnelWeb")]
6 | [assembly: AssemblyProduct("FunnelWeb")]
7 | [assembly: AssemblyCopyright("Copyright © FunnelWeb Contributors 2010")]
8 | [assembly: ComVisible(false)]
9 |
--------------------------------------------------------------------------------
/src/Information/VersionInfo.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.18010
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | using System;
12 | using System.Reflection;
13 | using System.Runtime.CompilerServices;
14 | using System.Runtime.InteropServices;
15 |
16 | [assembly: AssemblyVersion("2.3.0.0")]
17 | [assembly: AssemblyFileVersion("2.3.0.0")]
18 |
19 |
20 |
--------------------------------------------------------------------------------
8 | @Html.UrlLink(Model.AuthorUrl, Model.AuthorName, "fn url") 9 |