mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Some setup work
- renamed Index POST to IndexPOST and returning Index(model) on failure - taking a dependence on the Comments module and flipping CommentsShown on the home page that's created in setup - redirecting to ~/ on successful setup - removing the remaining views (home) from Orchard.Web - updating the slug constraint to cope with a null slug --HG-- branch : dev
This commit is contained in:
@@ -42,6 +42,9 @@ namespace Orchard.Pages.Services {
|
|||||||
|
|
||||||
public string LookupPublishedSlug(string slug) {
|
public string LookupPublishedSlug(string slug) {
|
||||||
lock (_syncLock) {
|
lock (_syncLock) {
|
||||||
|
if (slug == null)
|
||||||
|
return "";
|
||||||
|
|
||||||
string actual;
|
string actual;
|
||||||
if (_currentlyPublishedSlugs.TryGetValue(slug, out actual))
|
if (_currentlyPublishedSlugs.TryGetValue(slug, out actual))
|
||||||
return actual;
|
return actual;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using Orchard.Comments.Models;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.Core.Common.Models;
|
using Orchard.Core.Common.Models;
|
||||||
using Orchard.Core.Settings.Models;
|
using Orchard.Core.Settings.Models;
|
||||||
@@ -29,15 +30,15 @@ namespace Orchard.Setup.Controllers {
|
|||||||
|
|
||||||
private Localizer T { get; set; }
|
private Localizer T { get; set; }
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index(SetupViewModel model) {
|
||||||
return View(new SetupViewModel { AdminUsername = "admin" });
|
return View(model ?? new SetupViewModel { AdminUsername = "admin" });
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost, ActionName("Index")]
|
||||||
public ActionResult Index(SetupViewModel model) {
|
public ActionResult IndexPOST(SetupViewModel model) {
|
||||||
try {
|
try {
|
||||||
if (!ModelState.IsValid) {
|
if (!ModelState.IsValid) {
|
||||||
return View(model);
|
return Index(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize the database:
|
// initialize the database:
|
||||||
@@ -67,8 +68,9 @@ namespace Orchard.Setup.Controllers {
|
|||||||
// create home page as a CMS page
|
// create home page as a CMS page
|
||||||
var page = contentManager.Create("page");
|
var page = contentManager.Create("page");
|
||||||
page.As<BodyAspect>().Text = "Welcome to Orchard";
|
page.As<BodyAspect>().Text = "Welcome to Orchard";
|
||||||
page.As<RoutableAspect>().Slug = "home";
|
page.As<RoutableAspect>().Slug = "";
|
||||||
page.As<RoutableAspect>().Title = model.SiteName;
|
page.As<RoutableAspect>().Title = model.SiteName;
|
||||||
|
page.As<HasComments>().CommentsShown = false;
|
||||||
contentManager.Publish(page);
|
contentManager.Publish(page);
|
||||||
|
|
||||||
var authenticationService = finiteEnvironment.Resolve<IAuthenticationService>();
|
var authenticationService = finiteEnvironment.Resolve<IAuthenticationService>();
|
||||||
@@ -78,11 +80,11 @@ namespace Orchard.Setup.Controllers {
|
|||||||
_notifier.Information(T("Setup succeeded"));
|
_notifier.Information(T("Setup succeeded"));
|
||||||
|
|
||||||
// redirect to the welcome page.
|
// redirect to the welcome page.
|
||||||
return Redirect("~/home");
|
return Redirect("~/");
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
_notifier.Error(T("Setup failed: " + exception.Message));
|
_notifier.Error(T("Setup failed: " + exception.Message));
|
||||||
return RedirectToAction("Index");
|
return Index(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,10 @@
|
|||||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||||
<Name>Orchard.Core</Name>
|
<Name>Orchard.Core</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Orchard.Comments\Orchard.Comments.csproj">
|
||||||
|
<Project>{14C049FD-B35B-415A-A824-87F26B26E7FD}</Project>
|
||||||
|
<Name>Orchard.Comments</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Module.txt" />
|
<Content Include="Module.txt" />
|
||||||
|
@@ -92,8 +92,6 @@
|
|||||||
<Content Include="Default.aspx" />
|
<Content Include="Default.aspx" />
|
||||||
<Content Include="Global.asax" />
|
<Content Include="Global.asax" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.config" />
|
||||||
<Content Include="Views\Home\Index.ascx" />
|
|
||||||
<Content Include="Views\Web.config" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Orchard\Orchard.csproj">
|
<ProjectReference Include="..\Orchard\Orchard.csproj">
|
||||||
|
@@ -1,4 +0,0 @@
|
|||||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
|
|
||||||
<% Html.AddPageClassNames("home"); %>
|
|
||||||
<h1>Welcome to Orchard</h1>
|
|
||||||
<p>To learn more about Orchard visit <a href="http://orchardproject.net" title="Orchard Project">http://orchardproject.net</a>.</p>
|
|
@@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<configuration>
|
|
||||||
<system.web>
|
|
||||||
<httpHandlers>
|
|
||||||
<add path="*" verb="*"
|
|
||||||
type="System.Web.HttpNotFoundHandler"/>
|
|
||||||
</httpHandlers>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Enabling request validation in view pages would cause validation to occur
|
|
||||||
after the input has already been processed by the controller. By default
|
|
||||||
MVC performs request validation before a controller processes the input.
|
|
||||||
To change this behavior apply the ValidateInputAttribute to a
|
|
||||||
controller or action.
|
|
||||||
-->
|
|
||||||
<pages
|
|
||||||
validateRequest="false"
|
|
||||||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
|
||||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
|
||||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
|
||||||
<controls>
|
|
||||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
|
||||||
</controls>
|
|
||||||
</pages>
|
|
||||||
</system.web>
|
|
||||||
|
|
||||||
<system.webServer>
|
|
||||||
<validation validateIntegratedModeConfiguration="false"/>
|
|
||||||
<handlers>
|
|
||||||
<remove name="BlockViewHandler"/>
|
|
||||||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
|
|
||||||
</handlers>
|
|
||||||
</system.webServer>
|
|
||||||
</configuration>
|
|
Reference in New Issue
Block a user