diff --git a/src/Orchard.Tests/Mvc/OrchardControllerFactoryTests.cs b/src/Orchard.Tests/Mvc/OrchardControllerFactoryTests.cs index 38ec3b36c..8951bd60a 100644 --- a/src/Orchard.Tests/Mvc/OrchardControllerFactoryTests.cs +++ b/src/Orchard.Tests/Mvc/OrchardControllerFactoryTests.cs @@ -93,6 +93,15 @@ namespace Orchard.Tests.Mvc { Assert.That(((ReplacementFooController) controller).Disposals, Is.EqualTo(4)); } + [Test] + public void NullServiceKeyReturnsDefault() { + OrchardControllerFactoryAccessor orchardControllerFactory = new OrchardControllerFactoryAccessor(); + ReplacementFooController fooController; + + Assert.That(orchardControllerFactory.TryResolveAccessor(_workContextAccessor.GetContext(), null, out fooController), Is.False); + Assert.That(fooController, Is.Null); + } + private static RequestContext GetRequestContext(IWorkContextAccessor workContextAccessor) { var handler = new MvcRouteHandler(); @@ -120,6 +129,12 @@ namespace Orchard.Tests.Mvc { public int Disposals { get; set; } } + internal class OrchardControllerFactoryAccessor : OrchardControllerFactory { + public bool TryResolveAccessor(WorkContext workContext, object serviceKey, out T instance) { + return TryResolve(workContext, serviceKey, out instance); + } + } + private static void InjectKnownControllerTypes(DefaultControllerFactory controllerFactory, params Type[] controllerTypes) { // D'oh!!! Hey MVC people, how is this testable? ;) @@ -144,6 +159,4 @@ namespace Orchard.Tests.Mvc { cache); } } - - } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Orchard.Packaging.csproj b/src/Orchard.Web/Modules/Orchard.Packaging/Orchard.Packaging.csproj index 7e1e68cee..02b2f75dc 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Orchard.Packaging.csproj +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Orchard.Packaging.csproj @@ -120,11 +120,6 @@ Designer - - - Designer - - Designer diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Scripts/Web.config b/src/Orchard.Web/Modules/Orchard.Packaging/Scripts/Web.config deleted file mode 100644 index df1c33504..000000000 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Scripts/Web.config +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Styles/orchard-packaging-admin.css b/src/Orchard.Web/Modules/Orchard.Packaging/Styles/orchard-packaging-admin.css index ffcf95666..68ad245ef 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Styles/orchard-packaging-admin.css +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Styles/orchard-packaging-admin.css @@ -46,4 +46,4 @@ .screenshotThumbnail .thumbnail { width: 171px; height: 128px; -} +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/AddSource.cshtml b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/AddSource.cshtml index f04324d8c..29dcee9ea 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/AddSource.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/AddSource.cshtml @@ -1,6 +1,5 @@ @model Orchard.Packaging.ViewModels.PackagingAddSourceViewModel -

- @Html.TitleForPage(T("Add a Feed").ToString())

+

@Html.TitleForPage(T("Add a Feed").ToString())

@using ( Html.BeginFormAntiForgeryPost(Url.Action("AddSource")) ) { @Html.ValidationSummary() diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Sources.cshtml b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Sources.cshtml index 55c1f7c6d..099a8e3d8 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Sources.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Sources.cshtml @@ -1,31 +1,30 @@ @model Orchard.Packaging.ViewModels.PackagingSourcesViewModel -

- @Html.TitleForPage(T("Gallery Feeds").ToString())

+

@Html.TitleForPage(T("Gallery Feeds").ToString())

@Html.ActionLink(T("Add Feed").Text, "AddSource", new { }, new { @class = "button primaryAction" })
-
- - - - - - - - - - - - - - @foreach ( var item in Model.Sources ) { +
+
@T("Title")@T("Url")
+ + + + + + - - - + + + - } -
@item.FeedTitle@Html.Link(item.FeedUrl, item.FeedUrl)@Html.ActionLink(T("Remove").ToString(), "Remove", new { id = item.Id })@T("Title")@T("Url")
-
+ + @foreach ( var item in Model.Sources ) { + + @item.FeedTitle + @Html.Link(item.FeedUrl, item.FeedUrl) + @Html.ActionLink(T("Remove").ToString(), "Remove", new { id = item.Id }) + + } + + \ No newline at end of file diff --git a/src/Orchard.Web/Themes/TheAdmin/Views/Layout.cshtml b/src/Orchard.Web/Themes/TheAdmin/Views/Layout.cshtml index cab73e6c7..7aae5a236 100644 --- a/src/Orchard.Web/Themes/TheAdmin/Views/Layout.cshtml +++ b/src/Orchard.Web/Themes/TheAdmin/Views/Layout.cshtml @@ -10,8 +10,8 @@ Script.Require("jQuery"); Script.Require("ShapesBase"); Script.Include("admin.js"); - RegisterLink(new LinkEntry { Condition = "lte IE 8", Rel = "stylesheet", Type = "text/css", Href = Url.Content("../Styles/ie.css") }.AddAttribute("media", "screen, projection")); - RegisterLink(new LinkEntry { Condition = "lte IE 6", Rel = "stylesheet", Type = "text/css", Href = Url.Content("../Styles/ie6.css") }.AddAttribute("media", "screen, projection")); + RegisterLink(new LinkEntry { Condition = "lte IE 8", Rel = "stylesheet", Type = "text/css", Href = Url.Content("~/Themes/TheAdmin/Styles/ie.css") }.AddAttribute("media", "screen, projection")); + RegisterLink(new LinkEntry { Condition = "lte IE 6", Rel = "stylesheet", Type = "text/css", Href = Url.Content("~/Themes/TheAdmin/Styles/ie6.css") }.AddAttribute("media", "screen, projection")); // these are just hacked together to fire existing partials... can change Model.Header.Add(Display.Header()); diff --git a/src/Orchard/Mvc/OrchardControllerFactory.cs b/src/Orchard/Mvc/OrchardControllerFactory.cs index 6bf9c2d78..7c0e30690 100644 --- a/src/Orchard/Mvc/OrchardControllerFactory.cs +++ b/src/Orchard/Mvc/OrchardControllerFactory.cs @@ -7,14 +7,20 @@ using Autofac.Features.Metadata; using Orchard.Mvc.Extensions; namespace Orchard.Mvc { - public interface IControllerType { - Type ControllerType { get; } - } - + /// + /// Overrides the default controller factory to resolve controllers using LoC, based their areas and names. + /// public class OrchardControllerFactory : DefaultControllerFactory { - - bool TryResolve(WorkContext workContext, object serviceKey, out T instance ) { - if (workContext != null) { + /// + /// Tries to resolve an instance for the controller associated with a given service key for the work context scope. + /// + /// The type of the controller. + /// The work context. + /// The service key for the controller. + /// The controller instance. + /// True if the controller was resolved; false otherwise. + protected bool TryResolve(WorkContext workContext, object serviceKey, out T instance) { + if (workContext != null && serviceKey != null) { var key = new KeyedService(serviceKey, typeof (T)); object value; if (workContext.Resolve().TryResolve(key, out value)) { @@ -27,6 +33,13 @@ namespace Orchard.Mvc { return false; } + /// + /// Returns the controller type based on the name of both the controller and area. + /// + /// The request context from where to fetch the route data containing the area. + /// The controller name. + /// The controller type. + /// ControllerName: Item, Area: Containers would return the type for the ItemController class. protected override Type GetControllerType(RequestContext requestContext, string controllerName) { var routeData = requestContext.RouteData; @@ -47,6 +60,12 @@ namespace Orchard.Mvc { return null; } + /// + /// Returns an instance of the controller. + /// + /// The request context from where to fetch the route data containing the area. + /// The controller type. + /// An instance of the controller if it's type is registered; null if otherwise. protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) { IController controller; var workContext = requestContext.GetWorkContext(); @@ -57,6 +76,5 @@ namespace Orchard.Mvc { // fail as appropriate for MVC's expectations return null; } - } } \ No newline at end of file