Updated various input elements using NoEncode.

This prevents HTML characters from being encoded when using the tokenizer on element labels.
This commit is contained in:
Sipke Schoorstra 2015-12-04 12:14:21 +01:00
parent e29fb90298
commit 68b3fe56d0
14 changed files with 16 additions and 16 deletions

View File

@ -38,7 +38,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(Button element, ElementDisplayContext context) {
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
context.ElementShape.ProcessedText = _tokenizer.Replace(element.Text, context.GetTokenData());
context.ElementShape.ProcessedText = _tokenizer.Replace(element.Text, context.GetTokenData(), new ReplaceOptions {Encoding = ReplaceOptions.NoEncode});
}
}
}

View File

@ -67,7 +67,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(CheckBox element, ElementDisplayContext context) {
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData(), new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
context.ElementShape.ProcessedValue = _tokenizer.Replace(element.Value, context.GetTokenData());
}
}

View File

@ -78,7 +78,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(EmailField element, ElementDisplayContext context) {
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData(), new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
context.ElementShape.ProcessedValue = element.RuntimeValue;
}
}

View File

@ -84,8 +84,8 @@ namespace Orchard.DynamicForms.Drivers {
var tokenData = context.GetTokenData();
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, tokenData);
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, tokenData);
context.ElementShape.ProcessedOptions = _tokenizer.Replace(element.Options, tokenData).ToArray();
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, tokenData, new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
context.ElementShape.ProcessedOptions = _tokenizer.Replace(element.Options, tokenData, new ReplaceOptions { Encoding = ReplaceOptions.NoEncode }).ToArray();
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}", typeName, element.InputType));
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
}

View File

@ -13,7 +13,7 @@ namespace Orchard.DynamicForms.Drivers {
}
protected override void OnDisplaying(Fieldset element, ElementDisplayContext context) {
context.ElementShape.ProcessedLegend = _tokenizer.Replace(element.Legend, context.GetTokenData());
context.ElementShape.ProcessedLegend = _tokenizer.Replace(element.Legend, context.GetTokenData(), new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
}
}
}

View File

@ -36,7 +36,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(HiddenField element, ElementDisplayContext context) {
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
context.ElementShape.ProcessedValue = element.Value;
context.ElementShape.ProcessedValue = element.RuntimeValue;
}
}
}

View File

@ -42,7 +42,7 @@ namespace Orchard.DynamicForms.Drivers {
}
protected override void OnDisplaying(Label element, ElementDisplayContext context) {
context.ElementShape.ProcessedText = _tokenizer.Replace(element.Text, context.GetTokenData());
context.ElementShape.ProcessedText = _tokenizer.Replace(element.Text, context.GetTokenData(), new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
context.ElementShape.ProcessedFor = _tokenizer.Replace(element.For, context.GetTokenData());
}
}

View File

@ -75,7 +75,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(PasswordField element, ElementDisplayContext context) {
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData(), new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
}
}
}

View File

@ -149,7 +149,7 @@ namespace Orchard.DynamicForms.Drivers {
foreach (var contentItem in contentItems) {
var data = new {Content = contentItem};
var value = _tokenizer.Replace(valueExpression, data);
var text = _tokenizer.Replace(textExpression, data);
var text = _tokenizer.Replace(textExpression, data, new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
yield return new SelectListItem {
Text = text,

View File

@ -42,7 +42,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(RadioButton element, ElementDisplayContext context) {
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData(), new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
context.ElementShape.ProcessedValue = _tokenizer.Replace(element.Value, context.GetTokenData());
}
}

View File

@ -127,7 +127,7 @@ namespace Orchard.DynamicForms.Drivers {
var tokenData = context.GetTokenData();
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, tokenData);
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, tokenData);
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, tokenData, new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
context.ElementShape.TermOptions = GetTermOptions(element, context.DisplayType, taxonomyId, tokenData).ToArray();
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}", typeName, element.InputType));
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));

View File

@ -90,7 +90,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(TextArea element, ElementDisplayContext context) {
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData(), new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
context.ElementShape.ProcessedValue = element.RuntimeValue;
}
}

View File

@ -72,7 +72,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(UrlField element, ElementDisplayContext context) {
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData());
context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData(), new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
context.ElementShape.ProcessedValue = element.RuntimeValue;
}
}

View File

@ -5,9 +5,9 @@ using Orchard.Tokens;
namespace Orchard.DynamicForms.Helpers {
public static class TokenizerExtensions {
public static IEnumerable<SelectListItem> Replace(this ITokenizer tokenizer, IEnumerable<SelectListItem> items, IDictionary<string, object> data) {
public static IEnumerable<SelectListItem> Replace(this ITokenizer tokenizer, IEnumerable<SelectListItem> items, IDictionary<string, object> data, ReplaceOptions options) {
return items.Select(item => new SelectListItem {
Text = tokenizer.Replace(item.Text, data),
Text = tokenizer.Replace(item.Text, data, options),
Value = item.Value,
Disabled = item.Disabled,
Group = item.Group,