mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-01 17:25:05 +08:00
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:
commit
18b2ffe593
@ -41,6 +41,10 @@ namespace Orchard.DesignerTools.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool IsActivable() {
|
private bool IsActivable() {
|
||||||
|
// don't activate if no HttpContext
|
||||||
|
if (_workContext.HttpContext == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
// activate on front-end only
|
// activate on front-end only
|
||||||
if (AdminFilter.IsApplied(new RequestContext(_workContext.HttpContext, new RouteData())))
|
if (AdminFilter.IsApplied(new RequestContext(_workContext.HttpContext, new RouteData())))
|
||||||
return false;
|
return false;
|
||||||
|
@ -38,7 +38,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
|
|
||||||
protected override void OnDisplaying(Button element, ElementDisplayingContext context) {
|
protected override void OnDisplaying(Button element, ElementDisplayingContext context) {
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
|
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});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -67,7 +67,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
|
|
||||||
protected override void OnDisplaying(CheckBox element, ElementDisplayingContext context) {
|
protected override void OnDisplaying(CheckBox element, ElementDisplayingContext context) {
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
|
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());
|
context.ElementShape.ProcessedValue = _tokenizer.Replace(element.Value, context.GetTokenData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
|
|
||||||
protected override void OnDisplaying(EmailField element, ElementDisplayingContext context) {
|
protected override void OnDisplaying(EmailField element, ElementDisplayingContext context) {
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
|
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;
|
context.ElementShape.ProcessedValue = element.RuntimeValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,8 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
var tokenData = context.GetTokenData();
|
var tokenData = context.GetTokenData();
|
||||||
|
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, tokenData);
|
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.ProcessedOptions = _tokenizer.Replace(element.Options, tokenData).ToArray();
|
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}", typeName, element.InputType));
|
||||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
|
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
_tokenizer = tokenizer;
|
_tokenizer = tokenizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDisplaying(Fieldset element, ElementDisplayingContext context) {
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -36,7 +36,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
|
|
||||||
protected override void OnDisplaying(HiddenField element, ElementDisplayingContext context) {
|
protected override void OnDisplaying(HiddenField element, ElementDisplayingContext context) {
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
|
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
|
||||||
context.ElementShape.ProcessedValue = element.Value;
|
context.ElementShape.ProcessedValue = element.RuntimeValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -41,8 +41,8 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDisplaying(Label element, ElementDisplayingContext context) {
|
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());
|
context.ElementShape.ProcessedFor = _tokenizer.Replace(element.For, context.GetTokenData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
|
|
||||||
protected override void OnDisplaying(PasswordField element, ElementDisplayingContext context) {
|
protected override void OnDisplaying(PasswordField element, ElementDisplayingContext context) {
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
|
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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -147,7 +147,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
foreach (var contentItem in contentItems) {
|
foreach (var contentItem in contentItems) {
|
||||||
var data = new {Content = contentItem};
|
var data = new {Content = contentItem};
|
||||||
var value = _tokenizer.Replace(valueExpression, data);
|
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 {
|
yield return new SelectListItem {
|
||||||
Text = text,
|
Text = text,
|
||||||
|
@ -42,7 +42,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
|
|
||||||
protected override void OnDisplaying(RadioButton element, ElementDisplayingContext context) {
|
protected override void OnDisplaying(RadioButton element, ElementDisplayingContext context) {
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
|
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());
|
context.ElementShape.ProcessedValue = _tokenizer.Replace(element.Value, context.GetTokenData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
var tokenData = context.GetTokenData();
|
var tokenData = context.GetTokenData();
|
||||||
|
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, tokenData);
|
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.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}", typeName, element.InputType));
|
||||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
|
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
|
||||||
|
@ -89,7 +89,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
|
|
||||||
protected override void OnDisplaying(TextArea element, ElementDisplayingContext context) {
|
protected override void OnDisplaying(TextArea element, ElementDisplayingContext context) {
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
|
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;
|
context.ElementShape.ProcessedValue = element.RuntimeValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ namespace Orchard.DynamicForms.Drivers {
|
|||||||
|
|
||||||
protected override void OnDisplaying(UrlField element, ElementDisplayingContext context) {
|
protected override void OnDisplaying(UrlField element, ElementDisplayingContext context) {
|
||||||
context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
|
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;
|
context.ElementShape.ProcessedValue = element.RuntimeValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ using Orchard.Tokens;
|
|||||||
|
|
||||||
namespace Orchard.DynamicForms.Helpers {
|
namespace Orchard.DynamicForms.Helpers {
|
||||||
public static class TokenizerExtensions {
|
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 {
|
return items.Select(item => new SelectListItem {
|
||||||
Text = tokenizer.Replace(item.Text, data),
|
Text = tokenizer.Replace(item.Text, data, options),
|
||||||
Value = item.Value,
|
Value = item.Value,
|
||||||
Disabled = item.Disabled,
|
Disabled = item.Disabled,
|
||||||
Group = item.Group,
|
Group = item.Group,
|
||||||
|
@ -153,4 +153,4 @@ namespace Orchard.Users.Activities {
|
|||||||
get { return T("User is approved."); }
|
get { return T("User is approved."); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ namespace Orchard.ContentManagement.MetaData.Builders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ContentPartDefinitionBuilder RemoveField(string fieldName) {
|
public ContentPartDefinitionBuilder RemoveField(string fieldName) {
|
||||||
var existingField = _fields.SingleOrDefault(x => x.Name == fieldName);
|
var existingField = _fields.FirstOrDefault(x => x.Name == fieldName);
|
||||||
if (existingField != null) {
|
if (existingField != null) {
|
||||||
_fields.Remove(existingField);
|
_fields.Remove(existingField);
|
||||||
}
|
}
|
||||||
@ -162,4 +162,4 @@ namespace Orchard.ContentManagement.MetaData.Builders {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user