Gets sln building, removes old legacy settings, removes ascx dashboard support
This commit is contained in:
@@ -8,25 +8,6 @@ namespace Umbraco.Core.Configuration.Dashboard
|
||||
|
||||
internal class ControlElement : RawXmlConfigurationElement, IDashboardControl
|
||||
{
|
||||
public bool ShowOnce
|
||||
{
|
||||
get
|
||||
{
|
||||
return RawXml.Attribute("showOnce") == null
|
||||
? false
|
||||
: bool.Parse(RawXml.Attribute("showOnce").Value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool AddPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
return RawXml.Attribute("addPanel") == null
|
||||
? true
|
||||
: bool.Parse(RawXml.Attribute("addPanel").Value);
|
||||
}
|
||||
}
|
||||
|
||||
public string PanelCaption
|
||||
{
|
||||
@@ -37,7 +18,6 @@ namespace Umbraco.Core.Configuration.Dashboard
|
||||
: RawXml.Attribute("panelCaption").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public AccessElement Access
|
||||
{
|
||||
get
|
||||
@@ -66,9 +46,6 @@ namespace Umbraco.Core.Configuration.Dashboard
|
||||
}
|
||||
|
||||
|
||||
IAccess IDashboardControl.AccessRights
|
||||
{
|
||||
get { return Access; }
|
||||
}
|
||||
IAccess IDashboardControl.AccessRights => Access;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
{
|
||||
public interface IDashboardControl
|
||||
{
|
||||
bool ShowOnce { get; }
|
||||
|
||||
bool AddPanel { get; }
|
||||
|
||||
string PanelCaption { get; }
|
||||
|
||||
string ControlPath { get; }
|
||||
|
||||
@@ -1,204 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
{
|
||||
/// <summary>
|
||||
/// This reads in the manifests and stores some definitions in memory so we can look them on the server side
|
||||
/// </summary>
|
||||
internal class ManifestBuilder
|
||||
{
|
||||
private readonly IRuntimeCacheProvider _runtimeCache;
|
||||
private readonly ManifestParser _parser;
|
||||
|
||||
public ManifestBuilder(IRuntimeCacheProvider cache, ManifestParser parser)
|
||||
{
|
||||
_runtimeCache = cache;
|
||||
_parser = parser;
|
||||
}
|
||||
|
||||
public const string GridEditorsKey = "gridEditors";
|
||||
public const string PropertyEditorsKey = "propertyEditors";
|
||||
public const string ParameterEditorsKey = "parameterEditors";
|
||||
public const string DashboardsKey = "dashboards";
|
||||
|
||||
/// <summary>
|
||||
/// Returns all grid editors found in the manfifests
|
||||
/// </summary>
|
||||
internal IEnumerable<GridEditor> GridEditors
|
||||
{
|
||||
get
|
||||
{
|
||||
return _runtimeCache.GetCacheItem<IEnumerable<GridEditor>>(
|
||||
typeof (ManifestBuilder) + GridEditorsKey,
|
||||
() =>
|
||||
{
|
||||
var editors = new List<GridEditor>();
|
||||
foreach (var manifest in _parser.GetManifests())
|
||||
{
|
||||
if (manifest.GridEditors != null)
|
||||
{
|
||||
editors.AddRange(ManifestParser.GetGridEditors(manifest.GridEditors));
|
||||
}
|
||||
|
||||
}
|
||||
return editors;
|
||||
}, new TimeSpan(0, 10, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all property editors found in the manfifests
|
||||
/// </summary>
|
||||
internal IEnumerable<PropertyEditor> PropertyEditors
|
||||
{
|
||||
get
|
||||
{
|
||||
return _runtimeCache.GetCacheItem<IEnumerable<PropertyEditor>>(
|
||||
typeof(ManifestBuilder) + PropertyEditorsKey,
|
||||
() =>
|
||||
{
|
||||
var editors = new List<PropertyEditor>();
|
||||
foreach (var manifest in _parser.GetManifests())
|
||||
{
|
||||
if (manifest.PropertyEditors != null)
|
||||
{
|
||||
editors.AddRange(ManifestParser.GetPropertyEditors(manifest.PropertyEditors));
|
||||
}
|
||||
|
||||
}
|
||||
return editors;
|
||||
}, new TimeSpan(0, 10, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all parameter editors found in the manfifests and all property editors that are flagged to be parameter editors
|
||||
/// </summary>
|
||||
internal IEnumerable<ParameterEditor> ParameterEditors
|
||||
{
|
||||
get
|
||||
{
|
||||
return _runtimeCache.GetCacheItem<IEnumerable<ParameterEditor>>(
|
||||
typeof (ManifestBuilder) + ParameterEditorsKey,
|
||||
() =>
|
||||
{
|
||||
var editors = new List<ParameterEditor>();
|
||||
foreach (var manifest in _parser.GetManifests())
|
||||
{
|
||||
if (manifest.ParameterEditors != null)
|
||||
{
|
||||
editors.AddRange(ManifestParser.GetParameterEditors(manifest.ParameterEditors));
|
||||
}
|
||||
}
|
||||
return editors;
|
||||
}, new TimeSpan(0, 10, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all dashboards found in the manfifests
|
||||
/// </summary>
|
||||
internal IDictionary<string, Section> Dashboards
|
||||
{
|
||||
get
|
||||
{
|
||||
//TODO: Need to integrate the security with the manifest dashboards
|
||||
|
||||
return _runtimeCache.GetCacheItem<IDictionary<string, Section>>(
|
||||
typeof(ManifestBuilder) + DashboardsKey,
|
||||
() =>
|
||||
{
|
||||
var dashboards = new Dictionary<string, Section>();
|
||||
foreach (var manifest in _parser.GetManifests())
|
||||
{
|
||||
if (manifest.Dashboards != null)
|
||||
{
|
||||
var converted = manifest.Dashboards.ToDictionary(x => x.Key, x => x.Value.ToObject<Section>());
|
||||
foreach (var item in converted)
|
||||
{
|
||||
Section existing;
|
||||
if (dashboards.TryGetValue(item.Key, out existing))
|
||||
{
|
||||
foreach (var area in item.Value.Areas)
|
||||
{
|
||||
if (existing.Areas.Contains(area, StringComparer.InvariantCultureIgnoreCase) == false)
|
||||
existing.Areas.Add(area);
|
||||
}
|
||||
|
||||
//merge
|
||||
foreach (var tab in item.Value.Tabs)
|
||||
{
|
||||
Tab existingTab;
|
||||
if (existing.Tabs.TryGetValue(tab.Key, out existingTab))
|
||||
{
|
||||
//merge
|
||||
foreach (var control in tab.Value.Controls)
|
||||
{
|
||||
existingTab.Controls.Add(control);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
existing.Tabs[tab.Key] = tab.Value;
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
dashboards[item.Key] = item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dashboards;
|
||||
}, new TimeSpan(0, 10, 0));
|
||||
}
|
||||
}
|
||||
|
||||
#region Internal manifest models
|
||||
internal class Section
|
||||
{
|
||||
public Section()
|
||||
{
|
||||
Areas = new List<string>();
|
||||
Tabs = new Dictionary<string, Tab>();
|
||||
}
|
||||
[JsonProperty("areas")]
|
||||
public List<string> Areas { get; set; }
|
||||
[JsonProperty("tabs")]
|
||||
public IDictionary<string, Tab> Tabs { get; set; }
|
||||
}
|
||||
|
||||
internal class Tab
|
||||
{
|
||||
public Tab()
|
||||
{
|
||||
Controls = new List<Control>();
|
||||
Index = int.MaxValue; //default so we can check if this value has been explicitly set
|
||||
}
|
||||
[JsonProperty("controls")]
|
||||
public List<Control> Controls { get; set; }
|
||||
[JsonProperty("index")]
|
||||
public int Index { get; set; }
|
||||
}
|
||||
|
||||
internal class Control
|
||||
{
|
||||
[JsonProperty("path")]
|
||||
public string Path { get; set; }
|
||||
[JsonProperty("caption")]
|
||||
public string Caption { get; set; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
{
|
||||
public class ManifestDashboardControl
|
||||
{
|
||||
[JsonProperty("path")]
|
||||
public string Path { get; set; }
|
||||
|
||||
[JsonProperty("caption")]
|
||||
public string Caption { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
{
|
||||
public class ManifestDashboardSection
|
||||
{
|
||||
public ManifestDashboardSection()
|
||||
{
|
||||
Areas = new List<string>();
|
||||
Tabs = new Dictionary<string, ManifestDashboardTab>();
|
||||
}
|
||||
|
||||
[JsonProperty("areas")]
|
||||
public List<string> Areas { get; set; }
|
||||
|
||||
[JsonProperty("tabs")]
|
||||
public IDictionary<string, ManifestDashboardTab> Tabs { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Umbraco.Core.Manifest
|
||||
{
|
||||
public class ManifestDashboardTab
|
||||
{
|
||||
public ManifestDashboardTab()
|
||||
{
|
||||
Controls = new List<ManifestDashboardControl>();
|
||||
Index = int.MaxValue; //default so we can check if this value has been explicitly set
|
||||
}
|
||||
|
||||
[JsonProperty("controls")]
|
||||
public List<ManifestDashboardControl> Controls { get; set; }
|
||||
|
||||
[JsonProperty("index")]
|
||||
public int Index { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,7 @@ namespace Umbraco.Core.Manifest
|
||||
var parameterEditors = new List<IDataEditor>();
|
||||
var gridEditors = new List<GridEditor>();
|
||||
var contentApps = new List<IContentAppDefinition>();
|
||||
var dashboards = new Dictionary<string, ManifestDashboardSection>();
|
||||
|
||||
foreach (var manifest in manifests)
|
||||
{
|
||||
@@ -109,6 +110,35 @@ namespace Umbraco.Core.Manifest
|
||||
if (manifest.ParameterEditors != null) parameterEditors.AddRange(manifest.ParameterEditors);
|
||||
if (manifest.GridEditors != null) gridEditors.AddRange(manifest.GridEditors);
|
||||
if (manifest.ContentApps != null) contentApps.AddRange(manifest.ContentApps);
|
||||
if (manifest.Dashboards != null)
|
||||
{
|
||||
foreach (var item in manifest.Dashboards)
|
||||
{
|
||||
if (dashboards.TryGetValue(item.Key, out var existing))
|
||||
{
|
||||
foreach (var area in item.Value.Areas)
|
||||
if (existing.Areas.Contains(area, StringComparer.InvariantCultureIgnoreCase) == false)
|
||||
existing.Areas.Add(area);
|
||||
|
||||
//merge
|
||||
foreach (var tab in item.Value.Tabs)
|
||||
{
|
||||
if (existing.Tabs.TryGetValue(tab.Key, out var existingTab))
|
||||
{
|
||||
//merge
|
||||
foreach (var control in tab.Value.Controls)
|
||||
{
|
||||
existingTab.Controls.Add(control);
|
||||
}
|
||||
}
|
||||
else
|
||||
existing.Tabs[tab.Key] = tab.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
dashboards[item.Key] = item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new PackageManifest
|
||||
@@ -118,7 +148,8 @@ namespace Umbraco.Core.Manifest
|
||||
PropertyEditors = propertyEditors.ToArray(),
|
||||
ParameterEditors = parameterEditors.ToArray(),
|
||||
GridEditors = gridEditors.ToArray(),
|
||||
ContentApps = contentApps.ToArray()
|
||||
ContentApps = contentApps.ToArray(),
|
||||
Dashboards = dashboards
|
||||
};
|
||||
}
|
||||
|
||||
@@ -151,6 +182,7 @@ namespace Umbraco.Core.Manifest
|
||||
var manifest = JsonConvert.DeserializeObject<PackageManifest>(text,
|
||||
new DataEditorConverter(_logger),
|
||||
new ValueValidatorConverter(_validators),
|
||||
//TODO: DO i need a dashboard one?
|
||||
new ContentAppDefinitionConverter());
|
||||
|
||||
// scripts and stylesheets are raw string, must process here
|
||||
@@ -165,6 +197,8 @@ namespace Umbraco.Core.Manifest
|
||||
if (ppEditors.Count > 0)
|
||||
manifest.ParameterEditors = manifest.ParameterEditors.Union(ppEditors).ToArray();
|
||||
|
||||
//TODO: Do we need to deal with dashboards or are they auto parsed?
|
||||
|
||||
return manifest;
|
||||
}
|
||||
|
||||
@@ -173,5 +207,6 @@ namespace Umbraco.Core.Manifest
|
||||
{
|
||||
return JsonConvert.DeserializeObject<IEnumerable<GridEditor>>(text);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core.Models.ContentEditing;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
|
||||
@@ -32,6 +33,9 @@ namespace Umbraco.Core.Manifest
|
||||
/// <summary>
|
||||
/// The dictionary of dashboards
|
||||
/// </summary>
|
||||
public IDictionary<string, JObject> Dashboards { get; set; }
|
||||
[JsonProperty("dashboards")]
|
||||
public IReadOnlyDictionary<string, ManifestDashboardSection> Dashboards { get; set; } = new Dictionary<string, ManifestDashboardSection>();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Umbraco.Core.Models.Membership;
|
||||
|
||||
namespace Umbraco.Core.Models.ContentEditing
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Represents a content app definition.
|
||||
/// </summary>
|
||||
|
||||
@@ -335,6 +335,9 @@
|
||||
<Compile Include="Logging\Serilog\Enrichers\Log4NetLevelMapperEnricher.cs" />
|
||||
<Compile Include="Manifest\ContentAppDefinitionConverter.cs" />
|
||||
<Compile Include="Manifest\ManifestContentAppDefinition.cs" />
|
||||
<Compile Include="Manifest\ManifestDashboardControl.cs" />
|
||||
<Compile Include="Manifest\ManifestDashboardSection.cs" />
|
||||
<Compile Include="Manifest\ManifestDashboardTab.cs" />
|
||||
<Compile Include="Migrations\IncompleteMigrationExpressionException.cs" />
|
||||
<Compile Include="Migrations\MigrationBase_Extra.cs" />
|
||||
<Compile Include="Migrations\Upgrade\V_7_10_0\RenamePreviewFolder.cs" />
|
||||
|
||||
Reference in New Issue
Block a user