diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogDriver.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogDriver.cs index d0498a5bb..2a0f64fdd 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogDriver.cs @@ -81,6 +81,9 @@ namespace Orchard.Blogs.Controllers { return Combined( ContentItemTemplate("Items/Blogs.Blog").LongestMatch(displayType, "Summary", "DetailAdmin", "SummaryAdmin"), + ContentPartTemplate(blog, "Parts/Blogs.Blog.Manage").Location("primary:manage"), + ContentPartTemplate(blog, "Parts/Blogs.Blog.Metadata").Location("primary:metadata"), + ContentPartTemplate(blog, "Parts/Blogs.Blog.Description").Location("primary"), blogPosts == null ? null : ContentPartTemplate(blogPosts, "Parts/Blogs.BlogPost.List", "").Location("primary")); } diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostDriver.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostDriver.cs index ed18cba56..41493b9a2 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostDriver.cs @@ -64,7 +64,10 @@ namespace Orchard.Blogs.Controllers { } protected override DriverResult Display(BlogPost post, string displayType) { - return ContentItemTemplate("Items/Blogs.BlogPost").LongestMatch(displayType, "Summary", "SummaryAdmin"); + return Combined( + ContentItemTemplate("Items/Blogs.BlogPost").LongestMatch(displayType, "Summary", "SummaryAdmin"), + ContentPartTemplate(post, "Parts/Blogs.BlogPost.Manage").Location("primary:manage"), + ContentPartTemplate(post, "Parts/Blogs.BlogPost.Metadata").Location("primary:metadata")); } protected override DriverResult Editor(BlogPost post) { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj index 3f361a599..8188b4adb 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 9.0.21022 + 9.0.30729 2.0 {63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867} {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} @@ -155,6 +155,11 @@ + + + + + @@ -201,6 +206,9 @@ False + False + + False diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Items/Blogs.Blog.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Items/Blogs.Blog.ascx index 3f91a7f6f..803508baf 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Items/Blogs.Blog.ascx +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Items/Blogs.Blog.ascx @@ -1,10 +1,6 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>" %> <%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Extensions"%> <%@ Import Namespace="Orchard.Blogs.Models"%> -<%-- todo: (heskew) selectively display to those who have access --%>

<%=Html.TitleForPage(Model.Item.Name) %>

- -

<%=Html.Encode(Model.Item.Description) %>

-<% Html.Zone("primary"); +<% Html.Zone("primary", ":manage :metadata"); Html.ZonesAny(); %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Items/Blogs.BlogPost.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Items/Blogs.BlogPost.ascx index 738470580..6a62a7c92 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Items/Blogs.BlogPost.ascx +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Items/Blogs.BlogPost.ascx @@ -1,13 +1,6 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>" %> <%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Extensions"%> <%@ Import Namespace="Orchard.Blogs.Models"%>

<%=Html.TitleForPage(Model.Item.Title)%>

- - -<% Html.Zone("primary"); +<% Html.Zone("primary", ":manage :metadata"); Html.ZonesAny(); %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.Blog.Description.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.Blog.Description.ascx new file mode 100644 index 000000000..a79b21067 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.Blog.Description.ascx @@ -0,0 +1,5 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Blogs.Models"%> +
+

<%=Html.Encode(Model.Description) %>

+
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.Blog.Manage.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.Blog.Manage.ascx new file mode 100644 index 000000000..908c21e94 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.Blog.Manage.ascx @@ -0,0 +1,6 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Blogs.Extensions"%> +<%@ Import Namespace="Orchard.Blogs.Models"%> + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.Blog.Metadata.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.Blog.Metadata.ascx new file mode 100644 index 000000000..ecd331b26 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.Blog.Metadata.ascx @@ -0,0 +1,2 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Blogs.Models"%> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Manage.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Manage.ascx new file mode 100644 index 000000000..43f3a2823 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Manage.ascx @@ -0,0 +1,6 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Blogs.Extensions"%> +<%@ Import Namespace="Orchard.Blogs.Models"%> + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Metadata.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Metadata.ascx new file mode 100644 index 000000000..921c1f183 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.Metadata.ascx @@ -0,0 +1,8 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Blogs.Extensions"%> +<%@ Import Namespace="Orchard.Blogs.Models"%> + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Pages/Controllers/AdminController.cs index f7d4bf322..b693610d9 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Pages/Controllers/AdminController.cs @@ -132,6 +132,7 @@ namespace Orchard.Pages.Controllers { } Services.ContentManager.Create(model.Page.Item.ContentItem, VersionOptions.Draft); + Services.ContentManager.UpdateEditorModel(page, this); // Execute publish command switch (Request.Form["Command"]) { diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageDriver.cs b/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageDriver.cs index 1ad21020b..c06ec861f 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageDriver.cs @@ -60,7 +60,10 @@ namespace Orchard.Pages.Controllers { } protected override DriverResult Display(Page page, string displayType) { - return ContentItemTemplate("Items/Pages.Page").LongestMatch(displayType, "Summary", "SummaryAdmin"); + return Combined( + ContentItemTemplate("Items/Pages.Page").LongestMatch(displayType, "Summary", "SummaryAdmin"), + ContentPartTemplate(page, "Parts/Pages.Page.Manage").Location("primary:manage"), + ContentPartTemplate(page, "Parts/Pages.Page.Metadata").Location("primary:metadata")); } protected override DriverResult Editor(Page page) { diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj b/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj index be6647bda..9aa51df97 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj +++ b/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj @@ -119,6 +119,8 @@ + + diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Items/Pages.Page.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Items/Pages.Page.ascx index 000afe5a3..2a735a486 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Items/Pages.Page.ascx +++ b/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Items/Pages.Page.ascx @@ -1,10 +1,6 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>" %> <%@ Import Namespace="Orchard.Mvc.Html"%> <%@ Import Namespace="Orchard.Mvc.ViewModels"%> -

<%=Html.TitleForPage(Model.Item.Title)%>

- -<% Html.Zone("primary"); +<% Html.Zone("primary", ":manage :metadata"); Html.ZonesAny(); %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Manage.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Manage.ascx new file mode 100644 index 000000000..15a9f3dc0 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Manage.ascx @@ -0,0 +1,6 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Mvc.ViewModels"%> +<%@ Import Namespace="Orchard.Mvc.Html" %> + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Metadata.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Metadata.ascx new file mode 100644 index 000000000..09b1438cb --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Parts/Pages.Page.Metadata.ascx @@ -0,0 +1,5 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Mvc.ViewModels"%> + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/Page/Item.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/Page/Item.ascx index aa21b0278..2e9c113fc 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/Page/Item.ascx +++ b/src/Orchard.Web/Modules/Orchard.Pages/Views/Page/Item.ascx @@ -1,4 +1,4 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <%@ Import Namespace="Orchard.Mvc.Html"%> <%@ Import Namespace="Orchard.Pages.ViewModels"%> -<%=Html.DisplayForItem(m=>m.Page) %> +<%=Html.DisplayForItem(m=>m.Page) %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Controllers/SetupController.cs b/src/Orchard.Web/Modules/Orchard.Setup/Controllers/SetupController.cs index 603e78eac..f547d27a0 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Controllers/SetupController.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/Controllers/SetupController.cs @@ -103,7 +103,7 @@ namespace Orchard.Setup.Controllers { // create home page as a CMS page var page = contentManager.Create("page"); - page.As().Text = "

Welcome to Orchard!

Congratulations, you've successfully set-up your Orchard site.

This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click [Edit] to go into edit mode and replace this with whatever you want on your home page to make it your own.

One thing you could do (but you don't have to) is go into [Manage Settings] (follow the [Admin] link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.

You probably want to make the site your own. One of the ways you can do that is by clicking [Manage Themes] in the admin menu. A theme is a packaged look and feel that affects the whole site. We have installed a few themes already, but you'll also be able to browse through an online gallery of themes created by other users of Orchard.

Next, you can start playing with the content types that we installed. For example, go ahead and click [Add New Page] in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to [Manage Navigation]. You can also click [Add New Blog] and start posting by clicking [Add New Post].

Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs but you can install new ones by going to [Manage Themes] and clicking [Install a new Theme]. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please [consider participating].

--The Orchard Crew

"; + page.As().Text = "

Welcome to Orchard!

Congratulations, you've successfully set-up your Orchard site.

This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click Edit to go into edit mode and replace this with whatever you want on your home page to make it your own.

One thing you could do (but you don't have to) is go into Manage Settings (follow the Admin link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.

You probably want to make the site your own. One of the ways you can do that is by clicking Manage Themes in the admin menu. A theme is a packaged look and feel that affects the whole site. We have installed a few themes already, but you'll also be able to browse through an online gallery of themes created by other users of Orchard.

Next, you can start playing with the content types that we installed. For example, go ahead and click Add New Page in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to Manage Menu. You can also click Add New Blog and start posting by clicking \"Add New Post\".

Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to Manage Themes and clicking Install a new Theme. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please consider participating.

--The Orchard Crew

"; page.As().Slug = "home"; page.As().Title = T("Home").ToString(); page.As().CommentsShown = false; diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj index b41cab248..184187747 100644 --- a/src/Orchard.Web/Orchard.Web.csproj +++ b/src/Orchard.Web/Orchard.Web.csproj @@ -174,7 +174,6 @@ - @@ -196,7 +195,6 @@ - diff --git a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Items/Blogs.Blog.ascx b/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Items/Blogs.Blog.ascx index 4bbd140d3..e384ea728 100644 --- a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Items/Blogs.Blog.ascx +++ b/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Items/Blogs.Blog.ascx @@ -3,7 +3,5 @@ <%@ Import Namespace="Orchard.Blogs.Extensions"%> <%@ Import Namespace="Orchard.Blogs.Models"%>

<%=Html.TitleForPage(Model.Item.Name) %>

- -

<%=Html.Encode(Model.Item.Description) %>

-<% Html.Zone("primary"); +<% Html.Zone("primary", ":manage :metadata"); Html.ZonesAny(); %> \ No newline at end of file diff --git a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Items/Pages.Page.ascx b/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Items/Pages.Page.ascx deleted file mode 100644 index 83539088d..000000000 --- a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Items/Pages.Page.ascx +++ /dev/null @@ -1,12 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>" %> -<%@ Import Namespace="Orchard.Mvc.Html"%> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -

<%=Html.TitleForPage(Model.Item.Title)%>

- - -<% Html.Zone("primary"); - Html.ZonesAny(); %> - - diff --git a/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Items/Blogs.Blog.ascx b/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Items/Blogs.Blog.ascx index 4111fe8b9..f5f2d260e 100644 --- a/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Items/Blogs.Blog.ascx +++ b/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Items/Blogs.Blog.ascx @@ -1,20 +1,8 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>" %> <%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Extensions"%> <%@ Import Namespace="Orchard.Blogs.Models"%> -

<%=Html.TitleForPage(Model.Item.Name) %>

- -
-

<%=Html.Encode(Model.Item.Description) %>

-
- -<% Html.Zone("primary"); - Html.ZonesAny(); %> - - - \ No newline at end of file +<% Html.Zone("primary", ":manage :metadata"); + Html.ZonesAny(); %> \ No newline at end of file diff --git a/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Items/Pages.Page.ascx b/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Items/Pages.Page.ascx deleted file mode 100644 index 83539088d..000000000 --- a/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Items/Pages.Page.ascx +++ /dev/null @@ -1,12 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>" %> -<%@ Import Namespace="Orchard.Mvc.Html"%> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -

<%=Html.TitleForPage(Model.Item.Title)%>

- - -<% Html.Zone("primary"); - Html.ZonesAny(); %> - - diff --git a/src/Orchard/ContentManagement/ContentExtensions.cs b/src/Orchard/ContentManagement/ContentExtensions.cs index 139cfd870..1449c2aa4 100644 --- a/src/Orchard/ContentManagement/ContentExtensions.cs +++ b/src/Orchard/ContentManagement/ContentExtensions.cs @@ -166,15 +166,25 @@ namespace Orchard.ContentManagement { /* Display and editor convenience extension methods */ public static ContentItemViewModel BuildDisplayModel(this IContentManager manager, int id, string displayType) where T : class, IContent { - return manager.BuildDisplayModel(manager.Get(id), displayType); + var content = manager.Get(id); + if (content == null) + return null; + return manager.BuildDisplayModel(content, displayType); } public static ContentItemViewModel BuildEditorModel(this IContentManager manager, int id) where T : class, IContent { - return manager.BuildEditorModel(manager.Get(id)); + var content = manager.Get(id); + if (content == null) + return null; + return manager.BuildEditorModel(content); + } public static ContentItemViewModel UpdateEditorModel(this IContentManager manager, int id, IUpdateModel updater) where T : class, IContent { - return manager.UpdateEditorModel(manager.Get(id), updater); + var content = manager.Get(id); + if (content == null) + return null; + return manager.UpdateEditorModel(content, updater); } diff --git a/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs b/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs index a6bdf2b1c..5420aae4d 100644 --- a/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs +++ b/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; -using System.Text.RegularExpressions; using System.Web.Mvc; using System.Web.Mvc.Html; using System.Web.Routing;