diff --git a/src/Orchard.Web/Core/ContentsLocation/Models/LocationDefinition.cs b/src/Orchard.Web/Core/ContentsLocation/Models/LocationDefinition.cs deleted file mode 100644 index 524413aaa..000000000 --- a/src/Orchard.Web/Core/ContentsLocation/Models/LocationDefinition.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Orchard.Localization; - -namespace Orchard.Core.ContentsLocation.Models { - public class LocationDefinition { - public string Name { get; set; } - public LocalizedString DisplayName { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/ContentsLocation/Models/LocationSettings.cs b/src/Orchard.Web/Core/ContentsLocation/Models/LocationSettings.cs deleted file mode 100644 index af270d786..000000000 --- a/src/Orchard.Web/Core/ContentsLocation/Models/LocationSettings.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Collections.Generic; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Drivers; - -namespace Orchard.Core.ContentsLocation.Models { - public class LocationSettings : Dictionary { - public LocationSettings() { } - public LocationSettings(LocationSettings value) - : base(value) { - } - - public ContentLocation Get(string location) { - return Get(location, null, null); - } - - public ContentLocation Get(string location, string defaultZone, string defaultPosition) { - ContentLocation result; - if (this.TryGetValue(location, out result)) { - return result; - } - - return new ContentLocation { Zone = defaultZone, Position = defaultPosition }; - } - } - - public static class LocationSettingsExtensions { - public static ContentLocation GetLocation(this TContent part, string locationName) where TContent : ContentPart { - return part.GetLocation(locationName, null, null); - } - - public static ContentLocation GetLocation(this ContentPart part, string locationName, string defaultZone, string defaultPosition) { - // Get the specific location from the part in the type context - var location = part.TypePartDefinition.Settings.GetModel().Get(locationName); - if (location.Position != null || location.Zone != null) - return location; - - // Get the "Default" location from the part in the type context - location = part.TypePartDefinition.Settings.GetModel().Get("Default"); - if (location.Position != null || location.Zone != null) - return location; - - // Get the specific location from the part definition - location = part.PartDefinition.Settings.GetModel().Get(locationName); - if (location.Position != null || location.Zone != null) - return location; - - // Get the "Default" location from the part definition - location = part.PartDefinition.Settings.GetModel().Get("Default"); - if (location.Position != null || location.Zone != null) - return location; - - return new ContentLocation { Zone = defaultZone, Position = defaultPosition }; - } - - public static ContentLocation GetLocation(this ContentField field, string locationName, string defaultZone, string defaultPosition) { - // Get the specific location from the part in the type context - var location = field.PartFieldDefinition.Settings.GetModel().Get(locationName); - if (location.Position != null || location.Zone != null) - return location; - - // Get the "Default" location from the part in the type context - location = field.PartFieldDefinition.Settings.GetModel().Get("Default"); - if (location.Position != null || location.Zone != null) - return location; - - return new ContentLocation { Zone = defaultZone, Position = defaultPosition }; - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/ContentsLocation/Module.txt b/src/Orchard.Web/Core/ContentsLocation/Module.txt deleted file mode 100644 index bab62a261..000000000 --- a/src/Orchard.Web/Core/ContentsLocation/Module.txt +++ /dev/null @@ -1,12 +0,0 @@ -Name: ContentsLocation -AntiForgery: enabled -Author: The Orchard Team -Website: http://orchardproject.net -Version: 0.8.0 -OrchardVersion: 0.8.0 -Description: The "Contents Location" module introduces settings for part and field to fine tune the location of contents. -Features: - ContentsLocation: - Description: Contents location settings management - Dependencies: Settings - Category: Core diff --git a/src/Orchard.Web/Core/ContentsLocation/ResourceManifest.cs b/src/Orchard.Web/Core/ContentsLocation/ResourceManifest.cs deleted file mode 100644 index 958de7431..000000000 --- a/src/Orchard.Web/Core/ContentsLocation/ResourceManifest.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Orchard.UI.Resources; - -namespace Orchard.Core.ContentsLocation { - public class ResourceManifest : IResourceManifestProvider { - public void BuildManifests(ResourceManifestBuilder builder) { - builder.Add().DefineStyle("ContentsLocationAdmin").SetUrl("admin.css"); - } - } -} diff --git a/src/Orchard.Web/Core/ContentsLocation/Settings/LocationSettingsEditorEvents.cs b/src/Orchard.Web/Core/ContentsLocation/Settings/LocationSettingsEditorEvents.cs deleted file mode 100644 index 09eed4c81..000000000 --- a/src/Orchard.Web/Core/ContentsLocation/Settings/LocationSettingsEditorEvents.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System.Collections.Generic; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Drivers; -using Orchard.ContentManagement.MetaData; -using Orchard.ContentManagement.MetaData.Builders; -using Orchard.ContentManagement.MetaData.Models; -using Orchard.ContentManagement.ViewModels; -using Orchard.Core.ContentsLocation.Models; -using Orchard.Core.ContentsLocation.ViewModels; -using Orchard.Localization; - -namespace Orchard.Core.ContentsLocation.Settings { - public class LocationSettingsEditorEvents : ContentDefinitionEditorEventsBase { - - public LocationSettingsEditorEvents() { - T = NullLocalizer.Instance; - } - - public Localizer T { get; set; } - - private IEnumerable GetPredefinedLocations() { - yield return new LocationDefinition { Name = "Default", DisplayName = T("Default location (i.e. fallback if no specific override)") }; - yield return new LocationDefinition { Name = "Detail", DisplayName = T("\"Detail\" display location") }; - yield return new LocationDefinition { Name = "Editor", DisplayName = T("\"Editor\" display location") }; - yield return new LocationDefinition { Name = "Summary", DisplayName = T("\"Summary\" (front-end) display location") }; - yield return new LocationDefinition { Name = "SummaryAdmin", DisplayName = T("\"Summary\" (admin) display location") }; - } - - private LocationSettings MergeSettings(LocationSettings partSettings, LocationSettings partDefinitionSettings) { - return partSettings; - //var result = new LocationSettings(partSettings); - //foreach (var entry in partDefinitionSettings) { - // if (!partSettings.ContainsKey(entry.Key)) - // partSettings[entry.Key] = entry.Value; - //} - //return result; - } - - #region Standalone part definition - public override IEnumerable PartEditor(ContentPartDefinition definition) { - var settings = definition.Settings.GetModel(); - - foreach (var location in GetPredefinedLocations()) { - var viewModel = new LocationSettingsViewModel { - Definition = location, - Location = settings.Get(location.Name), - DefaultLocation = new ContentLocation() - }; - yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name); - } - } - - public override IEnumerable PartEditorUpdate(ContentPartDefinitionBuilder builder, IUpdateModel updateModel) { - var settings = new LocationSettings(); - foreach (var location in GetPredefinedLocations()) { - var viewModel = new LocationSettingsViewModel(); - updateModel.TryUpdateModel(viewModel, location.Name, null, null); - settings[location.Name] = viewModel.Location; - yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name); - } - builder.WithLocation(settings); - } - #endregion - - #region Part in the context of a content type - public override IEnumerable TypePartEditor(ContentTypePartDefinition definition) { - // Look for the setting in the most specific settings first (part definition in type) - // then in the global part definition. - var partSettings = definition.Settings.GetModel(); - var partDefinitionSettings = definition.PartDefinition.Settings.GetModel(); - var settings = MergeSettings(partSettings, partDefinitionSettings); - - foreach (var location in GetPredefinedLocations()) { - var viewModel = new LocationSettingsViewModel { - Definition = location, - Location = settings.Get(location.Name), - DefaultLocation = partDefinitionSettings.Get(location.Name) - }; - yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name); - } - } - - public override IEnumerable TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel) { - var settings = new LocationSettings(); - foreach (var location in GetPredefinedLocations()) { - var viewModel = new LocationSettingsViewModel(); - updateModel.TryUpdateModel(viewModel, location.Name, null, null); - settings[location.Name] = viewModel.Location; - yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name); - } - builder.WithLocation(settings); - } - #endregion - - #region Field within a content part - public override IEnumerable PartFieldEditor(ContentPartFieldDefinition definition) { - var settings = definition.Settings.GetModel(); - foreach (var location in GetPredefinedLocations()) { - var viewModel = new LocationSettingsViewModel { - Definition = location, - Location = settings.Get(location.Name), - DefaultLocation = new ContentLocation { Zone = "Primary", Position = "1" } - }; - yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name); - } - } - - public override IEnumerable PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) { - var settings = new LocationSettings(); - foreach (var location in GetPredefinedLocations()) { - var viewModel = new LocationSettingsViewModel(); - updateModel.TryUpdateModel(viewModel, location.Name, null, null); - settings[location.Name] = viewModel.Location; - yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name); - } - builder.WithLocation(settings); - } - #endregion - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/ContentsLocation/Styles/admin.css b/src/Orchard.Web/Core/ContentsLocation/Styles/admin.css deleted file mode 100644 index 376c52109..000000000 --- a/src/Orchard.Web/Core/ContentsLocation/Styles/admin.css +++ /dev/null @@ -1,25 +0,0 @@ -fieldset.location-setting { - overflow:auto; -} -fieldset.location-setting legend { - font-weight:normal; - margin:0; - padding-bottom:0; -} -fieldset.location-setting label { - display:inline; -} -fieldset.location-setting input.text-box { - display:block; - width:24em; -} -fieldset.location-setting fieldset { - clear:none; - float:left; - margin-right:1em; - margin-top:.5em; -} -fieldset.location-setting .default { - font-size:1.2em; - font-style:italic; -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/ContentsLocation/ViewModels/LocationSettingsViewModel.cs b/src/Orchard.Web/Core/ContentsLocation/ViewModels/LocationSettingsViewModel.cs deleted file mode 100644 index c0ea96833..000000000 --- a/src/Orchard.Web/Core/ContentsLocation/ViewModels/LocationSettingsViewModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Orchard.ContentManagement.Drivers; -using Orchard.Core.ContentsLocation.Models; - -namespace Orchard.Core.ContentsLocation.ViewModels { - public class LocationSettingsViewModel { - public LocationDefinition Definition { get; set; } - public ContentLocation Location { get; set; } - public ContentLocation DefaultLocation { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/ContentsLocation/Views/DefinitionTemplates/LocationSettings.cshtml b/src/Orchard.Web/Core/ContentsLocation/Views/DefinitionTemplates/LocationSettings.cshtml deleted file mode 100644 index 55305100b..000000000 --- a/src/Orchard.Web/Core/ContentsLocation/Views/DefinitionTemplates/LocationSettings.cshtml +++ /dev/null @@ -1,21 +0,0 @@ -@model Orchard.Core.ContentsLocation.ViewModels.LocationSettingsViewModel -@{ Style.Require("ContentsLocationAdmin"); } -
- @T("{0}", Model.Definition.DisplayName) -
- - @if (!string.IsNullOrWhiteSpace(Model.DefaultLocation.Zone)) { - @T(" - default: {0}", Model.DefaultLocation.Zone) - } - @Html.EditorFor(m => m.Location.Zone) - @Html.ValidationMessageFor(m => m.Location.Zone) -
-
- - @if (!string.IsNullOrWhiteSpace(Model.DefaultLocation.Zone)) { - @T(" - default: {0}", Model.DefaultLocation.Position) - } - @Html.EditorFor(m => m.Location.Position) -
@Html.ValidationMessageFor(m => m.Location.Position) -
\ No newline at end of file diff --git a/src/Orchard.Web/Core/ContentsLocation/Views/Web.config b/src/Orchard.Web/Core/ContentsLocation/Views/Web.config deleted file mode 100644 index 5c6614a80..000000000 --- a/src/Orchard.Web/Core/ContentsLocation/Views/Web.config +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Orchard.Web/Core/Localization/Drivers/LocalizationPartDriver.cs b/src/Orchard.Web/Core/Localization/Drivers/LocalizationPartDriver.cs index 474db6700..060054c92 100644 --- a/src/Orchard.Web/Core/Localization/Drivers/LocalizationPartDriver.cs +++ b/src/Orchard.Web/Core/Localization/Drivers/LocalizationPartDriver.cs @@ -3,7 +3,6 @@ using System.Linq; using JetBrains.Annotations; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; -using Orchard.Core.ContentsLocation.Models; using Orchard.Core.Localization.Models; using Orchard.Core.Localization.Services; using Orchard.Core.Localization.ViewModels; @@ -43,7 +42,8 @@ namespace Orchard.Core.Localization.Drivers { ContentLocalizations = new ContentLocalizationsViewModel(part) { Localizations = localizations } }; - return ContentPartTemplate(model, "Parts/Localization.Translation", TemplatePrefix).Location(part.GetLocation("Editor")); + // TODO: andrerod convert to new shape API. Location code kept for reference. + return ContentPartTemplate(model, "Parts/Localization.Translation", TemplatePrefix); //.Location(part.GetLocation("Editor")); } protected override DriverResult Editor(LocalizationPart part, IUpdateModel updater, dynamic shapeHelper) { diff --git a/src/Orchard.Web/Core/Navigation/Drivers/MenuPartDriver.cs b/src/Orchard.Web/Core/Navigation/Drivers/MenuPartDriver.cs index a4e11dc50..102fa3d45 100644 --- a/src/Orchard.Web/Core/Navigation/Drivers/MenuPartDriver.cs +++ b/src/Orchard.Web/Core/Navigation/Drivers/MenuPartDriver.cs @@ -2,7 +2,6 @@ using JetBrains.Annotations; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; -using Orchard.Core.ContentsLocation.Models; using Orchard.Core.Navigation.Models; using Orchard.Localization; using Orchard.Security; @@ -28,7 +27,8 @@ namespace Orchard.Core.Navigation.Drivers { if (!_authorizationService.TryCheckAccess(Permissions.ManageMainMenu, CurrentUser, part)) return null; - return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location(part.GetLocation("Editor")); + // TODO: andrerod convert to new shape API. Location code kept for reference. + return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart"); //.Location(part.GetLocation("Editor")); } protected override DriverResult Editor(MenuPart part, IUpdateModel updater, dynamic shapeHelper) { @@ -46,7 +46,8 @@ namespace Orchard.Core.Navigation.Drivers { updater.AddModelError("MenuText", T("The MenuText field is required")); } - return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart").Location(part.GetLocation("Editor")); + // TODO: andrerod convert to new shape API. Location code kept for reference. + return ContentPartTemplate(part, "Parts/Navigation.EditMenuPart"); //.Location(part.GetLocation("Editor")); } } } \ 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 a4a8010c7..f2f5374de 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -74,14 +74,9 @@ - - - - - @@ -257,9 +252,6 @@ - - - @@ -365,7 +357,6 @@ - diff --git a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs index 4d7940b50..77d960144 100644 --- a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs +++ b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs @@ -5,7 +5,6 @@ using JetBrains.Annotations; using Orchard.ContentManagement; using Orchard.ContentManagement.Aspects; using Orchard.ContentManagement.Drivers; -using Orchard.Core.ContentsLocation.Models; using Orchard.Core.Routable.Models; using Orchard.Core.Routable.Services; using Orchard.Core.Routable.ViewModels; @@ -70,9 +69,10 @@ namespace Orchard.Core.Routable.Drivers { : ""; } - var location = part.GetLocation("Editor"); + // TODO: andrerod convert to new shape API. Location code kept for reference. + //var location = part.GetLocation("Editor"); model.PromoteToHomePage = model.Id != 0 && part.Path != null && _routableHomePageProvider != null && CurrentSite.HomePage == _routableHomePageProvider.GetSettingValue(model.Id); - return ContentPartTemplate(model, TemplateName, Prefix).Location(location); + return ContentPartTemplate(model, TemplateName, Prefix); //.Location(location); } protected override DriverResult Editor(RoutePart part, IUpdateModel updater, dynamic shapeHelper) { diff --git a/src/Orchard.Web/Modules/Orchard.ArchiveLater/Drivers/ArchiveLaterPartDriver.cs b/src/Orchard.Web/Modules/Orchard.ArchiveLater/Drivers/ArchiveLaterPartDriver.cs index a31204176..1df330455 100644 --- a/src/Orchard.Web/Modules/Orchard.ArchiveLater/Drivers/ArchiveLaterPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.ArchiveLater/Drivers/ArchiveLaterPartDriver.cs @@ -6,7 +6,6 @@ using Orchard.ArchiveLater.ViewModels; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Services; -using Orchard.Core.ContentsLocation.Models; using Orchard.Localization; namespace ArchiveLater.Drivers { diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/LayerPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/LayerPartDriver.cs index f2680f251..f13fd91de 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/LayerPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/LayerPartDriver.cs @@ -1,7 +1,6 @@ using JetBrains.Annotations; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; -using Orchard.Core.ContentsLocation.Models; using Orchard.Widgets.Models; namespace Orchard.Widgets.Drivers { @@ -10,8 +9,10 @@ namespace Orchard.Widgets.Drivers { public class LayerPartDriver : ContentPartDriver { protected override DriverResult Editor(LayerPart layerPart, dynamic shapeHelper) { - ContentLocation location = layerPart.GetLocation("Editor"); - return ContentPartTemplate(layerPart, "Parts/Widgets.LayerPart").Location(location); + + // TODO: andrerod convert to new shape API. Location code kept for reference. + // ContentLocation location = layerPart.GetLocation("Editor"); + return ContentPartTemplate(layerPart, "Parts/Widgets.LayerPart"); //.Location(location); } protected override DriverResult Editor(LayerPart layerPart, IUpdateModel updater, dynamic shapeHelper) { diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetBagPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetBagPartDriver.cs index 78f2e02ec..43143b008 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetBagPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetBagPartDriver.cs @@ -1,6 +1,5 @@ using JetBrains.Annotations; using Orchard.ContentManagement.Drivers; -using Orchard.Core.ContentsLocation.Models; using Orchard.Widgets.Models; namespace Orchard.Widgets.Drivers { @@ -9,8 +8,9 @@ namespace Orchard.Widgets.Drivers { private const string TemplateName = "Parts/Widgets.WidgetBagPart"; protected override DriverResult Editor(WidgetBagPart part, dynamic shapeHelper) { - var location = part.GetLocation("Editor"); - return ContentPartTemplate("", TemplateName, Prefix).Location(location); + //var location = part.GetLocation("Editor"); + // TODO: andrerod convert to new shape API. Location code kept for reference. + return ContentPartTemplate("", TemplateName, Prefix); //.Location(location); } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetPartDriver.cs index c6ae2d6f9..aa8555634 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetPartDriver.cs @@ -1,7 +1,6 @@ using JetBrains.Annotations; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; -using Orchard.Core.ContentsLocation.Models; using Orchard.Widgets.Models; using Orchard.Widgets.Services; @@ -18,8 +17,9 @@ namespace Orchard.Widgets.Drivers { protected override DriverResult Editor(WidgetPart widgetPart, dynamic shapeHelper) { widgetPart.AvailableZones = _widgetsService.GetZones(); - ContentLocation location = widgetPart.GetLocation("Editor"); - return ContentPartTemplate(widgetPart, "Parts/Widgets.WidgetPart").Location(location); + // TODO: andrerod convert to new shape API. Location code kept for reference. + //ContentLocation location = widgetPart.GetLocation("Editor"); + return ContentPartTemplate(widgetPart, "Parts/Widgets.WidgetPart"); //.Location(location); } protected override DriverResult Editor(WidgetPart widgetPart, IUpdateModel updater, dynamic shapeHelper) {