Update: Plugin Framework

This commit is contained in:
Gary Sharp
2013-03-04 20:55:14 +11:00
parent 9b80fd743b
commit c205386bcf
18 changed files with 172 additions and 77 deletions
@@ -34,41 +34,36 @@ namespace Disco.Web.Areas.Config.Models.Plugins
}
}
public List<Tuple<Type, List<PluginManifest>>> PluginManifestsByType
public List<Tuple<Type, List<PluginManifest>>> PluginManifestsByCategory
{
get
{
if (PluginManifests.Count == 0)
return new List<Tuple<Type, List<PluginManifest>>>();
return null;
var categorisedManifests = PluginManifests.SelectMany(pm => pm.Features)
.GroupBy(fm => fm.CategoryType)
.Select(g => new Tuple<Type, List<PluginManifest>>(g.Key, g.Select(fm => fm.PluginManifest).Distinct().OrderBy(fm => fm.Name).ToList())).ToList();
// Ensure all plugins are represented
var allCategorisedManifests = categorisedManifests.SelectMany(g => g.Item2).ToList();
var unrepresentedPlugins = PluginManifests.Where(m => !allCategorisedManifests.Contains(m)).ToList();
if (unrepresentedPlugins.Count > 0)
List<Tuple<Type, PluginManifest>> pluginsByCategory = new List<Tuple<Type, PluginManifest>>();
foreach (var pluginManifest in PluginManifests)
{
Tuple<Type, List<PluginManifest>> otherCategory = null;
foreach (var category in categorisedManifests)
{
if (category.Item1 == typeof(OtherFeature))
{
otherCategory = category;
}
}
if (otherCategory == null)
{
otherCategory = new Tuple<Type, List<PluginManifest>>(typeof(OtherFeature), new List<PluginManifest>());
categorisedManifests.Add(otherCategory);
}
foreach (var pluginManifest in unrepresentedPlugins)
otherCategory.Item2.Add(pluginManifest);
var orderedFeatures = pluginManifest.Features.OrderBy(pf => pf.Id);
var primaryFeature = orderedFeatures.Where(pf => pf.PrimaryFeature).FirstOrDefault();
Type categoryType;
if (primaryFeature == null)
primaryFeature = orderedFeatures.FirstOrDefault();
if (primaryFeature == null)
categoryType = typeof(OtherFeature);
else
categoryType = primaryFeature.CategoryType;
pluginsByCategory.Add(new Tuple<Type, PluginManifest>(categoryType, pluginManifest));
}
return categorisedManifests;
return pluginsByCategory.GroupBy(p => p.Item1)
.OrderBy(g => g.Key.Name)
.Select(g => new Tuple<Type, List<PluginManifest>>(g.Key, g.Select(pg => pg.Item2).OrderBy(p => p.Name).ToList())).ToList();
}
}
}
@@ -13,7 +13,7 @@
}
else
{
var pluginGroups = Model.PluginManifestsByType;
var pluginGroups = Model.PluginManifestsByCategory;
int itemsPerColumn = pluginGroups.Count / 3;
@@ -38,7 +38,7 @@
<h3>@pluginDefinition.Name</h3>
</a>
<div class="pageMenuBlurb">
<span class="pluginId">@pluginDefinition.Id</span> | <span class="pluginVersion">v@(pluginDefinition.VersionFormatted)</span> | @pluginDefinition.Author | <a href="@pluginDefinition.Url" target="_blank">More Information</a>
<span class="pluginVersion">v@(pluginDefinition.VersionFormatted)</span> | @pluginDefinition.Author | <a href="@pluginDefinition.Url" target="_blank">More Information</a>
</div>
}
</div>
@@ -37,9 +37,9 @@ namespace Disco.Web.Areas.Config.Views.Plugins
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Plugins/Index.cshtml")]
public class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Plugins.IndexViewModel>
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Plugins.IndexViewModel>
{
public Index()
{
@@ -88,7 +88,7 @@ WriteLiteral(">\r\n <h2>No Plugins are Installed</h2>\r\n </di
}
else
{
var pluginGroups = Model.PluginManifestsByType;
var pluginGroups = Model.PluginManifestsByCategory;
int itemsPerColumn = pluginGroups.Count / 3;
@@ -169,14 +169,14 @@ WriteLiteral("</h2>\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1435), Tuple.Create("\"", 1504)
WriteAttribute("href", Tuple.Create(" href=\"", 1439), Tuple.Create("\"", 1508)
#line 37 "..\..\Areas\Config\Views\Plugins\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1442), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Configure(pluginDefinition.Id))
, Tuple.Create(Tuple.Create("", 1446), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Configure(pluginDefinition.Id))
#line default
#line hidden
, 1442), false)
, 1446), false)
);
WriteLiteral(">\r\n <h3>");
@@ -196,26 +196,13 @@ WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"pluginId\"");
WriteLiteral(">");
#line 41 "..\..\Areas\Config\Views\Plugins\Index.cshtml"
Write(pluginDefinition.Id);
#line default
#line hidden
WriteLiteral("</span> | <span");
WriteLiteral(" class=\"pluginVersion\"");
WriteLiteral(">v");
#line 41 "..\..\Areas\Config\Views\Plugins\Index.cshtml"
Write(pluginDefinition.VersionFormatted);
Write(pluginDefinition.VersionFormatted);
#line default
@@ -224,21 +211,21 @@ WriteLiteral("</span> | ");
#line 41 "..\..\Areas\Config\Views\Plugins\Index.cshtml"
Write(pluginDefinition.Author);
Write(pluginDefinition.Author);
#line default
#line hidden
WriteLiteral(" | <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1885), Tuple.Create("\"", 1913)
WriteAttribute("href", Tuple.Create(" href=\"", 1836), Tuple.Create("\"", 1864)
#line 41 "..\..\Areas\Config\Views\Plugins\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1892), Tuple.Create<System.Object, System.Int32>(pluginDefinition.Url
, Tuple.Create(Tuple.Create("", 1843), Tuple.Create<System.Object, System.Int32>(pluginDefinition.Url
#line default
#line hidden
, 1892), false)
, 1843), false)
);
WriteLiteral(" target=\"_blank\"");
+7
View File
@@ -731,6 +731,13 @@ div.logEventsViewport table.logEventsViewport > tbody > tr > td.eventType {
#plugins .pageMenuArea a > h3:hover {
color: #4f81bd;
}
#plugins .pageMenuArea .pageMenuBlurb {
padding-left: 18px;
}
#plugins #pageMenu td .pageMenuArea:not(:last-child) {
padding-bottom: 5px;
margin-bottom: 10px;
}
#plugins #pageMenu td .pageMenuArea > a {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB90CDRcZMTlpMjsAAAKbSURBVDjLbZHBS2NHHMc/82ZeXpLaiNJHDylF6KEIGxFa0Jtdi4IFqfQq2P/As4f9D0rwplIwsDlZiofHStaTVQJCj+6a9SpKL3HhkTx5cZLMTA9uHov4Pf2Y33w/fL8z4vj4mHfv3vNUHz60ouXl5VmtNScnJ3eVmZkfn96ZqVRQj6P7HXj56VwAFAqFsenp6W+73S7NZjMRUH/iPwVqnwC8nJ2drU9NTb3I5XIDpVS6u7v7qlQqEQQBxWLxq83NzX+EEIUkSYJ8Pj+xs7Pz0+cAyuXyTqPR+F5KiTEGrTVCCHzfR2v99d7eXg3AGMPGxsZb4CPwWEEIAUC73ebm5gYhBKVSiTiOcc4RBAHn5+dYa9Fas76+nvXIEvi+jzEG5xyrq6vEcczV1RW+77O2tka73WZ/f58wDHHOZQBvNEgp6ff7hGHI4eEhSinOzs64uLjg+vqaWq3GYDBASom19vkEWmuMMYyPjxNFEUtLS1hrOTg4wBiD53k4554HeJ6H1pp+v59VaTQaWGuRUqKUYjAYADwPcM6Rpim9Xg9jDFJKgiBASokQAuccDw8P5PP5ZwHOOUe1WsU5hxACz/Oy3xlplCZJkmw3Apw2m81fx8bGEEJkFay12YuPDMPhkDiOvwP+/gwgXhtjTq21Yb/fTyuVysPt7e3PW1tbf/q+T7Va/U0p9b7VahW11vlOp3Pt53JtAOI4RimFUgohRG5+fv6Po6Ojf7e3twcLCwtucXHR1ev1NIqiN3Nzc6+klEUpJVJK7u/vEXEcE4YhgJBSfjE5OfnDysrKX4VC4ctSqdQCXKfTedHr9T5GUfRLmqb/DYfDBDB3d3ePgJGSJOHy8pJOt4vneQS5HABaa6xzfFMuUy6XmZiYyDz/AxHBRmZKLqH0AAAAAElFTkSuQmCC) /*Images/Actions/pluginDownloadIcon16.png*/;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.0225.1951")]
[assembly: AssemblyFileVersion("1.2.0225.1951")]
[assembly: AssemblyVersion("1.2.0304.2046")]
[assembly: AssemblyFileVersion("1.2.0304.2046")]