diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs b/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs index db7183324..485f23421 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs +++ b/src/Orchard.Web/Modules/Orchard.Pages/Commands/PageCommands.cs @@ -1,9 +1,9 @@ using System; +using System.Web; using Orchard.Commands; using Orchard.ContentManagement; using Orchard.ContentManagement.Aspects; using Orchard.ContentPicker.Models; -using Orchard.Core.Common.Models; using Orchard.Core.Navigation.Models; using Orchard.Core.Navigation.Services; using Orchard.Security; @@ -103,10 +103,10 @@ namespace Orchard.Pages.Commands { } } - var text = String.Empty; + var layout = default(string); if (UseWelcomeText) { - text = T( -@"

You've successfully setup your Orchard Site and this is the homepage of your new site. + var text = T( + @"

You've successfully setup your Orchard Site and this is the homepage of your new site. Here are a few things you can look at to get familiar with the application. Once you feel confident you don't need this anymore, you can remove it by going into editing mode @@ -123,18 +123,86 @@ you can do so by creating your own module or by installing one that somebody els Modules are created by other users of Orchard just like you so if you feel up to it, please consider participating.

Thanks for using Orchard – The Orchard Team

", page.Id).Text; + + var asideFirstText = +@"

First Leader Aside

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. +Aliquam vel sem nibh. Suspendisse vel condimentum tellus.

"; + + var asideSecondText = +@"

Second Leader Aside

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. +Aliquam vel sem nibh. Suspendisse vel condimentum tellus.

"; + + var asideThirdText = +@"

Third Leader Aside

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum. +Aliquam vel sem nibh. Suspendisse vel condimentum tellus.

"; + + layout = + "{\"elements\": [{" + + "\"typeName\": \"Orchard.Layouts.Elements.Grid\"," + + "\"elements\": [{" + + "\"typeName\": \"Orchard.Layouts.Elements.Row\"," + + "\"elements\": [{" + + "\"typeName\": \"Orchard.Layouts.Elements.Column\"," + + "\"state\": \"ColumnSpan=12\"," + + "\"elements\": [{" + + "\"typeName\": \"Orchard.Layouts.Elements.Html\"," + + "\"state\": \"Content=" + Encode(text) + "\"" + + "}]" + + "}]" + + "},{" + + "\"typeName\": \"Orchard.Layouts.Elements.Row\"," + + "\"elements\": [{" + + "\"typeName\": \"Orchard.Layouts.Elements.Column\"," + + "\"state\": \"ColumnSpan=4\"," + + "\"elements\": [{" + + "\"typeName\": \"Orchard.Layouts.Elements.Html\"," + + "\"state\": \"Content=" + Encode(asideFirstText) + "\"" + + "}]" + + "},{" + + "\"typeName\": \"Orchard.Layouts.Elements.Column\"," + + "\"state\": \"ColumnSpan=4\"," + + "\"elements\": [{" + + "\"typeName\": \"Orchard.Layouts.Elements.Html\"," + + "\"state\": \"Content=" + Encode(asideSecondText) + "\"" + + "}]" + + "},{" + + "\"typeName\": \"Orchard.Layouts.Elements.Column\"," + + "\"state\": \"ColumnSpan=4\"," + + "\"elements\": [{" + + "\"typeName\": \"Orchard.Layouts.Elements.Html\"," + + "\"state\": \"Content=" + Encode(asideThirdText) + "\"" + + "}]" + + "}]" + + "}]" + + "}]}"; } else { if (!String.IsNullOrEmpty(Text)) { - text = Text; + layout = + "{\"elements\": [" + + "{" + + "\"typeName\": \"Orchard.Layouts.Elements.Html\"," + + "\"state\": \"Content=" + Encode(Text) + "\"" + + "}" + + "]}"; } } - page.As().Text = text; + + // (Layout) Hackish way to access the LayoutPart on the page without having to declare a dependency on Orchard.Layouts. + // This will break if the Page type does not have a LayoutPart. + ((dynamic) page).LayoutPart.LayoutState = layout; if (Publish) { _contentManager.Publish(page); } Context.Output.WriteLine(T("Page created successfully.").Text); } + + private string Encode(string text) { + return HttpUtility.UrlEncode(text); + } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Pages/Migrations.cs index 9f6a12240..f1f7f87b8 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Migrations.cs +++ b/src/Orchard.Web/Modules/Orchard.Pages/Migrations.cs @@ -16,7 +16,7 @@ namespace Orchard.Pages { .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-page\"}]") .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")) - .WithPart("BodyPart") + .WithPart("LayoutPart") .Creatable() .Listable() .Securable()); diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Recipes/default.recipe.xml b/src/Orchard.Web/Modules/Orchard.Setup/Recipes/default.recipe.xml index 9c62a0ed8..3a2bdf9f5 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Recipes/default.recipe.xml +++ b/src/Orchard.Web/Modules/Orchard.Setup/Recipes/default.recipe.xml @@ -14,6 +14,7 @@ Orchard.jQuery,Orchard.Widgets,Orchard.ContentTypes, Orchard.Scripting,Orchard.Scripting.Lightweight,PackagingServices,Orchard.Packaging, Orchard.Projections,Orchard.Fields,Orchard.OutputCache,Orchard.Taxonomies,Orchard.Workflows, + Orchard.Layouts, TheThemeMachine" /> @@ -48,9 +49,6 @@ layer create Anonymous /LayerRule:"not authenticated" /Description:"The widgets in this layer are displayed when the user is anonymous" layer create Disabled /LayerRule:"false" /Description:"The widgets in this layer are never displayed" layer create TheHomepage /LayerRule:"url '~/'" /Description:"The widgets in this layer are displayed on the home page" - widget create HtmlWidget /Title:"First Leader Aside" /Zone:"TripelFirst" /Position:"5" /Layer:"TheHomepage" /Identity:"SetupHtmlWidget1" /UseLoremIpsumText:true - widget create HtmlWidget /Title:"Second Leader Aside" /Zone:"TripelSecond" /Position:"5" /Layer:"TheHomepage" /Identity:"SetupHtmlWidget2" /UseLoremIpsumText:true - widget create HtmlWidget /Title:"Third Leader Aside" /Zone:"TripelThird" /Position:"5" /Layer:"TheHomepage" /Identity:"SetupHtmlWidget3" /UseLoremIpsumText:true site setting set baseurl menu create /MenuName:"Main Menu" page create /Slug:"welcome-to-orchard" /Title:"Welcome to Orchard!" /Path:"welcome-to-orchard" /Homepage:true /Publish:true /UseWelcomeText:true