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(), new ReplaceOptions {
         Encoding = ReplaceOptions.NoEncode
     });
 }
Exemple #2
0
 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(), new ReplaceOptions {
         Encoding = ReplaceOptions.NoEncode
     });
 }
 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(), new ReplaceOptions {
         Encoding = ReplaceOptions.NoEncode
     });
     context.ElementShape.ProcessedValue = element.RuntimeValue;
 }
        protected override void OnDisplaying(Taxonomy element, ElementDisplayingContext context)
        {
            var taxonomyId  = element.TaxonomyId;
            var typeName    = element.GetType().Name;
            var displayType = context.DisplayType;
            var tokenData   = context.GetTokenData();

            // Allow the initially selected value to be tokenized.
            // If a value was posted, use that value instead (without tokenizing it).
            if (element.PostedValue == null)
            {
                var defaultValue = _tokenizer.Replace(element.DefaultValue, tokenData, new ReplaceOptions {
                    Encoding = ReplaceOptions.NoEncode
                });
                element.RuntimeValue = defaultValue;
            }

            context.ElementShape.ProcessedName  = _tokenizer.Replace(element.Name, 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));
        }
Exemple #5
0
        protected override void OnDisplaying(Form element, ElementDisplayingContext context)
        {
            var controller = _currentControllerAccessor.CurrentController;
            var modelState = controller != null?controller.FetchModelState(element) : default(ModelStateDictionary);

            if (modelState != null && !modelState.IsValid)
            {
                // Read any posted values from the previous request.
                var values = controller.FetchPostedValues(element);
                _formService.ReadElementValues(element, new NameValueCollectionValueProvider(values, _cultureAccessor.CurrentCulture));

                // Add any model validation errors from the previous request.
                controller.ApplyAnyModelErrors(element, modelState);
            }

            // Assign the binding content type to each element within the form element.
            foreach (var child in element.Elements.Flatten().Where(x => x is FormElement).Cast <FormElement>())
            {
                child.FormBindingContentType = element.CreateContent == true ? element.FormBindingContentType : default(string);
            }

            // Set tokenized properties.
            var tokenData = context.GetTokenData();

            context.ElementShape.ProcessedAction = _tokenizer.Replace(element.Action, tokenData);
        }
Exemple #6
0
        protected override void OnDisplaying(Enumeration element, ElementDisplayingContext context)
        {
            var typeName    = element.GetType().Name;
            var displayType = context.DisplayType;
            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.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));
        }
Exemple #7
0
        protected override void OnDisplaying(HiddenField element, ElementDisplayingContext context)
        {
            var tokenData = context.GetTokenData();

            context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, tokenData);

            // Allow the initial value to be tokenized.
            // If a value was posted, use that value instead (without tokenizing it).
            context.ElementShape.ProcessedValue = element.PostedValue != null ? element.PostedValue : _tokenizer.Replace(element.RuntimeValue, tokenData, new ReplaceOptions {
                Encoding = ReplaceOptions.NoEncode
            });
        }
Exemple #8
0
        protected override void OnDisplaying(ReCaptcha element, ElementDisplayingContext context)
        {
            var workContext = _services.WorkContext;
            var currentSite = workContext.CurrentSite;
            var settings    = currentSite.As <ReCaptchaSettingsPart>();

            if (settings.TrustAuthenticatedUsers && workContext.CurrentUser != null)
            {
                return;
            }

            context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
            context.ElementShape.PublicKey     = settings.PublicKey;
        }
        protected override void OnDisplaying(Taxonomy element, ElementDisplayingContext context)
        {
            var taxonomyId  = element.TaxonomyId;
            var typeName    = element.GetType().Name;
            var displayType = context.DisplayType;
            var tokenData   = context.GetTokenData();

            context.ElementShape.ProcessedName  = _tokenizer.Replace(element.Name, 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));
        }
 protected override void OnDisplaying(Fieldset element, ElementDisplayingContext context)
 {
     context.ElementShape.ProcessedLegend = _tokenizer.Replace(element.Legend, context.GetTokenData());
 }
 protected override void OnDisplaying(MarkdownElement element, ElementDisplayingContext context)
 {
     context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "markdown", context.GetTokenData());
 }
Exemple #12
0
 protected override void OnDisplaying(Label element, ElementDisplayingContext context)
 {
     context.ElementShape.ProcessedText = _tokenizer.Replace(element.Text, context.GetTokenData());
     context.ElementShape.ProcessedFor  = _tokenizer.Replace(element.For, context.GetTokenData());
 }
Exemple #13
0
 protected override void OnDisplaying(ValidationMessage element, ElementDisplayingContext context)
 {
     context.ElementShape.ProcessedFor = _tokenizer.Replace(element.For, context.GetTokenData());
 }
 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.ProcessedValue = _tokenizer.Replace(element.Value, context.GetTokenData());
 }
 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.ProcessedValue = _tokenizer.Replace(element.RuntimeValue, context.GetTokenData());
 }
 protected override void OnDisplaying(Paragraph element, ElementDisplayingContext context)
 {
     context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "html", context.GetTokenData());
 }
 protected override void OnDisplaying(Heading element, ElementDisplayingContext context)
 {
     context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "html", context.GetTokenData());
     context.ElementShape.Level            = element.Level;
 }
 protected override void OnDisplaying(Fieldset element, ElementDisplayingContext context)
 {
     context.ElementShape.ProcessedLegend = _tokenizer.Replace(element.Legend, context.GetTokenData(), new ReplaceOptions {
         Encoding = ReplaceOptions.NoEncode
     });
 }
 protected override void OnDisplaying(HiddenField element, ElementDisplayingContext context)
 {
     context.ElementShape.ProcessedName  = _tokenizer.Replace(element.Name, context.GetTokenData());
     context.ElementShape.ProcessedValue = _tokenizer.Replace(element.Value, context.GetTokenData());
 }