mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
- Adding a resultfilter for widgets and some placeholders to fill when it all comes together.
--HG-- branch : dev
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
namespace Orchard.Core.Contents.Settings {
|
namespace Orchard.Core.Contents.Settings {
|
||||||
public class ContentTypeSettings {
|
public class ContentTypeSettings {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This setting is used to display a Content Type in Content Mamagement menu like
|
/// This setting is used to display a Content Type in Content Management menu like
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Creatable { get; set; }
|
public bool Creatable { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Mvc.Filters;
|
||||||
|
using Orchard.UI.Admin;
|
||||||
|
|
||||||
|
namespace Orchard.Widgets.Filters {
|
||||||
|
public class WidgetFilter : FilterProvider, IResultFilter {
|
||||||
|
private readonly IContentManager _contentManager;
|
||||||
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
|
|
||||||
|
public WidgetFilter(IContentManager contentManager, IWorkContextAccessor workContextAccessor) {
|
||||||
|
_contentManager = contentManager;
|
||||||
|
_workContextAccessor = workContextAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
||||||
|
var workContext = _workContextAccessor.GetContext(filterContext);
|
||||||
|
|
||||||
|
if (workContext == null ||
|
||||||
|
workContext.Page == null ||
|
||||||
|
workContext.CurrentSite == null ||
|
||||||
|
AdminFilter.IsApplied(filterContext.RequestContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Layers
|
||||||
|
// Get LayerZones
|
||||||
|
// Get WidgetParts
|
||||||
|
// BuildDisplayModel
|
||||||
|
// Add to Zone.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
using Orchard.ContentManagement;
|
using System.Collections.Generic;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
|
||||||
namespace Orchard.Widgets.Models {
|
namespace Orchard.Widgets.Models {
|
||||||
public class Layer : ContentItem {
|
public class Layer : ContentItem {
|
||||||
|
public IList<LayerZone> LayerZones = new List<LayerZone>();
|
||||||
|
public LayerPart LayerPart = new LayerPart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq">
|
<Reference Include="System.Xml.Linq">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
@@ -67,6 +67,9 @@
|
|||||||
<Compile Include="Models\WidgetPartRecord.cs" />
|
<Compile Include="Models\WidgetPartRecord.cs" />
|
||||||
<Compile Include="Permissions.cs" />
|
<Compile Include="Permissions.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Filters\WidgetFilter.cs" />
|
||||||
|
<Compile Include="Services\IWidgetService.cs" />
|
||||||
|
<Compile Include="Services\WidgetService.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Module.txt" />
|
<Content Include="Module.txt" />
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.Widgets.Models;
|
||||||
|
|
||||||
|
namespace Orchard.Widgets.Services {
|
||||||
|
public interface IWidgetService : IDependency {
|
||||||
|
IEnumerable<Layer> GetLayers();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Orchard.Logging;
|
||||||
|
using Orchard.Settings;
|
||||||
|
using Orchard.Widgets.Models;
|
||||||
|
|
||||||
|
namespace Orchard.Widgets.Services {
|
||||||
|
public class WidgetService : IWidgetService {
|
||||||
|
public WidgetService() {
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
|
||||||
|
|
||||||
|
#region IWidgetService Members
|
||||||
|
|
||||||
|
public IEnumerable<Layer> GetLayers() {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user