mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Swapping out BodyPart for LayoutPart for new sites.
Also, the three widgets created by default are replaced with HTML elements inside of the layout, since they appear on the home page only.
This commit is contained in:
@@ -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(
|
||||
@"<p>You've successfully setup your Orchard Site and this is the homepage of your new site.
|
||||
var text = T(
|
||||
@"<p>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
|
||||
<a href=""Admin/Contents/Edit/{0}"">remove it by going into editing mode</a>
|
||||
@@ -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,
|
||||
<a href=""http://orchardproject.net/contribution"">please consider participating</a>.</p>
|
||||
<p>Thanks for using Orchard – The Orchard Team </p>", page.Id).Text;
|
||||
|
||||
var asideFirstText =
|
||||
@"<h2>First Leader Aside</h2>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum.
|
||||
Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
|
||||
var asideSecondText =
|
||||
@"<h2>Second Leader Aside</h2>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum.
|
||||
Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
|
||||
var asideThirdText =
|
||||
@"<h2>Third Leader Aside</h2>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a nibh ut tortor dapibus vestibulum.
|
||||
Aliquam vel sem nibh. Suspendisse vel condimentum tellus.</p>";
|
||||
|
||||
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<BodyPart>().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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
@@ -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" />
|
||||
|
||||
<Metadata>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user