Plugin Base WebViewPage #22 & Authorization #24

Plugins have a base WebViewPage to inherit, this offers integration with
various Disco services. Plugins can also add Authorization attributes to
their Web Handlers and Controller Methods.
This commit is contained in:
Gary Sharp
2013-10-14 20:13:00 +11:00
parent 4b822d3ae3
commit 9784c5d282
21 changed files with 496 additions and 112 deletions
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace Disco.Services.Plugins.Features.UIExtension.Results
{
@@ -18,7 +19,7 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
this.results = Results;
}
public override void ExecuteResult<T>(System.Web.Mvc.WebViewPage<T> page)
public override void ExecuteResult<T>(WebViewPage<T> page)
{
foreach (var result in this.results)
{
@@ -1,9 +1,12 @@
using System;
using Disco.Services.Web.Bundles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace Disco.Services.Plugins.Features.UIExtension.Results
{
@@ -16,13 +19,13 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
: base(Source)
{
this._resource = Resource;
this._resourceUrl = HttpContext.Current.Request.RequestContext.DiscoPluginResourceUrl(Resource, false, Source.PluginManifest);
this._resourceUrl = new HtmlString(Source.PluginManifest.WebResourceUrl(Resource));
var deferredBundles = HttpContext.Current.Items["Bundles.UIExtensionCss"] as List<HtmlString>;
var deferredBundles = HttpContext.Current.Items[Bundle.UIExtensionCssKey] as List<HtmlString>;
if (deferredBundles == null)
{
deferredBundles = new List<HtmlString>();
HttpContext.Current.Items["Bundles.UIExtensionCss"] = deferredBundles;
HttpContext.Current.Items[Bundle.UIExtensionCssKey] = deferredBundles;
}
if (!deferredBundles.Contains(this._resourceUrl))
deferredBundles.Add(this._resourceUrl);
@@ -1,4 +1,5 @@
using System;
using Disco.Services.Web.Bundles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -17,16 +18,16 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
: base(Source)
{
this._resource = Resource;
this._resourceUrl = HttpContext.Current.Request.RequestContext.DiscoPluginResourceUrl(Resource, false, Source.PluginManifest);
this._resourceUrl = new HtmlString(Source.PluginManifest.WebResourceUrl(Resource));
this._placeInPageHead = PlaceInPageHead;
if (this._placeInPageHead)
{
var deferredBundles = HttpContext.Current.Items["Bundles.UIExtensionScripts"] as List<HtmlString>;
var deferredBundles = HttpContext.Current.Items[Bundle.UIExtensionScriptsKey] as List<HtmlString>;
if (deferredBundles == null)
{
deferredBundles = new List<HtmlString>();
HttpContext.Current.Items["Bundles.UIExtensionScripts"] = deferredBundles;
HttpContext.Current.Items[Bundle.UIExtensionScriptsKey] = deferredBundles;
}
if (!deferredBundles.Contains(this._resourceUrl))
deferredBundles.Add(this._resourceUrl);