Skip to content

Commit

Permalink
Release v.13.2.7500.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SFBuild committed Dec 8, 2020
1 parent 9952d61 commit 5623b55
Show file tree
Hide file tree
Showing 37 changed files with 1,872 additions and 494 deletions.
Binary file modified AssemblyInfoShare/SharedAssemblyInfo.cs
Binary file not shown.
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Telerik.Sitefinity.Frontend.Data</RootNamespace>
<AssemblyName>Telerik.Sitefinity.Frontend.Data</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
Expand Down Expand Up @@ -86,15 +86,15 @@
</ItemGroup>
<ItemGroup>
<Reference Include="Telerik.Sitefinity.Model">
<HintPath>..\packages\Telerik.Sitefinity.Core.13.1.7400\lib\net472\Telerik.Sitefinity.Model.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.13.2.7500\lib\net48\Telerik.Sitefinity.Model.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Telerik.Sitefinity">
<HintPath>..\packages\Telerik.Sitefinity.Core.13.1.7400\lib\net472\Telerik.Sitefinity.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.13.2.7500\lib\net48\Telerik.Sitefinity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Telerik.Sitefinity.Utilities">
<HintPath>..\packages\Telerik.Sitefinity.Core.13.1.7400\lib\net472\Telerik.Sitefinity.Utilities.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.13.2.7500\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="13.1.7400" targetFramework="net45" />
<package id="Telerik.Sitefinity.Core" version="13.2.7500" targetFramework="net45" />
</packages>
Expand Up @@ -291,7 +291,7 @@
var tempLayout = $(gridContext.layoutRoot).clone();

for (var i = 0; i < elements.length; i++) {
var innerDiv = elements[i].id ? $(tempLayout).findExcludeNested('#' + elements[i].id) : $(tempLayout).findExcludeNested('[data-sf-element=' + elements[i].name + ']');
var innerDiv = elements[i].id ? $(tempLayout).findExcludeNested('#' + elements[i].id) : $(tempLayout).findExcludeNested('[data-sf-element="' + elements[i].name + '"]');

if (innerDiv) {
var label = elements[i].label;
Expand Down Expand Up @@ -319,7 +319,7 @@

var refreshContainer = function (elements) {
for (var i = 0; i < elements.length; i++) {
var innerDiv = elements[i].id ? $(gridContext.layoutContainer).findExcludeNested('#' + elements[i].id) : $(gridContext.layoutContainer).findExcludeNested('[data-sf-element=' + elements[i].name + ']');
var innerDiv = elements[i].id ? $(gridContext.layoutContainer).findExcludeNested('#' + elements[i].id) : $(gridContext.layoutContainer).findExcludeNested('[data-sf-element="' + elements[i].name + '"]');

if (innerDiv) {
var css = elements[i].isPlaceholder ? 'sf_colsIn ' + elements[i].css : elements[i].css;
Expand Down
Expand Up @@ -168,7 +168,7 @@ private Type GetItemType(ControllerBase controller)
{
if (typeof(DynamicContent) == contentParam.ParameterType)
{
var controllerName = (string)controller.ViewBag.WidgetName;
var controllerName = this.GetControllerName(controller);
var dynamicContentType = controller.GetDynamicContentType(controllerName);
contentType = dynamicContentType != null ? TypeResolutionService.ResolveType(dynamicContentType.GetFullTypeName(), throwOnError: false) : null;
}
Expand All @@ -182,6 +182,19 @@ private Type GetItemType(ControllerBase controller)
return contentType;
}

private string GetControllerName(ControllerBase controller)
{
var widgetName = (string)controller.ViewBag.WidgetName;

if (!string.IsNullOrEmpty(widgetName))
{
return widgetName;
}

var controllerName = controller.GetType().Name.Replace("Controller", "");
return controllerName;
}

/// <summary>
/// This method returns the requested item status based on content location url parameters.
/// </summary>
Expand Down
Expand Up @@ -2,8 +2,10 @@
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using Telerik.Sitefinity.Data;
using Telerik.Sitefinity.Frontend.InlineEditing;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Utilities.TypeConverters;
using Telerik.Sitefinity.Web;

namespace Telerik.Sitefinity.Frontend.Mvc.Helpers
Expand Down Expand Up @@ -47,10 +49,10 @@ public static IHtmlString TextField(this HtmlHelper helper, string propName, str
{
htmlString = string.Format(HtmlProcessor.InlineEditingHtmlWrapper, propName, fieldType, propValue);
}

return new System.Web.Mvc.MvcHtmlString(htmlString);
}

/// <summary>
/// HTML helper which adds an InlineEditing region. This should be added once at the top of the page, and the whole region will support InlineEditing.
/// </summary>
Expand All @@ -62,14 +64,14 @@ public static IHtmlString TextField(this HtmlHelper helper, string propName, str
public static HtmlRegion InlineEditingRegion(
this HtmlHelper htmlHelper,
string providerName,
string type,
string type,
Guid id)
{
var htmlProcessor = new HtmlProcessor();
return htmlProcessor.CreateInlineEditingRegion(
htmlHelper.ViewContext.Writer,
providerName,
type,
providerName,
type,
id);
}

Expand All @@ -85,6 +87,11 @@ public static IHtmlString InlineEditingAttributes(this HtmlHelper htmlHelper, st
if (!SystemManager.IsInlineEditingMode)
return htmlHelper.Raw(string.Empty);

if (string.IsNullOrEmpty(providerName))
{
providerName = GetProviderName(type);
}

var providerNameEncoded = providerName != null ? htmlHelper.Encode(providerName) : providerName;
var typeEncoded = htmlHelper.Encode(type);

Expand Down Expand Up @@ -150,5 +157,31 @@ public static bool ShouldRenderInlineEditing(this HtmlHelper htmlHelper)

return shouldRender;
}

private static string GetProviderName(string type)
{
string providerName = null;

if (type != null)
{
var itemType = TypeResolutionService.ResolveType(type);
if (itemType != null)
{
Type managerType;
ManagerBase.TryGetMappedManagerType(itemType, out managerType);
if (managerType != null)
{
var currentSite = SystemManager.CurrentContext.CurrentSite;
var provider = currentSite.GetDefaultProvider(managerType.FullName);
if (provider != null)
{
providerName = provider.ProviderName;
}
}
}
}

return providerName;
}
}
}
62 changes: 56 additions & 6 deletions Telerik.Sitefinity.Frontend/Mvc/Helpers/UrlHelpers.cs
@@ -1,17 +1,12 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Hosting;
using System.Web.Mvc;
using System.Web.UI;
using Telerik.Sitefinity.Abstractions.VirtualPath;
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure;
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing;
using Telerik.Sitefinity.Frontend.Resources;
using Telerik.Sitefinity.Modules.Pages;
using Telerik.Sitefinity.Mvc.Rendering;
using Telerik.Sitefinity.Taxonomies.Model;
using Telerik.Sitefinity.Utilities.TypeConverters;
Expand Down Expand Up @@ -163,6 +158,61 @@ public static string GetRedirectPagingUrl(ITaxon taxonFilter)
return redirectUrl;
}

/// <summary>
/// Gets the URL template used for the paging when filtered by taxonomy and url evaluation mode.
/// </summary>
/// <returns>The URL template.</returns>
public static string GetRedirectPagingUrl(ITaxon taxonFilter, string[] urlParams, string queryString)
{
bool addQueryString = !string.IsNullOrEmpty(queryString);
string redirectUrl;
if (UrlParamsMapperBase.UseNamedParametersRouting)
{
redirectUrl = string.Format("/{0}/{1}/{2}", taxonFilter.Taxonomy.Name, taxonFilter.UrlName, FeatherActionInvoker.PagingNamedParameter) + "/{0}";
}
else
{
// 3 because we have the following structure /-in-tags/tags/tagName
if (urlParams != null && urlParams.Length >= 3)
{
if (taxonFilter is FlatTaxon)
{
redirectUrl = string.Format("/{0}/{1}/{2}", urlParams[0], urlParams[1], urlParams[2]);
}
else
{
if (urlParams[urlParams.Length - 1].Equals(taxonFilter.UrlName))
{
// url is like /-in-category/categories/cat1/cat2
string taxonFilterParams = string.Join("/", urlParams);
redirectUrl = "/" + taxonFilterParams;
}
else
{
// url is like /-in-category/categories/cat1/cat2/2 where '2' is the page so we want to exclude it from redirect url
string taxonFilterParams = string.Join("/", urlParams.Take(urlParams.Length - 1));
redirectUrl = "/" + taxonFilterParams;
}
}

// add /{0} at the very end for the page number
redirectUrl += "/{0}";
}
else
{
addQueryString = false;
redirectUrl = "/{0}" + queryString;
}
}

if (addQueryString)
{
redirectUrl += queryString;
}

return redirectUrl;
}

/// <summary>
/// Gets the resource path.
/// </summary>
Expand Down
Expand Up @@ -112,8 +112,9 @@ private void InitializeControls(string source)

private void HandleOpenTag(Stack<Control> container, HtmlChunk chunk, StringBuilder currentLiteralText)
{
if (chunk.TagName.Equals("title", StringComparison.OrdinalIgnoreCase))
if (chunk.TagName.Equals("title", StringComparison.OrdinalIgnoreCase) && isCurrentlyInHeadTag)
{
// if we are not currently parsing the <head> tag, then this title must be in the body and we should skip it
this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
var title = new HtmlTitle();
container.Peek().Controls.Add(title);
Expand All @@ -126,6 +127,7 @@ private void HandleOpenTag(Stack<Control> container, HtmlChunk chunk, StringBuil
var head = new HtmlHead();
container.Peek().Controls.Add(head);
container.Push(head);
isCurrentlyInHeadTag = true;
}
else if (chunk.TagName.Equals("asp:ContentPlaceHolder", StringComparison.OrdinalIgnoreCase))
{
Expand Down Expand Up @@ -187,8 +189,9 @@ private void HandleOpenTag(Stack<Control> container, HtmlChunk chunk, StringBuil

private void HandleCloseTag(Stack<Control> container, HtmlChunk chunk, StringBuilder currentLiteralText)
{
if (chunk.TagName.Equals("title", StringComparison.OrdinalIgnoreCase))
if (chunk.TagName.Equals("title", StringComparison.OrdinalIgnoreCase) && isCurrentlyInHeadTag)
{
// if we are not currently parsing the <head> tag, then this title must be in the body and we should skip it
if (container.Peek() is HtmlTitle)
{
((HtmlTitle)container.Pop()).Text = currentLiteralText.ToString();
Expand All @@ -204,6 +207,7 @@ private void HandleCloseTag(Stack<Control> container, HtmlChunk chunk, StringBui
{
this.AddIfNotEmpty(currentLiteralText.ToString(), container.Pop());
currentLiteralText.Clear();
isCurrentlyInHeadTag = false;
}
else if (chunk.TagName.Equals("form", StringComparison.OrdinalIgnoreCase))
{
Expand Down Expand Up @@ -260,5 +264,7 @@ private void InstantiateControls(Control placeHolder)
this.InstantiateInContentPlaceHolder(placeHolder, (ITemplate)this.ContentTemplates[placeHolder.ID]);
}
}

private bool isCurrentlyInHeadTag = false;
}
}
Expand Up @@ -15,7 +15,6 @@
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers;
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Personalization;
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing.Date;
using Telerik.Sitefinity.Frontend.Mvc.Models;
using Telerik.Sitefinity.Localization;
using Telerik.Sitefinity.Model;
using Telerik.Sitefinity.Modules.Pages.Configuration;
Expand Down Expand Up @@ -45,6 +44,7 @@ internal IUrlParamsMapper GetDefaultParamsMapper(ControllerBase controller)
result = result
.SetLast(this.GetInferredDetailActionParamsMapper(controller))
.SetLast(this.GetInferredSuccessorsActionParamsMapper(controller))
.SetLast(this.GetInferredTaxonFilterQueryParamsMapper(controller, "ListByTaxon"))
.SetLast(this.GetInferredTaxonFilterMapper(controller, "ListByTaxon"))
.SetLast(this.GetInferredClassificationFilterMapper(controller, "ListByTaxon"))
.SetLast(this.GetInferredDateFilterMapper(controller, "ListByDate"))
Expand Down Expand Up @@ -139,7 +139,7 @@ protected override void InitializeRouteParameters(MvcProxyBase proxyControl)
}
else
{
if (this.ShouldProcessRequest(controller))
if (this.ShouldProcessRequest(controller))
{
// in indexing mode, we only request pages, therefore there in no need to update data for relative routes
if (!proxyControl.IsIndexingMode())
Expand Down Expand Up @@ -318,6 +318,28 @@ private IUrlParamsMapper GetInferredDateFilterMapper(ControllerBase controller,
return new DateUrlParamsMapper(controller, new DateUrlEvaluatorAdapter());
}

private IUrlParamsMapper GetInferredTaxonFilterQueryParamsMapper(ControllerBase controller, string actionName)
{
IUrlParamsMapper result = null;

var actionDescriptor = new ReflectedControllerDescriptor(controller.GetType()).FindAction(controller.ControllerContext, actionName);
if (actionDescriptor == null || actionDescriptor.GetParameters().Length == 0)
{
return null;
}

var queryParams = controller.ControllerContext.RequestContext.HttpContext.Request.QueryString;
if (actionDescriptor.GetParameters()[0].ParameterType == typeof(ITaxon) && queryParams.Count == 3)
{
if (queryParams.Keys.Contains("taxonomy"))
{
result = new TaxonomyUrlParamsMapper(controller, new TaxonUrlMapper(new TaxonUrlEvaluatorAdapter()));
}
}

return result;
}

private IUrlParamsMapper GetInferredTaxonFilterMapper(ControllerBase controller, string actionName)
{
var actionDescriptor = new ReflectedControllerDescriptor(controller.GetType()).FindAction(controller.ControllerContext, actionName);
Expand Down Expand Up @@ -358,8 +380,8 @@ private IUrlParamsMapper GetInferredTaxonFilterMapper(ControllerBase controller,
var urlParamNames = new string[] { FeatherActionInvoker.TaxonNamedParamter, FeatherActionInvoker.PagingNamedParameter };
result = new CustomActionParamsMapper(controller, () => "/{" + taxonParamName + ":" + routeTemplate + "}/{" + pageParamName + "}", actionName, urlParamNames);
}
var urlTaxonParamNames = new string[] { FeatherActionInvoker.TaxonNamedParamter};

var urlTaxonParamNames = new string[] { FeatherActionInvoker.TaxonNamedParamter };
result = result.SetLast(new CustomActionParamsMapper(controller, () => "/{" + taxonParamName + ":" + routeTemplate + "}", actionName, urlTaxonParamNames));
}

Expand Down

0 comments on commit 5623b55

Please sign in to comment.