--HG--
branch : net40
This commit is contained in:
Renaud Paquay
2010-05-06 13:45:42 -07:00
34 changed files with 5753 additions and 3 deletions

View File

@@ -0,0 +1,61 @@
using Orchard.Commands;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.Core.Common.Models;
using Orchard.Core.Navigation.Models;
using Orchard.Security;
namespace Orchard.DevTools.Commands {
public class ProfilingCommands : DefaultOrchardCommandHandler {
private readonly IContentManager _contentManager;
private readonly IMembershipService _membershipService;
public ProfilingCommands(IContentManager contentManager, IMembershipService membershipService) {
_contentManager = contentManager;
_membershipService = membershipService;
}
[CommandName("add profiling data")]
public string AddProfilingData() {
var admin = _membershipService.GetUser("admin");
for (var index = 0; index != 5; ++index) {
var pageName = "page" + index;
var page = _contentManager.Create("page", VersionOptions.Draft);
page.As<ICommonAspect>().Owner = admin;
page.As<RoutableAspect>().Slug = pageName;
page.As<RoutableAspect>().Title = pageName;
page.As<BodyAspect>().Text = pageName;
page.As<MenuPart>().OnMainMenu = true;
page.As<MenuPart>().MenuPosition = "5." + index;
page.As<MenuPart>().MenuText = pageName;
_contentManager.Publish(page);
var blogName = "blog" + index;
var blog = _contentManager.New("blog");
blog.As<ICommonAspect>().Owner = admin;
blog.As<RoutableAspect>().Slug = blogName;
blog.As<RoutableAspect>().Title = blogName;
blog.As<MenuPart>().OnMainMenu = true;
blog.As<MenuPart>().MenuPosition = "6." + index;
blog.As<MenuPart>().MenuText = blogName;
_contentManager.Create(blog);
// "blogpost" content type can't be created w/out http context at the moment
//for (var index2 = 0; index2 != 5; ++index2) {
// var postName = "post" + index;
// var post = _contentManager.New("blogpost");
// post.As<ICommonAspect>().Owner = admin;
// post.As<ICommonAspect>().Container = blog;
// post.As<RoutableAspect>().Slug = postName;
// post.As<RoutableAspect>().Title = postName;
// post.As<BodyAspect>().Text = postName;
// _contentManager.Create(post);
//}
}
return "AddProfilingData completed";
}
}
}

View File

@@ -70,6 +70,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Commands\ProfilingCommands.cs" />
<Compile Include="Controllers\ContentController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Handlers\DebugLinkHandler.cs" />
@@ -82,9 +83,9 @@
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Views\Home\_RenderableAction.ascx" />
<Content Include="Views\Home\Simple.aspx" />
<Content Include="_Module.txt" />
<Content Include="Views\Content\Details.aspx" />
<Content Include="Views\Content\Index.aspx" />
<Content Include="Views\Home\Index.aspx" />
@@ -98,6 +99,10 @@
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

View File

@@ -0,0 +1 @@
name: Sandbox