コード例 #1
0
ファイル: Edit.ascx.cs プロジェクト: tvelzy/RadstackMedia
    /// <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);
    }
コード例 #2
0
    /// <summary>
    /// Initializes controls for activity rule.
    /// </summary>
    /// <param name="selectedActivity">Activity selected in drop-down menu</param>
    private void InitActivitySettings(string selectedActivity)
    {
        // Init activity selector from  edited object if any
        LoadEditedActivityRule(ref selectedActivity);

        string[] ignoredColumns =
        {
            "activitytype",
            "activitysiteid",
            "activityguid",
            "activityactivecontactid",
            "activityoriginalcontactid",
            "pagevisitid",
            "pagevisitactivityid",
            "searchid",
            "searchactivityid"
        };

        string[] activitiesWithValue =
        {
            PredefinedActivityType.PURCHASE,
            PredefinedActivityType.PURCHASEDPRODUCT,
            PredefinedActivityType.RATING,
            PredefinedActivityType.POLL_VOTING,
            PredefinedActivityType.PRODUCT_ADDED_TO_SHOPPINGCART
        };

        // Get columns from OM_Activity (i.e. base table for all activities)
        ActivityTypeInfo ati = ActivityTypeInfoProvider.GetActivityTypeInfo(selectedActivity);
        var fi = new FormInfo();

        // Get columns from additional table (if any) according to selected activity type
        bool     extraFieldsAtEnd     = true;
        FormInfo additionalFieldsForm = GetActivityAdditionalFields(selectedActivity, ref extraFieldsAtEnd);

        // Get the activity form elements
        FormInfo filterFieldsForm            = FormHelper.GetFormInfo(ActivityInfo.OBJECT_TYPE, true);
        IList <IDataDefinitionItem> elements = filterFieldsForm.GetFormElements(true, false);

        FormCategoryInfo newCategory = null;

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

                // Skip ignored columns
                if (ignoredColumns.Contains(ffi.Name.ToLowerCSafe()))
                {
                    continue;
                }

                if ((!ffi.PrimaryKey) && (fi.GetFormField(ffi.Name) == null))
                {
                    // Skip fields with Guid data type
                    if (ffi.DataType == FieldDataType.Guid)
                    {
                        continue;
                    }

                    // Sets control name based on given datatype of field. Can be overwritten if more proper control is available
                    string controlName = GetControlNameForFieldDataType(ffi);
                    if (!GetControlNameForActivities(ffi, ati, selectedActivity, activitiesWithValue, ref controlName))
                    {
                        continue;
                    }

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

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

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

                    fi.AddFormItem(ffi);
                }
            }
        }

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

            AddExtraActivityFields(ignoredColumns, fi, additionalFieldsForm);
        }

        LoadActivityForm(fi, selectedActivity);
    }
コード例 #3
0
ファイル: Edit.ascx.cs プロジェクト: KuduApps/Kentico
    /// <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);
        ArrayList 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.IndexOf("|" + ffi.Name.ToLower() + "|") >= 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 (String.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.Equals(captionKey, StringComparison.InvariantCultureIgnoreCase))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (String.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.Equals(captionKey, StringComparison.InvariantCultureIgnoreCase))
                        {
                            ffi.Caption = caption;
                        }
                    }
                    else if (String.Compare(ffi.Name, "ActivityNodeID", true) == 0)
                    {
                        // Document selector for NodeID
                        controlName = "selectdocument";
                    }
                    else if (String.Compare(ffi.Name, "ActivityCulture", true) == 0)
                    {
                        // Culture selector for culture
                        controlName = "sitecultureselector";
                    }
                    else if (String.Compare(ffi.Name, "ActivityValue", true) == 0)
                    {
                        // Show activity value only for relevant activity types
                        if (!ati.ActivityTypeIsCustom && (showActivityValueFor.IndexOf("|" + activityType + "|",  StringComparison.InvariantCultureIgnoreCase) < 0))
                        {
                            continue;
                        }
                    }

                    if (controlName != null)
                    {
                        // SKU selector for product
                        ffi.Settings["controlname"] = controlName;
                        if (String.Compare(controlName, "skuselector", StringComparison.InvariantCultureIgnoreCase) == 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);
    }
コード例 #4
0
    /// <summary>
    /// Initializes controls for activity rule.
    /// </summary>
    /// <param name="selectedActivity">Activity selected in drop-down menu</param>
    private void InitActivitySettings(string selectedActivity)
    {
        // Init activity selector from  edited object if any
        LoadEditedActivityRule(ref selectedActivity);

        List <string> ignoredColumns = new List <string>
        {
            "activitytype",
            "activitysiteid",
            "activitycontactid",
        };

        string[] activitiesWithValue =
        {
            PredefinedActivityType.PURCHASE,
            PredefinedActivityType.PURCHASEDPRODUCT,
            PredefinedActivityType.PRODUCT_ADDED_TO_SHOPPINGCART
        };

        // Get columns from OM_Activity (i.e. base table for all activities)
        ActivityTypeInfo ati = ActivityTypeInfo.Provider.Get(selectedActivity);
        var fi = new FormInfo();

        // Get the activity form elements
        FormInfo filterFieldsForm            = FormHelper.GetFormInfo(ActivityInfo.OBJECT_TYPE, true);
        IList <IDataDefinitionItem> elements = filterFieldsForm.GetFormElements(true, false);

        if ((selectedActivity != PredefinedActivityType.PAGE_VISIT) && (selectedActivity != PredefinedActivityType.LANDING_PAGE))
        {
            // Show these fields only for 'Page visit' and 'Landing page'
            ignoredColumns.AddRange(new[] { "activityabvariantname" });
        }

        FormCategoryInfo newCategory = null;

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

                // Skip ignored columns
                if (ignoredColumns.Contains(ffi.Name, StringComparer.InvariantCultureIgnoreCase))
                {
                    continue;
                }

                if (!ffi.PrimaryKey && (fi.GetFormField(ffi.Name) == null))
                {
                    // Skip fields with Guid data type
                    if (ffi.DataType == FieldDataType.Guid)
                    {
                        continue;
                    }

                    // Sets control name based on given datatype of field. Can be overwritten if more proper control is available
                    string controlName = GetControlNameForFieldDataType(ffi);
                    if (!GetControlNameForActivities(ffi, ati, selectedActivity, activitiesWithValue, ref controlName))
                    {
                        continue;
                    }

                    if (controlName != null)
                    {
                        // SKU selector for product
                        ffi.SetControlName(controlName);
                        ffi.Settings["allowempty"] = ffi.HasFormFieldControlWithName("skuselector");
                    }

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

                    fi.AddFormItem(ffi);
                }
            }
        }

        LoadActivityForm(fi, selectedActivity);
    }
    /// <summary>
    /// Initializes controls for activity rule.
    /// </summary>
    /// <param name="selectedActivity">Activity selected in drop-down menu</param>
    private void InitActivitySettings(string selectedActivity)
    {
        // Init activity selector from  edited object if any
        LoadEditedActivityRule(ref selectedActivity);

        string[] ignoredColumns =
        {
            "activitytype",
            "activitysiteid",
            "activityguid",
            "activityactivecontactid",
            "activityoriginalcontactid",
            "pagevisitid",
            "pagevisitactivityid",
            "searchid",
            "searchactivityid"
        };

        string[] activitiesWithValue =
        {
            PredefinedActivityType.PURCHASE,
            PredefinedActivityType.PURCHASEDPRODUCT,
            PredefinedActivityType.RATING,
            PredefinedActivityType.POLL_VOTING,
            PredefinedActivityType.PRODUCT_ADDED_TO_SHOPPINGCART
        };

        // Get columns from OM_Activity (i.e. base table for all activities)
        ActivityTypeInfo ati = ActivityTypeInfoProvider.GetActivityTypeInfo(selectedActivity);
        var fi = new FormInfo();

        // Get columns from additional table (if any) according to selected activity type
        bool extraFieldsAtEnd = true;
        FormInfo additionalFieldsForm = GetActivityAdditionalFields(selectedActivity, ref extraFieldsAtEnd);

        // Get the activity form elements
        FormInfo filterFieldsForm = FormHelper.GetFormInfo(ActivityInfo.OBJECT_TYPE, true);
        IList<IField> elements = filterFieldsForm.GetFormElements(true, false);

        FormCategoryInfo newCategory = null;

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

                // Skip ignored columns
                if (ignoredColumns.Contains(ffi.Name.ToLowerCSafe()))
                {
                    continue;
                }

                if ((!ffi.PrimaryKey) && (fi.GetFormField(ffi.Name) == null))
                {
                    // Skip fields with Guid data type
                    if (ffi.DataType == FieldDataType.Guid)
                    {
                        continue;
                    }

                    // Sets control name based on given datatype of field. Can be overwritten if more proper control is available
                    string controlName = GetControlNameForFieldDataType(ffi);
                    if (!GetControlNameForActivities(ffi, ati, selectedActivity, activitiesWithValue, ref controlName))
                    {
                        continue;
                    }

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

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

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

                    fi.AddFormItem(ffi);
                }
            }
        }

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

            AddExtraActivityFields(ignoredColumns, fi, additionalFieldsForm);
        }

        LoadActivityForm(fi, selectedActivity);
    }