mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Starting to break stuff in order to make things better...(starting w/ the Contents module)
Many modules are disabled by default to keep them out of the way for now. Run through the setup and hit ~/Contents/Item/Display/3 to get the homepage page --HG-- branch : dev extra : transplant_source : %8EH%F5%06%12%1D%3D%FC%7Bl%D6p%CF%DB%DAp%BF%1C%DB%A5
This commit is contained in:
@@ -19,7 +19,8 @@ namespace Orchard.Core.Common.Drivers {
|
||||
private readonly IEnumerable<IHtmlFilter> _htmlFilters;
|
||||
|
||||
private const string TemplateName = "Parts/Common.Body";
|
||||
private const string DefaultTextEditorTemplate = "TinyMceTextEditor";
|
||||
//todo: change back - or to something better
|
||||
private const string DefaultTextEditorTemplate = "PlainTextEditor"; //"TinyMceTextEditor";
|
||||
private const string PlainTextEditorTemplate = "PlainTextEditor";
|
||||
|
||||
public BodyPartDriver(IOrchardServices services, IEnumerable<IHtmlFilter> htmlFilters) {
|
||||
|
@@ -1,29 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Contents.ViewModels;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Core.Contents.Controllers {
|
||||
public class ItemController : Controller {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public ItemController(IContentManager contentManager) {
|
||||
public ItemController(IContentManager contentManager, IShapeHelperFactory shapeHelperFactory) {
|
||||
_contentManager = contentManager;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
||||
// /Contents/Item/Display/72
|
||||
public ActionResult Display(int id) {
|
||||
var contentItem = _contentManager.Get(id, VersionOptions.Published);
|
||||
|
||||
var model = new DisplayItemViewModel {
|
||||
Content = _contentManager.BuildDisplayModel(contentItem, "Detail")
|
||||
};
|
||||
PrepareDisplayViewModel(model.Content);
|
||||
return View("Display", model);
|
||||
var model = Shape.Content(
|
||||
_contentManager.BuildDisplayModel(contentItem, "Detail")
|
||||
);
|
||||
//PrepareDisplayViewModel(model.Content);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// /Contents/Item/Preview/72
|
||||
|
@@ -5,7 +5,7 @@ namespace Orchard.Core.Contents.ViewModels {
|
||||
public int Id { get; set; }
|
||||
public ContentItemViewModel Content { get; set; }
|
||||
}
|
||||
public class DisplayItemViewModel : BaseViewModel {
|
||||
public class DisplayItemViewModel {
|
||||
public ContentItemViewModel Content { get; set; }
|
||||
}
|
||||
}
|
6
src/Orchard.Web/Core/Contents/Views/Content.cshtml
Normal file
6
src/Orchard.Web/Core/Contents/Views/Content.cshtml
Normal file
@@ -0,0 +1,6 @@
|
||||
@model dynamic
|
||||
<h2>I am content</h2>
|
||||
<dl>
|
||||
<dt>content item id</dt>
|
||||
<dd>@Display(Model.Item.Id)</dd>
|
||||
</dl>
|
@@ -1,5 +0,0 @@
|
||||
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<Orchard.Core.Contents.ViewModels.DisplayItemViewModel>" %>
|
||||
|
||||
<div class="preview">
|
||||
<%: Html.DisplayForItem(m=>m.Content) %>
|
||||
</div>
|
3
src/Orchard.Web/Core/Contents/Views/Item/Display.cshtml
Normal file
3
src/Orchard.Web/Core/Contents/Views/Item/Display.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
@model dynamic
|
||||
<h1>Oh hai!</h1>
|
||||
@Display(Model)
|
@@ -39,6 +39,7 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
@@ -267,7 +268,6 @@
|
||||
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.Summary.ascx" />
|
||||
<Content Include="Contents\Views\EditorTemplates\Items\Contents.Item.ascx" />
|
||||
<Content Include="Contents\Views\Item\Preview.aspx" />
|
||||
<Content Include="Contents\Views\Item\Display.aspx" />
|
||||
<Content Include="Localization\Styles\admin.css" />
|
||||
<Content Include="Localization\Styles\base.css" />
|
||||
<Content Include="Localization\Views\DisplayTemplates\Parts\Localization.ContentTranslations.Summary.ascx" />
|
||||
@@ -366,6 +366,8 @@
|
||||
<Content Include="Reports\Views\Web.config" />
|
||||
<Content Include="PublishLater\Views\Web.config" />
|
||||
<Content Include="ContentsLocation\Views\Web.config" />
|
||||
<None Include="Contents\Views\Content.cshtml" />
|
||||
<None Include="Contents\Views\Item\Display.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
@@ -66,31 +66,32 @@ namespace Orchard.Setup.Services {
|
||||
string[] hardcoded = {
|
||||
"Orchard.Framework",
|
||||
"Common",
|
||||
"PublishLater",
|
||||
//"PublishLater",
|
||||
"Contents",
|
||||
"ContentsLocation",
|
||||
//"ContentsLocation",
|
||||
"Dashboard",
|
||||
"Reports",
|
||||
"Feeds",
|
||||
//"Reports",
|
||||
//"Feeds",
|
||||
"HomePage",
|
||||
"Navigation",
|
||||
"Scheduling",
|
||||
"Indexing",
|
||||
"Localization",
|
||||
//"Navigation",
|
||||
//"Scheduling",
|
||||
//"Indexing",
|
||||
//"Localization",
|
||||
"Routable",
|
||||
"Settings",
|
||||
"XmlRpc",
|
||||
//"XmlRpc",
|
||||
"Orchard.Users",
|
||||
"Orchard.Roles",
|
||||
"TinyMce",
|
||||
"PackagingServices",
|
||||
//"TinyMce",
|
||||
//"PackagingServices",
|
||||
"Orchard.Modules",
|
||||
"Orchard.Themes",
|
||||
"Orchard.Blogs",
|
||||
"Orchard.Comments",
|
||||
"Orchard.Tags",
|
||||
"Orchard.Media",
|
||||
"Futures.Widgets"};
|
||||
//"Orchard.Blogs",
|
||||
//"Orchard.Comments",
|
||||
//"Orchard.Tags",
|
||||
//"Orchard.Media",
|
||||
//"Futures.Widgets"
|
||||
};
|
||||
|
||||
context.EnabledFeatures = hardcoded;
|
||||
}
|
||||
@@ -191,21 +192,23 @@ namespace Orchard.Setup.Services {
|
||||
//hackInstallationGenerator.GenerateInstallEvents();
|
||||
|
||||
var contentDefinitionManager = environment.Resolve<IContentDefinitionManager>();
|
||||
contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg
|
||||
.WithPart("CommentsPart")
|
||||
.WithPart("TagsPart")
|
||||
.WithPart("LocalizationPart")
|
||||
.Indexed());
|
||||
//contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg
|
||||
// .WithPart("CommentsPart")
|
||||
// .WithPart("TagsPart")
|
||||
// .WithPart("LocalizationPart")
|
||||
// .Indexed()
|
||||
// );
|
||||
contentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg
|
||||
.WithPart("CommonPart")
|
||||
.WithPart("PublishLaterPart")
|
||||
//.WithPart("PublishLaterPart")
|
||||
.WithPart("RoutePart")
|
||||
.WithPart("BodyPart")
|
||||
.WithPart("CommentsPart")
|
||||
.WithPart("TagsPart")
|
||||
.WithPart("LocalizationPart")
|
||||
//.WithPart("CommentsPart")
|
||||
//.WithPart("TagsPart")
|
||||
//.WithPart("LocalizationPart")
|
||||
.Creatable()
|
||||
.Indexed());
|
||||
//.Indexed()
|
||||
);
|
||||
contentDefinitionManager.AlterPartDefinition("BodyPart", cfg => cfg
|
||||
.WithSetting("BodyPartSettings.FlavorDefault", BodyPartSettings.FlavorDefaultDefault));
|
||||
|
||||
@@ -216,18 +219,18 @@ namespace Orchard.Setup.Services {
|
||||
page.As<RoutePart>().Path = "home";
|
||||
page.As<RoutePart>().Title = T("Home").ToString();
|
||||
page.As<CommonPart>().Owner = user;
|
||||
if (page.Has<CommentsPart>()) {
|
||||
page.As<CommentsPart>().CommentsShown = false;
|
||||
}
|
||||
//if (page.Has<CommentsPart>()) {
|
||||
// page.As<CommentsPart>().CommentsShown = false;
|
||||
//}
|
||||
contentManager.Publish(page);
|
||||
siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;
|
||||
|
||||
// add a menu item for the shiny new home page
|
||||
var menuItem = contentManager.Create("MenuItem");
|
||||
menuItem.As<MenuPart>().MenuPosition = "1";
|
||||
menuItem.As<MenuPart>().MenuText = T("Home").ToString();
|
||||
menuItem.As<MenuPart>().OnMainMenu = true;
|
||||
menuItem.As<MenuItemPart>().Url = "";
|
||||
//var menuItem = contentManager.Create("MenuItem");
|
||||
//menuItem.As<MenuPart>().MenuPosition = "1";
|
||||
//menuItem.As<MenuPart>().MenuText = T("Home").ToString();
|
||||
//menuItem.As<MenuPart>().OnMainMenu = true;
|
||||
//menuItem.As<MenuItemPart>().Url = "";
|
||||
|
||||
//Temporary fix for running setup on command line
|
||||
if (HttpContext.Current != null) {
|
||||
|
@@ -66,7 +66,7 @@ namespace Orchard.Setup {
|
||||
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
||||
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableFactory>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -24,8 +24,8 @@ namespace Orchard.Mvc.ViewEngines {
|
||||
var skipLayoutViewEngine = false;
|
||||
if (string.IsNullOrEmpty(masterName) == false)
|
||||
skipLayoutViewEngine = true;
|
||||
if (!ThemeFilter.IsApplied(controllerContext.RequestContext))
|
||||
skipLayoutViewEngine = true;
|
||||
//if (!ThemeFilter.IsApplied(controllerContext.RequestContext))
|
||||
// skipLayoutViewEngine = true;
|
||||
if (_viewEngines == null || _viewEngines.Count == 0)
|
||||
skipLayoutViewEngine = true;
|
||||
if (skipLayoutViewEngine)
|
||||
|
Reference in New Issue
Block a user