private void LoadExtraSettings(FormFieldModel field, XElement bindingsXElement, XElement lastTabElement) { var config = FormBuilderConfiguration.GetSection(); var plugin = (DynamicFormBuilderConfiguration)config.Plugins["dynamic"]; var inputElement = plugin.InputElementHandlers.Single(el => el.ElementType.GetType() == field.InputElementType.GetType()); var settingsHandler = inputElement.SettingsHandler; if (settingsHandler != null) { var formFile = "\\InstalledPackages\\CompositeC1Contrib.FormBuilder.Dynamic\\InputElementSettings\\" + inputElement.Name + ".xml"; var settingsMarkupProvider = new FormDefinitionFileMarkupProvider(formFile); var formDefinitionElement = XElement.Load(settingsMarkupProvider.GetReader()); var settingsTab = new XElement(Namespaces.BindingFormsStdUiControls10 + "PlaceHolder"); var layout = formDefinitionElement.Element(Namespaces.BindingForms10 + FormKeyTagNames.Layout); var bindings = formDefinitionElement.Element(Namespaces.BindingForms10 + FormKeyTagNames.Bindings); settingsTab.Add(new XAttribute("Label", StringResourceSystemFacade.ParseString(inputElement.Name))); settingsTab.Add(layout.Elements()); bindingsXElement.Add(bindings.Elements()); lastTabElement.AddAfterSelf(settingsTab); settingsHandler.Load(field); foreach (var prop in settingsHandler.GetType().GetProperties()) { var value = prop.GetValue(settingsHandler, null); Bindings.Add(prop.Name, value); } } }
static AddFormFieldWorkflow() { var config = FormBuilderConfiguration.GetSection(); var plugin = (DynamicFormBuilderConfiguration)config.Plugins["dynamic"]; InputElementTypes = plugin.InputElementHandlers.ToDictionary(e => e.ElementType.GetType().AssemblyQualifiedName, e => e.Name); }
static AddSubmitHandlerWorkflow() { var config = FormBuilderConfiguration.GetSection(); var plugin = (DynamicFormBuilderConfiguration)config.Plugins["dynamic"]; Handlers = plugin.SubmitHandlers; }
private void LoadExtraSettings(IDynamicDefinition definition, XElement bindingsXElement, XElement lastTabElement) { var config = FormBuilderConfiguration.GetSection(); var plugin = (DynamicFormBuilderConfiguration)config.Plugins["dynamic"]; var settingsType = plugin.SettingsHandler; if (settingsType == null) { return; } var formFile = "\\InstalledPackages\\" + settingsType.Namespace + "\\" + settingsType.Name + ".xml"; var settingsMarkupProvider = new FormDefinitionFileMarkupProvider(formFile); var formDefinitionElement = XElement.Load(settingsMarkupProvider.GetReader()); var settingsTab = new XElement(Namespaces.BindingFormsStdUiControls10 + "PlaceHolder"); var layout = formDefinitionElement.Element(Namespaces.BindingForms10 + FormKeyTagNames.Layout); if (layout == null) { return; } var bindings = formDefinitionElement.Element(Namespaces.BindingForms10 + FormKeyTagNames.Bindings); if (bindings == null) { return; } settingsTab.Add(new XAttribute("Label", "Extra Settings")); settingsTab.Add(layout.Elements()); bindingsXElement.Add(bindings.Elements()); lastTabElement.AddAfterSelf(settingsTab); var settings = definition.Settings ?? (IFormSettings)Activator.CreateInstance(settingsType); foreach (var prop in settingsType.GetProperties()) { var value = prop.GetValue(settings, null); Bindings.Add(prop.Name, value); } }
public DynamicWizardDefinition(WizardModel model) { Model = model; Name = model.Name; SubmitHandlers = new List <FormSubmitHandler>(); IntroText = new XhtmlDocument(); SuccessResponse = new XhtmlDocument(); var config = FormBuilderConfiguration.GetSection(); var plugin = (DynamicFormBuilderConfiguration)config.Plugins["dynamic"]; var settingsType = plugin.SettingsHandler; if (settingsType != null) { Settings = (IFormSettings)Activator.CreateInstance(settingsType); } }
private void SaveExtraSettings(FormFieldModel field) { var config = FormBuilderConfiguration.GetSection(); var plugin = (DynamicFormBuilderConfiguration)config.Plugins["dynamic"]; var inputElement = plugin.InputElementHandlers.Single(el => el.ElementType.GetType() == field.InputElementType.GetType()); var settingsHandler = inputElement.SettingsHandler; if (settingsHandler != null) { foreach (var prop in settingsHandler.GetType().GetProperties()) { if (BindingExist(prop.Name)) { var value = GetBinding <object>(prop.Name); prop.SetValue(settingsHandler, value, null); } } settingsHandler.Save(field); } }
private void SaveExtraSettings(IDynamicDefinition definition) { var config = FormBuilderConfiguration.GetSection(); var plugin = (DynamicFormBuilderConfiguration)config.Plugins["dynamic"]; var settingsType = plugin.SettingsHandler; if (settingsType == null) { definition.Settings = null; return; } definition.Settings = (IFormSettings)Activator.CreateInstance(settingsType); foreach (var prop in settingsType.GetProperties().Where(p => BindingExist(p.Name))) { var value = GetBinding <object>(prop.Name); prop.SetValue(definition.Settings, value, null); } }
static RequiresCaptchaAttribute() { var captchaConfig = FormBuilderConfiguration.GetSection().Captcha; Provider = (CaptchaProvider)captchaConfig.Providers[captchaConfig.DefaultProvider]; }