Update: Plugin Functionality Extended

Additional plugin extensions and functionality.
This commit is contained in:
Gary Sharp
2013-04-30 12:50:19 +10:00
parent 2da0b236af
commit 52d57a35c2
10 changed files with 151 additions and 18 deletions
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0411.1608")]
[assembly: AssemblyFileVersion("1.2.0411.1608")]
[assembly: AssemblyVersion("1.2.0429.1616")]
[assembly: AssemblyFileVersion("1.2.0429.1616")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0418.1759")]
[assembly: AssemblyFileVersion("1.2.0418.1759")]
[assembly: AssemblyVersion("1.2.0426.1841")]
[assembly: AssemblyFileVersion("1.2.0426.1841")]
+29 -1
View File
@@ -97,22 +97,50 @@
<Compile Include="Repository\User\UserAttachment.cs" />
<Compile Include="Repository\User\UserDetail.cs" />
<Compile Include="UI\BaseUIModel.cs" />
<Compile Include="UI\Config\DeviceBatch\ConfigDeviceBatchCreateModel.cs" />
<Compile Include="UI\Config\DeviceBatch\ConfigDeviceBatchIndexModel.cs" />
<Compile Include="UI\Config\DeviceBatch\ConfigDeviceBatchIndexModelItem.cs" />
<Compile Include="UI\Config\DeviceBatch\ConfigDeviceBatchShowModel.cs" />
<Compile Include="UI\Config\DeviceBatch\ConfigDeviceBatchTimelineModel.cs" />
<Compile Include="UI\Config\DeviceModel\ConfigDeviceModelIndexModel.cs" />
<Compile Include="UI\Config\DeviceModel\ConfigDeviceModelIndexModelItem.cs" />
<Compile Include="UI\Config\DeviceModel\ConfigDeviceModelShowModelComponents.cs" />
<Compile Include="UI\Config\DeviceModel\ConfigDeviceModelShowModel.cs" />
<Compile Include="UI\Config\DeviceProfile\ConfigDeviceProfileCreateModel.cs" />
<Compile Include="UI\Config\DeviceProfile\ConfigDeviceProfileDefaultsModel.cs" />
<Compile Include="UI\Config\DeviceProfile\ConfigDeviceProfileIndexModel.cs" />
<Compile Include="UI\Config\DeviceProfile\ConfigDeviceProfileIndexModelItem.cs" />
<Compile Include="UI\Config\DeviceProfile\ConfigDeviceProfileShowModel.cs" />
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateCreateModel.cs" />
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateExpressionBrowserModel.cs" />
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateImportStatusModel.cs" />
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateIndexModel.cs" />
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateShowModel.cs" />
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateUndetectedPagesModel.cs" />
<Compile Include="UI\Config\Enrolment\ConfigEnrolmentIndexModel.cs" />
<Compile Include="UI\Config\Enrolment\ConfigEnrolmentStatusModel.cs" />
<Compile Include="UI\Config\Logging\ConfigLoggingIndexModel.cs" />
<Compile Include="UI\Config\Logging\ConfigLoggingTaskStatusModel.cs" />
<Compile Include="UI\Config\Organisation\ConfigOrganisationIndexModel.cs" />
<Compile Include="UI\Device\DeviceAddOfflineModel.cs" />
<Compile Include="UI\Device\DeviceIndexModel.cs" />
<Compile Include="UI\Device\DeviceShowModel.cs" />
<Compile Include="UI\Job\JobCreateModel.cs" />
<Compile Include="UI\Job\JobIndexModel.cs" />
<Compile Include="UI\Job\JobListModel.cs" />
<Compile Include="UI\Job\JobShowModel.cs" />
<Compile Include="UI\Search\SearchQueryModel.cs" />
<Compile Include="UI\User\UserIndexModel.cs" />
<Compile Include="UI\User\UserShowModel.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_StartDate="2011/7/1" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" />
<UserProperties BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_StartDate="2011/7/1" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0411.1908")]
[assembly: AssemblyFileVersion("1.2.0411.1908")]
[assembly: AssemblyVersion("1.2.0430.1219")]
[assembly: AssemblyFileVersion("1.2.0430.1219")]
@@ -64,7 +64,7 @@ namespace Disco.Services.Plugins.CommunityInterop
webRequest = (HttpWebRequest)HttpWebRequest.Create(PluginLibraryUpdateUrl());
webRequest.KeepAlive = false;
webRequest.ContentType = "application/json";
webRequest.ContentType = "application/xml";
webRequest.Method = WebRequestMethods.Http.Post;
webRequest.UserAgent = string.Format("Disco/{0} (PluginLibrary)", DiscoBIVersion);
+2 -1
View File
@@ -140,7 +140,8 @@ namespace Disco.Services.Plugins
Plugins.AddPlugin(packageManifest);
PluginsLog.LogInstalled(packageManifest);
this.Status.Finished("Plugin Installation Completed", string.Format("/Config/Plugins/{0}", System.Web.HttpUtility.UrlEncode(packageManifest.Id)));
this.Status.SetFinishedUrl(string.Format("/Config/Plugins/{0}", System.Web.HttpUtility.UrlEncode(packageManifest.Id)));
this.Status.UpdateStatus(100, "Plugin Installation Completed");
}
}
}
+41 -2
View File
@@ -145,10 +145,14 @@ namespace Disco.Services.Plugins
return ViewPage.DiscoPluginConfigureUrl(manifest);
}
public static HtmlString DiscoPluginConfigureUrl<T>(this WebViewPage<T> ViewPage, PluginManifest manifest)
{
return new HtmlString(ViewPage.ViewContext.RequestContext.DiscoPluginConfigureUrl(manifest));
}
public static string DiscoPluginConfigureUrl(this RequestContext RequestContext, PluginManifest manifest)
{
var routeValues = new RouteValueDictionary(new { PluginId = manifest.Id });
string pluginActionUrl = UrlHelper.GenerateUrl("Config_Plugins_Configure", null, null, routeValues, RouteTable.Routes, ViewPage.ViewContext.RequestContext, false);
return new HtmlString(pluginActionUrl);
string pluginActionUrl = UrlHelper.GenerateUrl("Config_Plugins_Configure", null, null, routeValues, RouteTable.Routes, RequestContext, false);
return pluginActionUrl;
}
public static MvcForm DiscoPluginActionBeginForm<T>(this WebViewPage<T> ViewPage, string PluginAction, FormMethod method, IDictionary<string, object> htmlAttributes)
{
@@ -203,7 +207,42 @@ namespace Disco.Services.Plugins
}
public static void DiscoPluginRegisterStylesheet<T>(this WebViewPage<T> ViewPage, string Resource)
{
if (string.IsNullOrEmpty(Resource))
throw new ArgumentNullException("Resource");
// Find Plugin
var pageType = ViewPage.GetType();
var pageAssembly = pageType.Assembly;
var manifest = Plugins.GetPlugin(pageAssembly);
ViewPage.DiscoPluginRegisterStylesheet(Resource, manifest);
}
public static void DiscoPluginRegisterStylesheet<T>(this WebViewPage<T> ViewPage, string Resource, PluginManifest manifest)
{
ViewPage.ViewContext.RequestContext.DiscoPluginRegisterStylesheet(Resource, manifest);
}
public static void DiscoPluginRegisterStylesheet(this RequestContext RequestContext, string Resource, PluginManifest manifest)
{
var resourcePath = manifest.WebResourcePath(Resource);
var routeValues = new RouteValueDictionary(new { PluginId = manifest.Id, res = Resource });
string pluginResourceUrl = UrlHelper.GenerateUrl("Plugin_Resources", null, null, routeValues, RouteTable.Routes, RequestContext, false);
pluginResourceUrl += string.Format("?v={0}", resourcePath.Item2);
HtmlString pluginResourceUrlHtml = new HtmlString(pluginResourceUrl);
var deferredBundles = RequestContext.HttpContext.Items["Bundles.UIExtensionCss"] as List<HtmlString>;
if (deferredBundles == null)
{
deferredBundles = new List<HtmlString>();
HttpContext.Current.Items["Bundles.UIExtensionCss"] = deferredBundles;
}
if (!deferredBundles.Contains(pluginResourceUrlHtml))
deferredBundles.Add(pluginResourceUrlHtml);
}
#endregion
}
+65 -4
View File
@@ -125,6 +125,62 @@ namespace Disco.Services.Plugins
return manifest;
}
private static Lazy<IReadOnlyCollection<string>> pluginExcludedAssemblies = new Lazy<IReadOnlyCollection<string>>(() =>
{
return new List<string>()
{
"BitMiracle.LibTiff.NET",
"C5",
"Common.Logging",
"DiffieHellman",
"Disco.BI",
"Disco.Data",
"Disco.Models",
"Disco.Services",
"Disco.Web",
"Disco.Web.Extensions",
"DotNet.Highcharts",
"EntityFramework",
"itextsharp",
"Microsoft.Web.Infrastructure",
"Newtonsoft.Json",
"Org.Mentalis.Security",
"Quartz",
"RazorGenerator.Mvc",
"SignalR",
"SignalR.Hosting.AspNet",
"SignalR.Hosting.Common",
"Spring.Core",
"System.Data.SqlServerCe",
"System.Data.SqlServerCe.Entity",
"System.Net.Http.Formatting",
"System.Reactive.Core",
"System.Reactive.Interfaces",
"System.Reactive.Linq",
"System.Reactive.PlatformServices",
"System.Web.Helpers",
"System.Web.Http",
"System.Web.Http.WebHost",
"System.Web.Mvc",
"System.Web.Razor",
"System.Web.WebPages.Deployment",
"System.Web.WebPages",
"System.Web.WebPages.Razor",
"T4MVCExtensions",
"Tamir.SharpSSH",
"WebActivatorEx",
"zxing"
};
});
public static IReadOnlyCollection<string> PluginExcludedAssemblies
{
get
{
return pluginExcludedAssemblies.Value;
}
}
/// <summary>
/// Uses reflection to build a Plugin Manifest
/// </summary>
@@ -173,16 +229,21 @@ namespace Disco.Services.Plugins
select type).FirstOrDefault();
Dictionary<string, string> pluginAssemblyReferences = new Dictionary<string, string>();
foreach (string referenceFilename in Directory.EnumerateFiles(pluginLocation, "*.dll", SearchOption.TopDirectoryOnly))
{
if (!referenceFilename.Equals(assembly.Location, StringComparison.InvariantCultureIgnoreCase))
{
try
// Ignore Excluded Assemblies
if (!PluginExcludedAssemblies.Contains(Path.GetFileNameWithoutExtension(referenceFilename)))
{
Assembly pluginRefAssembly = Assembly.ReflectionOnlyLoadFrom(referenceFilename);
pluginAssemblyReferences[pluginRefAssembly.FullName] = referenceFilename.Substring(pluginLocation.Length + 1);
try
{
Assembly pluginRefAssembly = Assembly.ReflectionOnlyLoadFrom(referenceFilename);
pluginAssemblyReferences[pluginRefAssembly.FullName] = referenceFilename.Substring(pluginLocation.Length + 1);
}
catch (Exception) { } // Ignore Load Exceptions
}
catch (Exception) { } // Ignore Load Exceptions
}
}
+5 -1
View File
@@ -22,7 +22,6 @@ namespace Disco.Services.Plugins
// Nothing in Base Class
}
#region Action Results
#region Compiled View
@@ -139,6 +138,11 @@ namespace Disco.Services.Plugins
return new RedirectResult(url, true);
}
public ActionResult RedirectToPluginConfiguration()
{
var routeValues = new RouteValueDictionary(new { PluginId = this.Manifest.Id });
return new RedirectToRouteResult("Config_Plugins_Configure", routeValues);
}
public ActionResult RedirectToPluginAction(string PluginAction)
{
if (string.IsNullOrEmpty(PluginAction))
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0411.1843")]
[assembly: AssemblyFileVersion("1.2.0411.1843")]
[assembly: AssemblyVersion("1.2.0430.1219")]
[assembly: AssemblyFileVersion("1.2.0430.1219")]