diff --git a/src/Orchard.Azure/Orchard.Azure.CloudService.sln b/src/Orchard.Azure/Orchard.Azure.CloudService.sln index 3036e9ba8..3314fa3ed 100644 --- a/src/Orchard.Azure/Orchard.Azure.CloudService.sln +++ b/src/Orchard.Azure/Orchard.Azure.CloudService.sln @@ -31,8 +31,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Modules", "..\Orcha EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.MultiTenancy", "..\Orchard.Web\Modules\Orchard.MultiTenancy\Orchard.MultiTenancy.csproj", "{72457126-E118-4171-A08F-9A709EE4B7FC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Pages", "..\Orchard.Web\Modules\Orchard.Pages\Orchard.Pages.csproj", "{4A9C04A6-0986-4A92-A610-5F59FF273FB9}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Roles", "..\Orchard.Web\Modules\Orchard.Roles\Orchard.Roles.csproj", "{D10AD48F-407D-4DB5-A328-173EC7CB010F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Sandbox", "..\Orchard.Web\Modules\Orchard.Sandbox\Orchard.Sandbox.csproj", "{17C44253-65A2-4597-98C7-16EE576824B6}" @@ -119,10 +117,6 @@ Global {72457126-E118-4171-A08F-9A709EE4B7FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {72457126-E118-4171-A08F-9A709EE4B7FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {72457126-E118-4171-A08F-9A709EE4B7FC}.Release|Any CPU.Build.0 = Release|Any CPU - {4A9C04A6-0986-4A92-A610-5F59FF273FB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4A9C04A6-0986-4A92-A610-5F59FF273FB9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4A9C04A6-0986-4A92-A610-5F59FF273FB9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4A9C04A6-0986-4A92-A610-5F59FF273FB9}.Release|Any CPU.Build.0 = Release|Any CPU {D10AD48F-407D-4DB5-A328-173EC7CB010F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D10AD48F-407D-4DB5-A328-173EC7CB010F}.Debug|Any CPU.Build.0 = Debug|Any CPU {D10AD48F-407D-4DB5-A328-173EC7CB010F}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -181,7 +175,6 @@ Global {D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {17F86780-9A1F-4AA1-86F1-875EEC2730C7} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {72457126-E118-4171-A08F-9A709EE4B7FC} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} - {4A9C04A6-0986-4A92-A610-5F59FF273FB9} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {D10AD48F-407D-4DB5-A328-173EC7CB010F} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {17C44253-65A2-4597-98C7-16EE576824B6} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} {4BE4EB01-AC56-4048-924E-2CA77F509ABA} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D} diff --git a/src/Orchard.Azure/Orchard.Azure.Web/Orchard.Azure.Web.csproj b/src/Orchard.Azure/Orchard.Azure.Web/Orchard.Azure.Web.csproj index a3b22e93a..699d564b1 100644 --- a/src/Orchard.Azure/Orchard.Azure.Web/Orchard.Azure.Web.csproj +++ b/src/Orchard.Azure/Orchard.Azure.Web/Orchard.Azure.Web.csproj @@ -210,10 +210,6 @@ {72457126-E118-4171-A08F-9A709EE4B7FC} Orchard.MultiTenancy - - {4A9C04A6-0986-4A92-A610-5F59FF273FB9} - Orchard.Pages - {D10AD48F-407D-4DB5-A328-173EC7CB010F} Orchard.Roles diff --git a/src/Orchard.Specs/Orchard.Specs.csproj b/src/Orchard.Specs/Orchard.Specs.csproj index e1aabe1d0..969840a8e 100644 --- a/src/Orchard.Specs/Orchard.Specs.csproj +++ b/src/Orchard.Specs/Orchard.Specs.csproj @@ -248,10 +248,6 @@ {D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB} Orchard.Media - - {4A9C04A6-0986-4A92-A610-5F59FF273FB9} - Orchard.Pages - {D10AD48F-407D-4DB5-A328-173EC7CB010F} Orchard.Roles diff --git a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj index a06be0a03..bcc28b3b4 100644 --- a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj +++ b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj @@ -137,10 +137,6 @@ {EA2B9121-EF54-40A6-A53E-6593C86EE696} Orchard.Indexing - - {4A9C04A6-0986-4A92-A610-5F59FF273FB9} - Orchard.Pages - {D10AD48F-407D-4DB5-A328-173EC7CB010F} Orchard.Roles diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index e72fca2c7..a17f32168 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -244,6 +244,11 @@ + + + + + diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/draft.gif b/src/Orchard.Web/Core/PublishLater/Content/Admin/images/draft.gif similarity index 100% rename from src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/draft.gif rename to src/Orchard.Web/Core/PublishLater/Content/Admin/images/draft.gif diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/offline.gif b/src/Orchard.Web/Core/PublishLater/Content/Admin/images/offline.gif similarity index 100% rename from src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/offline.gif rename to src/Orchard.Web/Core/PublishLater/Content/Admin/images/offline.gif diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/online.gif b/src/Orchard.Web/Core/PublishLater/Content/Admin/images/online.gif similarity index 100% rename from src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/online.gif rename to src/Orchard.Web/Core/PublishLater/Content/Admin/images/online.gif diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/published.gif b/src/Orchard.Web/Core/PublishLater/Content/Admin/images/published.gif similarity index 100% rename from src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/published.gif rename to src/Orchard.Web/Core/PublishLater/Content/Admin/images/published.gif diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/scheduled.gif b/src/Orchard.Web/Core/PublishLater/Content/Admin/images/scheduled.gif similarity index 100% rename from src/Orchard.Web/Modules/Orchard.Pages/Content/Admin/images/scheduled.gif rename to src/Orchard.Web/Core/PublishLater/Content/Admin/images/scheduled.gif diff --git a/src/Orchard.Web/Core/PublishLater/Views/DisplayTemplates/Parts/PublishLater.Metadata.SummaryAdmin.ascx b/src/Orchard.Web/Core/PublishLater/Views/DisplayTemplates/Parts/PublishLater.Metadata.SummaryAdmin.ascx index a10354176..785076cc0 100644 --- a/src/Orchard.Web/Core/PublishLater/Views/DisplayTemplates/Parts/PublishLater.Metadata.SummaryAdmin.ascx +++ b/src/Orchard.Web/Core/PublishLater/Views/DisplayTemplates/Parts/PublishLater.Metadata.SummaryAdmin.ascx @@ -3,16 +3,16 @@
  • <% // Published or not if (Model.HasPublished) { %> - " alt="<%:T("Online") %>" title="<%:T("The page is currently online") %>" /> <%:T("Published") %> | <% + " alt="<%:T("Online") %>" title="<%:T("The page is currently online") %>" /> <%:T("Published") %> | <% } else { %> - " alt="<%:T("Offline") %>" title="<%:T("The page is currently offline") %>" /> <%:T("Not Published") %> | <% + " alt="<%:T("Offline") %>" title="<%:T("The page is currently offline") %>" /> <%:T("Not Published") %> | <% } %>
  • <% // Does the page have a draft if (Model.HasDraft) { %> - " alt="<%:T("Draft") %>" title="<%:T("The page has a draft") %>" /><%:T("Draft") %> | <% + " alt="<%:T("Draft") %>" title="<%:T("The page has a draft") %>" /><%:T("Draft") %> | <% } else { %> <%:T("No Draft") %> | <% @@ -24,7 +24,7 @@ <%:T("Published: {0}", Html.DateTimeRelative(Model.VersionPublishedUtc.Value, T)) %><% } else { %> - " alt="<%:T("Scheduled") %>" title="<%:T("The page is scheduled for publishing") %>" /><%:T("Scheduled") %> + " alt="<%:T("Scheduled") %>" title="<%:T("The page is scheduled for publishing") %>" /><%:T("Scheduled") %> <%:Html.DateTime(Model.ScheduledPublishUtc.Value, T("M/d/yyyy h:mm tt")) %><% } %> | 
  • <% } %> diff --git a/src/Orchard.Web/Modules/Orchard.Pages/AdminMenu.cs b/src/Orchard.Web/Modules/Orchard.Pages/AdminMenu.cs deleted file mode 100644 index 1f7afd301..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/AdminMenu.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Orchard.Localization; -using Orchard.Pages.Services; -using Orchard.UI.Navigation; - -namespace Orchard.Pages { - public class AdminMenu : INavigationProvider { - private readonly IPageService _pageService; - - public AdminMenu(IPageService pageService) { - _pageService = pageService; - } - - public Localizer T { get; set; } - - public string MenuName { get { return "admin"; } } - - public void GetNavigation(NavigationBuilder builder) { - builder.Add(T("Pages"), "1", BuildMenu); - } - - private void BuildMenu(NavigationItemBuilder menu) { - if (_pageService.GetCount() > 0) - menu.Add(T("Manage Pages"), "1.0", - item => - item.Action("List", "Admin", new {area = "Orchard.Pages"}).Permission(Permissions.MetaListPages)); - - menu.Add(T("Create New Page"), "1.1", - item => - item.Action("Create", "Admin", new {area = "Orchard.Pages"}).Permission(Permissions.EditPages)); - } - } -} diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Content/Site.css b/src/Orchard.Web/Modules/Orchard.Pages/Content/Site.css deleted file mode 100644 index f29f72a8c..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Content/Site.css +++ /dev/null @@ -1,317 +0,0 @@ -/*---------------------------------------------------------- -The base color for this template is #5c87b2. If you'd like -to use a different color start by replacing all instances of -#5c87b2 with your new color. -----------------------------------------------------------*/ -body -{ - background-color: #5c87b2; - font-size: .75em; - font-family: Verdana, Helvetica, Sans-Serif; - margin: 0; - padding: 0; - color: #696969; -} - -a:link -{ - color: #034af3; - text-decoration: underline; -} -a:visited -{ - color: #505abc; -} -a:hover -{ - color: #1d60ff; - text-decoration: none; -} -a:active -{ - color: #12eb87; -} - -p, ul -{ - margin-bottom: 20px; - line-height: 1.6em; -} - -/* HEADINGS -----------------------------------------------------------*/ -h1, h2, h3, h4, h5, h6 -{ - font-size: 1.5em; - color: #000; - font-family: Arial, Helvetica, sans-serif; -} - -h1 -{ - font-size: 2em; - padding-bottom: 0; - margin-bottom: 0; -} -h2 -{ - padding: 0 0 10px 0; -} -h3 -{ - font-size: 1.2em; -} -h4 -{ - font-size: 1.1em; -} -h5, h6 -{ - font-size: 1em; -} - -/* this rule styles

    tags that are the -first child of the left and right table columns */ -.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2 -{ - margin-top: 0; -} - -/* PRIMARY LAYOUT ELEMENTS -----------------------------------------------------------*/ - -/* you can specify a greater or lesser percentage for the -page width. Or, you can specify an exact pixel width. */ -.page -{ - width: 90%; - margin-left: auto; - margin-right: auto; -} - -#header -{ - position: relative; - margin-bottom: 0px; - color: #000; - padding: 0; -} - -#header h1 -{ - font-weight: bold; - padding: 5px 0; - margin: 0; - color: #fff; - border: none; - line-height: 2em; - font-family: Arial, Helvetica, sans-serif; - font-size: 32px !important; -} - -#main -{ - padding: 30px 30px 15px 30px; - background-color: #fff; - margin-bottom: 30px; - _height: 1px; /* only IE6 applies CSS properties starting with an underscrore */ -} - -#footer -{ - color: #999; - padding: 10px 0; - text-align: center; - line-height: normal; - margin: 0; - font-size: .9em; -} - -/* TAB MENU -----------------------------------------------------------*/ -ul#menu -{ - border-bottom: 1px #5C87B2 solid; - padding: 0 0 2px; - position: relative; - margin: 0; - text-align: right; -} - -ul#menu li -{ - display: inline; - list-style: none; -} - -ul#menu li#greeting -{ - padding: 10px 20px; - font-weight: bold; - text-decoration: none; - line-height: 2.8em; - color: #fff; -} - -ul#menu li a -{ - padding: 10px 20px; - font-weight: bold; - text-decoration: none; - line-height: 2.8em; - background-color: #e8eef4; - color: #034af3; -} - -ul#menu li a:hover -{ - background-color: #fff; - text-decoration: none; -} - -ul#menu li a:active -{ - background-color: #a6e2a6; - text-decoration: none; -} - -ul#menu li.selected a -{ - background-color: #fff; - color: #000; -} - -/* FORM LAYOUT ELEMENTS -----------------------------------------------------------*/ - -fieldset -{ - margin: 1em 0; - padding: 1em; - border: 1px solid #CCC; -} - -fieldset p -{ - margin: 2px 12px 10px 10px; -} - -fieldset label -{ - display: block; -} - -fieldset label.inline -{ - display: inline; -} - -legend -{ - font-size: 1.1em; - font-weight: 600; - padding: 2px 4px 8px 4px; -} - -input[type="text"] -{ - width: 200px; - border: 1px solid #CCC; -} - -input[type="password"] -{ - width: 200px; - border: 1px solid #CCC; -} - -/* TABLE -----------------------------------------------------------*/ - -table -{ - border: solid 1px #e8eef4; - border-collapse: collapse; -} - -table td -{ - padding: 5px; - border: solid 1px #e8eef4; -} - -table th -{ - padding: 6px 5px; - text-align: left; - background-color: #e8eef4; - border: solid 1px #e8eef4; -} - -/* MISC -----------------------------------------------------------*/ -.clear -{ - clear: both; -} - -.error -{ - color:Red; -} - -#menucontainer -{ - margin-top:40px; -} - -div#title -{ - display:block; - float:left; - text-align:left; -} - -#logindisplay -{ - font-size:1.1em; - display:block; - text-align:right; - margin:10px; - color:White; -} - -#logindisplay a:link -{ - color: white; - text-decoration: underline; -} - -#logindisplay a:visited -{ - color: white; - text-decoration: underline; -} - -#logindisplay a:hover -{ - color: white; - text-decoration: none; -} - -.field-validation-error -{ - color: #ff0000; -} - -.input-validation-error -{ - border: 1px solid #ff0000; - background-color: #ffeeee; -} - -.validation-summary-errors -{ - font-weight: bold; - color: #ff0000; -} diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Pages/Controllers/AdminController.cs deleted file mode 100644 index e20bc868f..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/AdminController.cs +++ /dev/null @@ -1,279 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Web.Mvc; -using JetBrains.Annotations; -using Orchard.Localization; -using Orchard.ContentManagement; -using Orchard.Mvc.AntiForgery; -using Orchard.Mvc.Results; -using Orchard.Pages.Drivers; -using Orchard.Pages.Models; -using Orchard.Pages.Services; -using Orchard.Pages.ViewModels; -using Orchard.Settings; -using Orchard.UI.Notify; - -namespace Orchard.Pages.Controllers { - [ValidateInput(false)] - public class AdminController : Controller, IUpdateModel { - private readonly IPageService _pageService; - - public AdminController(IOrchardServices services, IPageService pageService) { - Services = services; - _pageService = pageService; - T = NullLocalizer.Instance; - } - - protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; } - public IOrchardServices Services { get; private set; } - public Localizer T { get; set; } - - public ActionResult List(PagesOptions options) { - // Default options - if (options == null) - options = new PagesOptions(); - - IEnumerable pages; - // Filtering - switch (options.Filter) { - case PagesFilter.All: - pages = _pageService.Get(); - break; - case PagesFilter.Published: - pages = _pageService.Get(PageStatus.Published); - break; - case PagesFilter.Offline: - pages = _pageService.Get(PageStatus.Offline); - break; - default: - throw new ArgumentOutOfRangeException(); - } - var entries = pages.Select(page => CreatePageEntry(page)).OrderBy(pageEntry => pageEntry.Page.Title).ToList(); - var model = new PagesViewModel { Options = options, PageEntries = entries }; - return View(model); - } - - [HttpPost, ActionName("List")] - [FormValueRequired("submit.BulkEdit")] - public ActionResult ListPOST(PagesOptions options, IList pageEntries) { - IEnumerable checkedEntries = pageEntries.Where(p => p.IsChecked); - switch (options.BulkAction) { - case PagesBulkAction.None: - break; - case PagesBulkAction.PublishNow: - if (!Services.Authorizer.Authorize(Permissions.PublishPages, T("Couldn't publish page"))) - return new HttpUnauthorizedResult(); - - foreach (PageEntry entry in checkedEntries) { - var page = _pageService.GetLatest(entry.PageId); - _pageService.Publish(page); - Services.ContentManager.Flush(); - } - break; - case PagesBulkAction.Unpublish: - if (!Services.Authorizer.Authorize(Permissions.PublishPages, T("Couldn't unpublish page"))) - return new HttpUnauthorizedResult(); - foreach (PageEntry entry in checkedEntries) { - var page = _pageService.GetLatest(entry.PageId); - _pageService.Unpublish(page); - Services.ContentManager.Flush(); - } - break; - case PagesBulkAction.Delete: - if (!Services.Authorizer.Authorize(Permissions.DeletePages, T("Couldn't delete page"))) - return new HttpUnauthorizedResult(); - - foreach (PageEntry entry in checkedEntries) { - var page = _pageService.GetLatest(entry.PageId); - _pageService.Delete(page); - Services.ContentManager.Flush(); - } - break; - default: - throw new ArgumentOutOfRangeException(); - } - - return RedirectToAction("List"); - } - - private static PageEntry CreatePageEntry(Page page) { - return new PageEntry { - Page = page, - IsChecked = false, - PageId = page.Id - }; - } - - public ActionResult Create() { - if (!Services.Authorizer.Authorize(Permissions.EditPages, T("Not allowed to create a page"))) - return new HttpUnauthorizedResult(); - - var page = Services.ContentManager.New(PageDriver.ContentType.Name); - - var model = new PageCreateViewModel { - Page = Services.ContentManager.BuildEditorModel(page) - }; - - return View(model); - } - - [HttpPost, ActionName("Create")] - public ActionResult CreatePOST(PageCreateViewModel model) { - if (!Services.Authorizer.Authorize(Permissions.EditPages, T("Couldn't create page"))) - return new HttpUnauthorizedResult(); - - // Validate form input - var page = Services.ContentManager.New(PageDriver.ContentType.Name); - model.Page = Services.ContentManager.UpdateEditorModel(page, this); - - if (!ModelState.IsValid) { - Services.TransactionManager.Cancel(); - return View(model); - } - - Services.ContentManager.Create(model.Page.Item.ContentItem, VersionOptions.Draft); - Services.ContentManager.UpdateEditorModel(page, this); - - return RedirectToAction("Edit", "Admin", new { id = model.Page.Item.ContentItem.Id }); - } - - public ActionResult Edit(int id) { - Page page = _pageService.GetLatest(id); - if (page == null) - return new NotFoundResult(); - - if (!Services.Authorizer.Authorize(Permissions.EditOthersPages, page, T("Couldn't edit page"))) - return new HttpUnauthorizedResult(); - - var model = new PageEditViewModel { - Page = Services.ContentManager.BuildEditorModel(page), - PromoteToHomePage = CurrentSite.HomePage == "PageHomePageProvider;" + page.Id - }; - - return View(model); - } - - [HttpPost, ActionName("Edit")] - public ActionResult EditPOST(int id) { - var page = _pageService.GetPageOrDraft(id); - if (page == null) - return new NotFoundResult(); - - if (!Services.Authorizer.Authorize(Permissions.EditOthersPages, page, T("Couldn't edit page"))) - return new HttpUnauthorizedResult(); - - // Validate form input - var model = new PageEditViewModel { - Page = Services.ContentManager.UpdateEditorModel(page, this) - }; - - TryUpdateModel(model); - - if (!ModelState.IsValid) { - Services.TransactionManager.Cancel(); - return View(model); - } - - return RedirectToAction("Edit", "Admin", new {id = model.Page.Item.ContentItem.Id}); - } - - [ValidateAntiForgeryTokenOrchard] - public ActionResult DiscardDraft(int id) { - // get the current draft version - var draft = Services.ContentManager.Get(id, VersionOptions.Draft); - if (draft == null) { - Services.Notifier.Information(T("There is no draft to discard.")); - return RedirectToAction("Edit", new { Id = id }); - } - - // check edit permission - if (!Services.Authorizer.Authorize(Permissions.EditOthersPages, draft, T("Couldn't discard page draft"))) - return new HttpUnauthorizedResult(); - - // locate the published revision to revert onto - var published = Services.ContentManager.Get(id, VersionOptions.Published); - if (published == null) { - Services.Notifier.Information(T("Can not discard draft on unpublished page.")); - return RedirectToAction("Edit", new { draft.Id }); - } - - // marking the previously published version as the latest - // has the effect of discarding the draft but keeping the history - draft.VersionRecord.Latest = false; - published.VersionRecord.Latest = true; - - Services.Notifier.Information(T("Page draft version discarded")); - return RedirectToAction("Edit", new { draft.Id }); - } - - [ValidateAntiForgeryTokenOrchard] - public ActionResult Publish(int id) { - if (!Services.Authorizer.Authorize(Permissions.PublishPages, T("Couldn't publish page"))) - return new HttpUnauthorizedResult(); - - var page = _pageService.GetLatest(id); - if (page == null) - return new NotFoundResult(); - - _pageService.Publish(page); - Services.ContentManager.Flush(); - Services.Notifier.Information(T("Page successfully published.")); - - return RedirectToAction("List"); - } - - [ValidateAntiForgeryTokenOrchard] - public ActionResult Unpublish(int id) { - if (!Services.Authorizer.Authorize(Permissions.PublishPages, T("Couldn't unpublish page"))) - return new HttpUnauthorizedResult(); - - var page = _pageService.GetLatest(id); - if (page == null) - return new NotFoundResult(); - - _pageService.Unpublish(page); - Services.ContentManager.Flush(); - Services.Notifier.Information(T("Page successfully unpublished.")); - - return RedirectToAction("List"); - } - - [ValidateAntiForgeryTokenOrchard] - public ActionResult Delete(int id) { - var page = _pageService.GetLatest(id); - if (page == null) - return new NotFoundResult(); - - if (!Services.Authorizer.Authorize(Permissions.DeleteOthersPages, page, T("Couldn't delete page"))) - return new HttpUnauthorizedResult(); - - _pageService.Delete(page); - Services.Notifier.Information(T("Page successfully deleted")); - - return RedirectToAction("List"); - } - - bool IUpdateModel.TryUpdateModel(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) { - return TryUpdateModel(model, prefix, includeProperties, excludeProperties); - } - - void IUpdateModel.AddModelError(string key, LocalizedString errorMessage) { - ModelState.AddModelError(key, errorMessage.ToString()); - } - - public class FormValueRequiredAttribute : ActionMethodSelectorAttribute { - private readonly string _submitButtonName; - - public FormValueRequiredAttribute(string submitButtonName) { - _submitButtonName = submitButtonName; - } - - public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) { - var value = controllerContext.HttpContext.Request.Form[_submitButtonName]; - return !string.IsNullOrEmpty(value); - } - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageController.cs b/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageController.cs deleted file mode 100644 index 7b768dca9..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Controllers/PageController.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Web.Mvc; -using Orchard.Localization; -using Orchard.Mvc.Results; -using Orchard.Pages.Routing; -using Orchard.Pages.Services; -using Orchard.Pages.ViewModels; -using Orchard.Security; - -namespace Orchard.Pages.Controllers { - [ValidateInput(false)] - public class PageController : Controller { - private readonly IPageService _pageService; - private readonly IPageSlugConstraint _pageSlugConstraint; - - public PageController(IOrchardServices services, IPageService pageService, IPageSlugConstraint pageSlugConstraint) { - Services = services; - _pageService = pageService; - _pageSlugConstraint = pageSlugConstraint; - T = NullLocalizer.Instance; - } - - public IOrchardServices Services { get; set; } - public Localizer T { get; set; } - - public ActionResult Item(string slug) { - if (!Services.Authorizer.Authorize(StandardPermissions.AccessFrontEnd, T("Couldn't view page"))) - return new HttpUnauthorizedResult(); - - var correctedSlug = _pageSlugConstraint.FindSlug(slug); - if (correctedSlug == null) - return new NotFoundResult(); - - var page = _pageService.Get(correctedSlug); - if (page == null) - return new NotFoundResult(); - - var model = new PageViewModel { - Page = Services.ContentManager.BuildDisplayModel(page, "Detail") - }; - return View(model); - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/DataMigrations/PageDataMigration.cs b/src/Orchard.Web/Modules/Orchard.Pages/DataMigrations/PageDataMigration.cs deleted file mode 100644 index bf027d0ba..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/DataMigrations/PageDataMigration.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Orchard.ContentManagement.MetaData; -using Orchard.Data.Migration; - -namespace Orchard.Pages.DataMigrations { - public class PageDataMigration : DataMigrationImpl { - - public int Create() { - - ContentDefinitionManager.AlterTypeDefinition("Page", - cfg => cfg - .WithPart("Page") - .WithPart("CommonPart") - .WithPart("RoutePart") - .WithPart("BodyPart") - ); - - return 1; - } - - - public int UpdateFrom1() { - ContentDefinitionManager.AlterTypeDefinition("Page", - cfg => cfg - .WithSetting("ContentTypeSettings.Creatable", "true") - ); - - return 2; - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Drivers/PageDriver.cs b/src/Orchard.Web/Modules/Orchard.Pages/Drivers/PageDriver.cs deleted file mode 100644 index 1bf4bcbb9..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Drivers/PageDriver.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Web.Routing; -using JetBrains.Annotations; -using Orchard.Localization; -using Orchard.Pages.Models; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Drivers; - -namespace Orchard.Pages.Drivers { - [UsedImplicitly] - public class PageDriver : ContentItemDriver { - public IOrchardServices Services { get; set; } - - public readonly static ContentType ContentType = new ContentType { - Name = "Page", - DisplayName = "Page" - }; - - public PageDriver(IOrchardServices services) { - Services = services; - T = NullLocalizer.Instance; - } - - public Localizer T { get; set; } - - protected override ContentType GetContentType() { - return ContentType; - } - - protected override string Prefix { get { return ""; } } - - protected override string GetDisplayText(Page page) { - return page.Title; - } - - public override RouteValueDictionary GetDisplayRouteValues(Page page) { - return new RouteValueDictionary { - {"Area", "Orchard.Pages"}, - {"Controller", "Page"}, - {"Action", "Item"}, - {"slug", page.Slug}, - }; - } - - public override RouteValueDictionary GetEditorRouteValues(Page page) { - return new RouteValueDictionary { - {"Area", "Orchard.Pages"}, - {"Controller", "Admin"}, - {"Action", "Edit"}, - {"id", page.Id}, - }; - } - - protected override DriverResult Display(Page page, string displayType) { - return ContentItemTemplate("Items/Pages.Page").LongestMatch(displayType, "Summary", "SummaryAdmin"); - } - - protected override DriverResult Editor(Page page) { - return ContentItemTemplate("Items/Pages.Page"); - } - - protected override DriverResult Editor(Page page, IUpdateModel updater) { - updater.TryUpdateModel(page, Prefix, null, null); - - return Editor(page); - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Extensions/UriExtensions.cs b/src/Orchard.Web/Modules/Orchard.Pages/Extensions/UriExtensions.cs deleted file mode 100644 index 1725dd90c..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Extensions/UriExtensions.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace Orchard.Pages.Extensions { - //TODO: Move to orchard.dll - public static class UriExtensions { - public static string ToRootString(this Uri uri) { - return string.Format("{0}://{1}{2}", uri.Scheme, uri.Host, uri.Port != 80 ? ":" + uri.Port : ""); - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Models/Page.cs b/src/Orchard.Web/Modules/Orchard.Pages/Models/Page.cs deleted file mode 100644 index 0f5a45546..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Models/Page.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Web.Mvc; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Utilities; -using Orchard.Core.Common.Models; -using Orchard.Core.Routable.Models; -using Orchard.Security; - -namespace Orchard.Pages.Models { - public class Page : ContentPart { - [HiddenInput(DisplayValue = false)] - public int Id { get { return ContentItem.Id; } } - - public string Title { - get { return this.As().Title; } - } - - public string Slug { - get { return this.As().Slug; } - set { this.As().Slug = value; } - } - - public IUser Creator { - get { return this.As().Owner; } - set { this.As().Owner = value; } - } - - public bool IsPublished { - get { return ContentItem.VersionRecord != null && ContentItem.VersionRecord.Published; } - } - - public bool HasDraft { - get { - return ( - (ContentItem.VersionRecord != null) && ( - (ContentItem.VersionRecord.Published == false) || - (ContentItem.VersionRecord.Published && ContentItem.VersionRecord.Latest == false))); - } - } - - public bool HasPublished { - get { - return IsPublished || ContentItem.ContentManager.Get(Id, VersionOptions.Published) != null; - } - } - public string PublishedSlug { - get { - if (IsPublished) - return Slug; - Page publishedPage = ContentItem.ContentManager.Get(Id, VersionOptions.Published); - if (publishedPage == null) - return String.Empty; - return publishedPage.Slug; - } - } - - public readonly LazyField _scheduledPublishUtc = new LazyField(); - public DateTime? ScheduledPublishUtc { get { return _scheduledPublishUtc.Value; } set{ _scheduledPublishUtc.Value = value;} } - - private string _scheduledPublishUtcDate; - - public string ScheduledPublishUtcDate { - get { - return !HasPublished && !string.IsNullOrEmpty(_scheduledPublishUtcDate) || !ScheduledPublishUtc.HasValue - ? _scheduledPublishUtcDate - : ScheduledPublishUtc.Value.ToShortDateString(); - } - set { _scheduledPublishUtcDate = value; } - } - - private string _scheduledPublishUtcTime; - - public string ScheduledPublishUtcTime { - get { - return !HasPublished && !string.IsNullOrEmpty(_scheduledPublishUtcTime) || !ScheduledPublishUtc.HasValue - ? _scheduledPublishUtcTime - : ScheduledPublishUtc.Value.ToShortTimeString(); - } - set { _scheduledPublishUtcTime = value; } - } - } -} diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Module.txt b/src/Orchard.Web/Modules/Orchard.Pages/Module.txt deleted file mode 100644 index ee9d1dd60..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Module.txt +++ /dev/null @@ -1,12 +0,0 @@ -name: Pages -antiforgery: enabled -author: The Orchard Team -website: http://orchardproject.net -version: 0.5.0 -orchardversion: 0.5.0 -description: The pages module enables the creation and management of pages on and Orchard web site. -features: - Orchard.Pages: - Description: Simple pages. - Dependencies: Contents - Category: Content diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj b/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj deleted file mode 100644 index 98bb6298f..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Orchard.Pages.csproj +++ /dev/null @@ -1,171 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {4A9C04A6-0986-4A92-A610-5F59FF273FB9} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Orchard.Pages - Orchard.Pages - v4.0 - false - - - 3.5 - - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - bin\ - TRACE - prompt - 4 - AllRules.ruleset - - - - - - 3.5 - - - - - - - - False - ..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll - - - - - - - - - - - - - False - ..\..\..\..\lib\yaml\Yaml.dll - - - - - - - - - - - - - - - - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6} - Orchard.Framework - - - {9916839C-39FC-4CEB-A5AF-89CA7E87119F} - Orchard.Core - - - - - - - - - - - - $(ProjectDir)\..\Manifests - - - - - - - - - - - - False - True - 1057 - / - - - False - True - http://orchard.codeplex.com - False - - - - - \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Permissions.cs b/src/Orchard.Web/Modules/Orchard.Pages/Permissions.cs deleted file mode 100644 index d2eeb668c..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Permissions.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Orchard.Security.Permissions; - -namespace Orchard.Pages { - public class Permissions : IPermissionProvider { - public static readonly Permission PublishOthersPages = new Permission { Description = "Publish or unpublish page for others", Name = "PublishOthersPages" }; - public static readonly Permission PublishPages = new Permission { Description = "Publish or unpublish page", Name = "PublishPages", ImpliedBy = new[] { PublishOthersPages } }; - public static readonly Permission EditOthersPages = new Permission { Description = "Edit page for others", Name = "EditOthersPages", ImpliedBy = new[] { PublishOthersPages } }; - public static readonly Permission EditPages = new Permission { Description = "Edit page", Name = "EditPages", ImpliedBy = new[] { EditOthersPages, PublishPages } }; - public static readonly Permission DeleteOthersPages = new Permission { Description = "Delete page for others", Name = "DeleteOthersPages" }; - public static readonly Permission DeletePages = new Permission { Description = "Delete page", Name = "DeletePages", ImpliedBy = new[] { DeleteOthersPages } }; - - public static readonly Permission MetaListPages = new Permission { ImpliedBy = new[] { EditPages, PublishPages, DeletePages } }; - - public string ModuleName { - get { - return "Pages"; - } - } - - public IEnumerable GetPermissions() { - return new Permission[] { - EditPages, - EditOthersPages, - PublishPages, - PublishOthersPages, - DeletePages, - DeleteOthersPages, - }; - } - - public IEnumerable GetDefaultStereotypes() { - return new[] { - new PermissionStereotype { - Name = "Administrator", - Permissions = new[] {PublishOthersPages,EditOthersPages,DeleteOthersPages} - }, - new PermissionStereotype { - Name = "Editor", - Permissions = new[] {PublishOthersPages,EditOthersPages,DeleteOthersPages} - }, - new PermissionStereotype { - Name = "Moderator", - //Permissions = new[] {} - }, - new PermissionStereotype { - Name = "Author", - Permissions = new[] {PublishPages,EditPages,DeletePages} - }, - new PermissionStereotype { - Name = "Contributor", - Permissions = new[] {EditPages} - }, - }; - } - - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/Orchard.Pages/Properties/AssemblyInfo.cs deleted file mode 100644 index 1335c9720..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Orchard.Pages")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyProduct("Orchard")] -[assembly: AssemblyCopyright("Copyright © CodePlex Foundation 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("7f5cbc21-9814-4456-8996-3e57e0331c76")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("0.5.0")] -[assembly: AssemblyFileVersion("0.5.0")] diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Routes.cs b/src/Orchard.Web/Modules/Orchard.Pages/Routes.cs deleted file mode 100644 index f717031d9..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Routes.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; -using System.Web.Mvc; -using System.Web.Routing; -using Orchard.Mvc.Routes; -using Orchard.Pages.Routing; - -namespace Orchard.Pages { - public class Routes : IRouteProvider { - private readonly IPageSlugConstraint _pageSlugConstraint; - - public Routes(IPageSlugConstraint pageSlugConstraint) { - _pageSlugConstraint = pageSlugConstraint; - } - - public void GetRoutes(ICollection routes) { - foreach (var routeDescriptor in GetRoutes()) - routes.Add(routeDescriptor); - } - - public IEnumerable GetRoutes() { - return new[] { - new RouteDescriptor { - Priority = 10, - Route = new Route( - "{*slug}", - new RouteValueDictionary { - {"area", "Orchard.Pages"}, - {"controller", "Page"}, - {"action", "Item"} - }, - new RouteValueDictionary { - {"slug", _pageSlugConstraint} - }, - new RouteValueDictionary { - {"area", "Orchard.Pages"} - }, - new MvcRouteHandler()) - } - }; - } - } -} diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Routing/IPageSlugConstraint.cs b/src/Orchard.Web/Modules/Orchard.Pages/Routing/IPageSlugConstraint.cs deleted file mode 100644 index 7c3adc37f..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Routing/IPageSlugConstraint.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using System.Web.Routing; - -namespace Orchard.Pages.Routing { - public interface IPageSlugConstraint : IRouteConstraint, ISingletonDependency { - void SetSlugs(IEnumerable slugs); - string FindSlug(string slug); - void AddSlug(string slug); - void RemoveSlug(string slug); - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Routing/PageSlugConstraint.cs b/src/Orchard.Web/Modules/Orchard.Pages/Routing/PageSlugConstraint.cs deleted file mode 100644 index a7c000dc8..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Routing/PageSlugConstraint.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Routing; -using JetBrains.Annotations; -using Orchard.Logging; - -namespace Orchard.Pages.Routing { - [UsedImplicitly] - public class PageSlugConstraint : IPageSlugConstraint { - /// - /// Singleton object, per Orchard Shell instance. We need to protect concurrent access to the dictionary. - /// - private readonly object _syncLock = new object(); - private IDictionary _slugs = new Dictionary(); - - public PageSlugConstraint() { - Logger = NullLogger.Instance; - } - - public ILogger Logger { get; set; } - - public void SetSlugs(IEnumerable slugs) { - // Make a copy to avoid performing potential lazy computation inside the lock - var slugsArray = slugs.ToArray(); - - lock (_syncLock) { - _slugs = slugsArray.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(value => value, StringComparer.OrdinalIgnoreCase); - } - - Logger.Debug("Page slugs: {0}", string.Join(", ", slugsArray)); - } - - public string FindSlug(string slug) { - lock (_syncLock) { - string actual; - return _slugs.TryGetValue(slug, out actual) ? actual : slug; - } - } - - public void AddSlug(string slug) { - lock (_syncLock) { - _slugs[slug] = slug; - } - } - - public void RemoveSlug(string slug) { - lock (_syncLock) { - _slugs.Remove(slug); - } - } - - public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { - if (routeDirection == RouteDirection.UrlGeneration) - return true; - - object value; - if (values.TryGetValue(parameterName, out value)) { - var parameterValue = Convert.ToString(value); - - lock (_syncLock) { - return _slugs.ContainsKey(parameterValue); - } - } - - return false; - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Routing/PageSlugConstraintUpdator.cs b/src/Orchard.Web/Modules/Orchard.Pages/Routing/PageSlugConstraintUpdator.cs deleted file mode 100644 index bf22b1c8e..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Routing/PageSlugConstraintUpdator.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Linq; -using JetBrains.Annotations; -using Orchard.Environment; -using Orchard.Pages.Services; -using Orchard.Tasks; - -namespace Orchard.Pages.Routing { - [UsedImplicitly] - public class PageSlugConstraintUpdator : IOrchardShellEvents, IBackgroundTask { - private readonly IPageSlugConstraint _pageSlugConstraint; - private readonly IPageService _pageService; - - public PageSlugConstraintUpdator(IPageSlugConstraint pageSlugConstraint, IPageService pageService) { - _pageSlugConstraint = pageSlugConstraint; - _pageService = pageService; - } - - void IOrchardShellEvents.Activated() { - Refresh(); - } - - void IOrchardShellEvents.Terminating() { - } - - void IBackgroundTask.Sweep() { - Refresh(); - } - - private void Refresh() { - _pageSlugConstraint.SetSlugs(_pageService.Get(PageStatus.Published).Select(p => p.Slug)); - } - - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Security/AuthorizationEventHandler.cs b/src/Orchard.Web/Modules/Orchard.Pages/Security/AuthorizationEventHandler.cs deleted file mode 100644 index 248f556e5..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Security/AuthorizationEventHandler.cs +++ /dev/null @@ -1,50 +0,0 @@ -using JetBrains.Annotations; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Aspects; -using Orchard.Pages.Models; -using Orchard.Security; -using Orchard.Security.Permissions; - -namespace Orchard.Pages.Security { - [UsedImplicitly] - public class AuthorizationEventHandler : IAuthorizationServiceEventHandler { - public void Checking(CheckAccessContext context) { } - public void Complete(CheckAccessContext context) { } - - public void Adjust(CheckAccessContext context) { - if (context.Granted == false && - context.Content.Is() && - OwnerVariationExists(context.Permission) && - HasOwnership(context.User, context.Content)) { - - context.Adjusted = true; - context.Permission = GetOwnerVariation(context.Permission); - } - } - - private static bool HasOwnership(IUser user, IContent content) { - if (user==null || content==null) - return false; - - var common = content.As(); - if (common==null || common.Owner==null) - return false; - - return user.Id == common.Owner.Id; - } - - private static bool OwnerVariationExists(Permission permission) { - return GetOwnerVariation(permission) != null; - } - - private static Permission GetOwnerVariation(Permission permission) { - if (permission.Name == Permissions.PublishOthersPages.Name) - return Permissions.PublishPages; - if (permission.Name == Permissions.EditOthersPages.Name) - return Permissions.EditPages; - if (permission.Name == Permissions.DeleteOthersPages.Name) - return Permissions.DeletePages; - return null; - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Services/IPageService.cs b/src/Orchard.Web/Modules/Orchard.Pages/Services/IPageService.cs deleted file mode 100644 index 6b0e49344..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Services/IPageService.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using Orchard.Pages.Models; - -namespace Orchard.Pages.Services { - public interface IPageService : IDependency { - int GetCount(); - IEnumerable Get(); - IEnumerable Get(PageStatus status); - Page Get(string slug); - Page Get(int id); - Page GetPageOrDraft(string slug); - Page GetPageOrDraft(int id); - Page GetLatest(string slug); - Page GetLatest(int id); - void Delete(Page page); - void Publish(Page page); - void Publish(Page page, DateTime scheduledPublishUtc); - void Unpublish(Page page); - DateTime? GetScheduledPublishUtc(Page page); - } - - public enum PageStatus { - All, - Published, - Offline - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Services/PageHomePageProvider.cs b/src/Orchard.Web/Modules/Orchard.Pages/Services/PageHomePageProvider.cs deleted file mode 100644 index 667bd6be5..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Services/PageHomePageProvider.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Web.Mvc; -using JetBrains.Annotations; -using Orchard.Localization; -using Orchard.Mvc.Results; -using Orchard.Pages.Routing; -using Orchard.Pages.ViewModels; -using Orchard.Services; - -namespace Orchard.Pages.Services { - [UsedImplicitly] - public class PageHomePageProvider : IHomePageProvider { - private readonly IPageService _pageService; - private readonly IPageSlugConstraint _pageSlugConstraint; - - public PageHomePageProvider(IOrchardServices services, IPageService pageService, IPageSlugConstraint pageSlugConstraint) { - Services = services; - _pageSlugConstraint = pageSlugConstraint; - _pageService = pageService; - T = NullLocalizer.Instance; - } - - public IOrchardServices Services { get; private set; } - public Localizer T { get; set; } - - public string GetProviderName() { - return "PageHomePageProvider"; - } - - public ActionResult GetHomePage(int itemId) { - var page = _pageService.Get(itemId); - if (page == null) - return new NotFoundResult(); - - var correctedSlug = _pageSlugConstraint.FindSlug(page.Slug); - if (correctedSlug == null) - return new NotFoundResult(); - - page = _pageService.Get(correctedSlug); - if (page == null) - return new NotFoundResult(); - - var model = new PageViewModel { - Page = Services.ContentManager.BuildDisplayModel(page, "Detail") - }; - - return new ViewResult { - ViewName = "~/Modules/Orchard.Pages/Views/Page/Item.ascx", - ViewData = new ViewDataDictionary(model) - }; - } - } -} diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Services/PageService.cs b/src/Orchard.Web/Modules/Orchard.Pages/Services/PageService.cs deleted file mode 100644 index dd724e20f..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Services/PageService.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using JetBrains.Annotations; -using Orchard.ContentManagement.Records; -using Orchard.Core.Routable.Models; -using Orchard.Pages.Drivers; -using Orchard.Pages.Models; -using Orchard.ContentManagement; -using Orchard.Pages.Routing; -using Orchard.Tasks.Scheduling; - -namespace Orchard.Pages.Services { - [UsedImplicitly] - public class PageService : IPageService { - private readonly IContentManager _contentManager; - private readonly IPublishingTaskManager _publishingTaskManager; - private readonly IPageSlugConstraint _pageSlugConstraint; - - public PageService(IContentManager contentManager, IPublishingTaskManager publishingTaskManager, IPageSlugConstraint pageSlugConstraint) { - _contentManager = contentManager; - _publishingTaskManager = publishingTaskManager; - _pageSlugConstraint = pageSlugConstraint; - } - - public int GetCount() { - //TODO: (erikpo) Need to add a count method to IContentQuery so it doesn't need to pull out all pages to get a count - return _contentManager.Query(VersionOptions.Latest).List().Count(); - } - - public IEnumerable Get() { - return Get(PageStatus.All); - } - - public IEnumerable Get(PageStatus status) { - switch (status) { - case PageStatus.All: - return _contentManager.Query(PageDriver.ContentType.Name).Join().ForVersion(VersionOptions.Latest).List().AsPart(); - case PageStatus.Published: - return _contentManager.Query(PageDriver.ContentType.Name).Join().ForVersion(VersionOptions.Published).List().AsPart(); - case PageStatus.Offline: - return _contentManager.Query(PageDriver.ContentType.Name).Join().ForVersion(VersionOptions.Latest).Where(ci => !ci.ContentItemVersionRecord.Published).List().AsPart(); - default: - return Enumerable.Empty(); - } - } - - public Page Get(int id) { - return _contentManager.Get(id); - } - - public Page Get(string slug) { - return - _contentManager.Query(PageDriver.ContentType.Name).Join().Where(rr => rr.Slug == slug).List().FirstOrDefault - ().As(); - } - - public Page GetLatest(int id) { - return _contentManager.Get(id, VersionOptions.Latest); - } - - public Page GetLatest(string slug) { - return - _contentManager.Query(VersionOptions.Latest, PageDriver.ContentType.Name).Join().Where(rr => rr.Slug == slug) - .Slice(0, 1).FirstOrDefault().As(); - } - - public Page GetPageOrDraft(int id) { - return _contentManager.GetDraftRequired(id); - } - - public Page GetPageOrDraft(string slug) { - Page page = GetLatest(slug); - return _contentManager.GetDraftRequired(page.Id); - } - - public void Delete(Page page) { - _publishingTaskManager.DeleteTasks(page.ContentItem); - _contentManager.Remove(page.ContentItem); - } - - public void Publish(Page page) { - _publishingTaskManager.DeleteTasks(page.ContentItem); - _contentManager.Publish(page.ContentItem); - _pageSlugConstraint.AddSlug(page.Slug); - } - - public void Publish(Page page, DateTime scheduledPublishUtc) { - _publishingTaskManager.Publish(page.ContentItem, scheduledPublishUtc); - } - - public void Unpublish(Page page) { - _contentManager.Unpublish(page.ContentItem); - _pageSlugConstraint.RemoveSlug(page.Slug); - } - - public DateTime? GetScheduledPublishUtc(Page page) { - var task = _publishingTaskManager.GetPublishTask(page.ContentItem); - return (task == null ? null : task.ScheduledUtc); - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Styles/admin.css b/src/Orchard.Web/Modules/Orchard.Pages/Styles/admin.css deleted file mode 100644 index 5504fdc34..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Styles/admin.css +++ /dev/null @@ -1,19 +0,0 @@ -.pageList { - margin:0; - padding:0; - /*background:#FFFFFF url(images/backgroundGradient.gif) repeat-x scroll left top;*/ -} -.orchard-pages .contentItems { - margin:.5em 0 0; - padding:0; - } -.contentItems .properties ul { - margin:0.8em 0 0 2em; -} -.contentItems .properties ul li { - margin:0; - padding:0 0 .1em 0; -} -.properties h3 { - display:inline; -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PageCreateViewModel.cs b/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PageCreateViewModel.cs deleted file mode 100644 index d78c0775c..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PageCreateViewModel.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Orchard.Mvc.ViewModels; -using Orchard.Pages.Models; - -namespace Orchard.Pages.ViewModels { - public class PageCreateViewModel : BaseViewModel { - public ContentItemViewModel Page { get; set; } - public bool PromoteToHomePage { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PageEditViewModel.cs b/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PageEditViewModel.cs deleted file mode 100644 index 2f1667548..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PageEditViewModel.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Orchard.Pages.Models; -using Orchard.Mvc.ViewModels; - -namespace Orchard.Pages.ViewModels { - public class PageEditViewModel : BaseViewModel { - public ContentItemViewModel Page { get; set; } - public bool PromoteToHomePage { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PageViewModel.cs b/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PageViewModel.cs deleted file mode 100644 index 82d8996af..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PageViewModel.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Orchard.Pages.Models; -using Orchard.Mvc.ViewModels; - -namespace Orchard.Pages.ViewModels { - public class PageViewModel : BaseViewModel { - public ContentItemViewModel Page { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PagesViewModel.cs b/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PagesViewModel.cs deleted file mode 100644 index 782151ae6..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/ViewModels/PagesViewModel.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using Orchard.Mvc.ViewModels; -using Orchard.Pages.Models; - -namespace Orchard.Pages.ViewModels { - public class PagesViewModel : BaseViewModel { - public IList PageEntries { get; set; } - public PagesOptions Options { get; set; } - } - - public class PageEntry { - public Page Page { get; set; } - public int PageId { get; set; } - public bool IsChecked { get; set; } - } - - public class PagesOptions { - public PagesFilter Filter { get; set; } - public PagesBulkAction BulkAction { get; set; } - } - - public enum PagesFilter { - All, - Published, - Offline - } - - public enum PagesBulkAction { - None, - PublishNow, - Unpublish, - Delete - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/Admin/Create.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/Admin/Create.ascx deleted file mode 100644 index 83104405a..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/Admin/Create.ascx +++ /dev/null @@ -1,12 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Mvc.Html"%> -<%@ Import Namespace="Orchard.Pages.ViewModels"%> -

    <%: Html.TitleForPage(T("Add Page").ToString()) %>

    -<% using (Html.BeginFormAntiForgeryPost()) { %> - <%: Html.ValidationSummary() %> - <%: Html.EditorForItem(m => m.Page) %> -
    - <%: Html.EditorFor(m => m.PromoteToHomePage) %> - -
    <% - } %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/Admin/Edit.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/Admin/Edit.ascx deleted file mode 100644 index 3813409fd..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/Admin/Edit.ascx +++ /dev/null @@ -1,12 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Mvc.Html"%> -<%@ Import Namespace="Orchard.Pages.ViewModels"%> -

    <%: Html.TitleForPage(T("Edit Page").ToString()) %>

    -<% using (Html.BeginFormAntiForgeryPost()) { %> - <%: Html.ValidationSummary() %> - <%: Html.EditorForItem(m => m.Page) %> -
    - <%: Html.EditorFor(m => m.PromoteToHomePage) %> - -
    <% - } %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/Admin/List.aspx b/src/Orchard.Web/Modules/Orchard.Pages/Views/Admin/List.aspx deleted file mode 100644 index 9dcf64e5d..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/Admin/List.aspx +++ /dev/null @@ -1,99 +0,0 @@ -<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage" %> -<%@ Import Namespace="Orchard.ContentManagement.Aspects"%> -<%@ Import Namespace="Orchard.ContentManagement"%> -<%@ Import Namespace="Orchard.Mvc.Html"%> -<%@ Import Namespace="Orchard.Pages.ViewModels"%><% -Html.RegisterStyle("admin.css"); %> - -

    <%: Html.TitleForPage(T("Manage Pages").ToString())%>

    -<%-- todo: Add helper text here when ready.

    <%: T("Possible text about setting up a page goes here.")%>

    --%> -
    <%: Html.ActionLink(T("Add a page").ToString(), "Create", new { }, new { @class = "button primaryAction" })%>
    <% -using (Html.BeginFormAntiForgeryPost()) { %> - <%: Html.ValidationSummary()%> -
    - - - " /> -
    -
    - - - "/> -
    -
    -
      <% - var pageIndex = 0; - foreach (var pageEntry in Model.PageEntries) { - var pi = pageIndex; %> -
    • -
      -
      - - -

      <%: Html.ActionLink(pageEntry.Page.Title, "Edit", new { id = pageEntry.PageId })%>

      -
        -
      • <% - // Published or not - if (pageEntry.Page.HasPublished) { %> - " alt="<%: T("Online") %>" title="<%: T("The page is currently online") %>" /> <%: T("Published") %> | <% - } - else { %> - " alt="<%: T("Offline") %>" title="<%: T("The page is currently offline") %>" /> <%: T("Not Published")%> | <% - } %> -
      • -
      • <% - // Does the page have a draft - if (pageEntry.Page.HasDraft) { %> - " alt="<%: T("Draft") %>" title="<%: T("The page has a draft") %>" /><%: T("Draft")%> | <% - } - else { %> - <%: T("No Draft")%> | <% - } %> -
      • -
      • <% - if (pageEntry.Page.ScheduledPublishUtc.HasValue && pageEntry.Page.ScheduledPublishUtc.Value > DateTime.UtcNow) { %> - " alt="<%: T("Scheduled") %>" title="<%: T("The page is scheduled for publishing") %>" /><%: T("Scheduled")%> - <%: Html.DateTime(pageEntry.Page.ScheduledPublishUtc.Value, T("M/d/yyyy h:mm tt"))%><% - } - else if (pageEntry.Page.IsPublished) { %> - <%: T("Published: {0}", Html.DateTimeRelative(pageEntry.Page.As().VersionPublishedUtc.Value, T)) %><% - } - else { %> - <%: T("Last modified: {0}", Html.DateTimeRelative(pageEntry.Page.As().ModifiedUtc.Value, T)) %><% - } %> |  -
      • -
      • <%: T("By {0}", pageEntry.Page.Creator.UserName)%>
      • -
      -
      - -
      -
      -
    • <% - pageIndex++; - } %> -
    -
    <% -} %> -
    <%: Html.ActionLink(T("Add a page").ToString(), "Create", new { }, new { @class = "button primaryAction" })%>
    diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Items/Pages.Page.Summary.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Items/Pages.Page.Summary.ascx deleted file mode 100644 index 0f7e575f0..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Items/Pages.Page.Summary.ascx +++ /dev/null @@ -1,7 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>" %> -<%@ Import Namespace="Orchard.Mvc.Html"%> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -

    "><%: Model.Item.Title %>

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

    <%:Html.ActionLink(Model.Item.Title, "Edit", new { id = Model.Item.Id }) %>

    <% - Html.Zone("metadata"); %> -
    - -
    - <% Html.Zone("primary"); %> -
    \ No newline at end of file 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 deleted file mode 100644 index 1a2136960..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/DisplayTemplates/Items/Pages.Page.ascx +++ /dev/null @@ -1,6 +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", ":manage :metadata"); - Html.ZonesAny(); %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/EditorTemplates/Items/Pages.Page.ascx b/src/Orchard.Web/Modules/Orchard.Pages/Views/EditorTemplates/Items/Pages.Page.ascx deleted file mode 100644 index b1f9c64b3..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/EditorTemplates/Items/Pages.Page.ascx +++ /dev/null @@ -1,20 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>" %> -<%@ Import Namespace="Orchard.Mvc.Html"%> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<% Html.AddTitleParts(Model.Item.Title); %> -
    -
    <% - Html.Zone("primary"); - Html.ZonesExcept("secondary"); %> -
    -
    - <% Html.Zone("secondary");%> -
    - "/><% - //TODO: (erikpo) In the future, remove the HasPublished check so the user can delete the content item from here if the choose to - if (Model.Item.HasDraft && Model.Item.HasPublished) { %> - <%: Html.AntiForgeryTokenValueOrchardLink(T("Discard Draft").ToString(), Url.Action("DiscardDraft", new {Area = "Orchard.Pages", Controller = "Admin", id = Model.Item.Id}), new {@class = "button"})%><% - } %> -
    -
    -
    \ 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 deleted file mode 100644 index a85782268..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/Page/Item.ascx +++ /dev/null @@ -1,4 +0,0 @@ -<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Mvc.Html"%> -<%@ Import Namespace="Orchard.Pages.ViewModels"%> -<%: Html.DisplayForItem(m=>m.Page) %> diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Views/Web.config b/src/Orchard.Web/Modules/Orchard.Pages/Views/Web.config deleted file mode 100644 index e065d8735..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Views/Web.config +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Web.config b/src/Orchard.Web/Modules/Orchard.Pages/Web.config deleted file mode 100644 index 99f041ba8..000000000 --- a/src/Orchard.Web/Modules/Orchard.Pages/Web.config +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj index 250287865..686df66a8 100644 --- a/src/Orchard.Web/Orchard.Web.csproj +++ b/src/Orchard.Web/Orchard.Web.csproj @@ -100,6 +100,8 @@ + + @@ -146,7 +148,7 @@ - + @@ -162,7 +164,7 @@ - + @@ -194,10 +196,10 @@ - + - + @@ -239,9 +241,9 @@ - + - + @@ -278,7 +280,7 @@ - + diff --git a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Pages.Page.Metadata.ascx b/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Common.Metadata.ascx similarity index 80% rename from src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Pages.Page.Metadata.ascx rename to src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Common.Metadata.ascx index edf6b58e2..9c5bf54e7 100644 --- a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Pages.Page.Metadata.ascx +++ b/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Common.Metadata.ascx @@ -1,4 +1,4 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> <%@ Import Namespace="Orchard.Mvc.ViewModels"%> <%--