diff --git a/src/Orchard.Web/Core/Contents/Controllers/ItemController.cs b/src/Orchard.Web/Core/Contents/Controllers/ItemController.cs index 12b8334a3..65ca517ae 100644 --- a/src/Orchard.Web/Core/Contents/Controllers/ItemController.cs +++ b/src/Orchard.Web/Core/Contents/Controllers/ItemController.cs @@ -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); } } } \ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml b/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml index 1af6b9171..6964cbd90 100644 --- a/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml +++ b/src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml @@ -5,5 +5,6 @@

@Html.TitleForPage((string)pageTitle.Text)

@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) } \ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml b/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml index 7cd4e1a3d..cf8cb8b92 100644 --- a/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml +++ b/src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml @@ -8,5 +8,6 @@

@Html.TitleForPage(pageTitle)

@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) } \ No newline at end of file diff --git a/src/Orchard.Web/Core/Contents/Views/Item/Display.cshtml b/src/Orchard.Web/Core/Contents/Views/Item/Display.cshtml deleted file mode 100644 index 631e9eb0f..000000000 --- a/src/Orchard.Web/Core/Contents/Views/Item/Display.cshtml +++ /dev/null @@ -1 +0,0 @@ -@Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index 198aed3e4..6722ce7b8 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -335,10 +335,8 @@ Designer - - diff --git a/src/Orchard.Web/Core/Routable/Controllers/ItemController.cs b/src/Orchard.Web/Core/Routable/Controllers/ItemController.cs index 4cc16d9d3..aa557164a 100644 --- a/src/Orchard.Web/Core/Routable/Controllers/ItemController.cs +++ b/src/Orchard.Web/Core/Routable/Controllers/ItemController.cs @@ -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) { diff --git a/src/Orchard.Web/Core/Routable/Views/Item/Display.cshtml b/src/Orchard.Web/Core/Routable/Views/Item/Display.cshtml deleted file mode 100644 index 631e9eb0f..000000000 --- a/src/Orchard.Web/Core/Routable/Views/Item/Display.cshtml +++ /dev/null @@ -1 +0,0 @@ -@Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs index 6e6dbbb44..1e6215a69 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogController.cs @@ -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); } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostController.cs index 86e399152..ae679af55 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostController.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostController.cs @@ -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) { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj index 4fb25b07d..215532f54 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj @@ -115,9 +115,7 @@ - - diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml deleted file mode 100644 index 631e9eb0f..000000000 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Blog/Item.cshtml +++ /dev/null @@ -1 +0,0 @@ -@Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Create.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Create.cshtml index 859c95591..927dcb9ba 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Create.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Create.cshtml @@ -1,5 +1,6 @@

@Html.TitleForPage(T("Create New Blog").ToString())

@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) } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Edit.cshtml index 3b0bf1ea8..cf5924fec 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Edit.cshtml @@ -1,5 +1,6 @@

@Html.TitleForPage(T("Blog Properties").ToString())

@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) } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Item.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Item.cshtml index c924a4211..689c95f24 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Item.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/Item.cshtml @@ -1,4 +1,5 @@ @{ Html.AddTitleParts(T("Manage Blog").ToString()); } -@Display(Model) \ No newline at end of file + // Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type + @Display(Model) diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPost/Item.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPost/Item.cshtml deleted file mode 100644 index 631e9eb0f..000000000 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPost/Item.cshtml +++ /dev/null @@ -1 +0,0 @@ -@Display(Model) \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPostAdmin/Create.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPostAdmin/Create.cshtml index ff7e3d534..7a54cee20 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPostAdmin/Create.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPostAdmin/Create.cshtml @@ -1,5 +1,6 @@

@Html.TitleForPage(T("Create New Blog Post").ToString())

@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) } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPostAdmin/Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPostAdmin/Edit.cshtml index 4c905b255..a6fde554b 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPostAdmin/Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogPostAdmin/Edit.cshtml @@ -1,5 +1,6 @@

@Html.TitleForPage(T("Edit Blog Post").ToString())

@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) } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/Placement.info b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/Placement.info new file mode 100644 index 000000000..0eab3bada --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/CodeGenerationTemplates/Placement.info @@ -0,0 +1,17 @@ + + + + + diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs index 245c39bba..b3a836035 100644 --- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs +++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Commands/CodeGenerationCommands.cs @@ -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); diff --git a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj index 70df50651..b490060bf 100644 --- a/src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj +++ b/src/Orchard.Web/Modules/Orchard.CodeGeneration/Orchard.CodeGeneration.csproj @@ -79,6 +79,9 @@ + + + + + + diff --git a/src/Orchard.Web/Themes/Themes.csproj b/src/Orchard.Web/Themes/Themes.csproj index edd3c2d09..8af254cc7 100644 --- a/src/Orchard.Web/Themes/Themes.csproj +++ b/src/Orchard.Web/Themes/Themes.csproj @@ -116,6 +116,9 @@ Designer
+ + +