Exemplo n.º 1
0
    /// <summary>
    /// Loads control with new FormInfo data.
    /// </summary>
    /// <param name="type">Selected control type</param>
    /// <param name="defaultValues">Indicates if default values should be loaded</param>
    public void LoadControlSettings(string type, bool defaultValues)
    {
        string selectedFieldType = type;

        if (String.IsNullOrEmpty(type))
        {
            selectedFieldType = drpFieldType.SelectedValue.ToLower();
        }
        if (selectedFieldType.StartsWith(controlPrefix))
        {
            selectedFieldType = selectedFieldType.Substring(controlPrefix.Length);
        }

        FormUserControlInfo control = FormUserControlInfoProvider.GetFormUserControlInfo(selectedFieldType);

        if (control != null)
        {
            // Get form controls' settings
            fi = FormHelper.GetFormControlParameters(selectedFieldType, control.UserControlParameters, true);

            // Simplify the settings - remove advanced ones
            SimplifyControlSettings(control.UserControlCodeName);

            Reload(defaultValues);
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// Selects control type according to current selected form control.
 /// </summary>
 private void SelectControlTypes(FormUserControlInfo fi)
 {
     if (fi != null)
     {
         drpTypeSelector.ControlType = fi.UserControlType;
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Gets and bulk updates form controls. Called when the "Get and bulk update controls" button is pressed.
    /// Expects the CreateFormControl method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateFormControls()
    {
        // Prepare the parameters
        string where = "UserControlCodeName LIKE N'MyNewControl%'";

        // Get the data
        DataSet formcontrols = FormUserControlInfoProvider.GetFormUserControls(where, null);

        if (!DataHelper.DataSourceIsEmpty(formcontrols))
        {
            // Loop through the individual items
            foreach (DataRow formcontrolsDr in formcontrols.Tables[0].Rows)
            {
                // Create object from DataRow
                FormUserControlInfo modifyControl = new FormUserControlInfo(formcontrolsDr);

                // Update the properties
                modifyControl.UserControlDisplayName = modifyControl.UserControlDisplayName.ToUpper();

                // Save the changes
                FormUserControlInfoProvider.SetFormUserControlInfo(modifyControl);
            }

            return(true);
        }

        return(false);
    }
Exemplo n.º 4
0
    /// <summary>
    /// Creates form control. Called when the "Create control" button is pressed.
    /// </summary>
    private bool CreateFormControl()
    {
        // Create new form control object
        FormUserControlInfo newControl = new FormUserControlInfo();

        // Set the properties
        newControl.UserControlDisplayName       = "My new control";
        newControl.UserControlCodeName          = "MyNewControl";
        newControl.UserControlFileName          = "~/CMSFormControls/Basic/TextBoxControl.ascx";
        newControl.UserControlType              = FormUserControlTypeEnum.Input;
        newControl.UserControlForText           = true;
        newControl.UserControlForLongText       = false;
        newControl.UserControlForInteger        = false;
        newControl.UserControlForLongInteger    = false;
        newControl.UserControlForDecimal        = false;
        newControl.UserControlForDateTime       = false;
        newControl.UserControlForBoolean        = false;
        newControl.UserControlForFile           = false;
        newControl.UserControlForDocAttachments = false;
        newControl.UserControlForGUID           = false;
        newControl.UserControlForVisibility     = false;
        newControl.UserControlShowInBizForms    = false;
        newControl.UserControlDefaultDataType   = "Text";

        // Save the form control
        FormUserControlInfoProvider.SetFormUserControlInfo(newControl);

        return(true);
    }
    /// <summary>
    /// Loads both field types and control types from inner settings.
    /// </summary>
    public void LoadTypes()
    {
        if (FieldInfo != null)
        {
            // Get control name..
            string item = null;
            // ..from settings..
            if (!string.IsNullOrEmpty(ValidationHelper.GetString(FieldInfo.Settings["controlname"], null)))
            {
                item = Convert.ToString(FieldInfo.Settings["controlname"]).ToLowerCSafe();
            }
            // ..or from field type.
            else
            {
                item = FormHelper.GetFormFieldControlTypeString(FieldInfo.FieldType).ToLowerCSafe();
            }

            // Load and select options
            FormUserControlInfo fi = FormUserControlInfoProvider.GetFormUserControlInfo(item);
            if (fi != null)
            {
                drpControl.ReturnColumnName = FormUserControlInfo.TYPEINFO.CodeNameColumn;
                drpControl.Value            = item;
                drpControl.Reload(true);
            }
        }
    }
    /// <summary>
    /// Creates form control. Called when the "Create control" button is pressed.
    /// </summary>
    private bool CreateFormControl()
    {
        // Create new form control object
        FormUserControlInfo newControl = new FormUserControlInfo();

        // Set the properties
        newControl.UserControlDisplayName = "My new control";
        newControl.UserControlCodeName = "MyNewControl";
        newControl.UserControlFileName = "~/CMSFormControls/Basic/TextBoxControl.ascx";
        newControl.UserControlType = FormUserControlTypeEnum.Input;
        newControl.UserControlForText = true;
        newControl.UserControlForLongText = false;
        newControl.UserControlForInteger = false;
        newControl.UserControlForLongInteger = false;
        newControl.UserControlForDecimal = false;
        newControl.UserControlForDateTime = false;
        newControl.UserControlForBoolean = false;
        newControl.UserControlForFile = false;
        newControl.UserControlForDocAttachments = false;
        newControl.UserControlForGUID = false;
        newControl.UserControlForVisibility = false;
        newControl.UserControlShowInBizForms = false;
        newControl.UserControlDefaultDataType = "Text";

        // Save the form control
        FormUserControlInfoProvider.SetFormUserControlInfo(newControl);

        return true;
    }
Exemplo n.º 7
0
    /// <summary>
    /// Handles btnOK's OnClick event.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        FormUserControlInfo fi = null;

        // Finds whether required fields are not empty
        string result = new Validator().NotEmpty(txtControlName.Text, rfvControlName.ErrorMessage).NotEmpty(txtControlDisplayName, rfvControlDisplayName.ErrorMessage).Result;

        // Check input file validity
        if (String.IsNullOrEmpty(result))
        {
            if (!tbFileName.IsValid())
            {
                result = tbFileName.ValidationError;
            }
        }

        // Try to create new form control if everything is OK
        if (String.IsNullOrEmpty(result))
        {
            fi = new FormUserControlInfo();
            fi.UserControlDisplayName       = txtControlDisplayName.Text.Trim();
            fi.UserControlCodeName          = txtControlName.Text.Trim();
            fi.UserControlFileName          = tbFileName.Value.ToString();
            fi.UserControlType              = drpTypeSelector.ControlType;
            fi.UserControlForText           = false;
            fi.UserControlForLongText       = false;
            fi.UserControlForInteger        = false;
            fi.UserControlForLongInteger    = false;
            fi.UserControlForDecimal        = false;
            fi.UserControlForDateTime       = false;
            fi.UserControlForBoolean        = false;
            fi.UserControlForFile           = false;
            fi.UserControlForDocAttachments = false;
            fi.UserControlForGUID           = false;
            fi.UserControlForVisibility     = false;
            fi.UserControlShowInBizForms    = false;
            fi.UserControlDefaultDataType   = "Text";
            try
            {
                FormUserControlInfoProvider.SetFormUserControlInfo(fi);
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text    = ex.Message.Replace("%%name%%", fi.UserControlCodeName);
            }
        }
        else
        {
            lblError.Visible = true;
            lblError.Text    = result;
        }

        // If control was succesfully created then redirect to editing page
        if (String.IsNullOrEmpty(lblError.Text) && (fi != null))
        {
            URLHelper.Redirect("Frameset.aspx?controlId=" + Convert.ToString(fi.UserControlID));
        }
    }
Exemplo n.º 8
0
    /// <summary>
    /// Handles btnOK's OnClick event.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        FormUserControlInfo fi = null;

        // Finds whether required fields are not empty
        string result = new Validator().NotEmpty(txtControlName.Text, rfvControlName.ErrorMessage).NotEmpty(txtControlDisplayName, rfvControlDisplayName.ErrorMessage).Result;

        // Check input file validity
        if (String.IsNullOrEmpty(result))
        {
            if (!tbFileName.IsValid())
            {
                result = tbFileName.ValidationError;
            }
        }

        // Try to create new form control if everything is OK
        if (String.IsNullOrEmpty(result))
        {
            fi = new FormUserControlInfo();
            fi.UserControlDisplayName = txtControlDisplayName.Text.Trim();
            fi.UserControlCodeName = txtControlName.Text.Trim();
            fi.UserControlFileName = tbFileName.Value.ToString();
            fi.UserControlType = drpTypeSelector.ControlType;
            fi.UserControlForText = false;
            fi.UserControlForLongText = false;
            fi.UserControlForInteger = false;
            fi.UserControlForLongInteger = false;
            fi.UserControlForDecimal = false;
            fi.UserControlForDateTime = false;
            fi.UserControlForBoolean = false;
            fi.UserControlForFile = false;
            fi.UserControlForDocAttachments = false;
            fi.UserControlForGUID = false;
            fi.UserControlForVisibility = false;
            fi.UserControlShowInBizForms = false;
            fi.UserControlDefaultDataType = "Text";
            try
            {
                FormUserControlInfoProvider.SetFormUserControlInfo(fi);
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text = ex.Message.Replace("%%name%%", fi.UserControlCodeName);
            }
        }
        else
        {
            lblError.Visible = true;
            lblError.Text = result;
        }

        // If control was succesfully created then redirect to editing page
        if (String.IsNullOrEmpty(lblError.Text) && (fi != null))
        {
            URLHelper.Redirect("Frameset.aspx?controlId=" + Convert.ToString(fi.UserControlID));
        }
    }
Exemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int    controlId   = QueryHelper.GetInteger("controlId", 0);
        string controlName = null;
        bool   isInherited = false;

        if (controlId > 0)
        {
            FormUserControlInfo fuci = FormUserControlInfoProvider.GetFormUserControlInfo(controlId);
            if (fuci != null)
            {
                controlName = fuci.UserControlDisplayName;
                if (fuci.UserControlParentID > 0)
                {
                    isInherited = true;
                }
            }
        }

        // Initializes page title
        string[,] breadcrumbs = new string[2, 3];
        breadcrumbs[0, 0]     = GetString("Development_FormUserControl_Edit.Controls");
        breadcrumbs[0, 1]     = "~/CMSModules/FormControls/Pages/Development/List.aspx";
        breadcrumbs[0, 2]     = "_parent";
        breadcrumbs[1, 0]     = controlName;
        breadcrumbs[1, 1]     = "";
        breadcrumbs[1, 2]     = "";

        // Initialize page
        CurrentMaster.Title.Breadcrumbs   = breadcrumbs;
        CurrentMaster.Title.TitleText     = GetString("Development_FormUserControl_Edit.Edit");
        CurrentMaster.Title.TitleImage    = GetImageUrl("Objects/CMS_FormControl/object.png");
        CurrentMaster.Title.HelpTopicName = "edit_form_control";
        CurrentMaster.Title.HelpName      = "helpTopic";

        if (!RequestHelper.IsPostBack())
        {
            string[,] tabs = new string[2, 4];

            tabs[0, 0] = GetString("general.general");
            tabs[0, 1] = "SetHelpTopic('helpTopic', 'edit_form_control');";
            tabs[0, 2] = "Edit.aspx?controlId=" + controlId;
            tabs[1, 0] = GetString("general.properties");

            if (isInherited)
            {
                tabs[1, 1] = "SetHelpTopic('helpTopic', 'properties_form_control_inherited');";
            }
            else
            {
                tabs[1, 1] = "SetHelpTopic('helpTopic', 'properties_form_control');";
            }

            tabs[1, 2] = "Parameters.aspx?controlId=" + controlId;

            CurrentMaster.Tabs.Tabs      = tabs;
            CurrentMaster.Tabs.UrlTarget = "FormUserControl";
        }
    }
Exemplo n.º 10
0
    /// <summary>
    /// Checks whether given form control is available. If so, sets it to referring control name.
    /// </summary>
    /// <param name="formControl">Codename of form control</param>
    /// <param name="controlName">Referring control name to which will be set codename of control, if exists</param>
    private void CheckFormControl(string formControl, ref string controlName)
    {
        // Check if user defined control exists
        FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(formControl);

        if (fui != null)
        {
            controlName = formControl;
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// Deletes form control. Called when the "Delete control" button is pressed.
    /// Expects the CreateFormControl method to be run first.
    /// </summary>
    private bool DeleteFormControl()
    {
        // Get the form control
        FormUserControlInfo deleteControl = FormUserControlInfoProvider.GetFormUserControlInfo("MyNewControl");

        // Delete the form control
        FormUserControlInfoProvider.DeleteFormUserControlInfo(deleteControl);

        return(deleteControl != null);
    }
Exemplo n.º 12
0
    /// <summary>
    /// Loads data of edited form user control.
    /// </summary>
    protected void LoadData()
    {
        // Load drop-down list with default data types
        if (drpDataType.Items.Count <= 0)
        {
            drpDataType.Items.Add(new ListItem("Text", "Text"));
            drpDataType.Items.Add(new ListItem("Long Text", "LongText"));
            drpDataType.Items.Add(new ListItem("Integer", "Integer"));
            drpDataType.Items.Add(new ListItem("Decimal", "Decimal"));
            drpDataType.Items.Add(new ListItem("DateTime", "DateTime"));
            drpDataType.Items.Add(new ListItem("Boolean", "Boolean"));
            drpDataType.Items.Add(new ListItem("File", "File"));
        }

        FormUserControlInfo fi = FormUserControlInfoProvider.GetFormUserControlInfo(controlId);

        EditedObject = fi;
        if (fi != null)
        {
            // Set properties
            tbCodeName.Text             = fi.UserControlCodeName;
            tbDisplayName.Text          = fi.UserControlDisplayName;
            tbFileName.Value            = fi.UserControlFileName;
            drpTypeSelector.ControlType = fi.UserControlType;

            drpModule.Value = fi.UserControlResourceID;

            // Set types
            chkForBizForms.Checked    = fi.UserControlShowInBizForms;
            chkForBoolean.Checked     = fi.UserControlForBoolean;
            chkForDateTime.Checked    = fi.UserControlForDateTime;
            chkForDecimal.Checked     = fi.UserControlForDecimal;
            chkForFile.Checked        = fi.UserControlForFile;
            chkForInteger.Checked     = fi.UserControlForInteger;
            chkForLongInteger.Checked = fi.UserControlForLongInteger;
            chkForLongText.Checked    = fi.UserControlForLongText;
            chkForText.Checked        = fi.UserControlForText;
            chkForGuid.Checked        = fi.UserControlForGUID;
            chkForVisibility.Checked  = fi.UserControlForVisibility;
            chkForDocAtt.Checked      = fi.UserControlForDocAttachments;

            // Set modules
            chkShowInDocumentTypes.Checked = fi.UserControlShowInDocumentTypes;
            chkShowInSystemTables.Checked  = fi.UserControlShowInSystemTables;
            chkShowInControls.Checked      = fi.UserControlShowInWebParts;
            chkShowInReports.Checked       = fi.UserControlShowInReports;
            chkShowInCustomTables.Checked  = fi.UserControlShowInCustomTables;

            tbColumnSize.Text         = fi.UserControlDefaultDataTypeSize.ToString();
            drpDataType.SelectedValue = fi.UserControlDefaultDataType;
        }
    }
    private static string GetControlForValue(FormUserControlInfo formControl)
    {
        List <string> values = new List <string>();

        if (formControl.UserControlForText)
        {
            values.Add(FOR_TEXT);
        }
        if (formControl.UserControlForLongText)
        {
            values.Add(FOR_LONG_TEXT);
        }
        if (formControl.UserControlForInteger)
        {
            values.Add(FOR_INT);
        }
        if (formControl.UserControlForLongInteger)
        {
            values.Add(FOR_LONG_INT);
        }
        if (formControl.UserControlForDecimal)
        {
            values.Add(FOR_DECIMAL);
        }
        if (formControl.UserControlForDateTime)
        {
            values.Add(FOR_DATE);
        }
        if (formControl.UserControlForBoolean)
        {
            values.Add(FOR_BOOL);
        }
        if (formControl.UserControlForGUID)
        {
            values.Add(FOR_GUID);
        }
        if (formControl.UserControlForFile)
        {
            values.Add(FOR_FILE);
        }
        if (formControl.UserControlForDocAttachments)
        {
            values.Add(FOR_ATTACH);
        }
        if (formControl.UserControlForVisibility)
        {
            values.Add(FOR_VISIBILITY);
        }

        return(String.Join("|", values));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblFiles.ToolTip    = GetString("clonning.settings.formusercontrol.files.tooltip");
        lblFileName.ToolTip = GetString("clonning.settings.formusercontrol.filename.tooltip");

        if (!RequestHelper.IsPostBack())
        {
            FormUserControlInfo control = InfoToClone as FormUserControlInfo;
            if (control != null)
            {
                txtFileName.Text = FileHelper.GetUniqueFileName(control.UserControlFileName);
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!RequestHelper.IsPostBack())
     {
         FormUserControlInfo control = InfoToClone as FormUserControlInfo;
         if (control != null)
         {
             if (!String.IsNullOrEmpty(control.UserControlFileName) && !control.UserControlFileName.EqualsCSafe("inherited", true))
             {
                 txtFileName.Text = FileHelper.GetUniqueFileName(control.UserControlFileName);
             }
         }
     }
 }
Exemplo n.º 16
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Load form control
        int controlId            = QueryHelper.GetInteger("controlId", 0);
        FormUserControlInfo fuci = FormUserControlInfoProvider.GetFormUserControlInfo(controlId);

        EditedObject = fuci;
        if (fuci != null)
        {
            ctrlView.FormControlName = fuci.UserControlCodeName;
        }

        btnSubmit.Click += btnSubmit_Click;
    }
    private void Control_OnBeforeSave(object sender, EventArgs e)
    {
        UIForm form = (UIForm)sender;
        FormUserControlInfo formControl = form.EditedObject as FormUserControlInfo;

        if (formControl != null)
        {
            if (form.IsInsertMode)
            {
                FormEngineUserControl fileName = form.FieldControls["UserControlFileName"];
                FormEngineUserControl parentId = form.FieldControls["UserControlParentID"];

                if ((fileName != null) && (parentId != null) && fileName.Visible && !parentId.Visible && (ValidationHelper.GetInteger(parentId.Value, 0) > 0))
                {
                    // Reset inheritance setting if it's not visible
                    formControl.SetValue("UserControlParentID", null);
                }
            }
            else
            {
                // Set control's priority
                formControl.UserControlPriority = ValidationHelper.GetBoolean(form.GetFieldValue(FIELD_PRIORITY), false) ? (int)ObjectPriorityEnum.High : (int)ObjectPriorityEnum.Low;

                // Set which (data) types the control can be used for
                List <string> values = GetFieldValues(form, FIELD_FOR);
                formControl.UserControlForText           = values.Contains(FOR_TEXT);
                formControl.UserControlForLongText       = values.Contains(FOR_LONG_TEXT);
                formControl.UserControlForInteger        = values.Contains(FOR_INT);
                formControl.UserControlForLongInteger    = values.Contains(FOR_LONG_INT);
                formControl.UserControlForDecimal        = values.Contains(FOR_DECIMAL);
                formControl.UserControlForDateTime       = values.Contains(FOR_DATE);
                formControl.UserControlForBoolean        = values.Contains(FOR_BOOL);
                formControl.UserControlForGUID           = values.Contains(FOR_GUID);
                formControl.UserControlForFile           = values.Contains(FOR_FILE);
                formControl.UserControlForDocAttachments = values.Contains(FOR_ATTACH);
                formControl.UserControlForVisibility     = values.Contains(FOR_VISIBILITY);

                // Set which resources the control can be shown in
                values = GetFieldValues(form, FIELD_SHOWIN);
                formControl.UserControlShowInDocumentTypes = values.Contains(SHOWIN_PAGETYPE);
                formControl.UserControlShowInBizForms      = values.Contains(SHOWIN_FORM);
                values = GetFieldValues(form, FIELD_SHOWIN2);
                formControl.UserControlShowInCustomTables = values.Contains(SHOWIN_CUSTOMTABLE);
                formControl.UserControlShowInSystemTables = values.Contains(SHOWIN_SYSTEMTABLE);
                formControl.UserControlShowInReports      = values.Contains(SHOWIN_REPORT);
                formControl.UserControlShowInWebParts     = values.Contains(SHOWIN_CONTROL);
            }
        }
    }
Exemplo n.º 18
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Load form control
        int controlId            = QueryHelper.GetInteger("controlId", 0);
        FormUserControlInfo fuci = FormUserControlInfoProvider.GetFormUserControlInfo(controlId);

        EditedObject = fuci;
        if (fuci != null)
        {
            ctrlView.FormControlName = fuci.UserControlCodeName;
            headTitle.Text           = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(fuci.UserControlDisplayName));
        }

        btnSubmit.Click += btnSubmit_Click;
    }
    private void Control_OnBeforeSave(object sender, EventArgs e)
    {
        UIForm form = (UIForm)sender;
        FormUserControlInfo formControl = form.EditedObject as FormUserControlInfo;

        if (formControl != null)
        {
            if (form.IsInsertMode)
            {
                FormEngineUserControl fileName = form.FieldControls["UserControlFileName"];
                FormEngineUserControl parentId = form.FieldControls["UserControlParentID"];

                if ((fileName != null) && (parentId != null) && fileName.Visible && !parentId.Visible && (ValidationHelper.GetInteger(parentId.Value, 0) > 0))
                {
                    // Reset inheritance setting if it's not visible
                    formControl.SetValue("UserControlParentID", null);
                }
            }
            else
            {
                // Set control's priority
                formControl.UserControlPriority = ValidationHelper.GetBoolean(form.GetFieldValue(FIELD_PRIORITY), false) ? (int)ObjectPriorityEnum.High : (int)ObjectPriorityEnum.Low;

                // Set which (data) types the control can be used for. Individual values are field types
                var values = GetFieldValues(form, FIELD_FOR);

                foreach (var group in DataTypeManager.GetFieldGroups())
                {
                    var col = FormHelper.GetDataTypeColumnForGroup(group);

                    formControl.SetValue(col, values.Contains(group));
                }

                // Set which resources the control can be shown in
                values = GetFieldValues(form, FIELD_SHOWIN);

                formControl.UserControlShowInDocumentTypes = values.Contains(SHOWIN_PAGETYPE);
                formControl.UserControlShowInBizForms      = values.Contains(SHOWIN_FORM);

                values = GetFieldValues(form, FIELD_SHOWIN2);

                formControl.UserControlShowInCustomTables = values.Contains(SHOWIN_CUSTOMTABLE);
                formControl.UserControlShowInSystemTables = values.Contains(SHOWIN_SYSTEMTABLE);
                formControl.UserControlShowInReports      = values.Contains(SHOWIN_REPORT);
                formControl.UserControlShowInWebParts     = values.Contains(SHOWIN_CONTROL);
            }
        }
    }
Exemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.BodyClass += " FieldEditorBody";

        // Load form control
        int controlId = QueryHelper.GetInteger("controlId", 0);
        fuci = FormUserControlInfoProvider.GetFormUserControlInfo(controlId);
        EditedObject = fuci;
        if (fuci != null)
        {
            // Initialize field editor
            fieldEditor.Mode = FieldEditorModeEnum.FormControls;
            fieldEditor.FormDefinition = fuci.UserControlParameters;
            fieldEditor.OnAfterDefinitionUpdate += fieldEditor_OnAfterDefinitionUpdate;
        }
    }
Exemplo n.º 21
0
    /// <summary>
    /// Gets FormInfo from current or parent form control.
    /// </summary>
    /// <returns>User control form info</returns>
    private FormInfo GetFormInfo()
    {
        FormInfo fi = null;

        // Control has parent
        if (fuci.UserControlParentID > 0)
        {
            FormUserControlInfo fuc = FormUserControlInfoProvider.GetFormUserControlInfo(fuci.UserControlParentID);
            fi = FormHelper.GetFormControlParameters(fuc.UserControlCodeName, fuc.UserControlParameters, true);
        }
        else
        {
            fi = FormHelper.GetFormControlParameters(fuci.UserControlCodeName, fuci.UserControlParameters, true);
        }

        return(fi);
    }
    private static string GetControlForValue(FormUserControlInfo formControl)
    {
        var values = new List <string>();

        // Build the list of enabled field types from the control properties
        foreach (var group in DataTypeManager.GetFieldGroups())
        {
            var col = FormHelper.GetDataTypeColumnForGroup(group);

            if (ValidationHelper.GetBoolean(formControl.GetValue(col), false))
            {
                values.Add(group);
            }
        }

        return(String.Join("|", values));
    }
Exemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.BodyClass += " FieldEditorBody";

        // Load form control
        int controlId = QueryHelper.GetInteger("controlId", 0);

        fuci         = FormUserControlInfoProvider.GetFormUserControlInfo(controlId);
        EditedObject = fuci;
        if (fuci != null)
        {
            // Initialize field editor
            fieldEditor.Mode                     = FieldEditorModeEnum.FormControls;
            fieldEditor.FormDefinition           = fuci.UserControlParameters;
            fieldEditor.OnAfterDefinitionUpdate += fieldEditor_OnAfterDefinitionUpdate;
        }
    }
Exemplo n.º 24
0
    /// <summary>
    /// Prepares new field.
    /// </summary>
    /// <param name="controlName">Code name of used control</param>
    private FormFieldInfo PrepareNewField(string controlName)
    {
        FormFieldInfo ffi = new FormFieldInfo();

        string[] controlDefaultDataType = FormUserControlInfoProvider.GetUserControlDefaultDataType(controlName);
        ffi.DataType  = controlDefaultDataType[0];
        ffi.Size      = ValidationHelper.GetInteger(controlDefaultDataType[1], 0);
        ffi.FieldType = FormFieldControlTypeEnum.CustomUserControl;

        FormUserControlInfo control = FormUserControlInfoProvider.GetFormUserControlInfo(controlName);

        if (control != null)
        {
            ffi.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, control.UserControlDisplayName);
        }

        ffi.AllowEmpty              = true;
        ffi.PublicField             = true;
        ffi.Name                    = GetUniqueFieldName(controlName);
        ffi.Settings["controlname"] = controlName;

        // For list controls create three default options
        if (FormHelper.HasListControl(ffi))
        {
            SpecialFieldsDefinition optionDefinition = new SpecialFieldsDefinition();

            for (int i = 1; i <= 3; i++)
            {
                optionDefinition.Add(new SpecialField
                {
                    Value = OptionsDesigner.DEFAULT_OPTION + i,
                    Text  = OptionsDesigner.DEFAULT_OPTION + i
                });
            }

            ffi.Settings["Options"] = optionDefinition.ToString();
        }

        if (controlName.EqualsCSafe("CalendarControl"))
        {
            ffi.Settings["EditTime"] = false;
        }

        return(ffi);
    }
Exemplo n.º 25
0
    /// <summary>
    /// Gets and updates form control. Called when the "Get and update control" button is pressed.
    /// Expects the CreateFormControl method to be run first.
    /// </summary>
    private bool GetAndUpdateFormControl()
    {
        // Get the form control
        FormUserControlInfo updateControl = FormUserControlInfoProvider.GetFormUserControlInfo("MyNewControl");

        if (updateControl != null)
        {
            // Update the properties
            updateControl.UserControlDisplayName = updateControl.UserControlDisplayName.ToLower();

            // Save the changes
            FormUserControlInfoProvider.SetFormUserControlInfo(updateControl);

            return(true);
        }

        return(false);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        FormUserControlInfo fci = FormUserControlInfoProvider.GetFormUserControlInfo(FormControlID);

        UIContext.EditedObject = fci;

        if (fci != null)
        {
            // Set form definition
            fieldEditor.FormDefinition = fci.UserControlMergedParameters;

            // Set field editor settings
            fieldEditor.Mode = (fci.UserControlParentID > 0) ? FieldEditorModeEnum.InheritedFormControl : FieldEditorModeEnum.FormControls;
            fieldEditor.DisplayedControls        = FieldEditorControlsEnum.ModeSelected;
            fieldEditor.OnAfterDefinitionUpdate += fieldEditor_OnAfterDefinitionUpdate;
            fieldEditor.AfterItemDeleted        += fieldEditor_AfterItemDeleted;

            if (fieldEditor.Mode == FieldEditorModeEnum.InheritedFormControl)
            {
                // Allow extra fields for inherited form controls
                fieldEditor.AllowExtraFields = true;

                // Set original form definition from parent form control
                FormUserControlInfo parentFci = FormUserControlInfoProvider.GetFormUserControlInfo(fci.UserControlParentID);
                if (parentFci != null)
                {
                    fieldEditor.OriginalFormDefinition = parentFci.UserControlParameters;
                }
            }
            else
            {
                // Add custom delete confirmation message
                string confirmScript = String.Format(@"
var confirmElem = document.getElementById('confirmdelete');
if (confirmElem != null) {{ confirmElem.value = '{0}'; }}", ScriptHelper.GetString(GetString("formcontrolparams.confirmdelete"), false));

                ScriptHelper.RegisterStartupScript(this, typeof(string), "FormControlConfirmDelete_" + ClientID, confirmScript, true);
            }
        }
        else
        {
            ShowError(GetString("general.invalidid"));
        }
    }
Exemplo n.º 27
0
    /// <summary>
    /// Loads control with new FormInfo data.
    /// </summary>
    /// <param name="type">Selected control type</param>
    /// <param name="defaultValues">Indicates if default values should be loaded</param>
    public void LoadControlSettings(string type, bool defaultValues)
    {
        string selectedFieldType = type;

        if (String.IsNullOrEmpty(type))
        {
            selectedFieldType = drpControl.Text.ToLowerCSafe();
        }
        if (selectedFieldType.StartsWithCSafe(controlPrefix))
        {
            selectedFieldType = selectedFieldType.Substring(controlPrefix.Length);
        }

        FormUserControlInfo control = FormUserControlInfoProvider.GetFormUserControlInfo(selectedFieldType);

        if (control != null)
        {
            string controlParameters = "";

            if (control.UserControlParentID == 0)
            {
                // Get normal form control parameters
                controlParameters = control.UserControlParameters;
            }
            else
            {
                // Get merged form info from inherited and parent control
                controlParameters = control.MergedFormInfo;
            }

            // Get form controls' settings
            fi = FormHelper.GetFormControlParameters(selectedFieldType, controlParameters, true);

            controlSettings.FormInfo = fi;

            Reload(defaultValues);
        }

        controlSettings.Visible = fi.ItemsList.OfType <FormFieldInfo>().Any(x => x.DisplayInSimpleMode);
    }
    private void Control_OnAfterDataLoad(object sender, EventArgs e)
    {
        UIForm form = (UIForm)sender;

        if (form.IsInsertMode)
        {
            return;
        }

        FormUserControlInfo formControl = form.EditedObject as FormUserControlInfo;

        if (formControl != null)
        {
            // Set control's priority
            var priorityControl = form.FieldControls[FIELD_PRIORITY];
            if (priorityControl != null)
            {
                priorityControl.Value = (formControl.UserControlPriority == (int)ObjectPriorityEnum.High);
            }

            // Set which (data) types the control can be used for
            var controlFor = form.FieldControls[FIELD_FOR];
            if (controlFor != null)
            {
                controlFor.Value = GetControlForValue(formControl);
            }

            // Set which resources the control can be shown in
            var controlShowIn = form.FieldControls[FIELD_SHOWIN];
            if (controlShowIn != null)
            {
                controlShowIn.Value = GetControlShowInValue(formControl, true);
            }
            var controlShowIn2 = form.FieldControls[FIELD_SHOWIN2];
            if (controlShowIn2 != null)
            {
                controlShowIn2.Value = GetControlShowInValue(formControl, false);
            }
        }
    }
    protected void fieldEditor_OnAfterDefinitionUpdate(object sender, EventArgs e)
    {
        // Update Form user control parameters
        if (EditedFormControl != null)
        {
            if (EditedFormControl.UserControlParentID > 0)
            {
                FormUserControlInfo parent = FormUserControlInfoProvider.GetFormUserControlInfo(EditedFormControl.UserControlParentID);
                // Get only differences
                EditedFormControl.UserControlParameters = FormHelper.GetFormDefinitionDifference(parent.UserControlParameters, fieldEditor.FormDefinition, true);
            }
            else
            {
                EditedFormControl.UserControlParameters = fieldEditor.FormDefinition;
            }

            FormUserControlInfoProvider.SetFormUserControlInfo(EditedFormControl);

            // Clear cached data
            FormUserControlInfoProvider.Clear(true);
        }
    }
Exemplo n.º 30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.BodyClass += " FieldEditorBody";

        // If saved is found in query string
        if ((!RequestHelper.IsPostBack()) && (QueryHelper.GetInteger("saved", 0) == 1))
        {
            ShowChangesSaved();
        }

        // Load form control
        int controlId = QueryHelper.GetInteger("controlId", 0);

        fuci         = FormUserControlInfoProvider.GetFormUserControlInfo(controlId);
        EditedObject = fuci;
        if (fuci != null)
        {
            if (fuci.UserControlParentID > 0)
            {
                fieldEditor.Visible                          = false;
                pnlDefaultEditor.Visible                     = true;
                defaultValueEditor.Visible                   = true;
                defaultValueEditor.OnEditorLoaded           += new CMSModules_PortalEngine_UI_WebParts_Development_DefaultValueEditor.EditorLoadedEventHandler(GetFormInfo);
                defaultValueEditor.DefaultValueXMLDefinition = fuci.UserControlParameters;

                // Add handler to
                defaultValueEditor.XMLCreated += new EventHandler(defaultValueEditor_XMLCreated);
            }
            else
            {
                // Initialize field editor
                fieldEditor.Mode                     = FieldEditorModeEnum.FormControls;
                fieldEditor.FormDefinition           = fuci.UserControlParameters;
                fieldEditor.OnAfterDefinitionUpdate += fieldEditor_OnAfterDefinitionUpdate;
            }
        }
    }
    private static string GetControlShowInValue(FormUserControlInfo formControl, bool firstSet)
    {
        var values = new List <string>();

        if (firstSet)
        {
            if (formControl.UserControlShowInDocumentTypes)
            {
                values.Add(SHOWIN_PAGETYPE);
            }
            if (formControl.UserControlShowInBizForms)
            {
                values.Add(SHOWIN_FORM);
            }
        }
        else
        {
            if (formControl.UserControlShowInCustomTables)
            {
                values.Add(SHOWIN_CUSTOMTABLE);
            }
            if (formControl.UserControlShowInSystemTables)
            {
                values.Add(SHOWIN_SYSTEMTABLE);
            }
            if (formControl.UserControlShowInReports)
            {
                values.Add(SHOWIN_REPORT);
            }
            if (formControl.UserControlShowInWebParts)
            {
                values.Add(SHOWIN_CONTROL);
            }
        }

        return(String.Join("|", values));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.BodyClass += " FieldEditorBody";

        // If saved is found in query string
        if ((!RequestHelper.IsPostBack()) && (QueryHelper.GetInteger("saved", 0) == 1))
        {
            ShowChangesSaved();
        }

        // Load form control
        int controlId = QueryHelper.GetInteger("controlId", 0);
        fuci = FormUserControlInfoProvider.GetFormUserControlInfo(controlId);
        EditedObject = fuci;
        if (fuci != null)
        {
            if (fuci.UserControlParentID > 0)
            {
                fieldEditor.Visible = false;
                pnlDefaultEditor.Visible = true;
                defaultValueEditor.Visible = true;
                defaultValueEditor.OnEditorLoaded += new CMSModules_PortalEngine_UI_WebParts_Development_DefaultValueEditor.EditorLoadedEventHandler(GetFormInfo);
                defaultValueEditor.DefaultValueXMLDefinition = fuci.UserControlParameters;

                // Add handler to
                defaultValueEditor.XMLCreated += new EventHandler(defaultValueEditor_XMLCreated);
            }
            else
            {
                // Initialize field editor
                fieldEditor.Mode = FieldEditorModeEnum.FormControls;
                fieldEditor.FormDefinition = fuci.UserControlParameters;
                fieldEditor.OnAfterDefinitionUpdate += fieldEditor_OnAfterDefinitionUpdate;
            }
        }
    }
Exemplo n.º 33
0
    /// <summary>
    /// Loads both field types and control types from inner settings.
    /// </summary>
    public void LoadTypes()
    {
        if (FieldInfo != null)
        {
            drpControlType.DataType            = FormFieldDataTypeCode.ALL;
            drpControlType.FieldEditorControls = GetDisplayedControls();
            drpControlType.ReloadControl();

            // Get control name..
            string item = null;
            // ..from settings..
            if (!string.IsNullOrEmpty(ValidationHelper.GetString(FieldInfo.Settings["controlname"], null)))
            {
                item = Convert.ToString(FieldInfo.Settings["controlname"]).ToLower();
            }
            // ..or from field type.
            else
            {
                item = FormHelper.GetFormFieldControlTypeString(FieldInfo.FieldType).ToLower();
            }

            // Load and select options
            FormUserControlInfo fi = FormUserControlInfoProvider.GetFormUserControlInfo(item);
            if (fi != null)
            {
                drpControlType.ControlType = fi.UserControlType;
                LoadFieldTypes(drpControlType.ControlType);

                // And set field value
                if (drpFieldType.Items.FindByValue(item) != null)
                {
                    drpFieldType.SelectedValue = item;
                }
            }
        }
    }
Exemplo n.º 34
0
    /// <summary>
    /// Initializes controls for activity rule.
    /// </summary>
    private void InitActivityRuleControls(string selectedActivityType)
    {
        ucActivityType.OnSelectedIndexChanged += new EventHandler(ucActivityType_OnSelectedIndexChanged);

        // Init activity selector from  edited object if any
        string activityType = selectedActivityType;

        if ((EditForm.EditedObject != null) && !RequestHelper.IsPostBack())
        {
            ucActivityType.Value = ValidationHelper.GetString(EditForm.Data["RuleParameter"], PredefinedActivityType.ABUSE_REPORT);
            activityType         = ucActivityType.SelectedValue;
            PreviousActivityType = activityType;
        }

        // List of ignored columns
        string ignoredColumns = "|activitytype|activitysiteid|activityguid|activityactivecontactid|activityoriginalcontactid|pagevisitid|pagevisitactivityid|searchid|searchactivityid|";

        // List of activities with "ActivityValue"
        StringBuilder sb = new StringBuilder();

        sb.Append("|");
        sb.Append(PredefinedActivityType.PURCHASE);
        sb.Append("|");
        sb.Append(PredefinedActivityType.PURCHASEDPRODUCT);
        sb.Append("|");
        sb.Append(PredefinedActivityType.RATING);
        sb.Append("|");
        sb.Append(PredefinedActivityType.POLL_VOTING);
        sb.Append("|");
        sb.Append(PredefinedActivityType.PRODUCT_ADDED_TO_SHOPPINGCART);
        sb.Append("|");
        string showActivityValueFor = sb.ToString();

        // Get columns from OM_Activity (i.e. base table for all activities)
        ActivityTypeInfo ati = ActivityTypeInfoProvider.GetActivityTypeInfo(activityType);

        FormInfo fi = new FormInfo(null);

        // Get columns from additional table (if any) according to selected activity type (page visit, search)
        FormInfo additionalFieldsForm = null;
        bool     extraFieldsAtEnd     = true;

        switch (activityType)
        {
        case PredefinedActivityType.PAGE_VISIT:
        case PredefinedActivityType.LANDING_PAGE:
            // Page visits
            additionalFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.PAGEVISIT, false);
            break;

        case PredefinedActivityType.INTERNAL_SEARCH:
        case PredefinedActivityType.EXTERNAL_SEARCH:
            // Search
            additionalFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.SEARCH, false);
            extraFieldsAtEnd     = false;
            break;
        }

        // Get the activity form elements
        FormInfo filterFieldsForm = FormHelper.GetFormInfo(OnlineMarketingObjectType.ACTIVITY, true);
        var      elements         = filterFieldsForm.GetFormElements(true, false);

        FormCategoryInfo newCategory = null;

        string caption    = null;
        string captionKey = null;

        foreach (var elem in elements)
        {
            if (elem is FormCategoryInfo)
            {
                // Form category
                newCategory = (FormCategoryInfo)elem;
            }
            else if (elem is FormFieldInfo)
            {
                // Form field
                FormFieldInfo ffi = (FormFieldInfo)elem;

                // Skip ignored columns
                if (ignoredColumns.IndexOfCSafe("|" + ffi.Name.ToLowerCSafe() + "|") >= 0)
                {
                    continue;
                }

                string controlName = null;
                if (!ffi.PrimaryKey && (fi.GetFormField(ffi.Name) == null))
                {
                    // Set default filters
                    switch (ffi.DataType)
                    {
                    case FormFieldDataTypeEnum.Text:
                    case FormFieldDataTypeEnum.LongText:
                        controlName = "textfilter";
                        ffi.Settings["OperatorFieldName"] = ffi.Name + ".operator";
                        break;

                    case FormFieldDataTypeEnum.DateTime:
                        controlName = "datetimefilter";
                        ffi.Settings["SecondDateFieldName"] = ffi.Name + ".seconddatetime";
                        break;

                    case FormFieldDataTypeEnum.Integer:
                    case FormFieldDataTypeEnum.LongInteger:
                        controlName = "numberfilter";
                        ffi.Settings["OperatorFieldName"] = ffi.Name + ".operator";
                        break;

                    case FormFieldDataTypeEnum.GUID:
                        continue;
                    }

                    // For item ID and detail ID fields use control defined in activity type
                    if (CMSString.Compare(ffi.Name, "ActivityItemID", true) == 0)
                    {
                        if (ati.ActivityTypeMainFormControl == null)
                        {
                            continue;
                        }

                        if (ati.ActivityTypeMainFormControl != String.Empty)
                        {
                            // Check if user defined control exists
                            FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(ati.ActivityTypeMainFormControl);
                            if (fui != null)
                            {
                                controlName = ati.ActivityTypeMainFormControl;
                            }
                        }

                        // Set detailed caption
                        captionKey = "activityitem." + activityType;
                        caption    = GetString(captionKey);
                        if (!caption.EqualsCSafe(captionKey, true))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (CMSString.Compare(ffi.Name, "ActivityItemDetailID", true) == 0)
                    {
                        if (ati.ActivityTypeDetailFormControl == null)
                        {
                            continue;
                        }

                        if (ati.ActivityTypeDetailFormControl != String.Empty)
                        {
                            // Check if user defined control exists
                            FormUserControlInfo fui = FormUserControlInfoProvider.GetFormUserControlInfo(ati.ActivityTypeDetailFormControl);
                            if (fui != null)
                            {
                                controlName = ati.ActivityTypeDetailFormControl;
                            }
                        }

                        // Set detailed caption
                        captionKey = "activityitemdetail." + activityType;
                        caption    = GetString(captionKey);
                        if (!caption.EqualsCSafe(captionKey, true))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (CMSString.Compare(ffi.Name, "ActivityNodeID", true) == 0)
                    {
                        // Document selector for NodeID
                        controlName = "selectdocument";
                    }
                    else if (CMSString.Compare(ffi.Name, "ActivityCulture", true) == 0)
                    {
                        // Culture selector for culture
                        controlName = "sitecultureselector";
                    }
                    else if (CMSString.Compare(ffi.Name, "ActivityValue", true) == 0)
                    {
                        // Show activity value only for relevant activity types
                        if (!ati.ActivityTypeIsCustom && (showActivityValueFor.IndexOfCSafe("|" + activityType + "|", true) < 0))
                        {
                            continue;
                        }
                    }

                    if (controlName != null)
                    {
                        // SKU selector for product
                        ffi.Settings["controlname"] = controlName;
                        if (CMSString.Compare(controlName, "skuselector", true) == 0)
                        {
                            ffi.Settings["allowempty"] = true;
                        }
                    }

                    // Ensure the category
                    if (newCategory != null)
                    {
                        fi.AddFormCategory(newCategory);

                        newCategory = null;

                        // // Extra fields at the beginning
                        if (!extraFieldsAtEnd && (additionalFieldsForm != null))
                        {
                            AddExtraFields(ignoredColumns, fi, additionalFieldsForm);

                            additionalFieldsForm = null;
                        }
                    }

                    fi.AddFormField(ffi);
                }
            }
        }

        // Extra fields at end
        if (extraFieldsAtEnd && (additionalFieldsForm != null))
        {
            // Ensure the category for extra fields
            if (newCategory != null)
            {
                fi.AddFormCategory(newCategory);

                newCategory = null;
            }

            AddExtraFields(ignoredColumns, fi, additionalFieldsForm);
        }

        LoadForm(activityFormCondition, fi, activityType);
    }
Exemplo n.º 35
0
 /// <summary>
 /// Selects control type according to current selected form control.
 /// </summary>
 private void SelectControlTypes(FormUserControlInfo fi)
 {
     if (fi != null)
     {
         drpTypeSelector.ControlType = fi.UserControlType;
     }
 }
Exemplo n.º 36
0
    /// <summary>
    /// Gets and bulk updates form controls. Called when the "Get and bulk update controls" button is pressed.
    /// Expects the CreateFormControl method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateFormControls()
    {
        // Prepare the parameters
        string where = "UserControlCodeName LIKE N'MyNewControl%'";

        // Get the data
        DataSet formcontrols = FormUserControlInfoProvider.GetFormUserControls(where, null);
        if (!DataHelper.DataSourceIsEmpty(formcontrols))
        {
            // Loop through the individual items
            foreach (DataRow formcontrolsDr in formcontrols.Tables[0].Rows)
            {
                // Create object from DataRow
                FormUserControlInfo modifyControl = new FormUserControlInfo(formcontrolsDr);

                // Update the properties
                modifyControl.UserControlDisplayName = modifyControl.UserControlDisplayName.ToUpper();

                // Save the changes
                FormUserControlInfoProvider.SetFormUserControlInfo(modifyControl);
            }

            return true;
        }

        return false;
    }
Exemplo n.º 37
0
    /// <summary>
    /// Handles btnOK's OnClick event.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Finds whether required fields are not empty
        string result = new Validator().NotEmpty(txtControlName.Text, rfvControlName.ErrorMessage).NotEmpty(txtControlDisplayName, rfvControlDisplayName.ErrorMessage).Result;

        // Check input file validity
        if (String.IsNullOrEmpty(result) && radNewControl.Checked)
        {
            if (!tbFileName.IsValid())
            {
                result = tbFileName.ValidationError;
            }
        }

        // Try to create new form control if everything is OK
        if (String.IsNullOrEmpty(result))
        {
            FormUserControlInfo fi = new FormUserControlInfo();
            fi.UserControlDisplayName = txtControlDisplayName.Text.Trim();
            fi.UserControlCodeName = txtControlName.Text.Trim();
            fi.UserControlType = drpTypeSelector.ControlType;
            fi.UserControlForText = false;
            fi.UserControlForLongText = false;
            fi.UserControlForInteger = false;
            fi.UserControlForLongInteger = false;
            fi.UserControlForDecimal = false;
            fi.UserControlForDateTime = false;
            fi.UserControlForBoolean = false;
            fi.UserControlForFile = false;
            fi.UserControlForDocAttachments = false;
            fi.UserControlForGUID = false;
            fi.UserControlForVisibility = false;
            fi.UserControlShowInBizForms = false;
            fi.UserControlDefaultDataType = "Text";

            // Inherited user control
            if (radInheritedControl.Checked)
            {
                fi.UserControlParentID = ValidationHelper.GetInteger(drpFormControls.Value, 0);

                // Create empty default values definition
                fi.UserControlParameters = "<form></form>";
                fi.UserControlFileName = "inherited";
            }
            else
            {
                fi.UserControlFileName = tbFileName.Value.ToString();
            }

            try
            {
                FormUserControlInfoProvider.SetFormUserControlInfo(fi);

                // If control was successfully created then redirect to editing page
                URLHelper.Redirect("Frameset.aspx?controlId=" + Convert.ToString(fi.UserControlID));
            }
            catch (Exception ex)
            {
                ShowError(ex.Message.Replace("%%name%%", fi.UserControlCodeName));
            }
        }
        else
        {
            ShowError(result);
        }
    }