Tidy: Sort/remove usings, simplify names
This commit is contained in:
+1
-7
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Plugins.Features.InteroperabilityProvider
|
||||
namespace Disco.Services.Plugins.Features.InteroperabilityProvider
|
||||
{
|
||||
[PluginFeatureCategory(DisplayName = "Interoperability Providers")]
|
||||
public abstract class InteroperabilityProviderFeature : PluginFeature
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Plugins.Features.Other
|
||||
namespace Disco.Services.Plugins.Features.Other
|
||||
{
|
||||
[PluginFeatureCategory(DisplayName = "Other")]
|
||||
public abstract class OtherFeature : PluginFeature
|
||||
|
||||
@@ -4,8 +4,6 @@ using Disco.Models.Repository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Services.Plugins.Features.RepairProvider
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
@@ -15,7 +10,7 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
public LiteralResult(PluginFeatureManifest Source, string Content)
|
||||
: base(Source)
|
||||
{
|
||||
this._content = Content;
|
||||
_content = Content;
|
||||
}
|
||||
|
||||
public override void ExecuteResult<T>(WebViewPage<T> page)
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
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
|
||||
@@ -16,12 +13,12 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
if (Results == null || Results.Length == 0)
|
||||
throw new ArgumentException("At least one result is required", "Results");
|
||||
|
||||
this.results = Results;
|
||||
results = Results;
|
||||
}
|
||||
|
||||
public override void ExecuteResult<T>(WebViewPage<T> page)
|
||||
{
|
||||
foreach (var result in this.results)
|
||||
foreach (var result in results)
|
||||
{
|
||||
result.ExecuteResult(page);
|
||||
page.WriteLiteral("\n");
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
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
|
||||
{
|
||||
@@ -18,8 +12,8 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
public PluginResourceCssResult(PluginFeatureManifest Source, string Resource)
|
||||
: base(Source)
|
||||
{
|
||||
this._resource = Resource;
|
||||
this._resourceUrl = Source.PluginManifest.WebResourceUrl(Resource);
|
||||
_resource = Resource;
|
||||
_resourceUrl = Source.PluginManifest.WebResourceUrl(Resource);
|
||||
|
||||
var deferredBundles = HttpContext.Current.Items[BundleTable.UIExtensionCssKey] as List<string>;
|
||||
if (deferredBundles == null)
|
||||
@@ -27,8 +21,8 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
deferredBundles = new List<string>();
|
||||
HttpContext.Current.Items[BundleTable.UIExtensionCssKey] = deferredBundles;
|
||||
}
|
||||
if (!deferredBundles.Contains(this._resourceUrl))
|
||||
deferredBundles.Add(this._resourceUrl);
|
||||
if (!deferredBundles.Contains(_resourceUrl))
|
||||
deferredBundles.Add(_resourceUrl);
|
||||
}
|
||||
|
||||
public override void ExecuteResult<T>(System.Web.Mvc.WebViewPage<T> page)
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Disco.Services.Web.Bundles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
@@ -17,11 +13,11 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
public PluginResourceScriptResult(PluginFeatureManifest Source, string Resource, bool PlaceInPageHead)
|
||||
: base(Source)
|
||||
{
|
||||
this._resource = Resource;
|
||||
this._resourceUrl = Source.PluginManifest.WebResourceUrl(Resource);
|
||||
this._placeInPageHead = PlaceInPageHead;
|
||||
_resource = Resource;
|
||||
_resourceUrl = Source.PluginManifest.WebResourceUrl(Resource);
|
||||
_placeInPageHead = PlaceInPageHead;
|
||||
|
||||
if (this._placeInPageHead)
|
||||
if (_placeInPageHead)
|
||||
{
|
||||
var deferredBundles = HttpContext.Current.Items[BundleTable.UIExtensionScriptsKey] as List<string>;
|
||||
if (deferredBundles == null)
|
||||
@@ -29,14 +25,14 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
deferredBundles = new List<string>();
|
||||
HttpContext.Current.Items[BundleTable.UIExtensionScriptsKey] = deferredBundles;
|
||||
}
|
||||
if (!deferredBundles.Contains(this._resourceUrl))
|
||||
deferredBundles.Add(this._resourceUrl);
|
||||
if (!deferredBundles.Contains(_resourceUrl))
|
||||
deferredBundles.Add(_resourceUrl);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExecuteResult<T>(System.Web.Mvc.WebViewPage<T> page)
|
||||
{
|
||||
if (!this._placeInPageHead)
|
||||
if (!_placeInPageHead)
|
||||
{
|
||||
page.WriteLiteral("<script src=\"");
|
||||
page.WriteLiteral(_resourceUrl);
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
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.WebPages;
|
||||
|
||||
@@ -20,8 +15,8 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
if (!typeof(WebViewPage).IsAssignableFrom(ViewType))
|
||||
throw new ArgumentException("The View Type must inherit from WebViewPage", "ViewType");
|
||||
|
||||
this.viewType = ViewType;
|
||||
this.model = Model;
|
||||
viewType = ViewType;
|
||||
model = Model;
|
||||
}
|
||||
|
||||
public override void ExecuteResult<T>(System.Web.Mvc.WebViewPage<T> page)
|
||||
@@ -30,7 +25,7 @@ namespace Disco.Services.Plugins.Features.UIExtension.Results
|
||||
if (partialView == null)
|
||||
throw new InvalidOperationException("Invalid View Type");
|
||||
partialView.ViewContext = page.ViewContext;
|
||||
partialView.ViewData = new ViewDataDictionary(this.model);
|
||||
partialView.ViewData = new ViewDataDictionary(model);
|
||||
partialView.InitHelpers();
|
||||
partialView.ExecutePageHierarchy(new WebPageContext(page.ViewContext.HttpContext, null, model), page.ViewContext.Writer, null);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.UI;
|
||||
using Disco.Services.Plugins.Features.UIExtension.Results;
|
||||
@@ -23,11 +19,11 @@ namespace Disco.Services.Plugins.Features.UIExtension
|
||||
}
|
||||
public UIExtensionFeature()
|
||||
{
|
||||
this.plugin = new Lazy<WebHelper>(new Func<WebHelper>(() => {
|
||||
if (this.Context == null)
|
||||
plugin = new Lazy<WebHelper>(new Func<WebHelper>(() => {
|
||||
if (Context == null)
|
||||
throw new InvalidOperationException("The Context property is not initialized");
|
||||
|
||||
return new WebHelper(this.Context.HttpContext, this.Manifest.PluginManifest);
|
||||
return new WebHelper(Context.HttpContext, Manifest.PluginManifest);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -37,36 +33,36 @@ namespace Disco.Services.Plugins.Features.UIExtension
|
||||
|
||||
protected LiteralResult Literal(string Content)
|
||||
{
|
||||
return new LiteralResult(this.Manifest, Content);
|
||||
return new LiteralResult(Manifest, Content);
|
||||
}
|
||||
protected LiteralResult Nothing()
|
||||
{
|
||||
return new LiteralResult(this.Manifest, null);
|
||||
return new LiteralResult(Manifest, null);
|
||||
}
|
||||
protected LiteralResult ScriptInline(string JavaScriptContent)
|
||||
{
|
||||
return new LiteralResult(this.Manifest, string.Concat("<script type=\"text/javascript\">\n//<!--\n", JavaScriptContent, "\n//-->\n</script>"));
|
||||
return new LiteralResult(Manifest, string.Concat("<script type=\"text/javascript\">\n//<!--\n", JavaScriptContent, "\n//-->\n</script>"));
|
||||
}
|
||||
protected PluginResourceScriptResult ScriptResource(string Resource, bool PlaceInPageHead)
|
||||
{
|
||||
return new PluginResourceScriptResult(this.Manifest, Resource, PlaceInPageHead);
|
||||
return new PluginResourceScriptResult(Manifest, Resource, PlaceInPageHead);
|
||||
}
|
||||
protected PluginResourceCssResult CssResource(string Resource)
|
||||
{
|
||||
return new PluginResourceCssResult(this.Manifest, Resource);
|
||||
return new PluginResourceCssResult(Manifest, Resource);
|
||||
}
|
||||
protected MultipleResult Multiple(params UIExtensionResult[] Results)
|
||||
{
|
||||
return new MultipleResult(this.Manifest, Results);
|
||||
return new MultipleResult(Manifest, Results);
|
||||
}
|
||||
[Obsolete("Use: PartialCompiled<ViewType>(dynamic Model)")]
|
||||
protected PrecompiledPartialViewResult Partial(Type PartialViewType, object Model = null)
|
||||
{
|
||||
return new PrecompiledPartialViewResult(this.Manifest, PartialViewType, Model);
|
||||
return new PrecompiledPartialViewResult(Manifest, PartialViewType, Model);
|
||||
}
|
||||
protected PrecompiledPartialViewResult PartialCompiled<ViewType>(dynamic Model = null) where ViewType : WebViewPage
|
||||
{
|
||||
return new PrecompiledPartialViewResult(this.Manifest, typeof(ViewType), Model);
|
||||
return new PrecompiledPartialViewResult(Manifest, typeof(ViewType), Model);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
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.Mvc;
|
||||
|
||||
namespace Disco.Services.Plugins.Features.UIExtension
|
||||
{
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.UI;
|
||||
using Disco.Services.Plugins;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
|
||||
namespace Disco.Services.Plugins.Features.UIExtension
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.BI.Config;
|
||||
@@ -22,7 +20,7 @@ namespace Disco.Services.Plugins.Features.WarrantyProvider
|
||||
public abstract string SubmitJob(DiscoDataContext Database, Job Job, OrganisationAddress Address, User TechUser, string FaultDescription, Dictionary<string, string> WarrantyProviderProperties);
|
||||
|
||||
public abstract Type JobDetailsViewType { get; }
|
||||
public bool JobDetailsSupported { get { return this.JobDetailsViewType != null; } }
|
||||
public bool JobDetailsSupported { get { return JobDetailsViewType != null; } }
|
||||
public abstract dynamic JobDetailsViewModel(DiscoDataContext Database, Controller controller, Job Job);
|
||||
|
||||
public static PluginFeatureManifest FindPluginFeature(string PluginIdOrWarrantyProviderId)
|
||||
|
||||
@@ -17,9 +17,9 @@ namespace Disco.Services.Plugins
|
||||
|
||||
protected override void ExecuteTask()
|
||||
{
|
||||
string packageUrlPath = (string)this.ExecutionContext.JobDetail.JobDataMap["PackageUrl"];
|
||||
string packageFilePath = (string)this.ExecutionContext.JobDetail.JobDataMap["PackageFilePath"];
|
||||
bool DeletePackageAfterInstall = (bool)this.ExecutionContext.JobDetail.JobDataMap["DeletePackageAfterInstall"];
|
||||
string packageUrlPath = (string)ExecutionContext.JobDetail.JobDataMap["PackageUrl"];
|
||||
string packageFilePath = (string)ExecutionContext.JobDetail.JobDataMap["PackageFilePath"];
|
||||
bool DeletePackageAfterInstall = (bool)ExecutionContext.JobDetail.JobDataMap["DeletePackageAfterInstall"];
|
||||
|
||||
if (!Plugins.PluginsLoaded)
|
||||
throw new InvalidOperationException("Plugins have not been initialized");
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Disco.Services.Plugins
|
||||
{
|
||||
@@ -31,8 +28,8 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public InvalidFeatureCategoryTypeException(Type CategoryType, string PluginRequested)
|
||||
{
|
||||
this._categoryType = CategoryType;
|
||||
this._pluginRequested = PluginRequested;
|
||||
_categoryType = CategoryType;
|
||||
_pluginRequested = PluginRequested;
|
||||
}
|
||||
|
||||
public override string Message
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Services.Tasks;
|
||||
|
||||
@@ -27,7 +23,7 @@ namespace Disco.Services.Plugins
|
||||
|
||||
public override sealed string ToString()
|
||||
{
|
||||
return string.Format("{0} ({1}) - v{2}", this.Manifest.Name, this.Manifest.Id, this.Manifest.Version.ToString(4));
|
||||
return string.Format("{0} ({1}) - v{2}", Manifest.Name, Manifest.Id, Manifest.Version.ToString(4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Plugins
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
@@ -23,12 +19,12 @@ namespace Disco.Services.Plugins
|
||||
[Obsolete("Use: Response<ViewType>(dynamic ViewModel)")]
|
||||
protected PluginConfigurationHandlerGetResponse GetResponse(Type ViewType, dynamic ViewModel = null)
|
||||
{
|
||||
return new PluginConfigurationHandlerGetResponse(this.Manifest, ViewType, ViewModel);
|
||||
return new PluginConfigurationHandlerGetResponse(Manifest, ViewType, ViewModel);
|
||||
}
|
||||
|
||||
protected PluginConfigurationHandlerGetResponse Response<ViewType>(dynamic Model = null) where ViewType : WebViewPage
|
||||
{
|
||||
return new PluginConfigurationHandlerGetResponse(this.Manifest, typeof(ViewType), Model);
|
||||
return new PluginConfigurationHandlerGetResponse(Manifest, typeof(ViewType), Model);
|
||||
}
|
||||
|
||||
public class PluginConfigurationHandlerGetResponse
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Data.Repository;
|
||||
using System.IO;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.WebPages;
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
namespace Disco.Services.Plugins
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Plugins
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Plugins
|
||||
{
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Data.Repository;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Disco.Services.Plugins
|
||||
{
|
||||
@@ -28,20 +24,20 @@ namespace Disco.Services.Plugins
|
||||
|
||||
internal bool Initialize(DiscoDataContext Database, PluginManifest pluginManifest)
|
||||
{
|
||||
this.PluginManifest = pluginManifest;
|
||||
PluginManifest = pluginManifest;
|
||||
|
||||
if (this.Type == null)
|
||||
this.Type = this.PluginManifest.PluginAssembly.GetType(this.TypeName, true, true);
|
||||
if (Type == null)
|
||||
Type = PluginManifest.PluginAssembly.GetType(TypeName, true, true);
|
||||
|
||||
if (this.CategoryType == null)
|
||||
this.CategoryType = Type.GetType(this.CategoryTypeName, true, true);
|
||||
if (CategoryType == null)
|
||||
CategoryType = Type.GetType(CategoryTypeName, true, true);
|
||||
|
||||
using (var instance = this.CreateInstance())
|
||||
using (var instance = CreateInstance())
|
||||
{
|
||||
instance.Initialize(Database);
|
||||
}
|
||||
|
||||
PluginsLog.LogInitializedPluginFeature(this.PluginManifest, this);
|
||||
PluginsLog.LogInitializedPluginFeature(PluginManifest, this);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -54,14 +50,14 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public CategoryType CreateInstance<CategoryType>() where CategoryType : PluginFeature
|
||||
{
|
||||
if (typeof(CategoryType).IsAssignableFrom(this.Type))
|
||||
if (typeof(CategoryType).IsAssignableFrom(Type))
|
||||
{
|
||||
var i = (CategoryType)Activator.CreateInstance(Type);
|
||||
i.Manifest = this;
|
||||
return i;
|
||||
}
|
||||
else
|
||||
throw new InvalidOperationException(string.Format("The feature [{0}] cannot be cast into type [{1}]", this.Type.Name, typeof(CategoryType).Name));
|
||||
throw new InvalidOperationException(string.Format("The feature [{0}] cannot be cast into type [{1}]", Type.Name, typeof(CategoryType).Name));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -28,23 +28,23 @@ namespace Disco.Services.Plugins
|
||||
|
||||
public PluginWebHandler()
|
||||
{
|
||||
this.plugin = new Lazy<WebHelper>(new Func<WebHelper>(() => new WebHelper(this.HostController.HttpContext, this.Manifest)));
|
||||
plugin = new Lazy<WebHelper>(new Func<WebHelper>(() => new WebHelper(HostController.HttpContext, Manifest)));
|
||||
}
|
||||
|
||||
public void OnActionExecuting()
|
||||
{
|
||||
this.Database = new DiscoDataContext();
|
||||
this.Database.Configuration.LazyLoadingEnabled = false;
|
||||
Database = new DiscoDataContext();
|
||||
Database.Configuration.LazyLoadingEnabled = false;
|
||||
}
|
||||
|
||||
public abstract ActionResult ExecuteAction(string ActionName);
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
if (this.Database != null)
|
||||
if (Database != null)
|
||||
{
|
||||
this.Database.Dispose();
|
||||
this.Database = null;
|
||||
Database.Dispose();
|
||||
Database = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Disco.Services.Plugins
|
||||
|
||||
public void SetCacheability(TimeSpan CacheDuration)
|
||||
{
|
||||
var cache = this.HostController.Response.Cache;
|
||||
var cache = HostController.Response.Cache;
|
||||
cache.SetOmitVaryStar(true);
|
||||
cache.SetExpires(DateTime.Now.Add(CacheDuration));
|
||||
cache.SetValidUntilExpires(true);
|
||||
@@ -76,7 +76,7 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public void SetCacheabilityOff()
|
||||
{
|
||||
var cache = this.HostController.Response.Cache;
|
||||
var cache = HostController.Response.Cache;
|
||||
cache.SetExpires(DateTime.Now.AddDays(-1));
|
||||
cache.SetCacheability(HttpCacheability.NoCache);
|
||||
}
|
||||
@@ -92,37 +92,37 @@ namespace Disco.Services.Plugins
|
||||
{
|
||||
string layoutPath = UseDiscoLayout ? "~/Views/Shared/_Layout.cshtml" : null;
|
||||
|
||||
IView v = new PrecompiledMvcView(this.HostController.Request.Path, layoutPath, typeof(ViewType), false, _viewFileNames);
|
||||
IView v = new PrecompiledMvcView(HostController.Request.Path, layoutPath, typeof(ViewType), false, _viewFileNames);
|
||||
|
||||
if (Model != null)
|
||||
this.HostController.ViewData.Model = Model;
|
||||
HostController.ViewData.Model = Model;
|
||||
|
||||
return new ViewResult { View = v, ViewData = this.HostController.ViewData, TempData = this.HostController.TempData };
|
||||
return new ViewResult { View = v, ViewData = HostController.ViewData, TempData = HostController.TempData };
|
||||
}
|
||||
public ActionResult CompiledView<ViewType>(bool UseDiscoLayout) where ViewType : WebViewPage
|
||||
{
|
||||
return this.CompiledView<ViewType>(null, UseDiscoLayout);
|
||||
return CompiledView<ViewType>(null, UseDiscoLayout);
|
||||
}
|
||||
public ActionResult CompiledView<ViewType>(object Model) where ViewType : WebViewPage
|
||||
{
|
||||
return this.CompiledView<ViewType>(Model, true);
|
||||
return CompiledView<ViewType>(Model, true);
|
||||
}
|
||||
public ActionResult CompiledView<ViewType>() where ViewType : WebViewPage
|
||||
{
|
||||
return this.CompiledView<ViewType>(false, true);
|
||||
return CompiledView<ViewType>(false, true);
|
||||
}
|
||||
public ActionResult CompiledPartialView<ViewType>(object Model) where ViewType : WebViewPage
|
||||
{
|
||||
IView v = new PrecompiledMvcView(this.HostController.Request.Path, typeof(ViewType), false, _viewFileNames);
|
||||
IView v = new PrecompiledMvcView(HostController.Request.Path, typeof(ViewType), false, _viewFileNames);
|
||||
|
||||
if (Model != null)
|
||||
this.HostController.ViewData.Model = Model;
|
||||
HostController.ViewData.Model = Model;
|
||||
|
||||
return new PartialViewResult { View = v, ViewData = this.HostController.ViewData, TempData = this.HostController.TempData };
|
||||
return new PartialViewResult { View = v, ViewData = HostController.ViewData, TempData = HostController.TempData };
|
||||
}
|
||||
public ActionResult CompiledPartialView<ViewType>() where ViewType : WebViewPage
|
||||
{
|
||||
return this.CompiledView<ViewType>();
|
||||
return CompiledView<ViewType>();
|
||||
}
|
||||
|
||||
[Obsolete("Use Generic Methods")]
|
||||
@@ -130,42 +130,42 @@ namespace Disco.Services.Plugins
|
||||
{
|
||||
string layoutPath = UseDiscoLayout ? "~/Views/Shared/_Layout.cshtml" : null;
|
||||
|
||||
IView v = new PrecompiledMvcView(this.HostController.Request.Path, layoutPath, CompiledViewType, false, _viewFileNames);
|
||||
IView v = new PrecompiledMvcView(HostController.Request.Path, layoutPath, CompiledViewType, false, _viewFileNames);
|
||||
|
||||
if (Model != null)
|
||||
this.HostController.ViewData.Model = Model;
|
||||
HostController.ViewData.Model = Model;
|
||||
|
||||
return new ViewResult { View = v, ViewData = this.HostController.ViewData, TempData = this.HostController.TempData };
|
||||
return new ViewResult { View = v, ViewData = HostController.ViewData, TempData = HostController.TempData };
|
||||
}
|
||||
[Obsolete("Use Generic Methods")]
|
||||
public ActionResult CompiledView(Type CompiledViewType, bool UseDiscoLayout)
|
||||
{
|
||||
return this.CompiledView(CompiledViewType, null, UseDiscoLayout);
|
||||
return CompiledView(CompiledViewType, null, UseDiscoLayout);
|
||||
}
|
||||
[Obsolete("Use Generic Methods")]
|
||||
public ActionResult CompiledView(Type CompiledViewType, object Model)
|
||||
{
|
||||
return this.CompiledView(CompiledViewType, Model, true);
|
||||
return CompiledView(CompiledViewType, Model, true);
|
||||
}
|
||||
[Obsolete("Use Generic Methods")]
|
||||
public ActionResult CompiledView(Type CompiledViewType)
|
||||
{
|
||||
return this.CompiledView(CompiledViewType, false, true);
|
||||
return CompiledView(CompiledViewType, false, true);
|
||||
}
|
||||
[Obsolete("Use Generic Methods")]
|
||||
public ActionResult CompiledPartialView(Type PartialCompiledViewType, object Model)
|
||||
{
|
||||
IView v = new PrecompiledMvcView(this.HostController.Request.Path, PartialCompiledViewType, false, _viewFileNames);
|
||||
IView v = new PrecompiledMvcView(HostController.Request.Path, PartialCompiledViewType, false, _viewFileNames);
|
||||
|
||||
if (Model != null)
|
||||
this.HostController.ViewData.Model = Model;
|
||||
HostController.ViewData.Model = Model;
|
||||
|
||||
return new PartialViewResult { View = v, ViewData = this.HostController.ViewData, TempData = this.HostController.TempData };
|
||||
return new PartialViewResult { View = v, ViewData = HostController.ViewData, TempData = HostController.TempData };
|
||||
}
|
||||
[Obsolete("Use Generic Methods")]
|
||||
public ActionResult CompiledPartialView(Type PartialCompiledViewType)
|
||||
{
|
||||
return this.CompiledView(PartialCompiledViewType, null);
|
||||
return CompiledView(PartialCompiledViewType, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -176,11 +176,11 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public ActionResult Content(string content, string contentType)
|
||||
{
|
||||
return this.Content(content, null, null);
|
||||
return Content(content, null, null);
|
||||
}
|
||||
public ActionResult Content(string content)
|
||||
{
|
||||
return this.Content(content, null);
|
||||
return Content(content, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace Disco.Services.Plugins
|
||||
#region File
|
||||
public ActionResult File(Stream fileStream, string contentType)
|
||||
{
|
||||
return this.File(fileStream, contentType, null);
|
||||
return File(fileStream, contentType, null);
|
||||
}
|
||||
public ActionResult File(Stream fileStream, string contentType, string fileDownloadName)
|
||||
{
|
||||
@@ -202,7 +202,7 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public ActionResult File(byte[] fileContents, string contentType)
|
||||
{
|
||||
return this.File(fileContents, contentType, null);
|
||||
return File(fileContents, contentType, null);
|
||||
}
|
||||
public ActionResult File(byte[] fileContents, string contentType, string fileDownloadName)
|
||||
{
|
||||
@@ -217,7 +217,7 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public ActionResult HttpNotFound()
|
||||
{
|
||||
return this.HttpNotFound(null);
|
||||
return HttpNotFound(null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace Disco.Services.Plugins
|
||||
if (string.IsNullOrEmpty(SessionId))
|
||||
throw new ArgumentNullException(SessionId);
|
||||
|
||||
return this.RedirectToAction("TaskStatus", "Logging", "Config", new { id = SessionId });
|
||||
return RedirectToAction("TaskStatus", "Logging", "Config", new { id = SessionId });
|
||||
}
|
||||
public ActionResult Redirect(string url)
|
||||
{
|
||||
@@ -245,7 +245,7 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public ActionResult RedirectToPluginConfiguration()
|
||||
{
|
||||
var routeValues = new RouteValueDictionary(new { PluginId = this.Manifest.Id });
|
||||
var routeValues = new RouteValueDictionary(new { PluginId = Manifest.Id });
|
||||
return new RedirectToRouteResult("Config_Plugins_Configure", routeValues);
|
||||
}
|
||||
public ActionResult RedirectToPluginAction(string PluginAction)
|
||||
@@ -253,17 +253,17 @@ namespace Disco.Services.Plugins
|
||||
if (string.IsNullOrEmpty(PluginAction))
|
||||
throw new ArgumentNullException("PluginAction");
|
||||
|
||||
var routeValues = new RouteValueDictionary(new { PluginId = this.Manifest.Id, PluginAction = PluginAction });
|
||||
string pluginActionUrl = UrlHelper.GenerateUrl("Plugin", null, null, routeValues, RouteTable.Routes, this.HostController.Request.RequestContext, false);
|
||||
var routeValues = new RouteValueDictionary(new { PluginId = Manifest.Id, PluginAction = PluginAction });
|
||||
string pluginActionUrl = UrlHelper.GenerateUrl("Plugin", null, null, routeValues, RouteTable.Routes, HostController.Request.RequestContext, false);
|
||||
|
||||
return new RedirectResult(pluginActionUrl, false);
|
||||
}
|
||||
public ActionResult RedirectToPluginResource(string Resource, bool? Download)
|
||||
{
|
||||
var resourcePath = this.Manifest.WebResourcePath(Resource);
|
||||
var resourcePath = Manifest.WebResourcePath(Resource);
|
||||
|
||||
var routeValues = new RouteValueDictionary(new { PluginId = this.Manifest.Id, res = Resource });
|
||||
string pluginActionUrl = UrlHelper.GenerateUrl("Plugin_Resources", null, null, routeValues, RouteTable.Routes, this.HostController.Request.RequestContext, false);
|
||||
var routeValues = new RouteValueDictionary(new { PluginId = Manifest.Id, res = Resource });
|
||||
string pluginActionUrl = UrlHelper.GenerateUrl("Plugin_Resources", null, null, routeValues, RouteTable.Routes, HostController.Request.RequestContext, false);
|
||||
|
||||
pluginActionUrl += string.Format("?v={0}", resourcePath.Item2);
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public ActionResult RedirectToPluginResource(string Resource)
|
||||
{
|
||||
return this.RedirectToPluginResource(Resource, null);
|
||||
return RedirectToPluginResource(Resource, null);
|
||||
}
|
||||
public ActionResult RedirectToRoute(string routeName, object routeValues)
|
||||
{
|
||||
@@ -290,7 +290,7 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public ActionResult RedirectToRoute(string routeName)
|
||||
{
|
||||
return this.RedirectToRoute(routeName, null);
|
||||
return RedirectToRoute(routeName, null);
|
||||
}
|
||||
public ActionResult RedirectToAction(string actionName, string controller, string areaName, object routeValues)
|
||||
{
|
||||
@@ -309,27 +309,27 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
public ActionResult RedirectToAction(string actionName, string controller, string areaName)
|
||||
{
|
||||
return this.RedirectToAction(actionName, controller, areaName, null);
|
||||
return RedirectToAction(actionName, controller, areaName, null);
|
||||
}
|
||||
public ActionResult RedirectToAction(string actionName, string controller, object routeValues)
|
||||
{
|
||||
return this.RedirectToAction(actionName, controller, null, routeValues);
|
||||
return RedirectToAction(actionName, controller, null, routeValues);
|
||||
}
|
||||
public ActionResult RedirectToAction(string actionName, string controller)
|
||||
{
|
||||
return this.RedirectToAction(actionName, controller, null, null);
|
||||
return RedirectToAction(actionName, controller, null, null);
|
||||
}
|
||||
public ActionResult RedirectToDiscoJob(int jobId)
|
||||
{
|
||||
return this.RedirectToAction("Show", "Job", null, new { id = jobId.ToString() });
|
||||
return RedirectToAction("Show", "Job", null, new { id = jobId.ToString() });
|
||||
}
|
||||
public ActionResult RedirectToDiscoDevice(string DeviceSerialNumber)
|
||||
{
|
||||
return this.RedirectToAction("Show", "Device", null, new { id = DeviceSerialNumber });
|
||||
return RedirectToAction("Show", "Device", null, new { id = DeviceSerialNumber });
|
||||
}
|
||||
public ActionResult RedirectToDiscoUser(string UserId)
|
||||
{
|
||||
return this.RedirectToAction("Show", "User", null, new { id = UserId });
|
||||
return RedirectToAction("Show", "User", null, new { id = UserId });
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Services.Plugins
|
||||
@@ -14,11 +12,11 @@ namespace Disco.Services.Plugins
|
||||
|
||||
public override ActionResult ExecuteAction(string ActionName)
|
||||
{
|
||||
var handlerType = this.GetType();
|
||||
var handlerType = GetType();
|
||||
var methodDescriptor = FindControllerMethod(Manifest, handlerType, ActionName);
|
||||
|
||||
if (methodDescriptor == null)
|
||||
return this.HttpNotFound("Unknown Plugin Method");
|
||||
return HttpNotFound("Unknown Plugin Method");
|
||||
|
||||
// Authorize Method
|
||||
if (methodDescriptor.Authorizers.Length > 0)
|
||||
@@ -36,7 +34,7 @@ namespace Disco.Services.Plugins
|
||||
}
|
||||
}
|
||||
|
||||
var methodParams = BuildMethodParameters(Manifest, handlerType, methodDescriptor.MethodInfo, ActionName, this.HostController);
|
||||
var methodParams = BuildMethodParameters(Manifest, handlerType, methodDescriptor.MethodInfo, ActionName, HostController);
|
||||
|
||||
return (ActionResult)methodDescriptor.MethodInfo.Invoke(this, methodParams);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Services.Plugins
|
||||
{
|
||||
@@ -21,14 +17,14 @@ namespace Disco.Services.Plugins
|
||||
|
||||
public PluginWebViewPage()
|
||||
{
|
||||
var self = this.GetType();
|
||||
this.Manifest = Plugins.GetPlugin(self.Assembly);
|
||||
var self = GetType();
|
||||
Manifest = Plugins.GetPlugin(self.Assembly);
|
||||
|
||||
this._plugin = new Lazy<WebPageHelper<T>>(() => {
|
||||
if (this.Context == null)
|
||||
_plugin = new Lazy<WebPageHelper<T>>(() => {
|
||||
if (Context == null)
|
||||
throw new InvalidOperationException("The WebViewPage Context property is not initialized");
|
||||
|
||||
return new WebPageHelper<T>(this, this.Manifest);
|
||||
return new WebPageHelper<T>(this, Manifest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Services.Logging;
|
||||
using Disco.Services.Logging.Models;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Disco.Services.Plugins
|
||||
{
|
||||
@@ -19,11 +16,11 @@ namespace Disco.Services.Plugins
|
||||
|
||||
public UnknownPluginException(string PluginRequested)
|
||||
{
|
||||
this._pluginRequested = PluginRequested;
|
||||
_pluginRequested = PluginRequested;
|
||||
}
|
||||
public UnknownPluginException(string PluginRequested, string Message) : base(Message)
|
||||
{
|
||||
this._pluginRequested = PluginRequested;
|
||||
_pluginRequested = PluginRequested;
|
||||
}
|
||||
|
||||
public override string Message
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace Disco.Services.Plugins
|
||||
|
||||
protected override void ExecuteTask()
|
||||
{
|
||||
string pluginId = (string)this.ExecutionContext.JobDetail.JobDataMap["PluginId"];
|
||||
string packageFilePath = (string)this.ExecutionContext.JobDetail.JobDataMap["PackageFilePath"];
|
||||
string pluginId = (string)ExecutionContext.JobDetail.JobDataMap["PluginId"];
|
||||
string packageFilePath = (string)ExecutionContext.JobDetail.JobDataMap["PackageFilePath"];
|
||||
|
||||
PluginLibraryManifestV2 libraryManifest;
|
||||
PluginLibraryIncompatibility libraryIncompatibility;
|
||||
@@ -82,13 +82,13 @@ namespace Disco.Services.Plugins
|
||||
|
||||
if (updatePlugins == null || updatePlugins.Count == 0)
|
||||
{
|
||||
this.Status.Finished("No plugins to update...", "/Config/Plugins");
|
||||
Status.Finished("No plugins to update...", "/Config/Plugins");
|
||||
return;
|
||||
}
|
||||
|
||||
ExecuteTaskInternal(this.Status, pluginPackagesLocation, updatePlugins);
|
||||
ExecuteTaskInternal(Status, pluginPackagesLocation, updatePlugins);
|
||||
|
||||
this.Status.Finished("Restarting Disco, please wait...", "/Config/Plugins");
|
||||
Status.Finished("Restarting Disco, please wait...", "/Config/Plugins");
|
||||
Plugins.RestartApp(2500);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,26 +14,26 @@ namespace Disco.Services.Plugins
|
||||
|
||||
protected override void ExecuteTask()
|
||||
{
|
||||
this.Status.UpdateStatus(0, "Updating plugins after Disco update", "Starting, please wait...");
|
||||
Status.UpdateStatus(0, "Updating plugins after Disco update", "Starting, please wait...");
|
||||
|
||||
// Wait for App to Load (10 Seconds)
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
this.Status.UpdateStatus(10 * i);
|
||||
Status.UpdateStatus(10 * i);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
// Update Catalogue
|
||||
using (DiscoDataContext database = new DiscoDataContext())
|
||||
{
|
||||
PluginLibrary.UpdateManifest(database, this.Status);
|
||||
PluginLibrary.UpdateManifest(database, Status);
|
||||
}
|
||||
|
||||
// Update all Plugins
|
||||
UpdatePluginTask.UpdateOffline(this.Status);
|
||||
UpdatePluginTask.UpdateOffline(Status);
|
||||
|
||||
// Restart
|
||||
this.Status.Finished("Restarting Disco, please wait...", "/");
|
||||
Status.Finished("Restarting Disco, please wait...", "/");
|
||||
Plugins.RestartApp(2500);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
using Disco.Services.Web.Bundles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
@@ -25,11 +18,11 @@ namespace Disco.Services.Plugins
|
||||
|
||||
public void IncludeStyleSheet(string Resource)
|
||||
{
|
||||
Context.IncludeStyleSheetResource(Resource, this.Manifest);
|
||||
Context.IncludeStyleSheetResource(Resource, Manifest);
|
||||
}
|
||||
public void IncludeJavaScript(string Resource)
|
||||
{
|
||||
Context.IncludeScriptResource(Resource, this.Manifest);
|
||||
Context.IncludeScriptResource(Resource, Manifest);
|
||||
}
|
||||
|
||||
#region Urls
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Html;
|
||||
|
||||
Reference in New Issue
Block a user