HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/TDijk1/erp-apps.eu/wwwroot/CMSModules/SmartSearch/SearchIndex_Content_List.aspx.cs
using System;
using System.Web.UI.WebControls;

using CMS.CustomTables;
using CMS.DocumentEngine;
using CMS.Helpers;
using CMS.Membership;
using CMS.UIControls;
using CMS.ExtendedControls.ActionsConfig;
using CMS.DataEngine;
using CMS.Search;

using TreeNode = CMS.DocumentEngine.TreeNode;


public partial class CMSModules_SmartSearch_SearchIndex_Content_List : GlobalAdminPage
{
    // Index id
    private int indexId = QueryHelper.GetInteger("indexid", 0);
    private bool displayHeaderActions = true;
    private bool displaySpecialActions;
    private bool isOnLineFormEdit;


    protected void Page_Load(object sender, EventArgs e)
    {
        string addAllowed = GetString("srch.index.addcontent");
        string addExcluded = GetString("srch.index.addexcluded");

        contentList.StopProcessing = true;
        forumList.StopProcessing = true;

        // Get search index info
        SearchIndexInfo sii = SearchIndexInfoProvider.GetSearchIndexInfo(indexId);

        if (sii != null)
        {
            // Switch by index type
            switch (sii.IndexType)
            {
                // Documents
                case TreeNode.OBJECT_TYPE:
                case SearchHelper.DOCUMENTS_CRAWLER_INDEX:
                    contentList.StopProcessing = false;
                    contentList.Visible = true;
                    contentList.OnAction += contentList_OnAction;
                    break;

                // Forums
                case PredefinedObjectType.FORUM:
                    forumList.StopProcessing = false;
                    forumList.Visible = true;
                    forumList.OnAction += contentList_OnAction;

                    addAllowed = GetString("srch.index.addforum");
                    addExcluded = GetString("srch.index.addforumexcluded");
                    break;

                // Users
                case UserInfo.OBJECT_TYPE:
                    userList.StopProcessing = false;
                    userList.Visible = true;
                    displayHeaderActions = false;
                    break;

                // Custom tables
                case CustomTableInfo.OBJECT_TYPE_CUSTOMTABLE:
                    customTableList.Visible = true;
                    customTableList.StopProcessing = false;
                    customTableList.OnAction += contentList_OnAction;
                    displayHeaderActions = false;
                    displaySpecialActions = true;
                    break;

                // Custom tables
                case PredefinedObjectType.BIZFORM:
                    onLineFormList.Visible = true;
                    onLineFormList.StopProcessing = false;
                    onLineFormList.OnAction += contentList_OnAction;
                    displayHeaderActions = false;
                    displaySpecialActions = true;
                    isOnLineFormEdit = true;
                    break;

                // General index
                case SearchHelper.GENERALINDEX:
                    generalList.Visible = true;
                    generalList.StopProcessing = false;
                    displayHeaderActions = false;
                    break;

                // Custom search
                case SearchHelper.CUSTOM_SEARCH_INDEX:
                    customList.Visible = true;
                    customList.StopProcessing = false;
                    displayHeaderActions = false;
                    break;
            }
        }

        // Display header action if it is required
        if (displayHeaderActions)
        {
            HeaderAction allowed = new HeaderAction();
            allowed.Text = addAllowed;
            allowed.RedirectUrl = ResolveUrl("SearchIndex_Content_Edit.aspx?indexid=" + indexId + "&itemtype=" + SearchIndexSettingsInfo.TYPE_ALLOWED);
            CurrentMaster.HeaderActions.AddAction(allowed);

            HeaderAction excluded = new HeaderAction();
            excluded.Text = addExcluded;
            excluded.RedirectUrl = ResolveUrl("SearchIndex_Content_Edit.aspx?indexid=" + indexId + "&itemtype=" + SearchIndexSettingsInfo.TYPE_EXLUDED);
            CurrentMaster.HeaderActions.AddAction(excluded);
        }

        if (displaySpecialActions)
        {
            HeaderAction actions = new HeaderAction();
            actions.Text = isOnLineFormEdit ? GetString("srch.index.addonlineform") : GetString("srch.index.addcustomtable");
            actions.RedirectUrl = ResolveUrl("SearchIndex_Content_Edit.aspx?indexid=" + indexId + "&itemtype=" + SearchIndexSettingsInfo.TYPE_ALLOWED);
            CurrentMaster.HeaderActions.AddAction(actions);
        }
    }


    /// <summary>
    /// Action event handler.
    /// </summary>
    private void contentList_OnAction(object sender, CommandEventArgs e)
    {
        URLHelper.Redirect("SearchIndex_Content_Edit.aspx?indexid=" + indexId + "&guid=" + e.CommandArgument);
    }
}