//
        //=============================================================================
        //   Print the manual query form
        //=============================================================================
        //
        private string GetForm_WebsiteFileManager(CoreController core)
        {
            string result = "";

            try {
                string     InstanceOptionString = "AdminLayout=1&filesystem=website files";
                AddonModel addon   = DbBaseModel.create <AddonModel>(core.cpParent, "{B966103C-DBF4-4655-856A-3D204DEF6B21}");
                string     Content = core.addon.execute(addon, new BaseClasses.CPUtilsBaseClass.addonExecuteContext {
                    addonType             = Contensive.BaseClasses.CPUtilsBaseClass.addonContext.ContextAdmin,
                    argumentKeyValuePairs = GenericController.convertQSNVAArgumentstoDocPropertiesList(core, InstanceOptionString),
                    instanceGuid          = "-2",
                    errorContextMessage   = "executing File Manager within website file manager"
                });
                string Description = "Manage files and folders within the Website's file area.";
                string ButtonList  = ButtonApply + "," + ButtonCancel;
                result = AdminUIController.getToolBody(core, "Website File Manager", ButtonList, "", false, false, Description, "", 0, Content);
            } catch (Exception ex) {
                LogController.logError(core, ex);
            }
            return(result);
        }
Beispiel #2
0
        //
        //========================================================================
        //
        //========================================================================
        //
        public static string get(CoreController core)
        {
            string tempGetForm_Downloads = null;

            try {
                //
                string Button = core.docProperties.getText(RequestNameButton);
                if (Button == ButtonCancel)
                {
                    return(core.webServer.redirect("/" + core.appConfig.adminRoute, "Downloads, Cancel Button Pressed"));
                }
                string ButtonListLeft  = "";
                string ButtonListRight = "";
                string Content         = "";
                //
                if (!core.session.isAuthenticatedAdmin())
                {
                    //
                    // Must be a developer
                    //
                    ButtonListLeft  = ButtonCancel;
                    ButtonListRight = "";
                    Content         = Content + AdminUIController.getFormBodyAdminOnly();
                }
                else
                {
                    int    ContentId = core.docProperties.getInteger("ContentID");
                    string Format    = core.docProperties.getText("Format");
                    //
                    // Process Requests
                    //
                    if (!string.IsNullOrEmpty(Button))
                    {
                        int RowCnt = 0;
                        switch (Button)
                        {
                        case ButtonDelete:
                            RowCnt = core.docProperties.getInteger("RowCnt");
                            if (RowCnt > 0)
                            {
                                int RowPtr = 0;
                                for (RowPtr = 0; RowPtr < RowCnt; RowPtr++)
                                {
                                    if (core.docProperties.getBoolean("Row" + RowPtr))
                                    {
                                        DownloadModel.delete <DownloadModel>(core.cpParent, core.docProperties.getInteger("RowID" + RowPtr));
                                    }
                                }
                            }
                            break;
                        }
                    }
                    //
                    // Build Tab0
                    //
                    string RQS      = core.doc.refreshQueryString;
                    int    PageSize = core.docProperties.getInteger(RequestNamePageSize);
                    if (PageSize == 0)
                    {
                        PageSize = 50;
                    }
                    int PageNumber = core.docProperties.getInteger(RequestNamePageNumber);
                    if (PageNumber == 0)
                    {
                        PageNumber = 1;
                    }
                    string AdminURL = "/" + core.appConfig.adminRoute;
                    int    TopCount = PageNumber * PageSize;
                    //
                    const int ColumnCnt = 5;
                    //
                    // Setup Headings
                    //
                    string[] ColCaption = new string[ColumnCnt + 1];
                    string[] ColAlign   = new string[ColumnCnt + 1];
                    string[] ColWidth   = new string[ColumnCnt + 1];
                    string[,] Cells = new string[PageSize + 1, ColumnCnt + 1];
                    int ColumnPtr = 0;
                    //
                    ColCaption[ColumnPtr] = "&nbsp;";
                    ColAlign[ColumnPtr]   = "center";
                    ColWidth[ColumnPtr]   = "10px";
                    ColumnPtr             = ColumnPtr + 1;
                    //
                    ColCaption[ColumnPtr] = "Name";
                    ColAlign[ColumnPtr]   = "left";
                    ColWidth[ColumnPtr]   = "";
                    ColumnPtr             = ColumnPtr + 1;
                    //
                    ColCaption[ColumnPtr] = "For";
                    ColAlign[ColumnPtr]   = "left";
                    ColWidth[ColumnPtr]   = "200px";
                    ColumnPtr             = ColumnPtr + 1;
                    //
                    ColCaption[ColumnPtr] = "Requested";
                    ColAlign[ColumnPtr]   = "left";
                    ColWidth[ColumnPtr]   = "200px";
                    ColumnPtr             = ColumnPtr + 1;
                    //
                    ColCaption[ColumnPtr] = "File";
                    ColAlign[ColumnPtr]   = "Left";
                    ColWidth[ColumnPtr]   = "100px";
                    ColumnPtr             = ColumnPtr + 1;
                    //
                    //   Get Downloads available
                    //
                    int DataRowCount = 0;
                    var downloadList = DbBaseModel.createList <DownloadModel>(core.cpParent, "", "id desc", PageSize, PageNumber);
                    int RowPointer   = 0;
                    if (downloadList.Count == 0)
                    {
                        Cells[0, 1] = "There are no download requests";
                        RowPointer  = 1;
                    }
                    else
                    {
                        RowPointer   = 0;
                        DataRowCount = DbBaseModel.getCount <DownloadModel>(core.cpParent);
                        string LinkPrefix = "<a href=\"" + core.appConfig.cdnFileUrl;
                        string LinkSuffix = "\" target=_blank>Download</a>";
                        foreach (var download in downloadList)
                        {
                            if (RowPointer >= PageSize)
                            {
                                break;
                            }
                            var requestedBy = DbBaseModel.create <PersonModel>(core.cpParent, download.requestedBy);
                            Cells[RowPointer, 0] = HtmlController.checkbox("Row" + RowPointer) + HtmlController.inputHidden("RowID" + RowPointer, download.id);
                            Cells[RowPointer, 1] = download.name;
                            Cells[RowPointer, 2] = (requestedBy == null) ? "unknown" : requestedBy.name;
                            Cells[RowPointer, 3] = download.dateRequested.ToString();
                            if (string.IsNullOrEmpty(download.resultMessage))
                            {
                                Cells[RowPointer, 4] = "\r\n<div id=\"pending" + RowPointer + "\">Pending <img src=\"/ccLib/images/ajax-loader-small.gif\" width=16 height=16></div>";
                            }
                            else if (!string.IsNullOrEmpty(download.filename.filename))
                            {
                                Cells[RowPointer, 4] = "<div id=\"pending" + RowPointer + "\">" + LinkPrefix + download.filename.filename + LinkSuffix + "</div>";
                            }
                            else
                            {
                                Cells[RowPointer, 4] = "<div id=\"pending" + RowPointer + "\">error</div>";
                            }
                            RowPointer = RowPointer + 1;
                        }
                    }
                    StringBuilderLegacyController Tab0 = new StringBuilderLegacyController();
                    Tab0.add(HtmlController.inputHidden("RowCnt", RowPointer));
                    string PreTableCopy  = "";
                    string PostTableCopy = "";
                    string Cell          = AdminUIController.getReport(core, RowPointer, ColCaption, ColAlign, ColWidth, Cells, PageSize, PageNumber, PreTableCopy, PostTableCopy, DataRowCount, "ccPanel");
                    Tab0.add(Cell);
                    Content         = Tab0.text;
                    ButtonListLeft  = ButtonCancel + "," + ButtonRefresh + "," + ButtonDelete;
                    ButtonListRight = "";
                    Content         = Content + HtmlController.inputHidden(rnAdminSourceForm, AdminFormDownloads);
                }
                //
                string Caption     = "Download Manager";
                string Description = ""
                                     + "<p>The Download Manager holds all downloads requested from anywhere on the website. It also provides tools to request downloads from any Content.</p>"
                                     + "<p>To add a new download of any content in Contensive, click Export on the filter tab of the content listing page. To add a new download from a SQL statement, use Custom Reports under Reports on the Navigator.</p>";
                int    ContentPadding = 0;
                string ContentSummary = "";
                tempGetForm_Downloads = AdminUIController.getToolBody(core, Caption, ButtonListLeft, ButtonListRight, true, true, Description, ContentSummary, ContentPadding, Content);
                //
                core.html.addTitle(Caption);
            } catch (Exception ex) {
                LogController.logError(core, ex);
            }
            return(tempGetForm_Downloads);
        }
        //
        //=============================================================================
        // Create a child content
        //=============================================================================
        //
        public static string get(CPClass cp)
        {
            string result = "";

            try {
                //
                bool   IsEmptyList       = false;
                int    ParentContentId   = 0;
                string ChildContentName  = "";
                int    ChildContentId    = 0;
                bool   AddAdminMenuEntry = false;
                StringBuilderLegacyController Content = new StringBuilderLegacyController();
                string FieldValue   = null;
                bool   NewGroup     = false;
                int    GroupId      = 0;
                string NewGroupName = "";
                string Button       = null;
                string Caption      = null;
                string Description  = "";
                string ButtonList   = "";
                bool   BlockForm    = false;
                //
                Button = cp.core.docProperties.getText(RequestNameButton);
                if (Button == ButtonCancel)
                {
                    //
                    //
                    //
                    return(cp.core.webServer.redirect("/" + cp.core.appConfig.adminRoute, "GetContentChildTool, Cancel Button Pressed"));
                }
                else if (!cp.core.session.isAuthenticatedAdmin())
                {
                    //
                    //
                    //
                    ButtonList = ButtonCancel;
                    Content.add(AdminUIController.getFormBodyAdminOnly());
                }
                else
                {
                    //
                    if (Button != ButtonOK)
                    {
                        //
                        // Load defaults
                        //
                        ParentContentId = cp.core.docProperties.getInteger("ParentContentID");
                        if (ParentContentId == 0)
                        {
                            ParentContentId = ContentMetadataModel.getContentId(cp.core, "Page Content");
                        }
                        AddAdminMenuEntry = true;
                        GroupId           = 0;
                    }
                    else
                    {
                        //
                        // Process input
                        //
                        ParentContentId = cp.core.docProperties.getInteger("ParentContentID");
                        var parentContentMetadata = ContentMetadataModel.create(cp.core, ParentContentId);
                        ChildContentName  = cp.core.docProperties.getText("ChildContentName");
                        AddAdminMenuEntry = cp.core.docProperties.getBoolean("AddAdminMenuEntry");
                        GroupId           = cp.core.docProperties.getInteger("GroupID");
                        NewGroup          = cp.core.docProperties.getBoolean("NewGroup");
                        NewGroupName      = cp.core.docProperties.getText("NewGroupName");
                        //
                        if ((parentContentMetadata == null) || (string.IsNullOrEmpty(ChildContentName)))
                        {
                            Processor.Controllers.ErrorController.addUserError(cp.core, "You must select a parent and provide a child name.");
                        }
                        else
                        {
                            //
                            // Create Definition
                            //
                            Description = Description + "<div>&nbsp;</div>"
                                          + "<div>Creating content [" + ChildContentName + "] from [" + parentContentMetadata.name + "]</div>";
                            var childContentMetadata = parentContentMetadata.createContentChild(cp.core, ChildContentName, cp.core.session.user.id);

                            ChildContentId = ContentMetadataModel.getContentId(cp.core, ChildContentName);
                            //
                            // Create Group and Rule
                            //
                            if (NewGroup && (!string.IsNullOrEmpty(NewGroupName)))
                            {
                                using (var csData = new CsModel(cp.core)) {
                                    csData.open("Groups", "name=" + DbController.encodeSQLText(NewGroupName));
                                    if (csData.ok())
                                    {
                                        Description = Description + "<div>Group [" + NewGroupName + "] already exists, using existing group.</div>";
                                        GroupId     = csData.getInteger("ID");
                                    }
                                    else
                                    {
                                        Description = Description + "<div>Creating new group [" + NewGroupName + "]</div>";
                                        csData.close();
                                        csData.insert("Groups");
                                        if (csData.ok())
                                        {
                                            GroupId = csData.getInteger("ID");
                                            csData.set("Name", NewGroupName);
                                            csData.set("Caption", NewGroupName);
                                        }
                                    }
                                }
                            }
                            if (GroupId != 0)
                            {
                                using (var csData = new CsModel(cp.core)) {
                                    csData.insert("Group Rules");
                                    if (csData.ok())
                                    {
                                        Description = Description + "<div>Assigning group [" + MetadataController.getRecordName(cp.core, "Groups", GroupId) + "] to edit content [" + ChildContentName + "].</div>";
                                        csData.set("GroupID", GroupId);
                                        csData.set("ContentID", ChildContentId);
                                    }
                                }
                            }
                            //
                            // Add Admin Menu Entry
                            //
                            if (AddAdminMenuEntry)
                            {
                                //
                                // Add Navigator entries
                            }
                            //
                            Description = Description + "<div>&nbsp;</div>"
                                          + "<div>Your new content is ready. <a href=\"?" + rnAdminForm + "=22\">Click here</a> to create another Content Definition, or hit [Cancel] to return to the main menu.</div>";
                            ButtonList = ButtonCancel;
                            BlockForm  = true;
                        }
                        cp.core.clearMetaData();
                        cp.core.cache.invalidateAll();
                    }
                    //
                    // Get the form
                    //
                    if (!BlockForm)
                    {
                        string tableBody = "";
                        //
                        FieldValue = "<select size=\"1\" name=\"ParentContentID\" ID=\"\"><option value=\"\">Select One</option>";
                        FieldValue = FieldValue + GetContentChildTool_Options(cp, 0, ParentContentId);
                        FieldValue = FieldValue + "</select>";
                        tableBody += AdminUIController.getEditRowLegacy(cp.core, FieldValue, "Parent Content Name", "", false, false, "");
                        //
                        FieldValue = HtmlController.inputText_Legacy(cp.core, "ChildContentName", ChildContentName, 1, 40);
                        tableBody += AdminUIController.getEditRowLegacy(cp.core, FieldValue, "New Child Content Name", "", false, false, "");
                        //
                        FieldValue = ""
                                     + HtmlController.inputRadio("NewGroup", false.ToString(), NewGroup.ToString()) + cp.core.html.selectFromContent("GroupID", GroupId, "Groups", "", "", "", ref IsEmptyList) + "(Select a current group)"
                                     + "<br>" + HtmlController.inputRadio("NewGroup", true.ToString(), NewGroup.ToString()) + HtmlController.inputText_Legacy(cp.core, "NewGroupName", NewGroupName) + "(Create a new group)";
                        tableBody += AdminUIController.getEditRowLegacy(cp.core, FieldValue, "Content Manager Group", "", false, false, "");
                        //
                        Content.add(AdminUIController.editTable(tableBody));
                        Content.add("</td></tr>" + kmaEndTable);
                        //
                        ButtonList = ButtonOK + "," + ButtonCancel;
                    }
                    Content.add(HtmlController.inputHidden(rnAdminSourceForm, AdminFormContentChildTool));
                }
                //
                Caption     = "Create Content Definition";
                Description = "<div>This tool is used to create content definitions that help segregate your content into authorable segments.</div>" + Description;
                result      = AdminUIController.getToolBody(cp.core, Caption, ButtonList, "", false, false, Description, "", 0, Content.text);
            } catch (Exception ex) {
                LogController.logError(cp.core, ex);
            }
            return(result);
        }
Beispiel #4
0
        //
        //========================================================================
        //
        //========================================================================
        //
        public static string get(CPClass cp)
        {
            string tempGetForm_HouseKeepingControl = null;

            try {
                //
                StringBuilderLegacyController Content = new StringBuilderLegacyController();
                string   Copy                  = null;
                string   SQL                   = null;
                string   Button                = null;
                int      PagesTotal            = 0;
                string   Caption               = null;
                DateTime DateValue             = default(DateTime);
                string   AgeInDays             = null;
                int      ArchiveRecordAgeDays  = 0;
                string   ArchiveTimeOfDay      = null;
                bool     ArchiveAllowFileClean = false;
                string   ButtonList            = "";
                string   Description           = null;
                //
                Button = cp.core.docProperties.getText(RequestNameButton);
                if (Button == ButtonCancel)
                {
                    //
                    //
                    //
                    return(cp.core.webServer.redirect("/" + cp.core.appConfig.adminRoute, "HouseKeepingControl, Cancel Button Pressed"));
                }
                else if (!cp.core.session.isAuthenticatedAdmin())
                {
                    //
                    //
                    //
                    ButtonList = ButtonCancel;
                    Content.add(AdminUIController.getFormBodyAdminOnly());
                }
                else
                {
                    //
                    string tableBody = "";
                    //
                    // Set defaults
                    //
                    ArchiveRecordAgeDays  = (cp.core.siteProperties.getInteger("ArchiveRecordAgeDays", 0));
                    ArchiveTimeOfDay      = cp.core.siteProperties.getText("ArchiveTimeOfDay", "12:00:00 AM");
                    ArchiveAllowFileClean = (cp.core.siteProperties.getBoolean("ArchiveAllowFileClean", false));
                    //
                    // Process Requests
                    //
                    switch (Button)
                    {
                    case ButtonOK:
                    case ButtonSave:
                        //
                        ArchiveRecordAgeDays = cp.core.docProperties.getInteger("ArchiveRecordAgeDays");
                        cp.core.siteProperties.setProperty("ArchiveRecordAgeDays", GenericController.encodeText(ArchiveRecordAgeDays));
                        //
                        ArchiveTimeOfDay = cp.core.docProperties.getText("ArchiveTimeOfDay");
                        cp.core.siteProperties.setProperty("ArchiveTimeOfDay", ArchiveTimeOfDay);
                        //
                        ArchiveAllowFileClean = cp.core.docProperties.getBoolean("ArchiveAllowFileClean");
                        cp.core.siteProperties.setProperty("ArchiveAllowFileClean", GenericController.encodeText(ArchiveAllowFileClean));
                        break;
                    }
                    //
                    if (Button == ButtonOK)
                    {
                        return(cp.core.webServer.redirect("/" + cp.core.appConfig.adminRoute, "StaticPublishControl, OK Button Pressed"));
                    }
                    //
                    // ----- Status
                    //
                    tableBody += HtmlController.tableRowStart() + "<td colspan=\"3\" class=\"ccPanel3D ccAdminEditSubHeader\"><b>Status</b>" + tableCellEnd + kmaEndTableRow;
                    //
                    // ----- Visits Found
                    //
                    PagesTotal = 0;
                    SQL        = "SELECT Count(ID) as Result FROM ccVisits;";
                    using (var csData = new CsModel(cp.core)) {
                        csData.openSql(SQL);
                        if (csData.ok())
                        {
                            PagesTotal = csData.getInteger("Result");
                        }
                    }
                    tableBody += AdminUIController.getEditRowLegacy(cp.core, SpanClassAdminNormal + PagesTotal, "Visits Found", "", false, false, "");
                    //
                    // ----- Oldest Visit
                    //
                    Copy      = "unknown";
                    AgeInDays = "unknown";
                    using (var csData = new CsModel(cp.core)) {
                        SQL = cp.core.db.getSQLSelect("ccVisits", "DateAdded", "", "ID", "", 1);
                        csData.openSql(SQL);
                        if (csData.ok())
                        {
                            DateValue = csData.getDate("DateAdded");
                            if (DateValue != DateTime.MinValue)
                            {
                                Copy      = GenericController.encodeText(DateValue);
                                AgeInDays = GenericController.encodeText(encodeInteger(Math.Floor(encodeNumber(cp.core.doc.profileStartTime - DateValue))));
                            }
                        }
                    }
                    tableBody += (AdminUIController.getEditRowLegacy(cp.core, SpanClassAdminNormal + Copy + " (" + AgeInDays + " days)", "Oldest Visit", "", false, false, ""));
                    //
                    // ----- Viewings Found
                    //
                    PagesTotal = 0;
                    SQL        = "SELECT Count(ID) as result  FROM ccViewings;";
                    using (var csData = new CsModel(cp.core)) {
                        csData.openSql(SQL);
                        if (csData.ok())
                        {
                            PagesTotal = csData.getInteger("Result");
                        }
                        csData.close();
                    }
                    tableBody += (AdminUIController.getEditRowLegacy(cp.core, SpanClassAdminNormal + PagesTotal, "Viewings Found", "", false, false, ""));
                    //
                    tableBody += (HtmlController.tableRowStart() + "<td colspan=\"3\" class=\"ccPanel3D ccAdminEditSubHeader\"><b>Options</b>" + tableCellEnd + kmaEndTableRow);
                    //
                    Caption    = "Archive Age";
                    Copy       = HtmlController.inputText_Legacy(cp.core, "ArchiveRecordAgeDays", ArchiveRecordAgeDays.ToString(), -1, 20) + "&nbsp;Number of days to keep visit records. 0 disables housekeeping.";
                    tableBody += (AdminUIController.getEditRowLegacy(cp.core, Copy, Caption));
                    //
                    Caption    = "Housekeeping Time";
                    Copy       = HtmlController.inputText_Legacy(cp.core, "ArchiveTimeOfDay", ArchiveTimeOfDay, -1, 20) + "&nbsp;The time of day when record deleting should start.";
                    tableBody += (AdminUIController.getEditRowLegacy(cp.core, Copy, Caption));
                    //
                    Caption    = "Purge Content Files";
                    Copy       = HtmlController.checkbox("ArchiveAllowFileClean", ArchiveAllowFileClean) + "&nbsp;Delete Contensive content files with no associated database record.";
                    tableBody += (AdminUIController.getEditRowLegacy(cp.core, Copy, Caption));
                    //
                    Content.add(AdminUIController.editTable(tableBody));
                    Content.add(HtmlController.inputHidden(rnAdminSourceForm, AdminformHousekeepingControl));
                    ButtonList = ButtonCancel + ",Refresh," + ButtonSave + "," + ButtonOK;
                }
                //
                Caption     = "Data Housekeeping Control";
                Description = "This tool is used to control the database record housekeeping process. This process deletes visit history records, so care should be taken before making any changes.";
                tempGetForm_HouseKeepingControl = AdminUIController.getToolBody(cp.core, Caption, ButtonList, "", false, false, Description, "", 0, Content.text);
                //
                cp.core.html.addTitle(Caption);
            } catch (Exception ex) {
                LogController.logError(cp.core, ex);
            }
            return(tempGetForm_HouseKeepingControl);
        }
Beispiel #5
0
        //
        //========================================================================
        //
        public static string get(CoreController core)
        {
            try {
                //
                string   Button        = null;
                string   SQL           = null;
                string   RQS           = null;
                int      PageSize      = 0;
                int      PageNumber    = 0;
                int      TopCount      = 0;
                int      RowPointer    = 0;
                int      DataRowCount  = 0;
                string   PreTableCopy  = "";
                string   PostTableCopy = "";
                int      ColumnPtr     = 0;
                string[] ColCaption    = null;
                string[] ColAlign      = null;
                string[] ColWidth      = null;
                string[,] Cells = null;
                string AdminURL                    = null;
                int    RowCnt                      = 0;
                int    RowPtr                      = 0;
                int    ContentId                   = 0;
                string Format                      = null;
                string Name                        = null;
                string title                       = null;
                string Description                 = null;
                string ButtonCommaListLeft         = null;
                string ButtonCommaListRight        = null;
                int    ContentPadding              = 0;
                string ContentSummary              = "";
                StringBuilderLegacyController Tab0 = new StringBuilderLegacyController();
                StringBuilderLegacyController Tab1 = new StringBuilderLegacyController();
                string Content                     = "";
                string SQLFieldName                = null;
                var    adminMenu                   = new EditTabModel();
                //
                const int ColumnCnt = 4;
                //
                Button    = core.docProperties.getText(RequestNameButton);
                ContentId = core.docProperties.getInteger("ContentID");
                Format    = core.docProperties.getText("Format");
                //
                title                = "Custom Report Manager";
                Description          = "Custom Reports are a way for you to create a snapshot of data to view or download. To request a report, select the Custom Reports tab, check the report(s) you want, and click the [Request Download] Button. When your report is ready, it will be available in the <a href=\"?" + rnAdminForm + "=30\">Download Manager</a>. To create a new custom report, select the Request New Report tab, enter a name and SQL statement, and click the Apply button.";
                ContentPadding       = 0;
                ButtonCommaListLeft  = ButtonCancel + "," + ButtonDelete + "," + ButtonRequestDownload;
                ButtonCommaListRight = "";
                SQLFieldName         = "SQLQuery";
                //
                if (!core.session.isAuthenticatedAdmin())
                {
                    //
                    // Must be a developer
                    //
                    Description = Description + "You can not access the Custom Report Manager because your account is not configured as an administrator.";
                }
                else
                {
                    //
                    // Process Requests
                    //
                    if (!string.IsNullOrEmpty(Button))
                    {
                        switch (Button)
                        {
                        case ButtonCancel:
                            return(core.webServer.redirect("/" + core.appConfig.adminRoute, "CustomReports, Cancel Button Pressed"));

                        case ButtonDelete:
                            RowCnt = core.docProperties.getInteger("RowCnt");
                            if (RowCnt > 0)
                            {
                                for (RowPtr = 0; RowPtr < RowCnt; RowPtr++)
                                {
                                    if (core.docProperties.getBoolean("Row" + RowPtr))
                                    {
                                        MetadataController.deleteContentRecord(core, "Custom Reports", core.docProperties.getInteger("RowID" + RowPtr));
                                    }
                                }
                            }
                            break;

                        case ButtonRequestDownload:
                        case ButtonApply:
                            //
                            Name = core.docProperties.getText("name");
                            SQL  = core.docProperties.getText(SQLFieldName);
                            if (!string.IsNullOrEmpty(Name) || !string.IsNullOrEmpty(SQL))
                            {
                                if ((string.IsNullOrEmpty(Name)) || (string.IsNullOrEmpty(SQL)))
                                {
                                    Processor.Controllers.ErrorController.addUserError(core, "A name and SQL Query are required to save a new custom report.");
                                }
                                else
                                {
                                    int customReportId = 0;
                                    using (var csData = new CsModel(core)) {
                                        csData.insert("Custom Reports");
                                        if (csData.ok())
                                        {
                                            customReportId = csData.getInteger("id");
                                            csData.set("Name", Name);
                                            csData.set(SQLFieldName, SQL);
                                        }
                                        csData.close();
                                    }
                                    requestDownload(core, customReportId);
                                }
                            }
                            //
                            RowCnt = core.docProperties.getInteger("RowCnt");
                            if (RowCnt > 0)
                            {
                                for (RowPtr = 0; RowPtr < RowCnt; RowPtr++)
                                {
                                    if (core.docProperties.getBoolean("Row" + RowPtr))
                                    {
                                        int customReportId = core.docProperties.getInteger("RowID" + RowPtr);
                                        using (var csData = new CsModel(core)) {
                                            csData.openRecord("Custom Reports", customReportId);
                                            if (csData.ok())
                                            {
                                                SQL  = csData.getText(SQLFieldName);
                                                Name = csData.getText("Name");
                                            }
                                        }
                                        requestDownload(core, customReportId);
                                    }
                                }
                            }
                            break;
                        }
                    }
                    //
                    // Build Tab0
                    //
                    Tab0.add("<p>The following is a list of available custom reports.</p>");
                    //
                    RQS      = core.doc.refreshQueryString;
                    PageSize = core.docProperties.getInteger(RequestNamePageSize);
                    if (PageSize == 0)
                    {
                        PageSize = 50;
                    }
                    PageNumber = core.docProperties.getInteger(RequestNamePageNumber);
                    if (PageNumber == 0)
                    {
                        PageNumber = 1;
                    }
                    AdminURL = "/" + core.appConfig.adminRoute;
                    TopCount = PageNumber * PageSize;
                    //
                    // Setup Headings
                    //
                    ColCaption = new string[ColumnCnt + 1];
                    ColAlign   = new string[ColumnCnt + 1];
                    ColWidth   = new string[ColumnCnt + 1];
                    Cells      = new string[PageSize + 1, ColumnCnt + 1];
                    //
                    ColCaption[ColumnPtr] = "Select<br><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=10 height=1>";
                    ColAlign[ColumnPtr]   = "center";
                    ColWidth[ColumnPtr]   = "10";
                    ColumnPtr             = ColumnPtr + 1;
                    //
                    ColCaption[ColumnPtr] = "Name";
                    ColAlign[ColumnPtr]   = "left";
                    ColWidth[ColumnPtr]   = "100%";
                    ColumnPtr             = ColumnPtr + 1;
                    //
                    ColCaption[ColumnPtr] = "Created By<br><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=100 height=1>";
                    ColAlign[ColumnPtr]   = "left";
                    ColWidth[ColumnPtr]   = "100";
                    ColumnPtr             = ColumnPtr + 1;
                    //
                    ColCaption[ColumnPtr] = "Date Created<br><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=150 height=1>";
                    ColAlign[ColumnPtr]   = "left";
                    ColWidth[ColumnPtr]   = "150";
                    ColumnPtr             = ColumnPtr + 1;
                    //
                    //   Get Data
                    //
                    using (var csData = new CsModel(core)) {
                        RowPointer = 0;
                        if (!csData.open("Custom Reports"))
                        {
                            Cells[0, 1] = "There are no custom reports defined";
                            RowPointer  = 1;
                        }
                        else
                        {
                            DataRowCount = csData.getRowCount();
                            while (csData.ok() && (RowPointer < PageSize))
                            {
                                int customReportId = csData.getInteger("ID");
                                Cells[RowPointer, 0] = HtmlController.checkbox("Row" + RowPointer) + HtmlController.inputHidden("RowID" + RowPointer, customReportId);
                                Cells[RowPointer, 1] = csData.getText("name");
                                Cells[RowPointer, 2] = csData.getText("CreatedBy");
                                Cells[RowPointer, 3] = csData.getDate("DateAdded").ToShortDateString();
                                RowPointer           = RowPointer + 1;
                                csData.goNext();
                            }
                        }
                        csData.close();
                    }
                    string Cell = null;
                    Tab0.add(HtmlController.inputHidden("RowCnt", RowPointer));
                    Cell = AdminUIController.getReport(core, RowPointer, ColCaption, ColAlign, ColWidth, Cells, PageSize, PageNumber, PreTableCopy, PostTableCopy, DataRowCount, "ccPanel");
                    Tab0.add("<div>" + Cell + "</div>");
                    //
                    // Build RequestContent Form
                    //
                    Tab1.add("<p>Use this form to create a new custom report. Enter the SQL Query for the report, and a name that will be used as a caption.</p>");
                    //
                    Tab1.add("<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">");
                    //
                    Tab1.add("<tr>");
                    Tab1.add("<td align=right>Name</td>");
                    Tab1.add("<td>" + HtmlController.inputText_Legacy(core, "Name", "", 1, 40) + "</td>");
                    Tab1.add("</tr>");
                    //
                    Tab1.add("<tr>");
                    Tab1.add("<td align=right>SQL Query</td>");
                    Tab1.add("<td>" + HtmlController.inputText_Legacy(core, SQLFieldName, "", 8, 40) + "</td>");
                    Tab1.add("</tr>");
                    //
                    Tab1.add("<tr><td width=\"120\"><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"120\" height=\"1\"></td><td width=\"100%\">&nbsp;</td></tr></table>");
                    //
                    // Build and add tabs
                    //
                    adminMenu.addEntry("Custom&nbsp;Reports", Tab0.text, "ccAdminTab");
                    adminMenu.addEntry("Request&nbsp;New&nbsp;Report", Tab1.text, "ccAdminTab");
                    Content = adminMenu.getTabs(core);
                    //
                }
                //
                core.html.addTitle("Custom Reports");
                //
                return(AdminUIController.getToolBody(core, title, ButtonCommaListLeft, ButtonCommaListRight, true, true, Description, ContentSummary, ContentPadding, Content));
            } catch (Exception ex) {
                LogController.logError(core, ex);
                return(toolExceptionMessage);
            }
        }
        //
        //====================================================================================================
        //
        public static string get(CoreController core)
        {
            string result = "";

            try {
                //
                int    ContentId   = 0;
                string TableName   = "";
                string ContentName = "";
                StringBuilderLegacyController Stream = new StringBuilderLegacyController();
                string          ButtonList           = null;
                string          Description          = null;
                string          Caption     = null;
                int             NavId       = 0;
                int             ParentNavId = 0;
                DataSourceModel datasource  = DataSourceModel.create(core.cpParent, core.docProperties.getInteger("DataSourceID"));
                //
                ButtonList  = ButtonCancel + "," + ButtonRun;
                Caption     = "Create Content Definition";
                Description = "This tool creates a Content Definition. If the SQL table exists, it is used. If it does not exist, it is created. If records exist in the table with a blank ContentControlID, the ContentControlID will be populated from this new definition. A Navigator Menu entry will be added under Manage Site Content - Advanced.";
                //
                //   print out the submit form
                //
                if (core.docProperties.getText("Button") != "")
                {
                    //
                    // Process input
                    //
                    ContentName = core.docProperties.getText("ContentName");
                    TableName   = core.docProperties.getText("TableName");
                    //
                    Stream.add(SpanClassAdminSmall);
                    Stream.add("<P>Creating content [" + ContentName + "] on table [" + TableName + "] on Datasource [" + datasource.name + "].</P>");
                    if ((!string.IsNullOrEmpty(ContentName)) && (!string.IsNullOrEmpty(TableName)) && (!string.IsNullOrEmpty(datasource.name)))
                    {
                        using (var db = new DbController(core, datasource.name)) {
                            db.createSQLTable(TableName);
                        }
                        ContentMetadataModel.createFromSQLTable(core, datasource, TableName, ContentName);
                        core.cache.invalidateAll();
                        core.clearMetaData();
                        ContentId   = Processor.Models.Domain.ContentMetadataModel.getContentId(core, ContentName);
                        ParentNavId = MetadataController.getRecordIdByUniqueName(core, NavigatorEntryModel.tableMetadata.contentName, "Manage Site Content");
                        if (ParentNavId != 0)
                        {
                            ParentNavId = 0;
                            using (var csSrc = new CsModel(core)) {
                                if (csSrc.open(NavigatorEntryModel.tableMetadata.contentName, "(name=" + DbController.encodeSQLText("Advanced") + ")and(parentid=" + ParentNavId + ")"))
                                {
                                    ParentNavId = csSrc.getInteger("ID");
                                }
                            }
                            if (ParentNavId != 0)
                            {
                                using (var csDest = new CsModel(core)) {
                                    csDest.open(NavigatorEntryModel.tableMetadata.contentName, "(name=" + DbController.encodeSQLText(ContentName) + ")and(parentid=" + NavId + ")");
                                    if (!csDest.ok())
                                    {
                                        csDest.close();
                                        csDest.insert(NavigatorEntryModel.tableMetadata.contentName);
                                    }
                                    if (csDest.ok())
                                    {
                                        csDest.set("name", ContentName);
                                        csDest.set("parentid", ParentNavId);
                                        csDest.set("contentid", ContentId);
                                    }
                                }
                            }
                        }
                        ContentId = ContentMetadataModel.getContentId(core, ContentName);
                        Stream.add("<P>Content Definition was created. An admin menu entry for this definition has been added under 'Site Content', and will be visible on the next page view. Use the [<a href=\"?af=105&ContentID=" + ContentId + "\">Edit Content Definition Fields</a>] tool to review and edit this definition's fields.</P>");
                    }
                    else
                    {
                        Stream.add("<P>Error, a required field is missing. Content not created.</P>");
                    }
                    Stream.add("</SPAN>");
                }
                Stream.add(SpanClassAdminNormal);
                Stream.add("Data Source<br>");
                Stream.add(core.html.selectFromContent("DataSourceID", datasource.id, "Data Sources", "", "Default"));
                Stream.add("<br><br>");
                Stream.add("Content Name<br>");
                Stream.add(HtmlController.inputText_Legacy(core, "ContentName", ContentName, 1, 40));
                Stream.add("<br><br>");
                Stream.add("Table Name<br>");
                Stream.add(HtmlController.inputText_Legacy(core, "TableName", TableName, 1, 40));
                Stream.add("<br><br>");
                Stream.add("</SPAN>");
                result = AdminUIController.getToolBody(core, Caption, ButtonList, "", false, false, Description, "", 10, Stream.text);
            } catch (Exception ex) {
                LogController.logError(core, ex);
            }
            return(result);
        }
Beispiel #7
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);
        }
        //
        //========================================================================
        //   Editor features are stored in the \config\EditorFeatures.txt file
        //   This is a crlf delimited list, with each row including:
        //       admin:featurelist
        //       contentmanager:featurelist
        //       public:featurelist
        //========================================================================
        //
        public static string get(CoreController core)
        {
            string result = null;

            try {
                string Description = "This tool is used to configure the wysiwyg content editor for different uses. Check the Administrator column if you want administrators to have access to this feature when editing a page. Check the Content Manager column to allow non-admins to have access to this feature. Check the Public column if you want those on the public site to have access to the feature when the editor is used for public forms.";
                string Button      = core.docProperties.getText(RequestNameButton);
                if (Button == ButtonCancel)
                {
                    //
                    // Cancel button pressed, return with nothing goes to root form
                }
                else
                {
                    StringBuilderLegacyController Content = new StringBuilderLegacyController();
                    string ButtonList = null;
                    //
                    // From here down will return a form
                    if (!core.session.isAuthenticatedAdmin())
                    {
                        //
                        // Does not have permission
                        ButtonList = ButtonCancel;
                        Content.add(AdminUIController.getFormBodyAdminOnly());
                        core.html.addTitle("Style Editor");
                        result = AdminUIController.getToolBody(core, "Site Styles", ButtonList, "", true, true, Description, "", 0, Content.text);
                    }
                    else
                    {
                        string AdminList   = "";
                        string CMList      = "";
                        string PublicList  = "";
                        int    Ptr         = 0;
                        string FeatureName = null;
                        //
                        // OK to see and use this form
                        if (Button == ButtonSave || Button == ButtonOK)
                        {
                            //
                            // Save the Previous edits
                            core.siteProperties.setProperty("Editor Background Color", core.docProperties.getText("editorbackgroundcolor"));
                            for (Ptr = 0; Ptr <= ((string[])null).GetUpperBound(0); Ptr++)
                            {
                                FeatureName = ((string[])null)[Ptr];
                                if (GenericController.toLCase(FeatureName) == "styleandformatting")
                                {
                                    //
                                    // must always be on or it throws js error (editor bug I guess)
                                    //
                                    AdminList  = AdminList + "," + FeatureName;
                                    CMList     = CMList + "," + FeatureName;
                                    PublicList = PublicList + "," + FeatureName;
                                }
                                else
                                {
                                    if (core.docProperties.getBoolean(FeatureName + ".admin"))
                                    {
                                        AdminList = AdminList + "," + FeatureName;
                                    }
                                    if (core.docProperties.getBoolean(FeatureName + ".cm"))
                                    {
                                        CMList = CMList + "," + FeatureName;
                                    }
                                    if (core.docProperties.getBoolean(FeatureName + ".public"))
                                    {
                                        PublicList = PublicList + "," + FeatureName;
                                    }
                                }
                            }
                            core.privateFiles.saveFile(InnovaEditorFeaturefilename, "admin:" + AdminList + Environment.NewLine + "contentmanager:" + CMList + Environment.NewLine + "public:" + PublicList);
                            //
                            // Clear the editor style rules template cache so next edit gets new background color
                            string EditorStyleRulesFilename = GenericController.strReplace(EditorStyleRulesFilenamePattern, "$templateid$", "0", 1, 99, 1);
                            core.privateFiles.deleteFile(EditorStyleRulesFilename);
                            //
                            using (var csData = new CsModel(core)) {
                                csData.openSql("select id from cctemplates");
                                while (csData.ok())
                                {
                                    EditorStyleRulesFilename = GenericController.strReplace(EditorStyleRulesFilenamePattern, "$templateid$", csData.getText("ID"), 1, 99, 1);
                                    core.privateFiles.deleteFile(EditorStyleRulesFilename);
                                    csData.goNext();
                                }
                            }
                        }
                        if (Button != ButtonOK)
                        {
                            //
                            // Draw the form
                            string FeatureList = core.cdnFiles.readFileText(InnovaEditorFeaturefilename);
                            if (string.IsNullOrEmpty(FeatureList))
                            {
                                FeatureList = "admin:" + InnovaEditorFeatureList + Environment.NewLine + "contentmanager:" + InnovaEditorFeatureList + Environment.NewLine + "public:" + InnovaEditorPublicFeatureList;
                            }
                            if (!string.IsNullOrEmpty(FeatureList))
                            {
                                string[] Features = stringSplit(FeatureList, Environment.NewLine);
                                AdminList = Features[0].Replace("admin:", "");
                                if (Features.GetUpperBound(0) > 0)
                                {
                                    CMList = Features[1].Replace("contentmanager:", "");
                                    if (Features.GetUpperBound(0) > 1)
                                    {
                                        PublicList = Features[2].Replace("public:", "");
                                    }
                                }
                            }
                            string Copy = Environment.NewLine + "<tr class=\"ccAdminListCaption\">"
                                          + "<td align=left style=\"width:200;\">Feature</td>"
                                          + "<td align=center style=\"width:100;\">Administrators</td>"
                                          + "<td align=center style=\"width:100;\">Content&nbsp;Managers</td>"
                                          + "<td align=center style=\"width:100;\">Public</td>"
                                          + "</tr>";
                            int RowPtr = 0;
                            for (Ptr = 0; Ptr <= ((string[])null).GetUpperBound(0); Ptr++)
                            {
                                FeatureName = ((string[])null)[Ptr];
                                if (GenericController.toLCase(FeatureName) == "styleandformatting")
                                {
                                    //
                                    // hide and force on during process - editor bug I think.
                                    //
                                }
                                else
                                {
                                    string TDLeft      = HtmlController.tableCellStart("", 0, encodeBoolean(RowPtr % 2), "left");
                                    string TDCenter    = HtmlController.tableCellStart("", 0, encodeBoolean(RowPtr % 2), "center");
                                    bool   AllowAdmin  = GenericController.encodeBoolean("," + AdminList + ",".IndexOf("," + FeatureName + ",", System.StringComparison.OrdinalIgnoreCase) + 1);
                                    bool   AllowCM     = GenericController.encodeBoolean("," + CMList + ",".IndexOf("," + FeatureName + ",", System.StringComparison.OrdinalIgnoreCase) + 1);
                                    bool   AllowPublic = GenericController.encodeBoolean("," + PublicList + ",".IndexOf("," + FeatureName + ",", System.StringComparison.OrdinalIgnoreCase) + 1);
                                    Copy += Environment.NewLine + "<tr>"
                                            + TDLeft + FeatureName + "</td>"
                                            + TDCenter + HtmlController.checkbox(FeatureName + ".admin", AllowAdmin) + "</td>"
                                            + TDCenter + HtmlController.checkbox(FeatureName + ".cm", AllowCM) + "</td>"
                                            + TDCenter + HtmlController.checkbox(FeatureName + ".public", AllowPublic) + "</td>"
                                            + "</tr>";
                                    RowPtr = RowPtr + 1;
                                }
                            }
                            Copy = ""
                                   + Environment.NewLine + "<div><b>body background style color</b> (default='white')</div>"
                                   + Environment.NewLine + "<div>" + HtmlController.inputText_Legacy(core, "editorbackgroundcolor", core.siteProperties.getText("Editor Background Color", "white")) + "</div>"
                                   + Environment.NewLine + "<div>&nbsp;</div>"
                                   + Environment.NewLine + "<div><b>Toolbar features available</b></div>"
                                   + Environment.NewLine + "<table border=\"0\" cellpadding=\"4\" cellspacing=\"0\" width=\"500px\" align=left>" + GenericController.nop(Copy) + Environment.NewLine + kmaEndTable;
                            Copy = Environment.NewLine + HtmlController.tableStart(20, 0, 0) + "<tr><td>" + GenericController.nop(Copy) + "</td></tr>\r\n" + kmaEndTable;
                            Content.add(Copy);
                            ButtonList = ButtonCancel + "," + ButtonRefresh + "," + ButtonSave + "," + ButtonOK;
                            Content.add(HtmlController.inputHidden(rnAdminSourceForm, AdminFormEditorConfig));
                            core.html.addTitle("Editor Settings");
                            result = AdminUIController.getToolBody(core, "Editor Configuration", ButtonList, "", true, true, Description, "", 0, Content.text);
                        }
                    }
                }
            } catch (Exception ex) {
                LogController.logError(core, ex);
            }
            return(result);
        }