- Adding a resultfilter for widgets and some placeholders to fill when it all comes together.

--HG--
branch : dev
This commit is contained in:
Suha Can 2010-09-29 15:29:33 -07:00
parent e9208542ed
commit 43889c8c10
6 changed files with 79 additions and 3 deletions

View File

@ -1,7 +1,7 @@
namespace Orchard.Core.Contents.Settings {
public class ContentTypeSettings {
/// <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>
public bool Creatable { get; set; }
}

View File

@ -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.
}
}
}

View File

@ -1,6 +1,9 @@
using Orchard.ContentManagement;
using System.Collections.Generic;
using Orchard.ContentManagement;
namespace Orchard.Widgets.Models {
public class Layer : ContentItem {
public IList<LayerZone> LayerZones = new List<LayerZone>();
public LayerPart LayerPart = new LayerPart();
}
}

View File

@ -43,7 +43,7 @@
</Reference>
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -67,6 +67,9 @@
<Compile Include="Models\WidgetPartRecord.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Filters\WidgetFilter.cs" />
<Compile Include="Services\IWidgetService.cs" />
<Compile Include="Services\WidgetService.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />

View File

@ -0,0 +1,8 @@
using System.Collections.Generic;
using Orchard.Widgets.Models;
namespace Orchard.Widgets.Services {
public interface IWidgetService : IDependency {
IEnumerable<Layer> GetLayers();
}
}

View File

@ -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
}
}