Move sections to their own namespace
This commit is contained in:
@@ -101,7 +101,7 @@ namespace Umbraco.Core.Manifest
|
||||
var gridEditors = new List<GridEditor>();
|
||||
var contentApps = new List<ManifestContentAppDefinition>();
|
||||
var dashboards = new List<ManifestDashboard>();
|
||||
var sections = new List<ManifestBackOfficeSection>();
|
||||
var sections = new List<ManifestSection>();
|
||||
|
||||
foreach (var manifest in manifests)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
{
|
||||
[DataContract(Name = "section", Namespace = "")]
|
||||
public class ManifestBackOfficeSection : IBackOfficeSection
|
||||
public class ManifestSection : ISection
|
||||
{
|
||||
[DataMember(Name = "alias")]
|
||||
public string Alias { get; set; }
|
||||
@@ -55,6 +55,6 @@ namespace Umbraco.Core.Manifest
|
||||
/// Gets or sets the sections listed in the manifest.
|
||||
/// </summary>
|
||||
[JsonProperty("sections")]
|
||||
public ManifestBackOfficeSection[] Sections { get; set; } = Array.Empty<ManifestBackOfficeSection>();
|
||||
public ManifestSection[] Sections { get; set; } = Array.Empty<ManifestSection>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
namespace Umbraco.Core.Models.Trees
|
||||
namespace Umbraco.Core.Models.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a back office section.
|
||||
/// </summary>
|
||||
public interface IBackOfficeSection
|
||||
public interface ISection
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the alias of the section.
|
||||
@@ -345,7 +345,7 @@
|
||||
<Compile Include="Logging\Viewer\MessageTemplateFilter.cs" />
|
||||
<Compile Include="Logging\Viewer\SavedLogSearch.cs" />
|
||||
<Compile Include="Manifest\DashboardAccessRuleConverter.cs" />
|
||||
<Compile Include="Manifest\ManifestBackOfficeSection.cs" />
|
||||
<Compile Include="Manifest\ManifestSection.cs" />
|
||||
<Compile Include="Manifest\ManifestContentAppDefinition.cs" />
|
||||
<Compile Include="Manifest\ManifestContentAppFactory.cs" />
|
||||
<Compile Include="Manifest\ManifestDashboard.cs" />
|
||||
@@ -452,7 +452,7 @@
|
||||
<Compile Include="Models\PublishedContent\ThreadCultureVariationContextAccessor.cs" />
|
||||
<Compile Include="Models\PublishedContent\VariationContextAccessorExtensions.cs" />
|
||||
<Compile Include="Models\SimpleContentType.cs" />
|
||||
<Compile Include="Models\Trees\IBackOfficeSection.cs" />
|
||||
<Compile Include="Models\Sections\ISection.cs" />
|
||||
<Compile Include="PackageActions\AllowDoctype.cs" />
|
||||
<Compile Include="PackageActions\PublishRootDocument.cs" />
|
||||
<Compile Include="Packaging\CompiledPackageXmlParser.cs" />
|
||||
|
||||
@@ -38,6 +38,7 @@ using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Trees;
|
||||
using Umbraco.Core.Composing.CompositionExtensions;
|
||||
using Umbraco.Web.Composing.CompositionExtensions;
|
||||
using Umbraco.Web.Sections;
|
||||
using Current = Umbraco.Core.Composing.Current;
|
||||
using FileSystems = Umbraco.Core.IO.FileSystems;
|
||||
|
||||
@@ -218,14 +219,14 @@ namespace Umbraco.Tests.Testing
|
||||
Composition.RegisterUnique<IPublishedSnapshotAccessor, TestPublishedSnapshotAccessor>();
|
||||
|
||||
// register back office sections in the order we want them rendered
|
||||
Composition.WithCollectionBuilder<BackOfficeSectionCollectionBuilder>().Append<ContentBackOfficeSection>()
|
||||
.Append<MediaBackOfficeSection>()
|
||||
.Append<SettingsBackOfficeSection>()
|
||||
.Append<PackagesBackOfficeSection>()
|
||||
.Append<UsersBackOfficeSection>()
|
||||
.Append<MembersBackOfficeSection>()
|
||||
.Append<FormsBackOfficeSection>()
|
||||
.Append<TranslationBackOfficeSection>();
|
||||
Composition.WithCollectionBuilder<SectionCollectionBuilder>().Append<ContentSection>()
|
||||
.Append<MediaSection>()
|
||||
.Append<SettingsSection>()
|
||||
.Append<PackagesSection>()
|
||||
.Append<UsersSection>()
|
||||
.Append<MembersSection>()
|
||||
.Append<FormsSection>()
|
||||
.Append<TranslationSection>();
|
||||
Composition.RegisterUnique<ISectionService, SectionService>();
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Search;
|
||||
using Umbraco.Web.Sections;
|
||||
using Umbraco.Web.Tour;
|
||||
using Umbraco.Web.Trees;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
@@ -93,8 +94,8 @@ namespace Umbraco.Web
|
||||
/// Gets the backoffice sections/applications collection builder.
|
||||
/// </summary>
|
||||
/// <param name="composition">The composition.</param>
|
||||
public static BackOfficeSectionCollectionBuilder Sections(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<BackOfficeSectionCollectionBuilder>();
|
||||
public static SectionCollectionBuilder Sections(this Composition composition)
|
||||
=> composition.WithCollectionBuilder<SectionCollectionBuilder>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the backoffice dashboards collection builder.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
public SectionMapperProfile(ILocalizedTextService textService)
|
||||
{
|
||||
CreateMap<IBackOfficeSection, Section>()
|
||||
CreateMap<ISection, Section>()
|
||||
.ForMember(dest => dest.RoutePath, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.Icon, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => textService.Localize("sections/" + src.Alias, (IDictionary<string, string>)null)))
|
||||
|
||||
@@ -31,6 +31,7 @@ using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Search;
|
||||
using Umbraco.Web.Sections;
|
||||
using Umbraco.Web.Security;
|
||||
using Umbraco.Web.Security.Providers;
|
||||
using Umbraco.Web.Services;
|
||||
@@ -225,15 +226,15 @@ namespace Umbraco.Web.Runtime
|
||||
.Append<ContentInfoContentAppFactory>();
|
||||
|
||||
// register back office sections in the order we want them rendered
|
||||
composition.WithCollectionBuilder<BackOfficeSectionCollectionBuilder>()
|
||||
.Append<ContentBackOfficeSection>()
|
||||
.Append<MediaBackOfficeSection>()
|
||||
.Append<SettingsBackOfficeSection>()
|
||||
.Append<PackagesBackOfficeSection>()
|
||||
.Append<UsersBackOfficeSection>()
|
||||
.Append<MembersBackOfficeSection>()
|
||||
.Append<FormsBackOfficeSection>()
|
||||
.Append<TranslationBackOfficeSection>();
|
||||
composition.WithCollectionBuilder<SectionCollectionBuilder>()
|
||||
.Append<ContentSection>()
|
||||
.Append<MediaSection>()
|
||||
.Append<SettingsSection>()
|
||||
.Append<PackagesSection>()
|
||||
.Append<UsersSection>()
|
||||
.Append<MembersSection>()
|
||||
.Append<FormsSection>()
|
||||
.Append<TranslationSection>();
|
||||
|
||||
// register core CMS dashboards and 3rd party types - will be ordered by weight attribute & merged with package.manifest dashboards
|
||||
composition.WithCollectionBuilder<DashboardCollectionBuilder>()
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the back office content section
|
||||
/// </summary>
|
||||
public class ContentBackOfficeSection : IBackOfficeSection
|
||||
public class ContentSection : ISection
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string Alias => Constants.Applications.Content;
|
||||
@@ -1,12 +1,12 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the back office media section
|
||||
/// </summary>
|
||||
public class FormsBackOfficeSection : IBackOfficeSection
|
||||
public class FormsSection : ISection
|
||||
{
|
||||
public string Alias => Constants.Applications.Forms;
|
||||
public string Name => "Forms";
|
||||
@@ -1,12 +1,12 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the back office media section
|
||||
/// </summary>
|
||||
public class MediaBackOfficeSection : IBackOfficeSection
|
||||
public class MediaSection : ISection
|
||||
{
|
||||
public string Alias => Constants.Applications.Media;
|
||||
public string Name => "Media";
|
||||
@@ -1,12 +1,12 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the back office members section
|
||||
/// </summary>
|
||||
public class MembersBackOfficeSection : IBackOfficeSection
|
||||
public class MembersSection : ISection
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string Alias => Constants.Applications.Members;
|
||||
@@ -1,12 +1,12 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the back office packages section
|
||||
/// </summary>
|
||||
public class PackagesBackOfficeSection : IBackOfficeSection
|
||||
public class PackagesSection : ISection
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string Alias => Constants.Applications.Packages;
|
||||
13
src/Umbraco.Web/Sections/SectionCollection.cs
Normal file
13
src/Umbraco.Web/Sections/SectionCollection.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
public class SectionCollection : BuilderCollectionBase<ISection>
|
||||
{
|
||||
public SectionCollection(IEnumerable<ISection> items)
|
||||
: base(items)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,15 @@ using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Manifest;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
public class BackOfficeSectionCollectionBuilder : OrderedCollectionBuilderBase<BackOfficeSectionCollectionBuilder, BackOfficeSectionCollection, IBackOfficeSection>
|
||||
public class SectionCollectionBuilder : OrderedCollectionBuilderBase<SectionCollectionBuilder, SectionCollection, ISection>
|
||||
{
|
||||
protected override BackOfficeSectionCollectionBuilder This => this;
|
||||
protected override SectionCollectionBuilder This => this;
|
||||
|
||||
protected override IEnumerable<IBackOfficeSection> CreateItems(IFactory factory)
|
||||
protected override IEnumerable<ISection> CreateItems(IFactory factory)
|
||||
{
|
||||
// get the manifest parser just-in-time - injecting it in the ctor would mean that
|
||||
// simply getting the builder in order to configure the collection, would require
|
||||
@@ -1,12 +1,12 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the back office settings section
|
||||
/// </summary>
|
||||
public class SettingsBackOfficeSection : IBackOfficeSection
|
||||
public class SettingsSection : ISection
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string Alias => Constants.Applications.Settings;
|
||||
@@ -1,12 +1,12 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the back office translation section
|
||||
/// </summary>
|
||||
public class TranslationBackOfficeSection : IBackOfficeSection
|
||||
public class TranslationSection : ISection
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string Alias => Constants.Applications.Translation;
|
||||
@@ -1,12 +1,12 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
namespace Umbraco.Web.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the back office users section
|
||||
/// </summary>
|
||||
public class UsersBackOfficeSection : IBackOfficeSection
|
||||
public class UsersSection : ISection
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string Alias => Constants.Applications.Users;
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
|
||||
namespace Umbraco.Web.Services
|
||||
{
|
||||
@@ -8,20 +8,20 @@ namespace Umbraco.Web.Services
|
||||
/// <summary>
|
||||
/// The cache storage for all applications
|
||||
/// </summary>
|
||||
IEnumerable<IBackOfficeSection> GetSections();
|
||||
IEnumerable<ISection> GetSections();
|
||||
|
||||
/// <summary>
|
||||
/// Get the user group's allowed sections
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IBackOfficeSection> GetAllowedSections(int userId);
|
||||
IEnumerable<ISection> GetAllowedSections(int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the application by its alias.
|
||||
/// </summary>
|
||||
/// <param name="appAlias">The application alias.</param>
|
||||
/// <returns></returns>
|
||||
IBackOfficeSection GetByAlias(string appAlias);
|
||||
ISection GetByAlias(string appAlias);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
using Umbraco.Core.Models.Sections;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Sections;
|
||||
using Umbraco.Web.Trees;
|
||||
|
||||
namespace Umbraco.Web.Services
|
||||
@@ -10,11 +11,11 @@ namespace Umbraco.Web.Services
|
||||
internal class SectionService : ISectionService
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private readonly BackOfficeSectionCollection _sectionCollection;
|
||||
private readonly SectionCollection _sectionCollection;
|
||||
|
||||
public SectionService(
|
||||
IUserService userService,
|
||||
BackOfficeSectionCollection sectionCollection)
|
||||
SectionCollection sectionCollection)
|
||||
{
|
||||
_userService = userService ?? throw new ArgumentNullException(nameof(userService));
|
||||
_sectionCollection = sectionCollection ?? throw new ArgumentNullException(nameof(sectionCollection));
|
||||
@@ -23,11 +24,11 @@ namespace Umbraco.Web.Services
|
||||
/// <summary>
|
||||
/// The cache storage for all applications
|
||||
/// </summary>
|
||||
public IEnumerable<IBackOfficeSection> GetSections()
|
||||
public IEnumerable<ISection> GetSections()
|
||||
=> _sectionCollection;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IBackOfficeSection> GetAllowedSections(int userId)
|
||||
public IEnumerable<ISection> GetAllowedSections(int userId)
|
||||
{
|
||||
var user = _userService.GetUserById(userId);
|
||||
if (user == null)
|
||||
@@ -37,7 +38,7 @@ namespace Umbraco.Web.Services
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IBackOfficeSection GetByAlias(string appAlias)
|
||||
public ISection GetByAlias(string appAlias)
|
||||
=> GetSections().FirstOrDefault(t => t.Alias == appAlias);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Models.Trees;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
public class BackOfficeSectionCollection : BuilderCollectionBase<IBackOfficeSection>
|
||||
{
|
||||
public BackOfficeSectionCollection(IEnumerable<IBackOfficeSection> items)
|
||||
: base(items)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -219,16 +219,16 @@
|
||||
<Compile Include="PropertyEditors\MultiUrlPickerValueEditor.cs" />
|
||||
<Compile Include="PropertyEditors\ValueConverters\MultiUrlPickerValueConverter.cs" />
|
||||
<Compile Include="Templates\ITemplateRenderer.cs" />
|
||||
<Compile Include="Trees\BackOfficeSectionCollectionBuilder.cs" />
|
||||
<Compile Include="Trees\FormsBackOfficeSection.cs" />
|
||||
<Compile Include="Trees\MediaBackOfficeSection.cs" />
|
||||
<Compile Include="Trees\MembersBackOfficeSection.cs" />
|
||||
<Compile Include="Trees\PackagesBackOfficeSection.cs" />
|
||||
<Compile Include="Trees\SettingsBackOfficeSection.cs" />
|
||||
<Compile Include="Trees\TranslationBackOfficeSection.cs" />
|
||||
<Compile Include="Sections\SectionCollectionBuilder.cs" />
|
||||
<Compile Include="Sections\FormsSection.cs" />
|
||||
<Compile Include="Sections\MediaSection.cs" />
|
||||
<Compile Include="Sections\MembersSection.cs" />
|
||||
<Compile Include="Sections\PackagesSection.cs" />
|
||||
<Compile Include="Sections\SettingsSection.cs" />
|
||||
<Compile Include="Sections\TranslationSection.cs" />
|
||||
<Compile Include="Trees\TreeCollectionBuilder.cs" />
|
||||
<Compile Include="Trees\TreeUse.cs" />
|
||||
<Compile Include="Trees\UsersBackOfficeSection.cs" />
|
||||
<Compile Include="Sections\UsersSection.cs" />
|
||||
<Compile Include="Trees\Tree.cs" />
|
||||
<Compile Include="Trees\ITree.cs" />
|
||||
<Compile Include="Models\ContentEditing\PublicAccess.cs" />
|
||||
@@ -248,7 +248,7 @@
|
||||
<Compile Include="Models\Mapping\ScheduledPublishDateResolver.cs" />
|
||||
<Compile Include="Services\ITreeService.cs" />
|
||||
<Compile Include="Services\ISectionService.cs" />
|
||||
<Compile Include="Trees\BackOfficeSectionCollection.cs" />
|
||||
<Compile Include="Sections\SectionCollection.cs" />
|
||||
<Compile Include="PropertyEditors\GridPropertyIndexValueFactory.cs" />
|
||||
<Compile Include="PropertyEditors\PropertyEditorsComposer.cs" />
|
||||
<Compile Include="PublishedCache\NuCache\NuCacheComposer.cs" />
|
||||
@@ -631,7 +631,7 @@
|
||||
<Compile Include="Actions\ActionUpdate.cs" />
|
||||
<Compile Include="Actions\IAction.cs" />
|
||||
<Compile Include="Models\ContentEditing\EntityBasic.cs" />
|
||||
<Compile Include="Trees\ContentBackOfficeSection.cs" />
|
||||
<Compile Include="Sections\ContentSection.cs" />
|
||||
<Compile Include="Services\SectionService.cs" />
|
||||
<Compile Include="Trees\TreeAttribute.cs" />
|
||||
<Compile Include="Models\Trees\TreeNode.cs" />
|
||||
|
||||
Reference in New Issue
Block a user