Create a blog instead of a page in the Blog recipe.

Adding the gallery and feeds to it as well.

--HG--
branch : recipe
This commit is contained in:
Suha Can
2011-02-21 13:37:18 -08:00
parent 277a394fa5
commit 993849778f
3 changed files with 19 additions and 24 deletions

View File

@@ -12,6 +12,7 @@ using Orchard.Core.Routable.Services;
using Orchard.Security;
using Orchard.Blogs.Services;
using Orchard.Core.Navigation.Services;
using Orchard.Settings;
namespace Orchard.Blogs.Commands {
public class BlogCommands : DefaultOrchardCommandHandler {
@@ -19,16 +20,19 @@ namespace Orchard.Blogs.Commands {
private readonly IMembershipService _membershipService;
private readonly IBlogService _blogService;
private readonly IMenuService _menuService;
private readonly ISiteService _siteService;
public BlogCommands(
IContentManager contentManager,
IMembershipService membershipService,
IBlogService blogService,
IMenuService menuService) {
IMenuService menuService,
ISiteService siteService) {
_contentManager = contentManager;
_membershipService = membershipService;
_blogService = blogService;
_menuService = menuService;
_siteService = siteService;
}
[OrchardSwitch]
@@ -46,10 +50,16 @@ namespace Orchard.Blogs.Commands {
[OrchardSwitch]
public string MenuText { get; set; }
[OrchardSwitch]
public bool Homepage { get; set; }
[CommandName("blog create")]
[CommandHelp("blog create /Slug:<slug> /Title:<title> /Owner:<username> [/MenuText:<menu text>]\r\n\t" + "Creates a new Blog")]
[OrchardSwitches("Slug,Title,Owner,MenuText")]
[CommandHelp("blog create /Slug:<slug> /Title:<title> [/Owner:<username>] [/MenuText:<menu text>] [/Homepage:true|false]\r\n\t" + "Creates a new Blog")]
[OrchardSwitches("Slug,Title,Owner,MenuText,Homepage")]
public string Create() {
if (String.IsNullOrEmpty(Owner)) {
Owner = _siteService.GetSiteSettings().SuperUser;
}
var owner = _membershipService.GetUser(Owner);
if ( owner == null ) {
@@ -65,6 +75,7 @@ namespace Orchard.Blogs.Commands {
blog.As<RoutePart>().Slug = Slug;
blog.As<RoutePart>().Path = Slug;
blog.As<RoutePart>().Title = Title;
blog.As<RoutePart>().PromoteToHomePage = Homepage;
if ( !String.IsNullOrWhiteSpace(MenuText) ) {
blog.As<MenuPart>().OnMainMenu = true;
blog.As<MenuPart>().MenuPosition = _menuService.Get().Select(menuPart => menuPart.MenuPosition).Max() + 1 + ".0";

View File

@@ -14,6 +14,7 @@
TinyMce,Orchard.Media,Orchard.PublishLater,
Orchard.jQuery,Orchard.Widgets,
Orchard.Scripting,Orchard.Scripting.Lightweight,
PackagingServices,Orchard.Packaging,Gallery,
TheThemeMachine" />
<Metadata>
@@ -44,7 +45,7 @@
layer create /Name:"Anonymous" /LayerRule:"not authenticated"
layer create /Name:"Disabled" /LayerRule:"false"
layer create /Name:"TheHomepage" /LayerRule:"url '~/'"
page create /Slug:"welcome-to-orchard" /Title:"Welcome to Orchard!" /Path:"welcome-to-orchard" /Homepage:true /Publish:true /UseWelcomeText:true
blog create /Slug:"welcome-to-orchard" /Title:"Welcome to Orchard!" /Homepage:true
widget create /Type:"HtmlWidget" /Title:"First Leader Aside" /Zone:"TripelFirst" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true
widget create /Type:"HtmlWidget" /Title:"Second Leader Aside" /Zone:"TripelSecond" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true
widget create /Type:"HtmlWidget" /Title:"Third Leader Aside" /Zone:"TripelThird" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true

View File

@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<Orchard>
<Recipe>
<Name>cms</Name>
<Description>Orchard CMS Recipe</Description>
<Name>CMS</Name>
<Description>A recipe providing an installation profile with the functionality for a generic CMS.</Description>
<Author>The Orchard Team</Author>
<WebSite>http://orchardproject.net</WebSite>
<Tags></Tags>
@@ -20,35 +20,18 @@
<TagsPart />
<LocalizationPart />
</Page>
<BlogPost ContentTypeSettings.Draftable="True" TypeIndexing.Included="true">
<CommentsPart />
<TagsPart />
<LocalizationPart />
</BlogPost>
</Types>
<Parts>
<BodyPart BodyPartSettings.FlavorDefault="html" />
<!-- Dynamic part -->
<Product ContentTypeSettings.Draftable="True" />
<!-- Dynamic parts -->
</Parts>
</Metadata>
<Settings>
<SiteSettingsPart PageSize="20" PageTitleSeparator = " - " />
<CommentSettingsPart ModerateComments="true" />
</Settings>
<Command>
feature enable Orchard.Experimental.TestingLists
layer create /Name:"Default" /LayerRule:"true"
layer create /Name:"Authenticated" /LayerRule:"authenticated"
layer create /Name:"Anonymous" /LayerRule:"not authenticated"
layer create /Name:"Disabled" /LayerRule:"false"
layer create /Name:"TheHomepage" /LayerRule:"url '~/'"
page create /Slug:"welcome-to-orchard" /Title:"Welcome to Orchard!" /Path:"welcome-to-orchard" /Homepage:true /Publish:true /UseWelcomeText:true
widget create /Type:"HtmlWidget" /Title:"First Leader Aside" /Zone:"TripelFirst" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true
widget create /Type:"HtmlWidget" /Title:"Second Leader Aside" /Zone:"TripelSecond" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true
widget create /Type:"HtmlWidget" /Title:"Third Leader Aside" /Zone:"TripelThird" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true
menuitem create /MenuPosition:"1" /MenuText:"Home" /Url:"" /OnMainMenu:true
</Command>