Skip to content

Commit

Permalink
Release v.14.1.7821
Browse files Browse the repository at this point in the history
  • Loading branch information
SFBuild committed Mar 25, 2022
1 parent 036ee20 commit 4415ae9
Show file tree
Hide file tree
Showing 60 changed files with 42,530 additions and 848 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.14.0.7700\lib\net48\Telerik.Sitefinity.Model.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.14.1.7821\lib\net48\Telerik.Sitefinity.Model.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Telerik.Sitefinity">
<HintPath>..\packages\Telerik.Sitefinity.Core.14.0.7700\lib\net48\Telerik.Sitefinity.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.14.1.7821\lib\net48\Telerik.Sitefinity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Telerik.Sitefinity.Utilities">
<HintPath>..\packages\Telerik.Sitefinity.Core.14.0.7700\lib\net48\Telerik.Sitefinity.Utilities.dll</HintPath>
<HintPath>..\packages\Telerik.Sitefinity.Core.14.1.7821\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="14.0.7700" targetFramework="net45" />
<package id="Telerik.Sitefinity.Core" version="14.1.7821" targetFramework="net45" />
</packages>
14 changes: 7 additions & 7 deletions Telerik.Sitefinity.Frontend/Designers/DesignerInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ private void RegisteringScriptsHandler(IScriptsRegisteringEvent @event)
{
var scriptRootPath = VirtualPathUtility.ToAbsolute("~/" + FrontendManager.VirtualPathBuilder.GetVirtualPath(this.GetType().Assembly));

@event.Scripts.Add(new ScriptReference(scriptRootPath + UrlHelpers.AppendVersion("Mvc/Scripts/Angular/angular.min.js")));
@event.Scripts.Add(new ScriptReference(scriptRootPath + UrlHelpers.AppendVersion("Mvc/Scripts/Angular/angular-route.min.js")));
@event.Scripts.Add(new ScriptReference(scriptRootPath + UrlHelpers.AppendVersion("Mvc/Scripts/Angular/angular-sanitize.min.js")));
@event.Scripts.Add(new ScriptReference(scriptRootPath + UrlHelpers.AppendVersion("Mvc/Scripts/Bootstrap/js/ui-bootstrap-tpls.min.js")));
@event.Scripts.Add(new ScriptReference(UrlHelpers.AppendVersion(scriptRootPath + "Mvc/Scripts/Angular/angular.min.js")));
@event.Scripts.Add(new ScriptReference(UrlHelpers.AppendVersion(scriptRootPath + "Mvc/Scripts/Angular/angular-route.min.js")));
@event.Scripts.Add(new ScriptReference(UrlHelpers.AppendVersion(scriptRootPath + "Mvc/Scripts/Angular/angular-sanitize.min.js")));
@event.Scripts.Add(new ScriptReference(UrlHelpers.AppendVersion(scriptRootPath + "Mvc/Scripts/Bootstrap/js/ui-bootstrap-tpls.min.js")));

////var references = PageManager.GetScriptReferences(ScriptRef.KendoAll);
////foreach (var scriptRef in references)
////{
//// @event.Scripts.Add(scriptRef);
////}

@event.Scripts.Add(new ScriptReference(scriptRootPath + UrlHelpers.AppendVersion("Designers/Scripts/page-editor-services.js")));
@event.Scripts.Add(new ScriptReference(scriptRootPath + UrlHelpers.AppendVersion("Designers/Scripts/page-editor.js")));
@event.Scripts.Add(new ScriptReference(UrlHelpers.AppendVersion(scriptRootPath + "Designers/Scripts/page-editor-services.js")));
@event.Scripts.Add(new ScriptReference(UrlHelpers.AppendVersion(scriptRootPath + "Designers/Scripts/page-editor.js")));

@event.Scripts.Add(new ScriptReference(scriptRootPath + UrlHelpers.AppendVersion("Mvc/Scripts/LABjs/LAB.min.js")));
@event.Scripts.Add(new ScriptReference(UrlHelpers.AppendVersion(scriptRootPath + "Mvc/Scripts/LABjs/LAB.min.js")));

var currentPackage = new PackageManager().GetCurrentPackage();
if (!currentPackage.IsNullOrEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@
initialData = $.extend(true, {}, response.data);
loadingPromise = null;
deferred.resolve(response.data);
}, function (response) {
}, function (err) {
loadingPromise = null;
deferred.reject(response.data);
deferred.reject(err);
});

loadingPromise = deferred.promise;
Expand Down Expand Up @@ -193,8 +193,8 @@
.then(function (response) {
initialData = $.extend(true, {}, properties);
deferred.resolve(response.data);
}, function (response) {
deferred.reject(response.data);
}, function (err) {
deferred.reject(err);
});

return deferred.promise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public void FileRenamed(string newFileName, string oldFileName, string newFilePa
/// The same logic can be found in PageTemplateHelper -> UpdateDefaultTemplateImages(). In need of a change do it in both places
/// </summary>
internal static void UpdateDefaultTemplateImages(LibrariesManager librariesManager)
{
{
var imagesToUpgrade = new List<string>
{
LayoutFileManager.TemplateImage1Column,
Expand Down Expand Up @@ -306,7 +306,7 @@ internal void CreateDefaultTemplates(string packageName, string layoutFile)
Path = LayoutFileManager.GridTemplatePathRightSidebar
};

if (!packageName.StartsWith("Bootstrap4"))
if (!packageName.StartsWith("Bootstrap4") && !packageName.StartsWith("Bootstrap5"))
{
this.CreateTemplate(packageName, layoutFile, LayoutFileManager.TemplateCaption2Columns, LayoutFileManager.TemplateImage2Columns, new LayoutControlDescription[] { header, twoColumns, footer });
this.CreateTemplate(packageName, layoutFile, LayoutFileManager.TemplateCaption3Columns, LayoutFileManager.TemplateImage3Columns, new LayoutControlDescription[] { header, threeColumns, footer });
Expand Down Expand Up @@ -476,6 +476,8 @@ private void CreateTemplate(string packageName, string fileNameWithoutExtension,
pageManager.TemplatesLifecycle.Publish(master);
pageManager.SaveChanges();

if (string.Equals(LayoutFileManager.Bootstrap5DefaultTemplateName, fullTemplateName, StringComparison.OrdinalIgnoreCase))
this.CreateDefaultTemplates("Bootstrap5", "default");
if (string.Equals(LayoutFileManager.Bootstrap4DefaultTemplateName, fullTemplateName, StringComparison.OrdinalIgnoreCase))
this.CreateDefaultTemplates("Bootstrap4", "default");
if (string.Equals(LayoutFileManager.BootstrapDefaultTemplateName, fullTemplateName, StringComparison.OrdinalIgnoreCase))
Expand Down Expand Up @@ -667,13 +669,15 @@ private class LayoutControlDescription
/// </summary>
public const string PageTemplateIconPathFormat = "Telerik.Sitefinity.Frontend.Resources.PageTemplateImages.{0}.gif";

public const string Bootstrap5DefaultTemplateName = "Bootstrap5.default";
public const string Bootstrap4DefaultTemplateName = "Bootstrap4.default";
public const string BootstrapDefaultTemplateName = "Bootstrap.default";
public const string SemanticUIDefaultTemplateName = "SemanticUI.default";
public const string FoundationDefaultTemplateName = "Foundation.default";

public static readonly string[] DefaultTemplateNames = new string[]
{
LayoutFileManager.Bootstrap5DefaultTemplateName,
LayoutFileManager.Bootstrap4DefaultTemplateName,
LayoutFileManager.BootstrapDefaultTemplateName,
LayoutFileManager.SemanticUIDefaultTemplateName,
Expand Down
13 changes: 13 additions & 0 deletions Telerik.Sitefinity.Frontend/FrontendModuleUpgrader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public static void Upgrade(Version upgradeFrom, SiteInitializer initializer)
FrontendModuleUpgrader.CreateBootstrap4Templates();
FrontendModuleUpgrader.UpdateDefaultTemplateImages();
}

if (upgradeFrom < new Version(14, 1))
{
FrontendModuleUpgrader.CreateBootstrap5Templates();
}
}

// 1, 2, 140, 0
Expand Down Expand Up @@ -395,5 +400,13 @@ private static void CreateBootstrap4Templates()

layoutManager.CreateDefaultTemplates("Bootstrap4", "default");
}

// 14.1
private static void CreateBootstrap5Templates()
{
var layoutManager = new LayoutFileManager();

layoutManager.CreateDefaultTemplates("Bootstrap5", "default");
}
}
}
7 changes: 2 additions & 5 deletions Telerik.Sitefinity.Frontend/GridSystem/GridControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ protected virtual string ProcessLayoutString(string targetTemplate, bool ensureS
parser.AutoExtractBetweenTagsOnly = false;
parser.CompressWhiteSpaceBeforeTag = false;
parser.KeepRawHTML = true;
bool hasSfCols = false;
var output = new StringBuilder();
HtmlChunk chunk;
while ((chunk = parser.ParseNext()) != null)
Expand All @@ -68,9 +67,7 @@ protected virtual string ProcessLayoutString(string targetTemplate, bool ensureS
if (cssClass != null)
{
var classes = cssClass.Split(new char[] { ' ' });
var chunkHasSfCols = classes.Contains("sf_cols", StringComparer.Ordinal);
hasSfCols = hasSfCols || chunkHasSfCols;
if (chunkHasSfCols ||
if (classes.Contains("sf_cols", StringComparer.Ordinal) ||
classes.Contains("sf_colsIn", StringComparer.Ordinal) ||
classes.Contains("sf_colsOut", StringComparer.Ordinal))
{
Expand All @@ -83,7 +80,7 @@ protected virtual string ProcessLayoutString(string targetTemplate, bool ensureS
output.Append(modified ? chunk.GenerateHtml() : chunk.Html);
}

if (!hasSfCols && ensureSfColsWrapper)
if (ensureSfColsWrapper)
{
return "<div runat=\"server\" class=\"sf_cols\">" + output.ToString() + "</div>";
}
Expand Down
38 changes: 38 additions & 0 deletions Telerik.Sitefinity.Frontend/Mvc/Helpers/HtmlHelperExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
using System.Collections.Generic;
using System.Web.Mvc;
using Sitefinity.Security.Sanitizers;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure;
using Telerik.Sitefinity.Mvc.Rendering;
using Telerik.Sitefinity.Security.CSRF;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Utilities.TypeConverters;
using Telerik.Sitefinity.Web.UI;

/// <summary>
Expand Down Expand Up @@ -73,6 +78,39 @@ public static MvcHtmlString UrlSanitize(this HtmlHelper htmlHelper, string url)
return MvcHtmlString.Create(sanitizedUrl);
}

/// <summary>
/// Adds an antiforgery markup and scripts to the view.
/// </summary>
/// <param name="htmlHelper">The HTML helper which this method is extending.</param>
/// <param name="retrievalScriptPath">The path to the token retrieval script.</param>
/// <returns></returns>
public static MvcHtmlString AddSitefinityAntiforgeryToken(this HtmlHelper htmlHelper, string retrievalScriptPath = null)
{
var antiForgery = ObjectFactory.IsTypeRegistered<IAntiCsrf>() ? ObjectFactory.Resolve<IAntiCsrf>() : null;
var antiForgeryEnabled = antiForgery != null && antiForgery.Enabled;
if (antiForgeryEnabled)
{
if (retrievalScriptPath == null)
{
var page = htmlHelper.ViewContext.HttpContext.Handler.GetPageHandler() ?? new PageProxy(null);
retrievalScriptPath = page.ClientScript.GetWebResourceUrl(TypeResolutionService.ResolveType("Telerik.Sitefinity.WebSecurity.WebSecurityModule"),
"Telerik.Sitefinity.WebSecurity.CSRF.TokenRetrieval.js");
}

htmlHelper.Script(retrievalScriptPath, "bottom", false);
var result =
$@"<input type=""hidden"" value="""" name=""{antiForgery.HiddenFieldName}"" />
<input type=""hidden"" value='{antiForgery.ServicePath}' name='antiCsrfService' />
<input type=""hidden"" value='{antiForgery.CustomHeaderName}' name='antiCsrfCustomHeaderName' />";

return MvcHtmlString.Create(result);
}
else
{
return MvcHtmlString.Empty;
}
}

private const string ElementIdsKey = "sf-element-ids";
private const string IdCountersKey = "sf-element-id-counters";
}
Expand Down
26 changes: 26 additions & 0 deletions Telerik.Sitefinity.Frontend/Mvc/Helpers/ResourceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,30 @@ public static MvcHtmlString RenderLangAttribute(this HtmlHelper helper, string c
return new MvcHtmlString(attributeString);
}

/// <summary>
/// Renders the dir attribute when language is right to left.
/// </summary>
/// <param name="helper">The helper.</param>
/// <returns></returns>
public static MvcHtmlString RenderDirAttribute(this HtmlHelper helper)
{
return RenderDirAttribute(helper, Telerik.Sitefinity.Services.SystemManager.CurrentContext.Culture.Name);
}

/// <summary>
/// Renders the dir attribute when language is right to left.
/// </summary>
/// <param name="helper">The helper.</param>
/// <param name="culture">The culture.</param>
/// <returns></returns>
public static MvcHtmlString RenderDirAttribute(this HtmlHelper helper, string culture)
{
var isRtl = (Array.Find(rtlLanguages, s => culture.ToString().StartsWith(s)) != null) || culture.ToString().ToLower().Contains("arab");
string attributeString = isRtl && (!SystemManager.IsDesignMode || SystemManager.IsPreviewMode) ? "dir=\"rtl\"" : "";

return new MvcHtmlString(attributeString);
}

/// <summary>
/// Gets the web resource URL.
/// </summary>
Expand Down Expand Up @@ -949,5 +973,7 @@ internal enum ResourceType
}

private static bool? isDebugMode;

private static string[] rtlLanguages = { "ar", "he", "fa", "ku", "ur", "dv", "ps", "ha", "ks", "yi" };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Telerik.Sitefinity.Services.Configuration;
using Telerik.Sitefinity.Web;
using Telerik.Sitefinity.ContentLocations;
using Telerik.Sitefinity.Lifecycle;

namespace Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers
{
Expand Down Expand Up @@ -145,6 +146,13 @@ internal virtual string GetDefaultCanonicalUrl(IDataItem item)
return null;

var locationsService = SystemManager.GetContentLocationService();
if (item is ILifecycleDataItemGeneric lifecycleDataItem &&
lifecycleDataItem.Status != GenericContent.Model.ContentLifecycleStatus.Master &&
manager is ILifecycleManager lifecycleManager)
{
item = lifecycleManager.Lifecycle.GetMaster(lifecycleDataItem);
}

var location = locationsService.GetItemDefaultLocation(item);
if (location != null)
{
Expand All @@ -157,6 +165,21 @@ internal virtual string GetDefaultCanonicalUrl(IDataItem item)

return canonicalUrl;
}

/// <summary>
/// Adds the canonical tag in the page headers HTML tag, like <link rel="canonical" href="http://www.test.com/item1" />.
/// </summary>
/// <param name="page">The page.</param>
/// <param name="item">The item.</param>
protected void AddCanonicalUrlTagIfEnabled(System.Web.UI.Page page, IDataItem item)
{
var contentView = this as IContentLocatableView;
if (contentView != null)
{
var defaultCanonicalUrl = this.GetDefaultCanonicalUrl(item);
contentView.AddCanonicalUrlTagIfEnabled(page, defaultCanonicalUrl);
}
}

internal virtual SeoAndOpenGraphElement GetSeoAndOpenGraphConfig()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private bool CanDisplayItem(IDataItem item)
if (serializedSelectedParentsIds != null)
{
isParentSelected = serializedSelectedParentsIds.ToString().Contains((item as IHasParent).Parent.Id.ToString());

if (!isParentSelected)
{
var folderIdProperty = item.GetType().GetProperty("FolderId");
Expand All @@ -126,7 +126,7 @@ private bool CanDisplayItem(IDataItem item)
var folderId = folderIdProperty.GetValue(item);
if (folderId != null)
{
isParentSelected = serializedSelectedParentsIds.ToString().Contains(folderId.ToString());
isParentSelected = serializedSelectedParentsIds.ToString().Contains(folderId.ToString());
}
}
}
Expand Down Expand Up @@ -164,6 +164,11 @@ protected virtual void AddContentItemToRouteData(RequestContext requestContext,

if (!redirectUrl.IsNullOrEmpty())
{
if (requestContext.HttpContext.Request.QueryString.Count > 0)
{
redirectUrl = $"{redirectUrl}?{requestContext.HttpContext.Request.QueryString}";
}

requestContext.RouteData.Values[Telerik.Sitefinity.Mvc.ControllerActionInvoker.SfRedirectUrlKey] = redirectUrl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ protected override void InitializeRouteParameters(MvcProxyBase proxyControl)
{
paramsMapper.ResolveUrlParams(originalParams, requestContext, modelUrlKeyPrefix);
}
else
{
this.GetPrefixParamsMapper(controller)?.ResolveUrlParams(originalParams, requestContext);
RouteHelper.SetUrlParametersResolved();
}
}
else
{
Expand Down Expand Up @@ -378,7 +373,7 @@ private IUrlParamsMapper GetInferredTaxonFilterMapper(ControllerBase controller,
{
var pageParamName = actionDescriptor.GetParameters()[1].ParameterName;
var urlParamNames = new string[] { FeatherActionInvoker.TaxonNamedParamter, FeatherActionInvoker.PagingNamedParameter };
result = new CustomActionParamsMapper(controller, () => "/{" + taxonParamName + ":" + routeTemplate + "}/{" + pageParamName + "}", actionName, urlParamNames);
result = new CustomActionParamsMapper(controller, () => "/{" + taxonParamName + ":" + routeTemplate + "}/{" + pageParamName + ":int}", actionName, urlParamNames);
}

var urlTaxonParamNames = new string[] { FeatherActionInvoker.TaxonNamedParamter };
Expand Down
Loading

0 comments on commit 4415ae9

Please sign in to comment.