//
        //=================================================================================
        //
        //=================================================================================
        //
        public static string get(CPClass cp, CoreController core, AdminDataModel adminData)
        {
            string returnForm = "";

            try {
                //
                string            SearchValue = null;
                FindWordMatchEnum MatchOption = 0;
                int FormFieldPtr                     = 0;
                int FormFieldCnt                     = 0;
                ContentMetadataModel CDef            = null;
                string FieldName                     = null;
                StringBuilderLegacyController Stream = new StringBuilderLegacyController();
                int      FieldPtr                    = 0;
                bool     RowEven                     = false;
                string   RQS          = null;
                string[] FieldNames   = { };
                string[] FieldCaption = { };
                int[]    fieldId      = null;
                CPContentBaseClass.FieldTypeIdEnum[] fieldTypeId = { };
                string[] FieldValue             = { };
                int[]    FieldMatchOptions      = { };
                int      FieldMatchOption       = 0;
                string[] FieldLookupContentName = { };
                string[] FieldLookupList        = { };
                int      ContentId   = 0;
                int      FieldCnt    = 0;
                int      FieldSize   = 0;
                int      RowPointer  = 0;
                string   LeftButtons = "";
                string   ButtonBar   = null;
                string   Title       = null;
                string   TitleBar    = null;
                string   Content     = null;

                //
                // Process last form
                //
                string           Button      = core.docProperties.getText("button");
                IndexConfigClass IndexConfig = null;
                if (!string.IsNullOrEmpty(Button))
                {
                    switch (Button)
                    {
                    case ButtonSearch:
                        IndexConfig  = IndexConfigClass.get(core, adminData);
                        FormFieldCnt = core.docProperties.getInteger("fieldcnt");
                        if (FormFieldCnt > 0)
                        {
                            for (FormFieldPtr = 0; FormFieldPtr < FormFieldCnt; FormFieldPtr++)
                            {
                                FieldName   = GenericController.toLCase(core.docProperties.getText("fieldname" + FormFieldPtr));
                                MatchOption = (FindWordMatchEnum)core.docProperties.getInteger("FieldMatch" + FormFieldPtr);
                                switch (MatchOption)
                                {
                                case FindWordMatchEnum.MatchEquals:
                                case FindWordMatchEnum.MatchGreaterThan:
                                case FindWordMatchEnum.matchincludes:
                                case FindWordMatchEnum.MatchLessThan:
                                    SearchValue = core.docProperties.getText("FieldValue" + FormFieldPtr);
                                    break;

                                default:
                                    SearchValue = "";
                                    break;
                                }
                                if (!IndexConfig.findWords.ContainsKey(FieldName))
                                {
                                    //
                                    // fieldname not found, save if not FindWordMatchEnum.MatchIgnore
                                    //
                                    if (MatchOption != FindWordMatchEnum.MatchIgnore)
                                    {
                                        IndexConfig.findWords.Add(FieldName, new IndexConfigFindWordClass {
                                            Name        = FieldName,
                                            MatchOption = MatchOption,
                                            Value       = SearchValue
                                        });
                                    }
                                }
                                else
                                {
                                    //
                                    // fieldname was found
                                    //
                                    IndexConfig.findWords[FieldName].MatchOption = MatchOption;
                                    IndexConfig.findWords[FieldName].Value       = SearchValue;
                                }
                            }
                        }
                        GetHtmlBodyClass.setIndexSQL_SaveIndexConfig(cp, core, IndexConfig);
                        return(string.Empty);

                    case ButtonCancel:
                        return(string.Empty);
                    }
                }
                IndexConfig = IndexConfigClass.get(core, adminData);
                Button      = "CriteriaSelect";
                RQS         = core.doc.refreshQueryString;
                //
                // ----- ButtonBar
                //
                if (adminData.ignore_legacyMenuDepth > 0)
                {
                    LeftButtons += AdminUIController.getButtonPrimary(ButtonClose, "window.close();");
                }
                else
                {
                    LeftButtons += AdminUIController.getButtonPrimary(ButtonCancel);
                }
                LeftButtons += AdminUIController.getButtonPrimary(ButtonSearch);
                ButtonBar    = AdminUIController.getSectionButtonBar(core, LeftButtons, "");
                //
                // ----- TitleBar
                //
                Title = adminData.adminContent.name;
                Title = Title + " Advanced Search";
                string TitleDescription = "<div>Enter criteria for each field to identify and select your results. The results of a search will have to have all of the criteria you enter.</div>";
                TitleBar = AdminUIController.getSectionHeader(core, Title, TitleDescription);
                //
                // ----- List out all fields
                //
                CDef      = ContentMetadataModel.createByUniqueName(core, adminData.adminContent.name);
                FieldSize = 100;
                Array.Resize(ref FieldNames, FieldSize + 1);
                Array.Resize(ref FieldCaption, FieldSize + 1);
                Array.Resize(ref fieldId, FieldSize + 1);
                Array.Resize(ref fieldTypeId, FieldSize + 1);
                Array.Resize(ref FieldValue, FieldSize + 1);
                Array.Resize(ref FieldMatchOptions, FieldSize + 1);
                Array.Resize(ref FieldLookupContentName, FieldSize + 1);
                Array.Resize(ref FieldLookupList, FieldSize + 1);
                foreach (KeyValuePair <string, ContentFieldMetadataModel> keyValuePair in adminData.adminContent.fields)
                {
                    ContentFieldMetadataModel field = keyValuePair.Value;
                    if (FieldPtr >= FieldSize)
                    {
                        FieldSize = FieldSize + 100;
                        Array.Resize(ref FieldNames, FieldSize + 1);
                        Array.Resize(ref FieldCaption, FieldSize + 1);
                        Array.Resize(ref fieldId, FieldSize + 1);
                        Array.Resize(ref fieldTypeId, FieldSize + 1);
                        Array.Resize(ref FieldValue, FieldSize + 1);
                        Array.Resize(ref FieldMatchOptions, FieldSize + 1);
                        Array.Resize(ref FieldLookupContentName, FieldSize + 1);
                        Array.Resize(ref FieldLookupList, FieldSize + 1);
                    }
                    FieldName              = GenericController.toLCase(field.nameLc);
                    FieldNames[FieldPtr]   = FieldName;
                    FieldCaption[FieldPtr] = field.caption;
                    fieldId[FieldPtr]      = field.id;
                    fieldTypeId[FieldPtr]  = field.fieldTypeId;
                    if (fieldTypeId[FieldPtr] == CPContentBaseClass.FieldTypeIdEnum.Lookup)
                    {
                        ContentId = field.lookupContentId;
                        if (ContentId > 0)
                        {
                            FieldLookupContentName[FieldPtr] = MetadataController.getContentNameByID(core, ContentId);
                        }
                        FieldLookupList[FieldPtr] = field.lookupList;
                    }
                    //
                    // set prepoplate value from indexconfig
                    //
                    if (IndexConfig.findWords.ContainsKey(FieldName))
                    {
                        FieldValue[FieldPtr]        = IndexConfig.findWords[FieldName].Value;
                        FieldMatchOptions[FieldPtr] = (int)IndexConfig.findWords[FieldName].MatchOption;
                    }
                    FieldPtr += 1;
                }
                FieldCnt = FieldPtr;
                //
                // Add headers to stream
                //
                returnForm = returnForm + "<table border=0 width=100% cellspacing=0 cellpadding=4>";
                //
                RowPointer = 0;
                for (FieldPtr = 0; FieldPtr < FieldCnt; FieldPtr++)
                {
                    returnForm       = returnForm + HtmlController.inputHidden("fieldname" + FieldPtr, FieldNames[FieldPtr]);
                    RowEven          = ((RowPointer % 2) == 0);
                    FieldMatchOption = FieldMatchOptions[FieldPtr];
                    switch (fieldTypeId[FieldPtr])
                    {
                    case CPContentBaseClass.FieldTypeIdEnum.Date:
                        //
                        // Date

                        returnForm = returnForm + "<tr>"
                                     + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>"
                                     + "<td class=\"ccAdminEditField\">"
                                     + "<div style=\"display:block;float:left;width:800px;\">"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not&nbsp;empty</div>"
                                     + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchEquals).ToString(), FieldMatchOption.ToString(), "") + "=</div>"
                                     + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchGreaterThan).ToString(), FieldMatchOption.ToString(), "") + "&gt;</div>"
                                     + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchLessThan).ToString(), FieldMatchOption.ToString(), "") + "&lt;</div>"
                                     + "<div style=\"display:block;float:left;width:300px;\">" + HtmlController.inputDate(core, "fieldvalue" + FieldPtr, encodeDate(FieldValue[FieldPtr])).Replace(">", " onFocus=\"ccAdvSearchText\">") + "</div>"
                                     + "</div>"
                                     + "</td>"
                                     + "</tr>";
                        break;

                    case CPContentBaseClass.FieldTypeIdEnum.Currency:
                    case CPContentBaseClass.FieldTypeIdEnum.Float:
                    case CPContentBaseClass.FieldTypeIdEnum.Integer:
                    case CPContentBaseClass.FieldTypeIdEnum.AutoIdIncrement:
                        //
                        // -- Numeric - changed FindWordMatchEnum.MatchEquals to MatchInclude to be compatible with Find Search
                        returnForm = returnForm + "<tr>"
                                     + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>"
                                     + "<td class=\"ccAdminEditField\">"
                                     + "<div style=\"display:block;float:left;width:800px;\">"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not&nbsp;empty</div>"
                                     + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.matchincludes).ToString(), FieldMatchOption.ToString(), "n" + FieldPtr) + "=</div>"
                                     + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchGreaterThan).ToString(), FieldMatchOption.ToString(), "") + "&gt;</div>"
                                     + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchLessThan).ToString(), FieldMatchOption.ToString(), "") + "&lt;</div>"
                                     + "<div style=\"display:block;float:left;width:300px;\">" + HtmlController.inputText_Legacy(core, "fieldvalue" + FieldPtr, FieldValue[FieldPtr], 1, 5, "", false, false, "ccAdvSearchText").Replace(">", " onFocus=\"var e=getElementById('n" + FieldPtr + "');e.checked=1;\">") + "</div>"
                                     + "</div>"
                                     + "</td>"
                                     + "</tr>";
                        RowPointer += 1;
                        break;

                    case CPContentBaseClass.FieldTypeIdEnum.File:
                    case CPContentBaseClass.FieldTypeIdEnum.FileImage:
                        //
                        // File
                        //
                        returnForm = returnForm + "<tr>"
                                     + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>"
                                     + "<td class=\"ccAdminEditField\">"
                                     + "<div style=\"display:block;float:left;width:800px;\">"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not&nbsp;empty</div>"
                                     + "</div>"
                                     + "</td>"
                                     + "</tr>";
                        RowPointer = RowPointer + 1;
                        break;

                    case CPContentBaseClass.FieldTypeIdEnum.Boolean:
                        //
                        // Boolean
                        //
                        returnForm = returnForm + "<tr>"
                                     + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>"
                                     + "<td class=\"ccAdminEditField\">"
                                     + "<div style=\"display:block;float:left;width:800px;\">"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchTrue).ToString(), FieldMatchOption.ToString(), "") + "true</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchFalse).ToString(), FieldMatchOption.ToString(), "") + "false</div>"
                                     + "</div>"
                                     + "</td>"
                                     + "</tr>";
                        break;

                    case CPContentBaseClass.FieldTypeIdEnum.Text:
                    case CPContentBaseClass.FieldTypeIdEnum.LongText:
                    case CPContentBaseClass.FieldTypeIdEnum.HTML:
                    case CPContentBaseClass.FieldTypeIdEnum.HTMLCode:
                    case CPContentBaseClass.FieldTypeIdEnum.FileHTML:
                    case CPContentBaseClass.FieldTypeIdEnum.FileHTMLCode:
                    case CPContentBaseClass.FieldTypeIdEnum.FileCSS:
                    case CPContentBaseClass.FieldTypeIdEnum.FileJavascript:
                    case CPContentBaseClass.FieldTypeIdEnum.FileXML:
                        //
                        // Text
                        //
                        returnForm = returnForm + "<tr>"
                                     + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>"
                                     + "<td class=\"ccAdminEditField\">"
                                     + "<div style=\"display:block;float:left;width:800px;\">"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not&nbsp;empty</div>"
                                     + "<div style=\"display:block;float:left;width:150px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.matchincludes).ToString(), FieldMatchOption.ToString(), "t" + FieldPtr) + "includes</div>"
                                     + "<div style=\"display:block;float:left;width:300px;\">" + HtmlController.inputText_Legacy(core, "fieldvalue" + FieldPtr, FieldValue[FieldPtr], 1, 5, "", false, false, "ccAdvSearchText").Replace(">", " onFocus=\"var e=getElementById('t" + FieldPtr + "');e.checked=1;\">") + "</div>"
                                     + "</div>"
                                     + "</td>"
                                     + "</tr>";
                        RowPointer = RowPointer + 1;
                        break;

                    case CPContentBaseClass.FieldTypeIdEnum.Lookup:
                    case CPContentBaseClass.FieldTypeIdEnum.MemberSelect:
                        //
                        // Lookup
                        returnForm = returnForm + "<tr>"
                                     + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>"
                                     + "<td class=\"ccAdminEditField\">"
                                     + "<div style=\"display:block;float:left;width:800px;\">"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>"
                                     + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not&nbsp;empty</div>"
                                     + "<div style=\"display:block;float:left;width:150px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.matchincludes).ToString(), FieldMatchOption.ToString(), "t" + FieldPtr) + "includes</div>"
                                     + "<div style=\"display:block;float:left;width:300px;\">" + HtmlController.inputText_Legacy(core, "fieldvalue" + FieldPtr, FieldValue[FieldPtr], 1, 5, "", false, false, "ccAdvSearchText").Replace(">", " onFocus=\"var e=getElementById('t" + FieldPtr + "'); e.checked= 1;\">") + "</div>"
                                     + "</div>"
                                     + "</td>"
                                     + "</tr>";
                        RowPointer = RowPointer + 1;
                        break;
                    }
                }
                returnForm = returnForm + HtmlController.tableRowStart();
                returnForm = returnForm + HtmlController.tableCellStart("120", 1, RowEven, "right") + "<img src=" + cdnPrefix + "images/spacer.gif width=120 height=1></td>";
                returnForm = returnForm + HtmlController.tableCellStart("99%", 1, RowEven, "left") + "<img src=" + cdnPrefix + "images/spacer.gif width=1 height=1></td>";
                returnForm = returnForm + kmaEndTableRow;
                returnForm = returnForm + "</table>";
                Content    = returnForm;
                //
                // Assemble LiveWindowTable
                Stream.add(ButtonBar);
                Stream.add(TitleBar);
                Stream.add(Content);
                Stream.add(ButtonBar);
                Stream.add("<input type=hidden name=fieldcnt VALUE=" + FieldCnt + ">");
                Stream.add("<input type=hidden name=" + RequestNameAdminSubForm + " VALUE=" + AdminFormIndex_SubFormAdvancedSearch + ">");
                returnForm = HtmlController.form(core, Stream.text);
                core.html.addTitle(adminData.adminContent.name + " Advanced Search");
            } catch (Exception ex) {
                LogController.logError(core, ex);
                throw;
            }
            return(returnForm);
        }
        //
        //===========================================================================
        //
        public static string get(CoreController core, AdminDataModel adminData, IndexConfigClass indexConfig, PermissionController.UserContentPermissions userContentPermissions, string sql, DataSourceModel dataSource, Dictionary <string, bool> FieldUsedInColumns, Dictionary <string, bool> IsLookupFieldValid)
        {
            try {
                bool allowDelete      = (adminData.adminContent.allowDelete) && (userContentPermissions.allowDelete) && (indexConfig.allowDelete);
                var  DataTable_HdrRow = new StringBuilder("<tr>");
                //
                // Row Number Column
                DataTable_HdrRow.Append("<td width=20 align=center valign=bottom class=\"small ccAdminListCaption\">Row</td>");
                //
                // Edit Column
                DataTable_HdrRow.Append("<td width=20 align=center valign=bottom class=\"small ccAdminListCaption\">Edit</td>");
                //
                // Delete Select Box Columns
                if (!allowDelete)
                {
                    DataTable_HdrRow.Append("<td width=20 align=center valign=bottom class=\"small ccAdminListCaption\"><input TYPE=CheckBox disabled=\"disabled\"></td>");
                }
                else
                {
                    DataTable_HdrRow.Append("<td width=20 align=center valign=bottom class=\"small ccAdminListCaption\"><input TYPE=CheckBox OnClick=\"CheckInputs('DelCheck',this.checked);\"></td>");
                }
                //
                // -- create header
                int ColumnWidthTotal = 0;
                foreach (var column in indexConfig.columns)
                {
                    if (column.Width < 1)
                    {
                        column.Width = 1;
                    }
                    ColumnWidthTotal += column.Width;
                }
                foreach (var column in indexConfig.columns)
                {
                    //
                    // ----- print column headers - anchored so they sort columns
                    //
                    int ColumnWidth = encodeInteger((100 * column.Width) / (double)ColumnWidthTotal);
                    //
                    // if this is a current sort ,add the reverse flag
                    //
                    StringBuilder buttonHref = new StringBuilder();
                    buttonHref.Append("/" + core.appConfig.adminRoute + "?" + rnAdminForm + "=" + AdminFormIndex + "&SetSortField=" + column.Name + "&RT=0&" + RequestNameTitleExtension + "=" + GenericController.encodeRequestVariable(adminData.titleExtension) + "&cid=" + adminData.adminContent.id + "&ad=" + adminData.ignore_legacyMenuDepth);
                    if (!indexConfig.sorts.ContainsKey(column.Name))
                    {
                        buttonHref.Append("&SetSortDirection=1");
                    }
                    else
                    {
                        switch (indexConfig.sorts[column.Name].direction)
                        {
                        case 1: {
                            buttonHref.Append("&SetSortDirection=2");
                            break;
                        }

                        case 2: {
                            buttonHref.Append("&SetSortDirection=0");
                            break;
                        }

                        default: {
                            // nothing
                            break;
                        }
                        }
                    }
                    //
                    // -- column header includes WherePairCount
                    if (!adminData.wherePair.Count.Equals(0))
                    {
                        int ptr = 0;
                        foreach (var kvp in adminData.wherePair)
                        {
                            if (!string.IsNullOrWhiteSpace(kvp.Key))
                            {
                                buttonHref.Append("&wl" + ptr + "=" + GenericController.encodeRequestVariable(kvp.Value));
                                buttonHref.Append("&wr" + ptr + "=" + GenericController.encodeRequestVariable(kvp.Value));
                                ptr++;
                            }
                        }
                    }
                    string buttonFace = adminData.adminContent.fields[column.Name.ToLowerInvariant()].caption;
                    buttonFace = GenericController.strReplace(buttonFace, " ", "&nbsp;");
                    string SortTitle = "Sort A-Z";
                    //
                    if (indexConfig.sorts.ContainsKey(column.Name))
                    {
                        string sortSuffix = ((indexConfig.sorts.Count < 2) ? "" : indexConfig.sorts[column.Name].order.ToString());
                        switch (indexConfig.sorts[column.Name].direction)
                        {
                        case 1: {
                            buttonFace = iconArrowDown + sortSuffix + "&nbsp;" + buttonFace;
                            SortTitle  = "Sort Z-A";
                            break;
                        }

                        case 2: {
                            buttonFace = iconArrowUp + sortSuffix + "&nbsp;" + buttonFace;
                            SortTitle  = "Remove Sort";
                            break;
                        }

                        default: {
                            // nothing
                            break;
                        }
                        }
                    }
                    if (indexConfig.allowColumnSort)
                    {
                        buttonFace = HtmlController.a(buttonFace, new CPBase.BaseModels.HtmlAttributesA()
                        {
                            title  = SortTitle,
                            href   = buttonHref.ToString(),
                            @class = "ccAdminListCaption"
                        });
                    }
                    adminData.buttonObjectCount += 1;
                    DataTable_HdrRow.Append("<td width=\"" + ColumnWidth + "%\" valign=bottom align=left class=\"small ccAdminListCaption\">");
                    DataTable_HdrRow.Append(buttonFace);
                    DataTable_HdrRow.Append("</td>");
                }
                DataTable_HdrRow.Append("</tr>");
                //
                // -- generic admin url for edit and add links
                string adminEditPresetArgQsList = "";
                string adminUrlBase             = "\\" + core.appConfig.adminRoute + "?" + rnAdminAction + "=" + Constants.AdminActionNop + "&cid=" + adminData.adminContent.id + "&" + RequestNameTitleExtension + "=" + GenericController.encodeRequestVariable(adminData.titleExtension) + "&ad=" + adminData.ignore_legacyMenuDepth + "&" + rnAdminSourceForm + "=" + adminData.adminForm + "&" + rnAdminForm + "=" + AdminFormEdit;
                if (!adminData.wherePair.Count.Equals(0))
                {
                    int WhereCount = 0;
                    foreach (var kvp in adminData.wherePair)
                    {
                        adminEditPresetArgQsList += "&" + encodeRequestVariable(kvp.Key) + "=" + GenericController.encodeRequestVariable(kvp.Value);
                        WhereCount++;
                    }
                    adminUrlBase += adminEditPresetArgQsList;
                }
                //
                // -- output data rows
                var    dataTableRows = new StringBuilder();
                string rowColor      = "";
                int    rowNumber     = 0;
                int    rowNumberLast = 0;
                using (var csData = new CsModel(core)) {
                    if (csData.openSql(sql, dataSource.name, indexConfig.recordsPerPage, indexConfig.pageNumber))
                    {
                        rowNumber     = indexConfig.recordTop;
                        rowNumberLast = indexConfig.recordTop + indexConfig.recordsPerPage;
                        //
                        // --- Print out the records
                        while ((csData.ok()) && (rowNumber < rowNumberLast))
                        {
                            int recordId = csData.getInteger("ID");
                            if (rowColor == "class=\"ccAdminListRowOdd\"")
                            {
                                rowColor = "class=\"ccAdminListRowEven\"";
                            }
                            else
                            {
                                rowColor = "class=\"ccAdminListRowOdd\"";
                            }
                            //
                            // -- new row
                            dataTableRows.Append(Environment.NewLine + "<tr>");
                            //
                            // --- row number column
                            dataTableRows.Append("<td align=right " + rowColor + ">" + (rowNumber + 1).ToString() + "</td>");
                            //
                            // --- edit column
                            dataTableRows.Append("<td align=center " + rowColor + ">" + getRecordEditAnchorTag(adminUrlBase + "&id=" + recordId) + "</td>");
                            //
                            // --- Delete Checkbox Columns
                            if (allowDelete)
                            {
                                dataTableRows.Append("<td align=center " + rowColor + "><input TYPE=CheckBox NAME=row" + rowNumber + " VALUE=1 ID=\"DelCheck\"><input type=hidden name=rowid" + rowNumber + " VALUE=" + recordId + "></span></td>");
                            }
                            else
                            {
                                dataTableRows.Append("<td align=center " + rowColor + "><input TYPE=CheckBox disabled=\"disabled\" NAME=row" + rowNumber + " VALUE=1><input type=hidden name=rowid" + rowNumber + " VALUE=" + recordId + "></span></td>");
                            }
                            //
                            // --- field columns
                            foreach (var column in indexConfig.columns)
                            {
                                string columnNameLc = column.Name.ToLowerInvariant();
                                if (FieldUsedInColumns.ContainsKey(columnNameLc))
                                {
                                    if (FieldUsedInColumns[columnNameLc])
                                    {
                                        dataTableRows.Append((Environment.NewLine + "<td valign=\"middle\" " + rowColor + " align=\"left\">" + SpanClassAdminNormal));
                                        dataTableRows.Append(getGridCell(core, adminData, column.Name, csData, IsLookupFieldValid[columnNameLc], GenericController.toLCase(adminData.adminContent.tableName) == "ccemail"));
                                        dataTableRows.Append(("&nbsp;</span></td>"));
                                    }
                                }
                            }
                            dataTableRows.Append(("\n    </tr>"));
                            csData.goNext();
                            rowNumber = rowNumber + 1;
                        }
                        dataTableRows.Append("<input type=hidden name=rowcnt value=" + rowNumber + ">");
                        //
                        // --- print out the stuff at the bottom
                        //
                        int RecordTop_NextPage = indexConfig.recordTop;
                        if (csData.ok())
                        {
                            RecordTop_NextPage = rowNumber;
                        }
                        int RecordTop_PreviousPage = indexConfig.recordTop - indexConfig.recordsPerPage;
                        if (RecordTop_PreviousPage < 0)
                        {
                            RecordTop_PreviousPage = 0;
                        }
                    }
                }
                //
                // Header at bottom
                //
                if (rowColor == "class=\"ccAdminListRowOdd\"")
                {
                    rowColor = "class=\"ccAdminListRowEven\"";
                }
                else
                {
                    rowColor = "class=\"ccAdminListRowOdd\"";
                }
                string blankRow = "<tr><td colspan=" + (indexConfig.columns.Count + 3) + " " + rowColor + " style=\"text-align:left ! important;\">{msg}</td></tr>";
                if (rowNumber == 0)
                {
                    //
                    // -- No records found
                    dataTableRows.Append(blankRow.Replace("{msg}", "----- no records were found -----"));
                }
                else
                {
                    if (rowNumber < rowNumberLast)
                    {
                        //
                        // --End of list
                        dataTableRows.Append(blankRow.Replace("{msg}", "----- end of list -----"));
                    }
                }
                if (indexConfig.allowAddRow)
                {
                    //
                    // optional AddRow
                    foreach (var addTag in getRecordAddAnchorTag(core, adminData.adminContent.name, adminEditPresetArgQsList, false, userContentPermissions.allowAdd))
                    {
                        dataTableRows.Append(blankRow.Replace("{msg}", addTag));
                    }
                }
                //
                // Add another header to the data rows
                //
                dataTableRows.Append(DataTable_HdrRow.ToString());
                //
                var DataTable_FindRow = new StringBuilder();
                if (indexConfig.allowFind)
                {
                    //
                    // ----- DataTable_FindRow
                    //
                    DataTable_FindRow.Append("<tr><td colspan=" + (3 + indexConfig.columns.Count) + " style=\"background-color:black;height:1;\"></td></tr>");
                    DataTable_FindRow.Append("<tr>");
                    DataTable_FindRow.Append("<td valign=\"middle\" colspan=3 width=\"60\" class=\"ccPanel\" align=center style=\"vertical-align:middle;padding:8px;text-align:center ! important;\">");
                    DataTable_FindRow.Append(AdminUIController.getButtonPrimary(ButtonFind, "", false, "FindButton") + "</td>");
                    int ColumnPointer = 0;
                    var listOfMatches = new List <FindWordMatchEnum> {
                        FindWordMatchEnum.matchincludes, FindWordMatchEnum.MatchEquals, FindWordMatchEnum.MatchTrue, FindWordMatchEnum.MatchFalse
                    };
                    foreach (var column in indexConfig.columns)
                    {
                        string FieldName     = GenericController.toLCase(column.Name);
                        string FindWordValue = "";
                        if (indexConfig.findWords.ContainsKey(FieldName))
                        {
                            var findWord = indexConfig.findWords[FieldName];
                            if (listOfMatches.Any(s => findWord.MatchOption.Equals(s)))
                            {
                                FindWordValue = findWord.Value;
                            }
                        }
                        DataTable_FindRow.Append(Environment.NewLine + "<td valign=\"middle\" align=\"center\" class=\"ccPanel3DReverse\" style=\"padding:8px;\">"
                                                 + "<input type=hidden name=\"FindName" + ColumnPointer + "\" value=\"" + FieldName + "\">"
                                                 + "<input class=\"form-control findInput\"  onkeypress=\"KeyCheck(event);\"  type=text id=\"F" + ColumnPointer + "\" name=\"FindValue" + ColumnPointer + "\" value=\"" + FindWordValue + "\" style=\"padding-right:.2rem;padding-left:.2rem;\">"
                                                 + "</td>");
                        ColumnPointer += 1;
                    }
                    DataTable_FindRow.Append("</tr>");
                }
                //
                // Assemble DataTable
                //
                string grid = ""
                              + "<table ID=\"DataTable\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"Background-Color:white;\">"
                              + DataTable_HdrRow + dataTableRows + DataTable_FindRow + "</table>";
                return(grid);
            } catch (Exception ex) {
                LogController.logError(core, ex);
                return(HtmlController.div("There was an error creating the record list."));
            }
        }
示例#3
0
        //
        //=============================================================================
        //   Export the Admin List form results
        //=============================================================================
        //
        public static string get(CoreController core, AdminDataModel adminData)
        {
            string result = "";

            try {
                //
                bool   AllowContentAccess                    = false;
                string ButtonCommaList                       = "";
                string ExportName                            = null;
                string Description                           = null;
                string Content                               = "";
                string Button                                = null;
                int    RecordLimit                           = 0;
                int    recordCnt                             = 0;
                string sqlFieldList                          = "";
                string SQLFrom                               = "";
                string SQLWhere                              = "";
                string SQLOrderBy                            = "";
                bool   IsLimitedToSubContent                 = false;
                string ContentAccessLimitMessage             = "";
                Dictionary <string, bool> FieldUsedInColumns = new Dictionary <string, bool>();
                Dictionary <string, bool> IsLookupFieldValid = new Dictionary <string, bool>();
                IndexConfigClass          IndexConfig        = null;
                string          SQL                          = null;
                bool            IsRecordLimitSet             = false;
                string          RecordLimitText              = null;
                var             cacheNameList                = new List <string>();
                DataSourceModel datasource                   = DataSourceModel.create(core.cpParent, adminData.adminContent.dataSourceId, ref cacheNameList);
                //
                // ----- Process Input
                //
                Button = core.docProperties.getText("Button");
                if (Button == ButtonCancelAll)
                {
                    //
                    // Cancel out to the main page
                    //
                    return(core.webServer.redirect("?", "CancelAll button pressed on Index Export"));
                }
                else if (Button != ButtonCancel)
                {
                    //
                    // get content access rights
                    //
                    var userContentPermissions = PermissionController.getUserContentPermissions(core, adminData.adminContent);
                    if (!userContentPermissions.allowEdit)
                    {
                        //
                        // You must be a content manager of this content to use this tool
                        //
                        Content = ""
                                  + "<p>You must be a content manager of " + adminData.adminContent.name + " to use this tool. Hit Cancel to return to main admin page.</p>"
                                  + HtmlController.inputHidden(RequestNameAdminSubForm, AdminFormIndex_SubFormExport) + "";
                        ButtonCommaList = ButtonCancelAll;
                    }
                    else
                    {
                        IsRecordLimitSet = false;
                        if (string.IsNullOrEmpty(Button))
                        {
                            //
                            // Set Defaults
                            //
                            ExportName      = "";
                            RecordLimit     = 0;
                            RecordLimitText = "";
                        }
                        else
                        {
                            ExportName      = core.docProperties.getText("ExportName");
                            RecordLimitText = core.docProperties.getText("RecordLimit");
                            if (!string.IsNullOrEmpty(RecordLimitText))
                            {
                                IsRecordLimitSet = true;
                                RecordLimit      = GenericController.encodeInteger(RecordLimitText);
                            }
                        }
                        if (string.IsNullOrEmpty(ExportName))
                        {
                            ExportName = adminData.adminContent.name + " export for " + core.session.user.name;
                        }
                        //
                        // Get the SQL parts
                        //
                        IndexConfig = IndexConfigClass.get(core, adminData);
                        ListView.setIndexSQL(core, adminData, IndexConfig, ref AllowContentAccess, ref sqlFieldList, ref SQLFrom, ref SQLWhere, ref SQLOrderBy, ref IsLimitedToSubContent, ref ContentAccessLimitMessage, ref FieldUsedInColumns, IsLookupFieldValid);
                        if (!AllowContentAccess)
                        {
                            //
                            // This should be caught with check earlier, but since I added this, and I never make mistakes, I will leave this in case there is a mistake in the earlier code
                            //
                            Processor.Controllers.ErrorController.addUserError(core, "Your account does not have access to any records in '" + adminData.adminContent.name + "'.");
                        }
                        else
                        {
                            //
                            // Get the total record count
                            //
                            SQL = "select count(" + adminData.adminContent.tableName + ".ID) as cnt from " + SQLFrom + " where " + SQLWhere;
                            using (var csData = new CsModel(core)) {
                                csData.openSql(SQL, datasource.name);
                                if (csData.ok())
                                {
                                    recordCnt = csData.getInteger("cnt");
                                }
                            }
                            //
                            // Build the SQL
                            //
                            SQL = "select";
                            if (IsRecordLimitSet && (datasource.dbTypeId != DataSourceTypeODBCMySQL))
                            {
                                SQL += " Top " + RecordLimit;
                            }
                            SQL += " " + adminData.adminContent.tableName + ".* From " + SQLFrom + " WHERE " + SQLWhere;
                            if (!string.IsNullOrEmpty(SQLOrderBy))
                            {
                                SQL += " Order By" + SQLOrderBy;
                            }
                            if (IsRecordLimitSet && (datasource.dbTypeId == DataSourceTypeODBCMySQL))
                            {
                                SQL += " Limit " + RecordLimit;
                            }
                            //
                            // Assumble the SQL
                            //
                            if (recordCnt == 0)
                            {
                                //
                                // There are no records to request
                                //
                                Content = ""
                                          + "<p>This selection has no records. Hit Cancel to return to the " + adminData.adminContent.name + " list page.</p>"
                                          + HtmlController.inputHidden(RequestNameAdminSubForm, AdminFormIndex_SubFormExport) + "";
                                ButtonCommaList = ButtonCancel;
                            }
                            else if (Button == ButtonRequestDownload)
                            {
                                //
                                // Request the download
                                //
                                var ExportCSVAddon = DbBaseModel.create <AddonModel>(core.cpParent, addonGuidExportCSV);
                                if (ExportCSVAddon == null)
                                {
                                    LogController.logError(core, new GenericException("ExportCSV addon not found. Task could not be added to task queue."));
                                }
                                else
                                {
                                    var docProperties = new Dictionary <string, string> {
                                        { "sql", SQL },
                                        { "datasource", "default" }
                                    };
                                    var cmdDetail = new TaskModel.CmdDetailClass {
                                        addonId   = ExportCSVAddon.id,
                                        addonName = ExportCSVAddon.name,
                                        args      = docProperties
                                    };
                                    TaskSchedulerController.addTaskToQueue(core, cmdDetail, false, ExportName, "export_" + adminData.adminContent.name.Replace(" ", "_") + ".csv");
                                }
                                //
                                Content = ""
                                          + "<p>Your export has been requested and will be available shortly in the <a href=\"?" + rnAdminForm + "=" + AdminFormDownloads + "\">Download Manager</a>. Hit Cancel to return to the " + adminData.adminContent.name + " list page.</p>"
                                          + HtmlController.inputHidden(RequestNameAdminSubForm, AdminFormIndex_SubFormExport) + "";
                                //
                                ButtonCommaList = ButtonCancel;
                            }
                            else
                            {
                                //
                                // no button or refresh button, Ask are you sure
                                //
                                Content += HtmlController.div(
                                    HtmlController.label("Export Name", "export-name")
                                    + HtmlController.inputText(core, "ExportName", ExportName, "form-control", "export-name")
                                    , "form-group");
                                Content += HtmlController.div(
                                    HtmlController.label("Records Found", "records-found")
                                    + HtmlController.inputText(core, "RecordCnt", recordCnt.ToString(), "form-control", "records-found", true)
                                    , "form-group");
                                Content += HtmlController.div(
                                    HtmlController.label("Record Limit", "record-limit")
                                    + HtmlController.inputText(core, "RecordLimit", RecordLimitText, "form-control", "record-limit")
                                    , "form-group");
                                if (core.session.isAuthenticatedDeveloper())
                                {
                                    Content += HtmlController.div(
                                        HtmlController.label("Results SQL", "export-query")
                                        + HtmlController.inputTextarea(core, "sql", SQL, 4, -1, "export-query", false, false, "form-control")
                                        , "form-group");
                                }
                                //
                                Content = ""
                                          //+ "\r<style>"
                                          //+ cr2 + ".exportTblCaption {width:100px;}"
                                          //+ cr2 + ".exportTblInput {}"
                                          //+ "\r</style>"
                                          + Content + HtmlController.inputHidden(RequestNameAdminSubForm, AdminFormIndex_SubFormExport) + "";
                                ButtonCommaList = ButtonCancel + "," + ButtonRequestDownload;
                                if (core.session.isAuthenticatedDeveloper())
                                {
                                    ButtonCommaList = ButtonCommaList + "," + ButtonRefresh;
                                }
                            }
                        }
                    }
                    //
                    Description = "<p>This tool creates an export of the current admin list page results. If you would like to download the current results, select a format and press OK. Your search results will be submitted for export. Your download will be ready shortly in the download manager. To exit without requesting an output, hit Cancel.</p>";
                    result      = AdminUIController.getToolBody(core, adminData.adminContent.name + " Export", ButtonCommaList, "", false, false, Description, "", 10, Content);
                }
            } catch (Exception ex) {
                LogController.logError(core, ex);
            }
            return(result);
        }
示例#4
0
        //
        //=================================================================================
        /// <summary>
        /// Load the index config, if it is empty, setup defaults
        /// </summary>
        /// <param name="core"></param>
        /// <param name="adminData"></param>
        /// <returns></returns>
        public static IndexConfigClass get(CoreController core, AdminDataModel adminData)
        {
            IndexConfigClass returnIndexConfig = new IndexConfigClass {
                contentID            = adminData.adminContent.id,
                activeOnly           = false,
                lastEditedByMe       = false,
                lastEditedToday      = false,
                lastEditedPast7Days  = false,
                lastEditedPast30Days = false,
                loaded          = true,
                open            = false,
                pageNumber      = 1,
                recordsPerPage  = Constants.RecordsPerPageDefault,
                recordTop       = 0,
                groupList       = new string[groupListCntMax],
                groupListCnt    = 0,
                columns         = new List <IndexConfigColumnClass>(),
                sorts           = new Dictionary <string, IndexConfigSortClass>(),
                findWords       = new Dictionary <string, IndexConfigFindWordClass>(),
                allowDelete     = true,
                allowFind       = true,
                allowAddRow     = false,
                allowColumnSort = true
            };

            try {
                //
                // Setup Member Properties
                string ConfigList = core.userProperty.getText(AdminDataModel.IndexConfigPrefix + encodeText(adminData.adminContent.id), "");
                if (!string.IsNullOrEmpty(ConfigList))
                {
                    //
                    // load values
                    //
                    ConfigList += Environment.NewLine;
                    string[] ConfigListLines = GenericController.splitNewLine(ConfigList);
                    int      Ptr             = 0;
                    while (Ptr < ConfigListLines.GetUpperBound(0))
                    {
                        //
                        // check next line
                        //
                        string ConfigListLine = GenericController.toLCase(ConfigListLines[Ptr]);
                        if (!string.IsNullOrEmpty(ConfigListLine))
                        {
                            if (ConfigListLine.Equals("columns"))
                            {
                                Ptr += 1;
                                while (!string.IsNullOrEmpty(ConfigListLines[Ptr]))
                                {
                                    string   Line      = ConfigListLines[Ptr];
                                    string[] LineSplit = Line.Split('\t');
                                    if (LineSplit.GetUpperBound(0) > 0)
                                    {
                                        string fieldName = LineSplit[0].Trim().ToLowerInvariant();
                                        if (!string.IsNullOrWhiteSpace(fieldName))
                                        {
                                            if (adminData.adminContent.fields.ContainsKey(fieldName))
                                            {
                                                returnIndexConfig.columns.Add(new IndexConfigColumnClass {
                                                    Name          = fieldName,
                                                    Width         = GenericController.encodeInteger(LineSplit[1]),
                                                    SortDirection = 0,
                                                    SortPriority  = 0
                                                });
                                            }
                                        }
                                    }
                                    Ptr += 1;
                                }
                            }
                            else if (ConfigListLine.Equals("sorts"))
                            {
                                Ptr += 1;
                                int orderPtr = 0;
                                while (!string.IsNullOrEmpty(ConfigListLines[Ptr]))
                                {
                                    string[] LineSplit = ConfigListLines[Ptr].Split('\t');
                                    if (LineSplit.GetUpperBound(0) == 1)
                                    {
                                        string fieldName = LineSplit[0].Trim().ToLowerInvariant();
                                        if (!string.IsNullOrWhiteSpace(fieldName))
                                        {
                                            returnIndexConfig.sorts.Add(fieldName, new IndexConfigSortClass {
                                                fieldName = fieldName,
                                                direction = ((LineSplit[1] == "1") ? 1 : 2),
                                                order     = ++orderPtr
                                            });
                                        }
                                    }
                                    Ptr += 1;
                                }
                            }
                        }
                        Ptr += 1;
                    }
                    if (returnIndexConfig.recordsPerPage <= 0)
                    {
                        returnIndexConfig.recordsPerPage = Constants.RecordsPerPageDefault;
                    }
                }
                //
                // Setup Visit Properties
                ConfigList = core.visitProperty.getText(AdminDataModel.IndexConfigPrefix + encodeText(adminData.adminContent.id), "");
                if (!string.IsNullOrEmpty(ConfigList))
                {
                    //
                    // load values
                    ConfigList += Environment.NewLine;
                    string[] ConfigListLines = GenericController.splitNewLine(ConfigList);
                    int      Ptr             = 0;
                    while (Ptr < ConfigListLines.GetUpperBound(0))
                    {
                        //
                        // check next line
                        string ConfigListLine = GenericController.toLCase(ConfigListLines[Ptr]);
                        if (!string.IsNullOrEmpty(ConfigListLine))
                        {
                            switch (ConfigListLine)
                            {
                            case "findwordlist":
                                Ptr += 1;
                                while (!string.IsNullOrEmpty(ConfigListLines[Ptr]))
                                {
                                    string   Line      = ConfigListLines[Ptr];
                                    string[] LineSplit = Line.Split('\t');
                                    if (LineSplit.GetUpperBound(0) > 1)
                                    {
                                        returnIndexConfig.findWords.Add(LineSplit[0], new IndexConfigFindWordClass {
                                            Name        = LineSplit[0],
                                            Value       = LineSplit[1],
                                            MatchOption = (FindWordMatchEnum)GenericController.encodeInteger(LineSplit[2])
                                        });
                                    }
                                    Ptr += 1;
                                }
                                break;

                            case "grouplist":
                                Ptr += 1;
                                while ((Ptr < ConfigListLines.GetUpperBound(0)) && !string.IsNullOrEmpty(ConfigListLines[Ptr]))
                                {
                                    if (returnIndexConfig.groupListCnt < groupListCntMax)
                                    {
                                        returnIndexConfig.groupList[returnIndexConfig.groupListCnt] = ConfigListLines[Ptr];
                                        returnIndexConfig.groupListCnt += 1;
                                    }
                                    Ptr += 1;
                                }
                                break;

                            case "cdeflist":
                                Ptr += 1;
                                returnIndexConfig.subCDefID = GenericController.encodeInteger(ConfigListLines[Ptr]);
                                break;

                            case "indexfiltercategoryid":
                                // -- remove deprecated value
                                Ptr += 1;
                                break;

                            case "indexfilteractiveonly":
                                returnIndexConfig.activeOnly = true;
                                break;

                            case "indexfilterlasteditedbyme":
                                returnIndexConfig.lastEditedByMe = true;
                                break;

                            case "indexfilterlasteditedtoday":
                                returnIndexConfig.lastEditedToday = true;
                                break;

                            case "indexfilterlasteditedpast7days":
                                returnIndexConfig.lastEditedPast7Days = true;
                                break;

                            case "indexfilterlasteditedpast30days":
                                returnIndexConfig.lastEditedPast30Days = true;
                                break;

                            case "indexfilteropen":
                                returnIndexConfig.open = true;
                                break;

                            case "recordsperpage":
                                Ptr += 1;
                                returnIndexConfig.recordsPerPage = GenericController.encodeInteger(ConfigListLines[Ptr]);
                                if (returnIndexConfig.recordsPerPage <= 0)
                                {
                                    returnIndexConfig.recordsPerPage = 50;
                                }
                                returnIndexConfig.recordTop = DbController.getStartRecord(returnIndexConfig.recordsPerPage, returnIndexConfig.pageNumber);
                                break;

                            case "pagenumber":
                                Ptr += 1;
                                returnIndexConfig.pageNumber = GenericController.encodeInteger(ConfigListLines[Ptr]);
                                if (returnIndexConfig.pageNumber <= 0)
                                {
                                    returnIndexConfig.pageNumber = 1;
                                }
                                returnIndexConfig.recordTop = DbController.getStartRecord(returnIndexConfig.recordsPerPage, returnIndexConfig.pageNumber);
                                break;

                            default:
                                break;
                            }
                        }
                        Ptr += 1;
                    }
                    if (returnIndexConfig.recordsPerPage <= 0)
                    {
                        returnIndexConfig.recordsPerPage = Constants.RecordsPerPageDefault;
                    }
                }
                //
                // Setup defaults if not loaded
                //
                if ((returnIndexConfig.columns.Count == 0) && (adminData.adminContent.adminColumns.Count > 0))
                {
                    foreach (var keyValuePair in adminData.adminContent.adminColumns)
                    {
                        returnIndexConfig.columns.Add(new IndexConfigColumnClass {
                            Name  = keyValuePair.Value.Name.ToLowerInvariant(),
                            Width = keyValuePair.Value.Width
                        });
                    }
                }
            } catch (Exception ex) {
                LogController.logError(core, ex);
                throw;
            }
            return(returnIndexConfig);
        }
        //
        //=============================================================================
        //   Print the Configure Index Form
        //=============================================================================
        //
        public static string get(CPClass cp, CoreController core, AdminDataModel adminData)
        {
            string result = "";

            try {
                // todo refactor out
                ContentMetadataModel adminContent = adminData.adminContent;
                string Button = core.docProperties.getText(RequestNameButton);
                if (Button == ButtonOK)
                {
                    //
                    // -- Process OK, remove subform from querystring and return empty
                    cp.Doc.AddRefreshQueryString(RequestNameAdminSubForm, "");
                    return(result);
                }
                //
                //   Load Request
                if (Button == ButtonReset)
                {
                    //
                    // -- Process reset
                    core.userProperty.setProperty(AdminDataModel.IndexConfigPrefix + adminContent.id.ToString(), "");
                }
                IndexConfigClass IndexConfig         = IndexConfigClass.get(core, adminData);
                int          ToolsAction             = core.docProperties.getInteger("dta");
                int          TargetFieldId           = core.docProperties.getInteger("fi");
                string       TargetFieldName         = core.docProperties.getText("FieldName");
                int          ColumnPointer           = core.docProperties.getInteger("dtcn");
                const string RequestNameAddField     = "addfield";
                string       FieldNameToAdd          = GenericController.toUCase(core.docProperties.getText(RequestNameAddField));
                const string RequestNameAddFieldId   = "addfieldID";
                int          FieldIDToAdd            = core.docProperties.getInteger(RequestNameAddFieldId);
                bool         normalizeSaveLoad       = core.docProperties.getBoolean("NeedToReloadConfig");
                bool         AllowContentAutoLoad    = false;
                StringBuilderLegacyController Stream = new StringBuilderLegacyController();
                string Title       = "Set Columns: " + adminContent.name;
                string Description = "Use the icons to add, remove and modify your personal column prefernces for this content (" + adminContent.name + "). Hit OK when complete. Hit Reset to restore your column preferences for this content to the site's default column preferences.";
                Stream.add(AdminUIController.getHeaderTitleDescription(Title, Description));
                //
                //--------------------------------------------------------------------------------
                // Process actions
                //--------------------------------------------------------------------------------
                //
                if (adminContent.id != 0)
                {
                    var CDef             = ContentMetadataModel.create(core, adminContent.id);
                    int ColumnWidthTotal = 0;
                    if (ToolsAction != 0)
                    {
                        //
                        // Block contentautoload, then force a load at the end
                        //
                        AllowContentAutoLoad = (core.siteProperties.getBoolean("AllowContentAutoLoad", true));
                        core.siteProperties.setProperty("AllowContentAutoLoad", false);
                        bool   reloadMetadata  = false;
                        int    SourceContentId = 0;
                        string SourceName      = null;
                        //
                        // Make sure the FieldNameToAdd is not-inherited, if not, create new field
                        //
                        if (FieldIDToAdd != 0)
                        {
                            foreach (KeyValuePair <string, ContentFieldMetadataModel> keyValuePair in adminContent.fields)
                            {
                                ContentFieldMetadataModel field = keyValuePair.Value;
                                if (field.id == FieldIDToAdd)
                                {
                                    if (field.inherited)
                                    {
                                        SourceContentId = field.contentId;
                                        SourceName      = field.nameLc;
                                        //
                                        // -- copy the field
                                        using (var CSSource = new CsModel(core)) {
                                            if (CSSource.open("Content Fields", "(ContentID=" + SourceContentId + ")and(Name=" + DbController.encodeSQLText(SourceName) + ")"))
                                            {
                                                using (var CSTarget = new CsModel(core)) {
                                                    if (CSTarget.insert("Content Fields"))
                                                    {
                                                        CSSource.copyRecord(CSTarget);
                                                        CSTarget.set("ContentID", adminContent.id);
                                                        reloadMetadata = true;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                        //
                        // Make sure all fields are not-inherited, if not, create new fields
                        //
                        foreach (var column in IndexConfig.columns)
                        {
                            ContentFieldMetadataModel field = adminContent.fields[column.Name.ToLowerInvariant()];
                            if (field.inherited)
                            {
                                SourceContentId = field.contentId;
                                SourceName      = field.nameLc;
                                using (var CSSource = new CsModel(core)) {
                                    if (CSSource.open("Content Fields", "(ContentID=" + SourceContentId + ")and(Name=" + DbController.encodeSQLText(SourceName) + ")"))
                                    {
                                        using (var CSTarget = new CsModel(core)) {
                                            if (CSTarget.insert("Content Fields"))
                                            {
                                                CSSource.copyRecord(CSTarget);
                                                CSTarget.set("ContentID", adminContent.id);
                                                reloadMetadata = true;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        //
                        // get current values for Processing
                        //
                        foreach (var column in IndexConfig.columns)
                        {
                            ColumnWidthTotal += column.Width;
                        }
                        //
                        // ----- Perform any actions first
                        //
                        switch (ToolsAction)
                        {
                        case ToolsActionAddField: {
                            //
                            // Add a field to the index form
                            //
                            if (FieldIDToAdd != 0)
                            {
                                IndexConfigColumnClass column = null;
                                foreach (var columnx in IndexConfig.columns)
                                {
                                    columnx.Width = encodeInteger((columnx.Width * 80) / (double)ColumnWidthTotal);
                                }
                                {
                                    column = new IndexConfigColumnClass();
                                    using (var csData = new CsModel(core)) {
                                        if (csData.openRecord("Content Fields", FieldIDToAdd))
                                        {
                                            column.Name  = csData.getText("name");
                                            column.Width = 20;
                                        }
                                    }
                                    IndexConfig.columns.Add(column);
                                    normalizeSaveLoad = true;
                                }
                            }
                            //
                            break;
                        }

                        case ToolsActionRemoveField: {
                            //
                            // Remove a field to the index form
                            int columnWidthTotal = 0;
                            var dstColumns       = new List <IndexConfigColumnClass>();
                            foreach (var column in IndexConfig.columns)
                            {
                                if (column.Name != TargetFieldName.ToLowerInvariant())
                                {
                                    dstColumns.Add(column);
                                    columnWidthTotal += column.Width;
                                }
                            }
                            IndexConfig.columns = dstColumns;
                            normalizeSaveLoad   = true;
                            break;
                        }

                        case ToolsActionMoveFieldLeft: {
                            if (IndexConfig.columns.First().Name != TargetFieldName.ToLowerInvariant())
                            {
                                int listIndex = 0;
                                foreach (var column in IndexConfig.columns)
                                {
                                    if (column.Name == TargetFieldName.ToLowerInvariant())
                                    {
                                        break;
                                    }
                                    listIndex += 1;
                                }
                                IndexConfig.columns.swap(listIndex, listIndex - 1);
                                normalizeSaveLoad = true;
                            }
                            break;
                        }

                        case ToolsActionMoveFieldRight: {
                            if (IndexConfig.columns.Last().Name != TargetFieldName.ToLowerInvariant())
                            {
                                int listIndex = 0;
                                foreach (var column in IndexConfig.columns)
                                {
                                    if (column.Name == TargetFieldName.ToLowerInvariant())
                                    {
                                        break;
                                    }
                                    listIndex += 1;
                                }
                                IndexConfig.columns.swap(listIndex, listIndex + 1);
                                normalizeSaveLoad = true;
                            }
                            break;
                        }

                        case ToolsActionExpand: {
                            foreach (var column in IndexConfig.columns)
                            {
                                if (column.Name == TargetFieldName.ToLowerInvariant())
                                {
                                    column.Width = Convert.ToInt32(Convert.ToDouble(column.Width) * 1.1);
                                }
                                else
                                {
                                    column.Width = Convert.ToInt32(Convert.ToDouble(column.Width) * 0.9);
                                }
                            }
                            normalizeSaveLoad = true;
                            break;
                        }

                        case ToolsActionContract: {
                            foreach (var column in IndexConfig.columns)
                            {
                                if (column.Name != TargetFieldName.ToLowerInvariant())
                                {
                                    column.Width = Convert.ToInt32(Convert.ToDouble(column.Width) * 1.1);
                                }
                                else
                                {
                                    column.Width = Convert.ToInt32(Convert.ToDouble(column.Width) * 0.9);
                                }
                            }
                            normalizeSaveLoad = true;
                            break;
                        }
                        }
                        //
                        // Reload CDef if it changed
                        //
                        if (reloadMetadata)
                        {
                            core.clearMetaData();
                            core.cache.invalidateAll();
                            CDef = ContentMetadataModel.createByUniqueName(core, adminContent.name);
                        }
                        //
                        // save indexconfig
                        //
                        if (normalizeSaveLoad)
                        {
                            //
                            // Normalize the widths of the remaining columns
                            ColumnWidthTotal = 0;
                            foreach (var column in IndexConfig.columns)
                            {
                                ColumnWidthTotal += column.Width;
                            }
                            foreach (var column in IndexConfig.columns)
                            {
                                column.Width = encodeInteger((1000 * column.Width) / (double)ColumnWidthTotal);
                            }
                            GetHtmlBodyClass.setIndexSQL_SaveIndexConfig(cp, core, IndexConfig);
                            IndexConfig = IndexConfigClass.get(core, adminData);
                        }
                    }
                    //
                    //--------------------------------------------------------------------------------
                    //   Display the form
                    //--------------------------------------------------------------------------------
                    //
                    Stream.add("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"99%\"><tr>");
                    Stream.add("<td width=\"5%\">&nbsp;</td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>10%</nobr></td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>20%</nobr></td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>30%</nobr></td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>40%</nobr></td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>50%</nobr></td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>60%</nobr></td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>70%</nobr></td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>80%</nobr></td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>90%</nobr></td>");
                    Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>100%</nobr></td>");
                    Stream.add("<td width=\"4%\" align=\"center\">&nbsp;</td>");
                    Stream.add("</tr></table>");
                    //
                    Stream.add("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"99%\"><tr>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>");
                    Stream.add("</tr></table>");
                    //
                    // print the column headers
                    //
                    ColumnWidthTotal = 0;
                    int InheritedFieldCount = 0;
                    if (IndexConfig.columns.Count > 0)
                    {
                        //
                        // Calc total width
                        //
                        foreach (var column in IndexConfig.columns)
                        {
                            ColumnWidthTotal += column.Width;
                        }
                        if (ColumnWidthTotal > 0)
                        {
                            Stream.add("<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"90%\">");
                            //
                            // -- header
                            Stream.add("<tr>");
                            int    ColumnWidth = 0;
                            int    fieldId     = 0;
                            string Caption     = null;
                            foreach (var column in IndexConfig.columns)
                            {
                                //
                                // print column headers - anchored so they sort columns
                                //
                                ColumnWidth = encodeInteger(100 * (column.Width / (double)ColumnWidthTotal));
                                ContentFieldMetadataModel field = adminContent.fields[column.Name.ToLowerInvariant()];
                                fieldId = field.id;
                                Caption = field.caption;
                                if (field.inherited)
                                {
                                    Caption             = Caption + "*";
                                    InheritedFieldCount = InheritedFieldCount + 1;
                                }
                                Stream.add("<td class=\"small\" width=\"" + ColumnWidth + "%\" valign=\"top\" align=\"left\" style=\"background-color:white;border: 1px solid #555;\">" + Caption + "</td>");
                            }
                            Stream.add("</tr>");
                            //
                            // -- body
                            Stream.add("<tr>");
                            foreach (var column in IndexConfig.columns)
                            {
                                //
                                // print column headers - anchored so they sort columns
                                //
                                ColumnWidth = encodeInteger(100 * (column.Width / (double)ColumnWidthTotal));
                                ContentFieldMetadataModel field = adminContent.fields[column.Name.ToLowerInvariant()];
                                fieldId = field.id;
                                Caption = field.caption;
                                if (field.inherited)
                                {
                                    Caption             = Caption + "*";
                                    InheritedFieldCount = InheritedFieldCount + 1;
                                }
                                int    ColumnPtr = 0;
                                string link      = "?" + core.doc.refreshQueryString + "&FieldName=" + HtmlController.encodeHtml(field.nameLc) + "&fi=" + fieldId + "&dtcn=" + ColumnPtr + "&" + RequestNameAdminSubForm + "=" + AdminFormIndex_SubFormSetColumns;
                                Stream.add("<td width=\"" + ColumnWidth + "%\" valign=\"top\" align=\"left\">");
                                Stream.add(HtmlController.div(AdminUIController.getDeleteLink(link + "&dta=" + ToolsActionRemoveField), "text-center"));
                                Stream.add(HtmlController.div(AdminUIController.getArrowRightLink(link + "&dta=" + ToolsActionMoveFieldRight), "text-center"));
                                Stream.add(HtmlController.div(AdminUIController.getArrowLeftLink(link + "&dta=" + ToolsActionMoveFieldLeft), "text-center"));
                                Stream.add(HtmlController.div(AdminUIController.getExpandLink(link + "&dta=" + ToolsActionExpand), "text-center"));
                                Stream.add(HtmlController.div(AdminUIController.getContractLink(link + "&dta=" + ToolsActionContract), "text-center"));
                                Stream.add("</td>");
                            }
                            Stream.add("</tr>");
                            Stream.add("</table>");
                        }
                    }
                    //
                    // ----- If anything was inherited, put up the message
                    //
                    if (InheritedFieldCount > 0)
                    {
                        Stream.add("<p class=\"ccNormal\">* This field was inherited from the Content Definition's Parent. Inherited fields will automatically change when the field in the parent is changed. If you alter these settings, this connection will be broken, and the field will no longer inherit it's properties.</P class=\"ccNormal\">");
                    }
                    //
                    // ----- now output a list of fields to add
                    //
                    if (CDef.fields.Count == 0)
                    {
                        Stream.add(SpanClassAdminNormal + "This Content Definition has no fields</span><br>");
                    }
                    else
                    {
                        foreach (KeyValuePair <string, ContentFieldMetadataModel> keyValuePair in adminContent.fields)
                        {
                            ContentFieldMetadataModel field = keyValuePair.Value;
                            //
                            // display the column if it is not in use
                            if ((IndexConfig.columns.Find(x => x.Name == field.nameLc) == null))
                            {
                                if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.File)
                                {
                                    //
                                    // file can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (file field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileText)
                                {
                                    //
                                    // filename can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (text file field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileHTML)
                                {
                                    //
                                    // filename can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (html file field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileHTMLCode)
                                {
                                    //
                                    // filename can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (html code file field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileCSS)
                                {
                                    //
                                    // css filename can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (css file field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileXML)
                                {
                                    //
                                    // xml filename can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (xml file field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileJavascript)
                                {
                                    //
                                    // javascript filename can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (javascript file field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.LongText)
                                {
                                    //
                                    // can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (long text field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.HTML)
                                {
                                    //
                                    // can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (html field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileImage)
                                {
                                    //
                                    // can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (image field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.Redirect)
                                {
                                    //
                                    // can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (redirect field)"));
                                }
                                else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.ManyToMany)
                                {
                                    //
                                    // many to many can not be search
                                    Stream.add(HtmlController.div(iconNotAvailable + "&nbsp;" + field.caption + " (many-to-many field)"));
                                }
                                else
                                {
                                    //
                                    // can be used as column header
                                    string link = "?" + core.doc.refreshQueryString + "&fi=" + field.id + "&dta=" + ToolsActionAddField + "&" + RequestNameAddFieldId + "=" + field.id + "&" + RequestNameAdminSubForm + "=" + AdminFormIndex_SubFormSetColumns;
                                    Stream.add(HtmlController.div(AdminUIController.getPlusLink(link, "&nbsp;" + field.caption)));
                                }
                            }
                        }
                    }
                }
                //
                //--------------------------------------------------------------------------------
                // print the content tables that have index forms to Configure
                //--------------------------------------------------------------------------------
                //
                core.siteProperties.setProperty("AllowContentAutoLoad", GenericController.encodeText(AllowContentAutoLoad));
                string Content = ""
                                 + Stream.text
                                 + HtmlController.inputHidden("cid", adminContent.id.ToString())
                                 + HtmlController.inputHidden(rnAdminForm, "1")
                                 + HtmlController.inputHidden(RequestNameAdminSubForm, AdminFormIndex_SubFormSetColumns)
                                 + "";
                //
                // -- assemble form
                result = AdminUIController.getToolForm(core, Content, ButtonOK + "," + ButtonReset);
                core.html.addTitle(Title);
            } catch (Exception ex) {
                LogController.logError(core, ex);
            }
            return(result);
        }