Roughing in wiki sandbox. Removing mvc 2 tooling dependencies.

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4041461
This commit is contained in:
loudej
2009-11-19 23:20:51 +00:00
parent f29342735f
commit 3dfc1a0090
25 changed files with 312 additions and 19 deletions

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Core</RootNamespace>

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{50B779EA-EC00-4699-84C0-03B395C365D2}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Web</RootNamespace>

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Blogs</RootNamespace>

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1ECC1131-0D0C-4822-AD90-E979868C63F3}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.CmsPages</RootNamespace>

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{14C049FD-B35B-415A-A824-87F26B26E7FD}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Comments</RootNamespace>

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.DevTools</RootNamespace>

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Media</RootNamespace>

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D10AD48F-407D-4DB5-A328-173EC7CB010F}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Roles</RootNamespace>

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{79AED36E-ABD0-4747-93D3-8722B042454B}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Users</RootNamespace>

View File

@@ -0,0 +1,70 @@
using System;
using System.Linq;
using System.Web.Mvc;
using Orchard.Data;
using Orchard.Models;
using Orchard.Models.Driver;
using Orchard.Wikis.Models;
using Orchard.Wikis.ViewModels;
namespace Orchard.Wikis.Controllers
{
public class PageController : Controller, IUpdateModel {
private readonly IRepository<WikiPageRecord> _wikiPageRepository;
private readonly IContentManager _contentManager;
public PageController(IRepository<WikiPageRecord> wikiPageRepository, IContentManager contentManager) {
_wikiPageRepository = wikiPageRepository;
_contentManager = contentManager;
}
public ActionResult Index()
{
var pages = _wikiPageRepository.Fetch(x => true, o => o.Asc(x => x.Name));
var model = new PageIndexViewModel {
Pages = pages.Select(x => _contentManager.Get<WikiPage>(x.Id)).ToList()
};
return View(model);
}
public ActionResult Show(int id) {
var model = new PageShowViewModel {
Page = _contentManager.Get<WikiPage>(id)
};
return View(model);
}
public ActionResult Create() {
return View(new PageCreateViewModel());
}
[HttpPost]
public ActionResult Create(PageCreateViewModel model) {
var page = _contentManager.New<WikiPage>("wikipage");
page.Record.Name = model.Name;
_contentManager.Create(page);
return RedirectToAction("show", new {page.ContentItem.Id});
}
public ActionResult Edit(int id) {
var model = new PageEditViewModel {Page = _contentManager.Get<WikiPage>(id)};
model.Editors = _contentManager.GetEditors(model.Page.ContentItem);
return View(model);
}
[HttpPost]
public ActionResult Edit(int id, FormCollection input) {
var model = new PageEditViewModel { Page = _contentManager.Get<WikiPage>(id) };
model.Editors = _contentManager.UpdateEditors(model.Page.ContentItem, this);
if (!TryUpdateModel(model, input.ToValueProvider()))
return View(model);
return RedirectToAction("show", new { id });
}
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
return TryUpdateModel(model, prefix, includeProperties, excludeProperties);
}
}
}

View File

@@ -0,0 +1,7 @@
using Orchard.Models;
namespace Orchard.Wikis.Models {
public class WikiPage : ContentPartForRecord<WikiPageRecord> {
}
}

View File

@@ -1,15 +1,15 @@
using Orchard.Core.Common.Models;
using Orchard.Data;
using Orchard.Models.Driver;
namespace Orchard.Wikis.Models {
public class WikiPageHandler : ContentHandler {
protected override void Activating(ActivatingContentContext context) {
if (context.ContentType == "wikipage") {
context.Builder
.Weld<CommonPart>()
.Weld<RoutablePart>()
.Weld<ContentPart>();
}
public WikiPageHandler(IRepository<WikiPageRecord> wikiPageRepository) {
Filters.Add(new ActivatingFilter<WikiPage>("wikipage"));
Filters.Add(new ActivatingFilter<CommonPart>("wikipage"));
Filters.Add(new ActivatingFilter<RoutablePart>("wikipage"));
Filters.Add(new ActivatingFilter<ContentPart>("wikipage"));
Filters.Add(new StorageFilterForRecord<WikiPageRecord>(wikiPageRepository) { AutomaticallyCreateMissingRecord = true });
}
}
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.Models.Records;
namespace Orchard.Wikis.Models {
public class WikiPageRecord : ContentPartRecord{
public virtual string Name { get; set; }
}
}

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{17C44253-65A2-4597-98C7-16EE576824B6}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Wikis</RootNamespace>
@@ -63,14 +63,25 @@
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Controllers\PageController.cs" />
<Compile Include="Models\WikiPage.cs" />
<Compile Include="Models\WikiPageHandler.cs" />
<Compile Include="Models\WikiPageRecord.cs" />
<Compile Include="Models\WikiSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\PageEditViewModel.cs" />
<Compile Include="ViewModels\PageCreateViewModel.cs" />
<Compile Include="ViewModels\PageShowViewModel.cs" />
<Compile Include="ViewModels\PageIndexViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Package.txt" />
<Content Include="Views\Admin\Index.aspx" />
<Content Include="Views\Models\EditorTemplates\WikiSettingsRecord.ascx" />
<Content Include="Views\Page\Edit.aspx" />
<Content Include="Views\Page\Create.aspx" />
<Content Include="Views\Page\Show.aspx" />
<Content Include="Views\Page\Index.aspx" />
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
</ItemGroup>

View File

@@ -1 +1 @@
name: Wikis
name: Wiki

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.Wikis.Models;
namespace Orchard.Wikis.ViewModels {
public class PageCreateViewModel {
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using System.Collections.Generic;
using Orchard.UI.Models;
using Orchard.Wikis.Models;
namespace Orchard.Wikis.ViewModels {
public class PageEditViewModel {
public WikiPage Page { get; set; }
public IEnumerable<ModelTemplate> Editors { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using System.Collections.Generic;
using Orchard.Mvc.ViewModels;
using Orchard.Wikis.Models;
namespace Orchard.Wikis.ViewModels {
public class PageIndexViewModel : BaseViewModel {
public IList<WikiPage> Pages { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using System.Collections.Generic;
using Orchard.UI.Models;
using Orchard.Wikis.Models;
namespace Orchard.Wikis.ViewModels {
public class PageShowViewModel {
public WikiPage Page { get; set; }
public IList<ModelTemplate> Chunks { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<PageCreateViewModel>" %>
<%@ Import Namespace="Orchard.Wikis.ViewModels" %>
<%@ Import Namespace="Orchard.Mvc.Html" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TwoColumns</title>
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<div id="innerheader">
<% Html.Include("header"); %>
</div>
</div>
<div id="page">
<div id="sideBar">
<% Html.Include("Navigation"); %>
</div>
<div id="main">
<h3>
Create Page</h3>
<%using (Html.BeginForm()) { %>
<ul>
<li>
<%=Html.LabelFor(x => x.Name)%><%=Html.EditorFor(x => x.Name)%></li>
<li>
<input type="submit" name="submit" value="Create" /></li>
</ul>
<%} %>
</div>
<div id="footer">
<% Html.Include("footer"); %>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,38 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<PageEditViewModel>" %>
<%@ Import Namespace="Orchard.Wikis.ViewModels" %>
<%@ Import Namespace="Orchard.Mvc.Html" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TwoColumns</title>
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<div id="innerheader">
<% Html.Include("header"); %>
</div>
</div>
<div id="page">
<div id="sideBar">
<% Html.Include("Navigation"); %>
</div>
<div id="main">
<h3>
Edit Page</h3>
<%using (Html.BeginForm()) { %>
<ul>
<li>
<%=Html.LabelFor(x => x.Page.Record.Name)%><%=Html.EditorFor(x => x.Page.Record.Name)%></li>
<li>
<input type="submit" name="submit" value="Save" /></li>
</ul>
<%} %>
</div>
<div id="footer">
<% Html.Include("footer"); %>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,42 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<PageIndexViewModel>" %>
<%@ Import Namespace="Orchard.Wikis.ViewModels"%>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TwoColumns</title>
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<div id="innerheader">
<% Html.Include("header"); %>
</div>
</div>
<div id="page">
<div id="sideBar">
<% Html.Include("Navigation"); %>
</div>
<div id="main">
<h3>Wiki Pages</h3>
<ul>
<%foreach(var item in Model.Pages.OrderBy(x=>x.Record.Name)){%>
<li><%=Html.ActionLink(item.Record.Name, "show", new { item.ContentItem.Id }, new{})%></li>
<%}%>
</ul>
</div>
<div id="footer">
<% Html.Include("footer"); %>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,35 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<PageShowViewModel>" %>
<%@ Import Namespace="Orchard.Wikis.ViewModels" %>
<%@ Import Namespace="Orchard.Mvc.Html" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TwoColumns</title>
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<div id="innerheader">
<% Html.Include("header"); %>
</div>
</div>
<div id="page">
<div id="sideBar">
<% Html.Include("Navigation"); %>
</div>
<div id="main">
<h3>
<%=Html.Encode(Model.Page.Record.Name) %></h3>
<p>
<%=Html.ActionLink("edit", "edit", new{Model.Page.ContentItem.Id}, new{}) %></p>
<div>
body
</div>
</div>
<div id="footer">
<% Html.Include("footer"); %>
</div>
</div>
</body>
</html>

View File

@@ -5,7 +5,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{954CA994-D204-468B-9D69-51F6AD3E1C29}</ProjectGuid>
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TinyMce</RootNamespace>

View File

@@ -34,6 +34,7 @@ namespace Orchard.Data {
CreatePersistenceModel(Assembly.Load("Orchard.Core")),
CreatePersistenceModel(Assembly.Load("Orchard.Wikis")),
CreatePersistenceModel(Assembly.Load("Orchard.Comments")),
CreatePersistenceModel(Assembly.Load("Orchard.Blogs")),
};
return _sessionFactory ??