mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 02:44:52 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Themes;
|
||||
|
||||
namespace Orchard.Core.Contents.Controllers {
|
||||
@@ -24,8 +25,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
public ActionResult Display(int id) {
|
||||
var contentItem = _contentManager.Get(id, VersionOptions.Published);
|
||||
dynamic model = _contentManager.BuildDisplay(contentItem);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return new ShapeResult(this, model);
|
||||
}
|
||||
|
||||
// /Contents/Item/Preview/72
|
||||
@@ -41,8 +41,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
dynamic model = _contentManager.BuildDisplay(contentItem);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View("Display", (object)model);
|
||||
return new ShapeResult(this, model);
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,5 +5,6 @@
|
||||
<h1>@Html.TitleForPage((string)pageTitle.Text)</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -8,5 +8,6 @@
|
||||
<h1>@Html.TitleForPage(pageTitle)</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -1 +0,0 @@
|
||||
@Display(Model)
|
@@ -335,10 +335,8 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Contents\Views\Content.ControlWrapper.cshtml" />
|
||||
<Content Include="Contents\Views\Item\Display.cshtml" />
|
||||
<Content Include="Navigation\Placement.info" />
|
||||
<Content Include="Routable\Views\Parts.RoutableTitle.cshtml" />
|
||||
<Content Include="Routable\Views\Item\Display.cshtml" />
|
||||
<Content Include="Routable\Views\Routable.HomePage.cshtml" />
|
||||
<Content Include="Contents\Views\Content.Summary.cshtml" />
|
||||
<Content Include="Shapes\Views\Pager.cshtml" />
|
||||
|
@@ -9,6 +9,7 @@ using Orchard.Core.Routable.Services;
|
||||
using Orchard.Data;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Services;
|
||||
using Orchard.Themes;
|
||||
|
||||
@@ -59,8 +60,7 @@ namespace Orchard.Core.Routable.Controllers {
|
||||
}
|
||||
|
||||
dynamic model = _contentManager.BuildDisplay(hits.Single());
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return new ShapeResult(this, model);
|
||||
}
|
||||
|
||||
public ActionResult Slugify(string contentType, int? id, int? containerId) {
|
||||
|
@@ -1 +0,0 @@
|
||||
@Display(Model)
|
@@ -8,6 +8,7 @@ using Orchard.Core.Feeds;
|
||||
using Orchard.Core.Routable.Services;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Services;
|
||||
using Orchard.Themes;
|
||||
using Orchard.UI.Navigation;
|
||||
@@ -92,8 +93,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
var totalItemCount = _blogPostService.PostCount(blogPart);
|
||||
blog.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after");
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)blog);
|
||||
return new ShapeResult(this, blog);
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,6 +7,7 @@ using Orchard.ContentManagement;
|
||||
using Orchard.Core.Feeds;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Security;
|
||||
using Orchard.Themes;
|
||||
|
||||
@@ -51,8 +52,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = _services.ContentManager.BuildDisplay(postPart);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return new ShapeResult(this, model);
|
||||
}
|
||||
|
||||
public ActionResult ListByArchive(string blogPath, string archiveData) {
|
||||
|
@@ -115,9 +115,7 @@
|
||||
<Content Include="Views\BlogAdmin\List.cshtml" />
|
||||
<Content Include="Views\BlogPostAdmin\Create.cshtml" />
|
||||
<Content Include="Views\BlogPostAdmin\Edit.cshtml" />
|
||||
<Content Include="Views\BlogPost\Item.cshtml" />
|
||||
<Content Include="Views\BlogPost\ListByArchive.cshtml" />
|
||||
<Content Include="Views\Blog\Item.cshtml" />
|
||||
<Content Include="Views\Blog\List.cshtml" />
|
||||
<Content Include="Views\Parts.Blogs.Blog.Manage.cshtml" />
|
||||
<Content Include="Views\Parts.Blogs.Blog.Description.cshtml" />
|
||||
|
@@ -1 +0,0 @@
|
||||
@Display(Model)
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Create New Blog").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Blog Properties").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
@{
|
||||
Html.AddTitleParts(T("Manage Blog").ToString());
|
||||
}
|
||||
@Display(Model)
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
|
@@ -1 +0,0 @@
|
||||
@Display(Model)
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Create New Blog Post").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Edit Blog Post").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
<Placement>
|
||||
<!-- Customize where the shapes are rendered -->
|
||||
|
||||
<!--
|
||||
<Place Parts_Blogs_BlogArchives="Content:before"/>
|
||||
<Place Parts_Blogs_RecentBlogPosts="Content:after"/>
|
||||
<Match ContentType="Blog">
|
||||
<Match DisplayType="Summary">
|
||||
<Place Parts_Blogs_Blog_Description="Content:before"
|
||||
Parts_Blogs_Blog_BlogPostCount="Meta:3"/>
|
||||
</Match>
|
||||
</Match>
|
||||
<Match Path="/About">
|
||||
<Place Parts_Common_Metadata="-"/>
|
||||
</Match>
|
||||
-->
|
||||
</Placement>
|
@@ -312,6 +312,9 @@ namespace Orchard.CodeGeneration.Commands {
|
||||
File.WriteAllBytes(themePath + "Theme.png", File.ReadAllBytes(_codeGenTemplatePath + "Theme.png"));
|
||||
createdFiles.Add(themePath + "Theme.png");
|
||||
|
||||
File.WriteAllText(themePath + "Placement.info", File.ReadAllText(_codeGenTemplatePath + "Placement.info"));
|
||||
createdFiles.Add(themePath + "Placement.info");
|
||||
|
||||
// create new csproj for the theme
|
||||
if (projectGuid != null) {
|
||||
var itemGroup = CreateProjectItemGroup(themePath, createdFiles, createdFolders);
|
||||
|
@@ -79,6 +79,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="CodeGenerationTemplates\ModuleRootWebConfig.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="CodeGenerationTemplates\Placement.info" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -66,7 +66,7 @@ namespace Orchard.Users.Controllers {
|
||||
users = users.Where(u => u.RegistrationStatus == UserStatus.Pending);
|
||||
break;
|
||||
case UsersFilter.EmailPending:
|
||||
users = users.Where(u => u.EmailStatus == UserStatus.Approved);
|
||||
users = users.Where(u => u.EmailStatus == UserStatus.Pending);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Add User").ToString()) </h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Edit User").ToString()) </h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Add Layer").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Add Widget").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Edit Layer").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
<h1>@Html.TitleForPage(T("Edit Widget").ToString())</h1>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model)
|
||||
}
|
17
src/Orchard.Web/Themes/TheThemeMachine/Placement.info
Normal file
17
src/Orchard.Web/Themes/TheThemeMachine/Placement.info
Normal file
@@ -0,0 +1,17 @@
|
||||
<Placement>
|
||||
<!-- Customize where the shapes are rendered -->
|
||||
|
||||
<!--
|
||||
<Place Parts_Blogs_BlogArchives="Content:before"/>
|
||||
<Place Parts_Blogs_RecentBlogPosts="Content:after"/>
|
||||
<Match ContentType="Blog">
|
||||
<Match DisplayType="Summary">
|
||||
<Place Parts_Blogs_Blog_Description="Content:before"
|
||||
Parts_Blogs_Blog_BlogPostCount="Meta:3"/>
|
||||
</Match>
|
||||
</Match>
|
||||
<Match Path="/About">
|
||||
<Place Parts_Common_Metadata="-"/>
|
||||
</Match>
|
||||
-->
|
||||
</Placement>
|
@@ -116,6 +116,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="TheThemeMachine\Placement.info" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Routing;
|
||||
using ClaySharp.Implementation;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
@@ -100,6 +101,7 @@ namespace Orchard.ContentManagement {
|
||||
//var theme = workContext.CurrentTheme;
|
||||
var theme = _themeService.Value.GetRequestTheme(_requestContext);
|
||||
var shapeTable = _shapeTableManager.GetShapeTable(theme.Id);
|
||||
var request = _requestContext.HttpContext.Request;
|
||||
|
||||
ShapeDescriptor descriptor;
|
||||
if (shapeTable.Descriptors.TryGetValue(partShapeType, out descriptor)) {
|
||||
@@ -107,6 +109,7 @@ namespace Orchard.ContentManagement {
|
||||
ContentType = context.ContentItem.ContentType,
|
||||
DisplayType = displayType,
|
||||
Differentiator = differentiator,
|
||||
Path = request.Path.Substring((request.ApplicationPath ?? "").Length)
|
||||
};
|
||||
var location = descriptor.Placement(placementContext);
|
||||
return location ?? defaultLocation;
|
||||
|
@@ -111,5 +111,6 @@ namespace Orchard.DisplayManagement.Descriptors {
|
||||
public string ContentType { get; set; }
|
||||
public string DisplayType { get; set; }
|
||||
public string Differentiator { get; set; }
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -98,6 +98,12 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy {
|
||||
return ctx => (ctx.DisplayType ?? "").StartsWith(prefix) && predicate(ctx);
|
||||
}
|
||||
return ctx => (ctx.DisplayType == expression) && predicate(ctx);
|
||||
case "Path":
|
||||
if (expression.EndsWith("*")) {
|
||||
var prefix = expression.Substring(0, expression.Length - 1);
|
||||
return ctx => (ctx.Path ?? "").StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && predicate(ctx);
|
||||
}
|
||||
return ctx => (ctx.Path.Equals(expression, StringComparison.OrdinalIgnoreCase)) && predicate(ctx);
|
||||
}
|
||||
return predicate;
|
||||
}
|
||||
|
Reference in New Issue
Block a user