Merge branch '1.9.x' into dev

Conflicts:
	src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/CheckboxElementDriver.cs
	src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/EmailFieldElementDriver.cs
	src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/FieldsetElementDriver.cs
	src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/HiddenFieldElementDriver.cs
	src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/LabelElementDriver.cs
	src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/TextAreaElementDriver.cs
	src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/UrlFieldElementDriver.cs
This commit is contained in:
Sipke Schoorstra 2015-12-04 12:20:58 +01:00
commit 18b2ffe593
17 changed files with 25 additions and 21 deletions

View File

@ -41,6 +41,10 @@ namespace Orchard.DesignerTools.Services {
}
private bool IsActivable() {
// don't activate if no HttpContext
if (_workContext.HttpContext == null)
return false;
// activate on front-end only
if (AdminFilter.IsApplied(new RequestContext(_workContext.HttpContext, new RouteData())))
return false;

View File

@ -38,7 +38,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(Button element, ElementDisplayingContext 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, ElementDisplayingContext 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, ElementDisplayingContext 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

@ -12,8 +12,8 @@ namespace Orchard.DynamicForms.Drivers {
_tokenizer = tokenizer;
}
protected override void OnDisplaying(Fieldset element, ElementDisplayingContext context) {
context.ElementShape.ProcessedLegend = _tokenizer.Replace(element.Legend, context.GetTokenData());
protected override void OnDisplaying(Fieldset element, ElementDisplayContext context) {
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, ElementDisplayingContext context) {
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
context.ElementShape.ProcessedValue = element.Value;
context.ElementShape.ProcessedValue = element.RuntimeValue;
}
}
}

View File

@ -41,8 +41,8 @@ namespace Orchard.DynamicForms.Drivers {
});
}
protected override void OnDisplaying(Label element, ElementDisplayingContext context) {
context.ElementShape.ProcessedText = _tokenizer.Replace(element.Text, context.GetTokenData());
protected override void OnDisplaying(Label element, ElementDisplayContext context) {
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, ElementDisplayingContext 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

@ -147,7 +147,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, ElementDisplayingContext 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

@ -89,7 +89,7 @@ namespace Orchard.DynamicForms.Drivers {
protected override void OnDisplaying(TextArea element, ElementDisplayingContext 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, ElementDisplayingContext 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,

View File

@ -153,4 +153,4 @@ namespace Orchard.Users.Activities {
get { return T("User is approved."); }
}
}
}
}

View File

@ -43,7 +43,7 @@ namespace Orchard.ContentManagement.MetaData.Builders {
}
public ContentPartDefinitionBuilder RemoveField(string fieldName) {
var existingField = _fields.SingleOrDefault(x => x.Name == fieldName);
var existingField = _fields.FirstOrDefault(x => x.Name == fieldName);
if (existingField != null) {
_fields.Remove(existingField);
}
@ -162,4 +162,4 @@ namespace Orchard.ContentManagement.MetaData.Builders {
return obj;
}
}
}
}