mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +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 readonly IEnumerable<IHtmlFilter> _htmlFilters;
|
||||||
|
|
||||||
private const string TemplateName = "Parts/Common.Body";
|
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";
|
private const string PlainTextEditorTemplate = "PlainTextEditor";
|
||||||
|
|
||||||
public BodyPartDriver(IOrchardServices services, IEnumerable<IHtmlFilter> htmlFilters) {
|
public BodyPartDriver(IOrchardServices services, IEnumerable<IHtmlFilter> htmlFilters) {
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
using System;
|
using System.Web.Mvc;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.Core.Contents.ViewModels;
|
using Orchard.Core.Contents.ViewModels;
|
||||||
|
using Orchard.DisplayManagement;
|
||||||
using Orchard.Mvc.ViewModels;
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
namespace Orchard.Core.Contents.Controllers {
|
namespace Orchard.Core.Contents.Controllers {
|
||||||
public class ItemController : Controller {
|
public class ItemController : Controller {
|
||||||
private readonly IContentManager _contentManager;
|
private readonly IContentManager _contentManager;
|
||||||
|
|
||||||
public ItemController(IContentManager contentManager) {
|
public ItemController(IContentManager contentManager, IShapeHelperFactory shapeHelperFactory) {
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
|
Shape = shapeHelperFactory.CreateHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynamic Shape { get; set; }
|
||||||
|
|
||||||
// /Contents/Item/Display/72
|
// /Contents/Item/Display/72
|
||||||
public ActionResult Display(int id) {
|
public ActionResult Display(int id) {
|
||||||
var contentItem = _contentManager.Get(id, VersionOptions.Published);
|
var contentItem = _contentManager.Get(id, VersionOptions.Published);
|
||||||
|
|
||||||
var model = new DisplayItemViewModel {
|
var model = Shape.Content(
|
||||||
Content = _contentManager.BuildDisplayModel(contentItem, "Detail")
|
_contentManager.BuildDisplayModel(contentItem, "Detail")
|
||||||
};
|
);
|
||||||
PrepareDisplayViewModel(model.Content);
|
//PrepareDisplayViewModel(model.Content);
|
||||||
return View("Display", model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /Contents/Item/Preview/72
|
// /Contents/Item/Preview/72
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace Orchard.Core.Contents.ViewModels {
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public ContentItemViewModel Content { get; set; }
|
public ContentItemViewModel Content { get; set; }
|
||||||
}
|
}
|
||||||
public class DisplayItemViewModel : BaseViewModel {
|
public class DisplayItemViewModel {
|
||||||
public ContentItemViewModel Content { get; set; }
|
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>
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
@@ -267,7 +268,6 @@
|
|||||||
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.Summary.ascx" />
|
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.Summary.ascx" />
|
||||||
<Content Include="Contents\Views\EditorTemplates\Items\Contents.Item.ascx" />
|
<Content Include="Contents\Views\EditorTemplates\Items\Contents.Item.ascx" />
|
||||||
<Content Include="Contents\Views\Item\Preview.aspx" />
|
<Content Include="Contents\Views\Item\Preview.aspx" />
|
||||||
<Content Include="Contents\Views\Item\Display.aspx" />
|
|
||||||
<Content Include="Localization\Styles\admin.css" />
|
<Content Include="Localization\Styles\admin.css" />
|
||||||
<Content Include="Localization\Styles\base.css" />
|
<Content Include="Localization\Styles\base.css" />
|
||||||
<Content Include="Localization\Views\DisplayTemplates\Parts\Localization.ContentTranslations.Summary.ascx" />
|
<Content Include="Localization\Views\DisplayTemplates\Parts\Localization.ContentTranslations.Summary.ascx" />
|
||||||
@@ -366,6 +366,8 @@
|
|||||||
<Content Include="Reports\Views\Web.config" />
|
<Content Include="Reports\Views\Web.config" />
|
||||||
<Content Include="PublishLater\Views\Web.config" />
|
<Content Include="PublishLater\Views\Web.config" />
|
||||||
<Content Include="ContentsLocation\Views\Web.config" />
|
<Content Include="ContentsLocation\Views\Web.config" />
|
||||||
|
<None Include="Contents\Views\Content.cshtml" />
|
||||||
|
<None Include="Contents\Views\Item\Display.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
|
|||||||
@@ -66,31 +66,32 @@ namespace Orchard.Setup.Services {
|
|||||||
string[] hardcoded = {
|
string[] hardcoded = {
|
||||||
"Orchard.Framework",
|
"Orchard.Framework",
|
||||||
"Common",
|
"Common",
|
||||||
"PublishLater",
|
//"PublishLater",
|
||||||
"Contents",
|
"Contents",
|
||||||
"ContentsLocation",
|
//"ContentsLocation",
|
||||||
"Dashboard",
|
"Dashboard",
|
||||||
"Reports",
|
//"Reports",
|
||||||
"Feeds",
|
//"Feeds",
|
||||||
"HomePage",
|
"HomePage",
|
||||||
"Navigation",
|
//"Navigation",
|
||||||
"Scheduling",
|
//"Scheduling",
|
||||||
"Indexing",
|
//"Indexing",
|
||||||
"Localization",
|
//"Localization",
|
||||||
"Routable",
|
"Routable",
|
||||||
"Settings",
|
"Settings",
|
||||||
"XmlRpc",
|
//"XmlRpc",
|
||||||
"Orchard.Users",
|
"Orchard.Users",
|
||||||
"Orchard.Roles",
|
"Orchard.Roles",
|
||||||
"TinyMce",
|
//"TinyMce",
|
||||||
"PackagingServices",
|
//"PackagingServices",
|
||||||
"Orchard.Modules",
|
"Orchard.Modules",
|
||||||
"Orchard.Themes",
|
"Orchard.Themes",
|
||||||
"Orchard.Blogs",
|
//"Orchard.Blogs",
|
||||||
"Orchard.Comments",
|
//"Orchard.Comments",
|
||||||
"Orchard.Tags",
|
//"Orchard.Tags",
|
||||||
"Orchard.Media",
|
//"Orchard.Media",
|
||||||
"Futures.Widgets"};
|
//"Futures.Widgets"
|
||||||
|
};
|
||||||
|
|
||||||
context.EnabledFeatures = hardcoded;
|
context.EnabledFeatures = hardcoded;
|
||||||
}
|
}
|
||||||
@@ -191,21 +192,23 @@ namespace Orchard.Setup.Services {
|
|||||||
//hackInstallationGenerator.GenerateInstallEvents();
|
//hackInstallationGenerator.GenerateInstallEvents();
|
||||||
|
|
||||||
var contentDefinitionManager = environment.Resolve<IContentDefinitionManager>();
|
var contentDefinitionManager = environment.Resolve<IContentDefinitionManager>();
|
||||||
contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg
|
//contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg
|
||||||
.WithPart("CommentsPart")
|
// .WithPart("CommentsPart")
|
||||||
.WithPart("TagsPart")
|
// .WithPart("TagsPart")
|
||||||
.WithPart("LocalizationPart")
|
// .WithPart("LocalizationPart")
|
||||||
.Indexed());
|
// .Indexed()
|
||||||
|
// );
|
||||||
contentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg
|
contentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg
|
||||||
.WithPart("CommonPart")
|
.WithPart("CommonPart")
|
||||||
.WithPart("PublishLaterPart")
|
//.WithPart("PublishLaterPart")
|
||||||
.WithPart("RoutePart")
|
.WithPart("RoutePart")
|
||||||
.WithPart("BodyPart")
|
.WithPart("BodyPart")
|
||||||
.WithPart("CommentsPart")
|
//.WithPart("CommentsPart")
|
||||||
.WithPart("TagsPart")
|
//.WithPart("TagsPart")
|
||||||
.WithPart("LocalizationPart")
|
//.WithPart("LocalizationPart")
|
||||||
.Creatable()
|
.Creatable()
|
||||||
.Indexed());
|
//.Indexed()
|
||||||
|
);
|
||||||
contentDefinitionManager.AlterPartDefinition("BodyPart", cfg => cfg
|
contentDefinitionManager.AlterPartDefinition("BodyPart", cfg => cfg
|
||||||
.WithSetting("BodyPartSettings.FlavorDefault", BodyPartSettings.FlavorDefaultDefault));
|
.WithSetting("BodyPartSettings.FlavorDefault", BodyPartSettings.FlavorDefaultDefault));
|
||||||
|
|
||||||
@@ -216,18 +219,18 @@ namespace Orchard.Setup.Services {
|
|||||||
page.As<RoutePart>().Path = "home";
|
page.As<RoutePart>().Path = "home";
|
||||||
page.As<RoutePart>().Title = T("Home").ToString();
|
page.As<RoutePart>().Title = T("Home").ToString();
|
||||||
page.As<CommonPart>().Owner = user;
|
page.As<CommonPart>().Owner = user;
|
||||||
if (page.Has<CommentsPart>()) {
|
//if (page.Has<CommentsPart>()) {
|
||||||
page.As<CommentsPart>().CommentsShown = false;
|
// page.As<CommentsPart>().CommentsShown = false;
|
||||||
}
|
//}
|
||||||
contentManager.Publish(page);
|
contentManager.Publish(page);
|
||||||
siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;
|
siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;
|
||||||
|
|
||||||
// add a menu item for the shiny new home page
|
// add a menu item for the shiny new home page
|
||||||
var menuItem = contentManager.Create("MenuItem");
|
//var menuItem = contentManager.Create("MenuItem");
|
||||||
menuItem.As<MenuPart>().MenuPosition = "1";
|
//menuItem.As<MenuPart>().MenuPosition = "1";
|
||||||
menuItem.As<MenuPart>().MenuText = T("Home").ToString();
|
//menuItem.As<MenuPart>().MenuText = T("Home").ToString();
|
||||||
menuItem.As<MenuPart>().OnMainMenu = true;
|
//menuItem.As<MenuPart>().OnMainMenu = true;
|
||||||
menuItem.As<MenuItemPart>().Url = "";
|
//menuItem.As<MenuItemPart>().Url = "";
|
||||||
|
|
||||||
//Temporary fix for running setup on command line
|
//Temporary fix for running setup on command line
|
||||||
if (HttpContext.Current != null) {
|
if (HttpContext.Current != null) {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace Orchard.Setup {
|
|||||||
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
||||||
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
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;
|
var skipLayoutViewEngine = false;
|
||||||
if (string.IsNullOrEmpty(masterName) == false)
|
if (string.IsNullOrEmpty(masterName) == false)
|
||||||
skipLayoutViewEngine = true;
|
skipLayoutViewEngine = true;
|
||||||
if (!ThemeFilter.IsApplied(controllerContext.RequestContext))
|
//if (!ThemeFilter.IsApplied(controllerContext.RequestContext))
|
||||||
skipLayoutViewEngine = true;
|
// skipLayoutViewEngine = true;
|
||||||
if (_viewEngines == null || _viewEngines.Count == 0)
|
if (_viewEngines == null || _viewEngines.Count == 0)
|
||||||
skipLayoutViewEngine = true;
|
skipLayoutViewEngine = true;
|
||||||
if (skipLayoutViewEngine)
|
if (skipLayoutViewEngine)
|
||||||
|
|||||||
Reference in New Issue
Block a user