Esempio n. 1
0
        public void Building(OrchardForms.BuildingContext context)
        {
            if (context.Shape.Id == "DateTimeFilterForm")
            {
                var siteCulture = CultureInfo.GetCultureInfo(_workContextAccessor.GetContext().CurrentCulture);
                var utcNow      = DateTime.UtcNow;

                // Default values for dates and times is UtcNow.
                context.Shape._From._Date.Value    = _dateLocalizationServices.ConvertToSiteTimeZone(utcNow).ToString(siteCulture.DateTimeFormat.ShortDatePattern);
                context.Shape._From._Time.Value    = _dateLocalizationServices.ConvertToSiteTimeZone(utcNow).ToString(siteCulture.DateTimeFormat.ShortTimePattern);
                context.Shape._From._Culture.Value = siteCulture.Name;

                context.Shape._To._Date.Value    = _dateLocalizationServices.ConvertToSiteTimeZone(utcNow).ToString(siteCulture.DateTimeFormat.ShortDatePattern);
                context.Shape._To._Time.Value    = _dateLocalizationServices.ConvertToSiteTimeZone(utcNow).ToString(siteCulture.DateTimeFormat.ShortTimePattern);
                context.Shape._To._Culture.Value = siteCulture.Name;
            }
        }
Esempio n. 2
0
        public dynamic Build(string formName, string prefix = "") {
            var context = new DescribeContext();
            foreach (var provider in _formProviders) {
                provider.Describe(context);
            }

            var descriptor = context.Describe().FirstOrDefault(x => x.Name == formName);

            if (descriptor == null) {
                return null;
            }

            var shape = descriptor.Shape(_shapeFactory);
            var buildingContext = new BuildingContext { Shape = shape };

            _formEventHandlers.Invoke(dispatch => dispatch.Building(buildingContext), Logger);
            // alter the shapes tree (validation, ajax, ...));
            _formEventHandlers.Invoke(dispatch => dispatch.Built(buildingContext), Logger);

            return shape;
        }
Esempio n. 3
0
 public void Built(BuildingContext context) {
 }
Esempio n. 4
0
 public void Built(OrchardForms.BuildingContext context)
 {
 }
 public virtual void Built(BuildingContext context) {}
 public virtual void Built(BuildingContext context)
 {
 }
Esempio n. 7
0
 void IFormEventHandler.Built(BuildingContext context) {}