Skip to content

Commit

Permalink
Release v.14.3.8000.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SFBuild committed Oct 28, 2022
1 parent 39b0d5f commit e6c8448
Show file tree
Hide file tree
Showing 31 changed files with 1,212 additions and 9,939 deletions.
Binary file modified AssemblyInfoShare/SharedAssemblyInfo.cs
Binary file not shown.
Expand Up @@ -44,6 +44,15 @@
<PropertyGroup>
<DelaySign>true</DelaySign>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug Headless|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -78,23 +87,20 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\snk\PublicKey.snk">
<Link>PublicKey.snk</Link>
</None>
<None Include="OpenAccessNuGet.targets" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="Telerik.Sitefinity.Model">
<HintPath>..\packages\Telerik.Sitefinity.Core.14.2.7900\lib\net48\Telerik.Sitefinity.Model.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.14.3.8000\lib\net48\Telerik.Sitefinity.Model.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Telerik.Sitefinity">
<HintPath>..\packages\Telerik.Sitefinity.Core.14.2.7900\lib\net48\Telerik.Sitefinity.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.14.3.8000\lib\net48\Telerik.Sitefinity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Telerik.Sitefinity.Utilities">
<HintPath>..\packages\Telerik.Sitefinity.Core.14.2.7900\lib\net48\Telerik.Sitefinity.Utilities.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.14.3.8000\lib\net48\Telerik.Sitefinity.Utilities.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Telerik.Sitefinity.Frontend.Data/packages.config
Expand Up @@ -2,5 +2,5 @@
<packages>
<package id="Telerik.DataAccess.Core" version="2020.0.428.1" targetFramework="net471" />
<package id="Telerik.DataAccess.Fluent" version="2020.0.428.1" targetFramework="net471" developmentDependency="true" />
<package id="Telerik.Sitefinity.Core" version="14.2.7900" targetFramework="net45" />
<package id="Telerik.Sitefinity.Core" version="14.3.8000" targetFramework="net48" />
</packages>
19 changes: 19 additions & 0 deletions Telerik.Sitefinity.Frontend/ControllerProvider.cs
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers;
using Telerik.Sitefinity.Mvc.Store;

namespace Telerik.Sitefinity.Frontend
{
internal class ControllerProvider : IControllerProvider
{
public IEnumerable<Type> GetControllers()
{
var controllerContainerInitializer = new ControllerContainerInitializer();
return controllerContainerInitializer.GetControllers();
}
}
}
7 changes: 7 additions & 0 deletions Telerik.Sitefinity.Frontend/FrontendModule.cs
Expand Up @@ -10,9 +10,16 @@
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Data;
using Telerik.Sitefinity.Frontend;
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers;
using Telerik.Sitefinity.Services;

[assembly: SitefinityModule(FrontendModule.ModuleName,
typeof(FrontendModule),
"Feather",
"Modern, intuitive, convention based, mobile-first UI for Progress Sitefinity CMS.",
StartupType.OnApplicationStart)]

namespace Telerik.Sitefinity.Frontend
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Telerik.Sitefinity.Frontend/FrontendModuleInstaller.cs
Expand Up @@ -130,7 +130,7 @@ private static void ClearToolboxItems()
private static void RemoveToolboxItemIfExists(ToolboxSection mvcWidgetsSection, string toolName)
{
var tool = mvcWidgetsSection.Tools.FirstOrDefault<ToolboxItem>(t => t.Name == toolName);
if (tool != null)
if (tool != null && tool.Source == ConfigSource.Database)
mvcWidgetsSection.Tools.Remove(tool);
}

Expand Down
33 changes: 0 additions & 33 deletions Telerik.Sitefinity.Frontend/FrontendModuleUninstaller.cs
Expand Up @@ -32,39 +32,6 @@ public static void Unload(IEnumerable<IInitializer> initializers)
public static void Uninstall(IEnumerable<IInitializer> initializers)
{
FrontendModuleUninstaller.Uninitialize(initializers);

var featherWidgetTypes = new List<string>();
var configManager = ConfigManager.GetManager();
var toolboxesConfig = configManager.GetSection<ToolboxesConfig>();

foreach (var toolbox in toolboxesConfig.Toolboxes.Values)
{
ICollection<ToolboxSection> emptySections = new List<ToolboxSection>();
foreach (var section in toolbox.Sections)
{
var featherWidgets = ((ICollection<ToolboxItem>)section.Tools)
.Where(i =>
i.ControlType.StartsWith("Telerik.Sitefinity.Frontend", StringComparison.Ordinal) ||
(!i.ControllerType.IsNullOrEmpty() && i.ControllerType.StartsWith("Telerik.Sitefinity.Frontend", StringComparison.Ordinal)));
featherWidgetTypes.AddRange(featherWidgets.Select(t => t.ControllerType));

var mvcToolsToDelete = featherWidgets.Select(i => i.GetKey());
foreach (var key in mvcToolsToDelete)
{
section.Tools.Remove(section.Tools.Elements.SingleOrDefault(e => e.GetKey() == key));
}

if (section.Tools.Count == 0)
emptySections.Add(section);
}

foreach (var emptySection in emptySections)
{
toolbox.Sections.Remove(emptySection);
}
}

configManager.SaveSection(toolboxesConfig);
}

// Called both by Unload and Uninstall
Expand Down
10 changes: 6 additions & 4 deletions Telerik.Sitefinity.Frontend/FrontendModuleUpgrader.cs
Expand Up @@ -87,7 +87,7 @@ private static void DeleteOldGridSection()
if (layoutsToolbox != null)
{
var htmlLayoutsSection = layoutsToolbox.Sections.FirstOrDefault<ToolboxSection>(s => s.Name == "HtmlLayouts");
if (htmlLayoutsSection != null)
if (htmlLayoutsSection != null && htmlLayoutsSection.Source == ConfigSource.Database)
{
layoutsToolbox.Sections.Remove(htmlLayoutsSection);
configManager.SaveSection(toolboxConfig);
Expand Down Expand Up @@ -147,12 +147,13 @@ private static void RemoveMvcWidgetToolboxItems()
var widgets = section.Tools.Where<ToolboxItem>(t => t.ControllerType.StartsWith("Telerik.Sitefinity.Frontend.", StringComparison.Ordinal) && !t.ControllerType.StartsWith("Telerik.Sitefinity.Frontend.DynamicContent", StringComparison.Ordinal)).ToArray();
foreach (ToolboxItem tool in widgets)
{
section.Tools.Remove(tool);
if (tool.Source == ConfigSource.Database)
section.Tools.Remove(tool);
}
}

var mvcWidgetsSection = pageControls.Sections.FirstOrDefault<ToolboxSection>(s => s.Name == "MvcWidgets");
if (mvcWidgetsSection != null)
if (mvcWidgetsSection != null && mvcWidgetsSection.Source == ConfigSource.Database)
{
pageControls.Sections.Remove(mvcWidgetsSection);
}
Expand Down Expand Up @@ -293,7 +294,8 @@ private static void TransferGridWidgetSectionToDefault(string sectionName)
var pageControls = toolboxesConfig.Toolboxes["PageLayouts"];

var sectionToDelete = pageControls.Sections.FirstOrDefault<ToolboxSection>(e => e.Name == sectionName);
pageControls.Sections.Remove(sectionToDelete);
if (sectionToDelete != null && sectionToDelete.Source == ConfigSource.Database)
pageControls.Sections.Remove(sectionToDelete);

configurationManager.SaveSection(toolboxesConfig);
}
Expand Down
Expand Up @@ -89,12 +89,12 @@ public virtual void UnregisterToolboxItem(string fileName)
var fileNameWithoutExtension = this.GetFileNameWithoutExtension(fileName);
var itemToDelete = section.Tools.FirstOrDefault<ToolboxItem>(e => e.Name == fileNameWithoutExtension);

if (itemToDelete != null)
if (itemToDelete != null && itemToDelete.Source == ConfigSource.Database)
{
section.Tools.Remove(itemToDelete);
}

if (!section.Tools.Any<ToolboxItem>())
if (!section.Tools.Any<ToolboxItem>() && section.Source == ConfigSource.Database)
{
pageControls.Sections.Remove(section);
}
Expand Down
Expand Up @@ -142,7 +142,7 @@ protected virtual bool IsPreviewMode
internal virtual string GetDefaultCanonicalUrl(IDataItem item)
{
IManager manager = null;
if (!ManagerBase.TryGetMappedManager(item.GetType(), string.Empty, out manager))
if (!ManagerBase.TryGetMappedManager(item.GetType(), item.GetProviderName(), out manager))
return null;

var locationsService = SystemManager.GetContentLocationService();
Expand Down
Expand Up @@ -91,7 +91,7 @@ public virtual void Initialize()

this.RegisterVirtualPaths(this.ControllerContainerAssemblies);

var controllerTypes = this.GetControllers(this.ControllerContainerAssemblies);
var controllerTypes = this.GetControllers();
this.InitializeControllers(controllerTypes);

this.InitializeCustomRouting();
Expand All @@ -116,10 +116,7 @@ public virtual void Uninitialize()
this.ControllerContainerAssemblies = null;

// Clears all controllers
foreach (var ctrl in ControllerStore.Controllers().ToList())
{
ControllerStore.RemoveController(ctrl.ControllerType);
}
// ControllerStore.ClearControllers();

var sitefinityViewEngines = ViewEngines.Engines.Where(v => v != null && v.GetType() == typeof(CompositePrecompiledMvcEngineWrapper)).ToList();
foreach (var sitefinityViewEngine in sitefinityViewEngines)
Expand All @@ -140,25 +137,37 @@ public virtual void Uninitialize()
/// </summary>
public virtual IEnumerable<Assembly> RetrieveAssemblies()
{
IEnumerable<string> assemblyFileNames = this.RetrieveControllerAssembliesFileNames().Distinct().ToArray();
IList<Task<Assembly>> retrieveAssemblyTasks = new List<Task<Assembly>>();

foreach (string assemblyFileName in assemblyFileNames)
using (new HealthMonitoring.MethodPerformanceRegion("ControllerContainerInitializer.RetrieveAssemblies"))
{
retrieveAssemblyTasks.Add(this.LoadControllerAssemblyAsync(assemblyFileName));
}
IEnumerable<string> assemblyFileNames = this.RetrieveControllerAssembliesFileNames().Distinct().ToArray();
IList<Task<Assembly>> retrieveAssemblyTasks = new List<Task<Assembly>>();

Task.WaitAll(retrieveAssemblyTasks.ToArray());
foreach (string assemblyFileName in assemblyFileNames)
{
retrieveAssemblyTasks.Add(this.LoadControllerAssemblyAsync(assemblyFileName));
}

IEnumerable<Assembly> result = retrieveAssemblyTasks
.Select(v => v.Result)
.Where(v => v != null);
Task.WaitAll(retrieveAssemblyTasks.ToArray());

return result;
IEnumerable<Assembly> result = retrieveAssemblyTasks
.Select(v => v.Result)
.Where(v => v != null);

return result;
}
}

#endregion


#region Internal
internal IEnumerable<Type> GetControllers()
{
using (new HealthMonitoring.MethodPerformanceRegion("ControllerContainerInitializer.GetControllers"))
return this.GetControllers(this.ControllerContainerAssemblies);
}
#endregion

#region Protected members

/// <summary>
Expand Down Expand Up @@ -370,8 +379,6 @@ protected virtual void InitializeCustomRouting()
/// <param name="controllers">The controllers to be registered.</param>
protected virtual void RegisterControllers(IEnumerable<Type> controllers)
{
var controllerStore = new ControllerStore();
controllerStore.AddControllers(controllers.ToArray(), ConfigManager.GetManager());
controllers.ToList().ForEach(c => ControllerContainerInitializer.RegisterStringResources(c));
}

Expand Down
Expand Up @@ -16,6 +16,7 @@
using Telerik.Sitefinity.Frontend.Resources;
using Telerik.Sitefinity.Frontend.Resources.Resolvers;
using Telerik.Sitefinity.Security.Model;
using Telerik.Sitefinity.Security.Sanitizers;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Web;
using Telerik.Sitefinity.Web.UI;
Expand All @@ -42,7 +43,7 @@ public static bool ShouldReturnDetails(this Controller controller, ContentViewDi
if (controller == null)
throw new ArgumentNullException("controller");

if (contentViewDisplayMode == ContentViewDisplayMode.Detail && viewModel != null && viewModel.Items.Count() == 1)
if (contentViewDisplayMode == ContentViewDisplayMode.Detail && viewModel != null)
{
return true;
}
Expand Down Expand Up @@ -287,6 +288,26 @@ public static IndexRenderModes GetIndexRenderMode(this IController controller)
return attribute == null ? IndexRenderModes.Normal : attribute.Mode;
}

/// <summary>
/// Returns the invalid response for the details view.
/// </summary>
/// <returns>The <see cref="ActionResult"/></returns>
public static ActionResult HandleInvalidDetailsAction(this IController controller, string message)
{
if (SystemManager.IsDesignMode || SystemManager.IsPreviewMode)
{
var sanitizer = ObjectFactory.Resolve<IHtmlSanitizer>();
message = sanitizer.Sanitize(message);

var response = new ContentResult();
response.Content = message;

return response;
}

return new EmptyResult();
}

#endregion

#region Internal methods
Expand Down
29 changes: 18 additions & 11 deletions Telerik.Sitefinity.Frontend/Mvc/Models/ContentModelBase.cs
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web.Mvc;
using ServiceStack.Text;
using Telerik.Sitefinity.ContentLocations;
using Telerik.Sitefinity.Data;
Expand All @@ -16,7 +17,6 @@
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Taxonomies.Model;
using Telerik.Sitefinity.Web.Model;
using Telerik.Sitefinity.Web.OutputCache;
using Telerik.Sitefinity.Web.UI.ContentUI.Enums;

namespace Telerik.Sitefinity.Frontend.Mvc.Models
Expand Down Expand Up @@ -287,8 +287,8 @@ public virtual IEnumerable<IContentLocationInfo> GetLocations()
case ContentViewDisplayMode.Automatic:
if (this.SelectionMode == SelectionMode.SelectedItems && string.IsNullOrEmpty(this.FilterExpression))
{
var masterIdsList = this.GetMasterIdsFromSelection();
location.Filters.Add(new ItemsSelectionLocationFilter(masterIdsList.Select(x => x.ToString())));
var masterAndLiveIdsList = this.GetMasterAndLiveIdsFromSelection();
location.Filters.Add(new ItemsSelectionLocationFilter(masterAndLiveIdsList.Select(x => x.ToString())));
}
else
{
Expand Down Expand Up @@ -881,9 +881,9 @@ private bool TryGetTaxonomyFieldName(Guid taxonomyId, out string taxonomyField)
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "It would add too much risk now to change this to property and would not bring much value to code quality and maintenance.")]
protected virtual string GetSelectedItemsFilterExpression()
{
var masterIds = this.GetMasterIdsFromSelection();
var masterAndLiveIds = this.GetMasterAndLiveIdsFromSelection();

var selectedItemConditions = masterIds.Select(id => "Id = {0} OR OriginalContentId = {0}".Arrange(id.ToString("D")));
var selectedItemConditions = masterAndLiveIds.Select(id => "Id = {0} OR OriginalContentId = {0}".Arrange(id.ToString("D")));
var selectedItemsFilterExpression = string.Join(" OR ", selectedItemConditions);

return selectedItemsFilterExpression;
Expand All @@ -901,16 +901,23 @@ protected virtual void AddCommonDependencies(IList<CacheDependencyKey> keys, Typ
keys.Add(new CacheDependencyKey() { Type = typeof(Sitefinity.Services.Comments.IThread) });
}

private IEnumerable<Guid> GetMasterIdsFromSelection()
private IEnumerable<Guid> GetMasterAndLiveIdsFromSelection()
{
var selectedItemGuids = this.selectedItemsIds.Select(id => new Guid(id));

var masterIds = this.GetItemsQuery()
.OfType<ILifecycleDataItemGeneric>()
.Where(c => selectedItemGuids.Contains(c.Id) || selectedItemGuids.Contains(c.OriginalContentId))
.Select(n => n.OriginalContentId != Guid.Empty ? n.OriginalContentId : n.Id)
.Distinct();
.OfType<ILifecycleDataItemGeneric>()
.Where(c => selectedItemGuids.Contains(c.Id) || selectedItemGuids.Contains(c.OriginalContentId))
.Select(n => n.OriginalContentId != Guid.Empty ? n.OriginalContentId : n.Id);

var liveIds = this.GetItemsQuery()
.OfType<ILifecycleDataItemGeneric>()
.Where(c => (selectedItemGuids.Contains(c.Id) || selectedItemGuids.Contains(c.OriginalContentId)) && c.Status == ContentLifecycleStatus.Live)
.Select(n => n.Id);

return masterIds;
var result = new HashSet<Guid>(masterIds.Union(liveIds));

return result;
}

private IQueryable<IDataItem> GetRelatedItems(IDataItem relatedItem, int page, ref int? totalCount)
Expand Down

0 comments on commit e6c8448

Please sign in to comment.