Skip to content

Commit

Permalink
Release v.13.3.7600.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gg3orgiev committed Mar 10, 2021
1 parent 5623b55 commit 8c0bcde
Show file tree
Hide file tree
Showing 32 changed files with 40,410 additions and 651 deletions.
Binary file modified AssemblyInfoShare/SharedAssemblyInfo.cs
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@
</ItemGroup>
<ItemGroup>
<Reference Include="Telerik.Sitefinity.Model">
<HintPath>..\packages\Telerik.Sitefinity.Core.13.2.7500\lib\net48\Telerik.Sitefinity.Model.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.13.3.7600\lib\net48\Telerik.Sitefinity.Model.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Telerik.Sitefinity">
<HintPath>..\packages\Telerik.Sitefinity.Core.13.2.7500\lib\net48\Telerik.Sitefinity.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.13.3.7600\lib\net48\Telerik.Sitefinity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Telerik.Sitefinity.Utilities">
<HintPath>..\packages\Telerik.Sitefinity.Core.13.2.7500\lib\net48\Telerik.Sitefinity.Utilities.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.13.3.7600\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
Original file line number Diff line number Diff line change
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="13.2.7500" targetFramework="net45" />
<package id="Telerik.Sitefinity.Core" version="13.3.7600" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,12 @@ private IEnumerable<string> GetProviderNames(ControllerBase controller, Type con

if (manager != null)
{
return manager.Providers.Select(p => p.Name);
IList<string> providers = manager.GetContextProviders().Select(p => p.Name).ToList();

if (!providers.Contains(manager.Provider.Name))
providers.Add(manager.Provider.Name);

return providers;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
using Telerik.Sitefinity.Mvc.Proxy.TypeDescription;
using Telerik.Sitefinity.Mvc.Store;
using Telerik.Sitefinity.Pages;
using Telerik.Sitefinity.Security;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Taxonomies;
using Telerik.Sitefinity.Taxonomies.Model;
Expand Down Expand Up @@ -357,7 +356,7 @@ protected virtual void InitializeCustomRouting()
this.RegisterTaxonomyRoutes();
});

TaxonomyManager.Executing += new EventHandler<ExecutingEventArgs>(OnPersistTaxonomy);
CacheDependency.Subscribe(typeof(Taxonomy), this.OnTaxonomiesUpdated);

string mvcControllerProxySettingsPropertyDescriptorName = string.Format("{0}.{1}", typeof(MvcWidgetProxy).FullName, "Settings");
ObjectFactory.Container.RegisterType<IControlPropertyDescriptor, ControllerSettingsPropertyDescriptor>(mvcControllerProxySettingsPropertyDescriptorName);
Expand All @@ -380,36 +379,6 @@ protected virtual void RegisterControllers(IEnumerable<Type> controllers)

#region Private members

private void OnPersistTaxonomy(object sender, ExecutingEventArgs args)
{
if (!(args.CommandName == "CommitTransaction" || args.CommandName == "FlushTransaction"))
return;

var taxonomyProvider = sender as TaxonomyDataProvider;

var dirtyItems = taxonomyProvider.GetDirtyItems();
if (dirtyItems.Count == 0)
return;

foreach (var item in dirtyItems)
{
if (item is Taxonomy taxonomy)
{
var itemStatus = taxonomyProvider.GetDirtyItemStatus(item);
var taxonomyName = taxonomy.Name;
if (!string.IsNullOrEmpty(taxonomyName) &&
(itemStatus == SecurityConstants.TransactionActionType.New || itemStatus == SecurityConstants.TransactionActionType.Updated))
{
taxonomyName = taxonomyName.ToLowerInvariant();
if (!ObjectFactory.IsTypeRegistered<TaxonParamResolver>(taxonomyName))
{
ObjectFactory.Container.RegisterType<IRouteParamResolver, TaxonParamResolver>(taxonomyName, new InjectionConstructor(taxonomyName));
}
}
}
}
}

private void RegisterTaxonomyRoutes()
{
var taxonomies = TaxonomyManager.GetTaxonomiesCache();
Expand All @@ -419,7 +388,8 @@ private void RegisterTaxonomyRoutes()
foreach (var taxonomy in taxonomies)
{
var taxonomyName = this.GetTaxonomyName(taxonomy.Id, taxonomy.Name);
ObjectFactory.Container.RegisterType<IRouteParamResolver, TaxonParamResolver>(taxonomyName, new InjectionConstructor(taxonomyName));
if (!ObjectFactory.IsTypeRegistered<TaxonParamResolver>(taxonomyName))
ObjectFactory.Container.RegisterType<IRouteParamResolver, TaxonParamResolver>(taxonomyName, new InjectionConstructor(taxonomyName));
}
}
}
Expand Down Expand Up @@ -668,6 +638,16 @@ private string AssemblyPackage(Assembly assembly)
return attribute.Name;
}

private void OnTaxonomiesUpdated(ICacheDependencyHandler caller, Type itemType, string itemKey)
{
// needs to run on a separate thread otherwise messes up the open access cache for som reason
// no time to investigate and I see this method has already been called in the same fashion in earlier checkins
Task.Run(() =>
{
RegisterTaxonomyRoutes();
});
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Reflection;
using System.Web.Mvc;
using System.Web.Routing;
using Telerik.Sitefinity.Frontend.Mvc.Models;
using Telerik.Sitefinity.Web;

namespace Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing
Expand Down Expand Up @@ -46,13 +47,13 @@ public CustomActionParamsMapper(ControllerBase controller, Func<string> routeTem
/// <inheritdoc />
protected override bool TryMatchUrl(string[] urlParams, RequestContext requestContext, string urlKeyPrefix)
{
if (urlParams == null)
if (urlParams == null || !this.IsPaginationAllowed())
return false;

var routeTemplate = this.routeTemplateResolver();

var metaParams = routeTemplate
.Split(new []{'/'}, StringSplitOptions.RemoveEmptyEntries);
.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

var parameterMap = this.MapParams(this.actionMethod, metaParams, urlParams, this.urlParamNames);

Expand All @@ -66,6 +67,32 @@ protected override bool TryMatchUrl(string[] urlParams, RequestContext requestCo
return true;
}

private bool IsPaginationAllowed()
{
if (this.actionName == "Index")
{
var modelProperty = this.Controller.GetType().GetProperty("Model");
if (modelProperty != null)
{
var model = modelProperty.GetValue(this.Controller, null);
if (model != null)
{
var displayModeProp = model.GetType().GetProperty("DisplayMode");
if (displayModeProp != null)
{
var displayModeValue = displayModeProp.GetValue(model, null);
if (displayModeValue != null && displayModeValue.ToString() != ListDisplayMode.Paging.ToString())
{
return false;
}
}
}
}
}

return true;
}

private void PopulateRouteData(RouteValueDictionary routeDataValues, IList<UrlSegmentInfo> parameters)
{
foreach (var parameter in parameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override bool TryMatchUrl(string[] urlParams, RequestContext requestCo
var selfRouting = this.Controller as IRouteMapper;
if (urlParams != null && selfRouting != null && selfRouting.TryMapRouteParameters(urlParams, requestContext))
{
RouteHelper.SetUrlParametersResolved(true);
RouteHelper.SetUrlParametersResolved();
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private bool TryMatchUrl(string[] urlParams, RequestContext requestContext, bool
var contentItemResolver = new ContentDataItemResolver();
var item = contentItemResolver.GetItemByUrl(url, this.ItemType, providerName, out redirectUrl);

if (item != null)
if (item != null && this.CanDisplayItem(item))
{
SystemManager.CurrentHttpContext.Items["detailItem"] = item;

Expand All @@ -101,6 +101,43 @@ private bool TryMatchUrl(string[] urlParams, RequestContext requestContext, bool
return false;
}

private bool CanDisplayItem(IDataItem item)
{
bool isParentSelected = true;
var modelProperty = this.Controller.GetType().GetProperty("Model");
if (modelProperty != null)
{
var model = modelProperty.GetValue(this.Controller);
if (item is IHasParent)
{
var serializedSelectedParentsIdsProperty = model.GetType().GetProperty("SerializedSelectedParentsIds");
if (serializedSelectedParentsIdsProperty != null)
{
var serializedSelectedParentsIds = serializedSelectedParentsIdsProperty.GetValue(model);
if (serializedSelectedParentsIds != null)
{
isParentSelected = serializedSelectedParentsIds.ToString().Contains((item as IHasParent).Parent.Id.ToString());

if (!isParentSelected)
{
var folderIdProperty = item.GetType().GetProperty("FolderId");
if (folderIdProperty != null)
{
var folderId = folderIdProperty.GetValue(item);
if (folderId != null)
{
isParentSelected = serializedSelectedParentsIds.ToString().Contains(folderId.ToString());
}
}
}
}
}
}
}

return isParentSelected;
}

/// <inheritdoc />
protected override bool TryMatchUrl(string[] urlParams, RequestContext requestContext, string urlKeyPrefix)
{
Expand Down
19 changes: 18 additions & 1 deletion Telerik.Sitefinity.Frontend/Resources/PackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ public string GetCurrentPackage()
if (context == null)
return null;

if (context.Request.Path.Contains("/Sitefinity/Versioning"))
{
// If we are in the versioning try get tha package from page info
if (SystemManager.CurrentHttpContext.Items.Contains(PackageManager.CurrentVersionTemplateId))
{
var templateId = SystemManager.CurrentHttpContext.Items[PackageManager.CurrentVersionTemplateId] as string;
packageName = this.GetPackageFromTemplateId(templateId);
if (!packageName.IsNullOrEmpty())
return packageName;
}
}

packageName = this.GetPackageFromContext();
if (!packageName.IsNullOrEmpty())
return packageName;
Expand Down Expand Up @@ -217,7 +229,10 @@ private string GetPackageFromNodeId(string nodeId)
if (SystemManager.IsDesignMode)
{
var draft = pageManager.GetPageDraft(pageData.Id);
return draft.TemplateId != Guid.Empty ? this.GetPackageFromTemplateId(draft.TemplateId.ToString()) : null;
if (draft != null)
{
return draft.TemplateId != Guid.Empty ? this.GetPackageFromTemplateId(draft.TemplateId.ToString()) : null;
}
}

return this.GetPackageFromTemplate(pageData.Template);
Expand Down Expand Up @@ -368,6 +383,8 @@ protected override bool Validate(string paramValue, string[] arguments)
/// </summary>
public const string CurrentPackageKey = "CurrentResourcePackage";

public const string CurrentVersionTemplateId = "CurrentVersionTemplateId";

public const string PackageUrlParameterName = "package";

#endregion
Expand Down
Loading

0 comments on commit 8c0bcde

Please sign in to comment.