Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PortalSettings"/> class.
        ///   The PortalSettings Constructor encapsulates all of the logic
        ///   necessary to obtain configuration settings necessary to get
        ///   custom setting for a different portal than current (EditPortal.aspx.cs)<br/>
        ///   These Portal Settings are stored within a SQL database, and are
        ///   fetched below by calling the "GetPortalSettings" stored procedure.<br/>
        ///   This overload it is used
        /// </summary>
        /// <param name="portalId">
        /// The portal id.
        /// </param>
        /// <remarks>
        /// </remarks>
        private PortalSettings(int portalId)
        {
            this.ActivePage = new PageSettings();
            this.DesktopPages = new List<PageStripDetails>();
            this.ShowPages = true;
            this.MobilePages = new ArrayList();

            // Create Instance of Connection and Command Object
            using (var connection = Config.SqlConnectionString)
            using (var command = new SqlCommand("rb_GetPortalSettingsPortalID", connection))
            {
                // Mark the Command as a SPROC
                command.CommandType = CommandType.StoredProcedure;

                // Add Parameters to SPROC
                var parameterPortalId = new SqlParameter(StringsAtPortalId, SqlDbType.Int) { Value = portalId };
                command.Parameters.Add(parameterPortalId);

                // Open the database connection and execute the command
                connection.Open();
                var result = command.ExecuteReader(CommandBehavior.CloseConnection); // by Manu CloseConnection

                try
                {
                    if (result.Read())
                    {
                        this.PortalID = Int32.Parse(result["PortalID"].ToString());
                        this.PortalName = result["PortalName"].ToString();
                        this.PortalAlias = result["PortalAlias"].ToString();

                        // jes1111 - this.PortalTitle = ConfigurationSettings.AppSettings["PortalTitlePrefix"] + result["PortalName"].ToString();
                        this.PortalTitle = String.Concat(Config.PortalTitlePrefix, result["PortalName"].ToString());
                        this.PortalPath = result["PortalPath"].ToString();
                        this.ActivePage.PageID = 0;

                        // added Thierry (tiptopweb) used for dropdown for layout and theme
                        this.ActivePage.PortalPath = this.PortalPath;
                        this.ActiveModule = 0;
                    }
                    else
                    {
                        throw new Exception(
                            "The portal you requested cannot be found. PortalID: " + portalId,
                            new HttpException(404, "Portal not found"));
                    }
                }
                finally
                {
                    result.Close(); // by Manu, fixed bug 807858
                    connection.Close();
                }
            }

            // Go to get custom settings
            this.CustomSettings = GetPortalCustomSettings(portalId, GetPortalBaseSettings(this.PortalPath));
            this.CurrentLayout = this.CustomSettings["SITESETTINGS_PAGE_LAYOUT"].ToString();

            // Initialize Theme
            var themeManager = new ThemeManager(this.PortalPath);

            // Default
            themeManager.Load(this.CustomSettings["SITESETTINGS_THEME"].ToString());
            this.CurrentThemeDefault = themeManager.CurrentTheme;

            // Alternate
            themeManager.Load(this.CustomSettings["SITESETTINGS_ALT_THEME"].ToString());
            this.CurrentThemeAlt = themeManager.CurrentTheme;
        }
Пример #2
0
        /// <summary>
        /// Gets the current theme.
        /// </summary>
        /// <param name="requiredTheme">
        /// The required theme.
        /// </param>
        /// <returns>
        /// The theme.
        /// </returns>
        /// <remarks>
        /// </remarks>
        public Theme GetCurrentTheme(string requiredTheme)
        {
            switch (requiredTheme)
            {
                case "Alt":

                    // look for an alternate custom theme
                    if (this.ActivePage.CustomSettings["CustomThemeAlt"] != null &&
                        this.ActivePage.CustomSettings["CustomThemeAlt"].ToString().Length > 0)
                    {
                        var customTheme = this.ActivePage.CustomSettings["CustomThemeAlt"].ToString().Trim();
                        var themeManager = new ThemeManager(this.PortalPath);
                        themeManager.Load(customTheme);
                        return themeManager.CurrentTheme;
                    }

                    // no custom theme
                    return this.CurrentThemeAlt;
                default:

                    // look for an custom theme
                    if (this.ActivePage.CustomSettings[StringsCustomTheme] != null &&
                        this.ActivePage.CustomSettings[StringsCustomTheme].ToString().Length > 0)
                    {
                        var customTheme = this.ActivePage.CustomSettings[StringsCustomTheme].ToString().Trim();
                        var themeManager = new ThemeManager(this.PortalPath);
                        themeManager.Load(customTheme);
                        return themeManager.CurrentTheme;
                    }

                    // no custom theme
                    return this.CurrentThemeDefault;
            }
        }
Пример #3
0
        /// <summary>
        /// Theme definition and images
        /// </summary>
        /// <returns>
        /// The theme.
        /// </returns>
        /// <remarks>
        /// </remarks>
        public Theme GetCurrentTheme()
        {
            // look for an custom theme
            if (this.ActivePage.CustomSettings[StringsCustomTheme] != null &&
                this.ActivePage.CustomSettings[StringsCustomTheme].ToString().Length > 0)
            {
                var customTheme = this.ActivePage.CustomSettings[StringsCustomTheme].ToString().Trim();
                var themeManager = new ThemeManager(this.PortalPath);
                themeManager.Load(customTheme);
                return themeManager.CurrentTheme;
            }

            // no custom theme
            return this.CurrentThemeDefault;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PortalSettings"/> class.
        ///   The PortalSettings Constructor encapsulates all of the logic
        ///   necessary to obtain configuration settings necessary to render
        ///   a Portal Page view for a given request.<br/>
        ///   These Portal Settings are stored within a SQL database, and are
        ///   fetched below by calling the "GetPortalSettings" stored procedure.<br/>
        ///   This stored procedure returns values as SPROC output parameters,
        ///   and using three result sets.
        /// </summary>
        /// <param name="pageId">
        /// The page id.
        /// </param>
        /// <param name="portalAlias">
        /// The portal alias.
        /// </param>
        /// <remarks>
        /// </remarks>
        private PortalSettings(int pageId, string portalAlias)
        {
            this.ActivePage = new PageSettings();
            this.DesktopPages = new List<PageStripDetails>();
            this.ShowPages = true;
            this.MobilePages = new ArrayList();

            // Create Instance of Connection and Command Object
            using (var connection = Config.SqlConnectionString)
            using (var command = new SqlCommand("rb_GetPortalSettings", connection))
            {
                // Mark the Command as a SPROC
                command.CommandType = CommandType.StoredProcedure;

                // Add Parameters to SPROC
                var parameterPortalAlias = new SqlParameter("@PortalAlias", SqlDbType.NVarChar, 128)
                    {
                        Value = portalAlias // Specify the Portal Alias Dynamically
                    };
                command.Parameters.Add(parameterPortalAlias);
                var parameterPageId = new SqlParameter(StringsAtPageId, SqlDbType.Int, 4) { Value = pageId };
                command.Parameters.Add(parameterPageId);
                var parameterPortalLanguage = new SqlParameter("@PortalLanguage", SqlDbType.NVarChar, 12)
                    {
                       Value = this.PortalContentLanguage.Name
                    };
                command.Parameters.Add(parameterPortalLanguage);

                // Add out parameters to Sproc
                var parameterPortalId = new SqlParameter(StringsAtPortalId, SqlDbType.Int, 4)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterPortalId);
                var parameterPortalName = new SqlParameter("@PortalName", SqlDbType.NVarChar, 128)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterPortalName);
                var parameterPortalPath = new SqlParameter("@PortalPath", SqlDbType.NVarChar, 128)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterPortalPath);
                var parameterEditButton = new SqlParameter("@AlwaysShowEditButton", SqlDbType.Bit, 1)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterEditButton);
                var parameterPageName = new SqlParameter("@PageName", SqlDbType.NVarChar, 50)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterPageName);
                var parameterPageOrder = new SqlParameter("@PageOrder", SqlDbType.Int, 4)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterPageOrder);
                var parameterParentPageId = new SqlParameter("@ParentPageID", SqlDbType.Int, 4)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterParentPageId);
                var parameterMobilePageName = new SqlParameter("@MobilePageName", SqlDbType.NVarChar, 50)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterMobilePageName);
                var parameterAuthRoles = new SqlParameter("@AuthRoles", SqlDbType.NVarChar, 512)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterAuthRoles);
                var parameterShowMobile = new SqlParameter("@ShowMobile", SqlDbType.Bit, 1)
                    {
                       Direction = ParameterDirection.Output
                    };
                command.Parameters.Add(parameterShowMobile);
                SqlDataReader result;

                try
                {
                    // Open the database connection and execute the command
                    // try // jes1111
                    // {
                    connection.Open();
                    result = command.ExecuteReader(CommandBehavior.CloseConnection);
                    this.CurrentLayout = "Default";

                    // Read the first resultset -- Desktop Page Information
                    while (result.Read())
                    {
                        var tabDetails = new PageStripDetails
                            {
                                PageID = (int)result["PageID"],
                                ParentPageID = Int32.Parse("0" + result["ParentPageID"]),
                                PageName = (string)result["PageName"],
                                PageOrder = (int)result["PageOrder"],
                                PageLayout = this.CurrentLayout,
                                AuthorizedRoles = (string)result["AuthorizedRoles"]
                            };
                        this.PortalAlias = portalAlias;

                        // Update the AuthorizedRoles Variable
                        this.DesktopPages.Add(tabDetails);
                    }

                    if (this.DesktopPages.Count == 0)
                    {
                        return; // Abort load

                        // throw new Exception("The portal you requested has no Pages. PortalAlias: '" + portalAlias + "'", new HttpException(404, "Portal not found"));
                    }

                    // Read the second result --  Mobile Page Information
                    result.NextResult();

                    while (result.Read())
                    {
                        var tabDetails = new PageStripDetails
                            {
                                PageID = (int)result["PageID"],
                                PageName = (string)result["MobilePageName"],
                                PageLayout = this.CurrentLayout,
                                AuthorizedRoles = (string)result["AuthorizedRoles"]
                            };
                        this.MobilePages.Add(tabDetails);
                    }

                    // Read the third result --  Module Page Information
                    result.NextResult();

                    while (result.Read())
                    {
                        var m = new ModuleSettings
                            {
                                ModuleID = (int)result["ModuleID"],
                                ModuleDefID = (int)result["ModuleDefID"],
                                GuidID = (Guid)result["GeneralModDefID"],
                                PageID = (int)result["TabID"],
                                PaneName = (string)result["PaneName"],
                                ModuleTitle = (string)result["ModuleTitle"]
                            };
                        var value = result["AuthorizedEditRoles"];
                        m.AuthorizedEditRoles = !Convert.IsDBNull(value) ? (string)value : string.Empty;
                        value = result["AuthorizedViewRoles"];
                        m.AuthorizedViewRoles = !Convert.IsDBNull(value) ? (string)value : string.Empty;
                        value = result["AuthorizedAddRoles"];
                        m.AuthorizedAddRoles = !Convert.IsDBNull(value) ? (string)value : string.Empty;
                        value = result["AuthorizedDeleteRoles"];
                        m.AuthorizedDeleteRoles = !Convert.IsDBNull(value) ? (string)value : string.Empty;
                        value = result["AuthorizedPropertiesRoles"];
                        m.AuthorizedPropertiesRoles = !Convert.IsDBNull(value) ? (string)value : string.Empty;

                        // [email protected] (19/08/2004) Add support for move & delete module roles
                        value = result["AuthorizedMoveModuleRoles"];
                        m.AuthorizedMoveModuleRoles = !Convert.IsDBNull(value) ? (string)value : string.Empty;
                        value = result["AuthorizedDeleteModuleRoles"];
                        m.AuthorizedDeleteModuleRoles = !Convert.IsDBNull(value) ? (string)value : string.Empty;

                        // Change by [email protected]
                        // Date: 6/2/2003
                        value = result["AuthorizedPublishingRoles"];
                        m.AuthorizedPublishingRoles = !Convert.IsDBNull(value) ? (string)value : string.Empty;
                        value = result["SupportWorkflow"];
                        m.SupportWorkflow = !Convert.IsDBNull(value) ? (bool)value : false;

                        // Date: 27/2/2003
                        value = result["AuthorizedApproveRoles"];
                        m.AuthorizedApproveRoles = !Convert.IsDBNull(value) ? (string)value : string.Empty;
                        value = result["WorkflowState"];
                        m.WorkflowStatus = !Convert.IsDBNull(value)
                                               ? (WorkflowState)(0 + (byte)value)
                                               : WorkflowState.Original;

                        // End Change [email protected]
                        // Start Change [email protected]
                        try
                        {
                            value = result["SupportCollapsable"];
                        }
                        catch
                        {
                            value = DBNull.Value;
                        }

                        m.SupportCollapsable = DBNull.Value != value ? (bool)value : false;

                        // End Change  [email protected]
                        // Start Change [email protected]
                        try
                        {
                            value = result["ShowEveryWhere"];
                        }
                        catch
                        {
                            value = DBNull.Value;
                        }

                        m.ShowEveryWhere = DBNull.Value != value ? (bool)value : false;

                        // End Change  [email protected]
                        m.CacheTime = int.Parse(result["CacheTime"].ToString());
                        m.ModuleOrder = int.Parse(result["ModuleOrder"].ToString());
                        value = result["ShowMobile"];
                        m.ShowMobile = !Convert.IsDBNull(value) ? (bool)value : false;
                        m.DesktopSrc = result["DesktopSrc"].ToString();
                        m.MobileSrc = result["MobileSrc"].ToString();
                        m.Admin = bool.Parse(result["Admin"].ToString());
                        this.ActivePage.Modules.Add(m);
                    }

                    // Now read Portal out params
                    result.NextResult();
                    this.PortalID = (int)parameterPortalId.Value;
                    this.PortalName = (string)parameterPortalName.Value;

                    // jes1111 - this.PortalTitle = ConfigurationSettings.AppSettings["PortalTitlePrefix"] + this.PortalName;
                    this.PortalTitle = String.Concat(Config.PortalTitlePrefix, this.PortalName);

                    // jes1111 - this.PortalPath = Settings.Path.WebPathCombine(ConfigurationSettings.AppSettings["PortalsDirectory"], (string) parameterPortalPath.Value);
                    this.PortalPath = Path.WebPathCombine(Config.PortalsDirectory, (string)parameterPortalPath.Value);

                    // jes1111 - this.PortalSecurePath = ConfigurationSettings.AppSettings["PortalSecureDirectory"]; // added Thierry (tiptopweb) 12 Apr 2003
                    this.PortalSecurePath = Config.PortalSecureDirectory;
                    this.ActivePage.PageID = pageId;
                    this.ActivePage.PageLayout = this.CurrentLayout;
                    this.ActivePage.ParentPageID = Int32.Parse("0" + parameterParentPageId.Value);
                    this.ActivePage.PageOrder = (int)parameterPageOrder.Value;
                    this.ActivePage.MobilePageName = (string)parameterMobilePageName.Value;
                    this.ActivePage.AuthorizedRoles = (string)parameterAuthRoles.Value;
                    this.ActivePage.PageName = (string)parameterPageName.Value;
                    this.ActivePage.ShowMobile = (bool)parameterShowMobile.Value;
                    this.ActivePage.PortalPath = this.PortalPath; // [email protected] for page custom layout
                    result.Close(); // by Manu, fixed bug 807858

                    // }
                    // catch (Exception ex)
                    // {
                    // HttpContext.Current.Response.Write("Failed rb_GetPortalSettings for " + pageID.ToString() + ", " + portalAlias + ":<br/>"+ex.Message);
                    // HttpContext.Current.Response.End();
                    // //Response.Redirect("~/app_support/ErrorNoPortal.aspx",true);
                    // }
                }
                catch (SqlException sqex)
                {
                    var requestUri = HttpContext.Current.Request.Url;

                        throw new DatabaseUnreachableException("This may be a new db", sqex);

                    return;
                }
                finally
                {
                    // by Manu fix close bug #2
                    if (connection.State == ConnectionState.Open)
                    {
                        connection.Close();
                    }
                }
            }

            // Provide a valid tab id if it is missing

            // 11-10-2011
            // Changed to go to the first page that the user logged has permission to see

            //if (this.ActivePage.PageID == 0)
            //{
            //    this.ActivePage.PageID = ((PageStripDetails)this.DesktopPages[0]).PageID;
            //}

            // Go to get custom settings
            if (!Directory.Exists(Path.ApplicationPhysicalPath + this.PortalFullPath))
            {
                var portals = new PortalsDB();
                portals.CreatePortalPath(this.PortalAlias);
            }

            this.CustomSettings = GetPortalCustomSettings(this.PortalID, GetPortalBaseSettings(this.PortalPath));

            // Initialize Theme
            var themeManager = new ThemeManager(this.PortalPath);

            // Default
            themeManager.Load(this.CustomSettings["SITESETTINGS_THEME"].ToString());
            this.CurrentThemeDefault = themeManager.CurrentTheme;

            // Alternate
            if (this.CustomSettings["SITESETTINGS_ALT_THEME"].ToString() == this.CurrentThemeDefault.Name)
            {
                this.CurrentThemeAlt = this.CurrentThemeDefault;
            }
            else
            {
                themeManager.Load(this.CustomSettings["SITESETTINGS_ALT_THEME"].ToString());
                this.CurrentThemeAlt = themeManager.CurrentTheme;
            }

            // themeManager.Save(this.CustomSettings["SITESETTINGS_THEME"].ToString());
            // Set layout
            this.CurrentLayout = this.CustomSettings["SITESETTINGS_PAGE_LAYOUT"].ToString();

            // Jes1111
            // Generate DesktopPagesXml
            // jes1111 - if (bool.Parse(ConfigurationSettings.AppSettings["PortalSettingDesktopPagesXml"]))
            // if (Config.PortalSettingDesktopPagesXml)
            // this.DesktopPagesXml = GetDesktopPagesXml();
        }
Пример #5
0
        /// <summary>
        /// Gets the portal base settings.
        /// </summary>
        /// <param name="portalPath">
        /// The portal path.
        /// </param>
        /// <returns>
        /// </returns>
        /// <remarks>
        /// </remarks>
        public static Dictionary<string, ISettingItem> GetPortalBaseSettings(string portalPath)
        {
            Dictionary<string, ISettingItem> baseSettings;

            if (!CurrentCache.Exists(Key.PortalBaseSettings()))
            {
                // fix: Jes1111 - 27-02-2005 - for proper operation of caching
                var layoutManager = new LayoutManager(portalPath);
                var layoutList = layoutManager.GetLayouts();
                var themeManager = new ThemeManager(portalPath);
                var themeList = themeManager.GetThemes();

                // Define base settings
                baseSettings = new Dictionary<string, ISettingItem>();

                var group = SettingItemGroup.THEME_LAYOUT_SETTINGS;
                var groupOrderBase = (int)SettingItemGroup.THEME_LAYOUT_SETTINGS;

                // StringDataType
                var image =
                    new SettingItem<string, TextBox>(
                        new UploadedFileDataType(Path.WebPathCombine(Path.ApplicationRoot, portalPath)))
                        {
                            Order = groupOrderBase + 5,
                            Group = group,
                            EnglishName = "Logo",
                            Description =
                                "Enter the name of logo file here. The logo will be searched in your portal dir. For the default portal is (~/_Appleseed)."
                        };

                baseSettings.Add("SITESETTINGS_LOGO", image);

                // ArrayList layoutList = new LayoutManager(PortalPath).GetLayouts();
                var tabLayoutSetting =
                    new SettingItem<string, ListControl>(new CustomListDataType(layoutList, StringsName, StringsName))
                        {
                            Value = "Default",
                            Order = groupOrderBase + 10,
                            Group = group,
                            EnglishName = "Page layout",
                            Description = "Specify the site level page layout here."
                        };
                baseSettings.Add("SITESETTINGS_PAGE_LAYOUT", tabLayoutSetting);

                // ArrayList themeList = new ThemeManager(PortalPath).GetThemes();
                var theme =
                    new SettingItem<string, ListControl>(new CustomListDataType(themeList, StringsName, StringsName))
                        {
                            Required = true,
                            Order = groupOrderBase + 15,
                            Group = group,
                            EnglishName = "Theme",
                            Description = "Specify the site level theme here."
                        };
                baseSettings.Add("SITESETTINGS_THEME", theme);

                // SettingItem ThemeAlt = new SettingItem(new CustomListDataType(new ThemeManager(PortalPath).GetThemes(), strName, strName));
                var themeAlt =
                    new SettingItem<string, ListControl>(new CustomListDataType(themeList, StringsName, StringsName))
                        {
                            Required = true,
                            Order = groupOrderBase + 20,
                            Group = group,
                            EnglishName = "Alternate theme",
                            Description = "Specify the site level alternate theme here."
                        };
                baseSettings.Add("SITESETTINGS_ALT_THEME", themeAlt);

                // Jes1111 - 2004-08-06 - Zen support
                var allowModuleCustomThemes = new SettingItem<bool, CheckBox>
                    {
                        Order = groupOrderBase + 25,
                        Group = group,
                        Value = true,
                        EnglishName = "Allow Module Custom Themes?",
                        Description = "Select to allow Custom Theme to be set on Modules."
                    };
                baseSettings.Add("SITESETTINGS_ALLOW_MODULE_CUSTOM_THEMES", allowModuleCustomThemes);

                groupOrderBase = (int)SettingItemGroup.SECURITY_USER_SETTINGS;
                group = SettingItemGroup.SECURITY_USER_SETTINGS;

                // Show input for Portal Administrators when using Windows Authentication and Multi-portal
                // [email protected] 28.April.2003
                // This setting is removed in Global.asa for non-Windows authentication sites.
                var portalAdmins = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 5,
                        Group = group,
                        Value = Config.ADAdministratorGroup,
                        Required = false,
                        Description =
                            "Show input for Portal Administrators when using Windows Authentication and Multi-portal"
                    };

                // jes1111 - PortalAdmins.Value = ConfigurationSettings.AppSettings["ADAdministratorGroup"];
                baseSettings.Add("WindowsAdmins", portalAdmins);

                // Allow new registrations?
                var allowNewRegistrations = new SettingItem<bool, CheckBox>
                    {
                        Order = groupOrderBase + 10,
                        Group = group,
                        Value = true,
                        EnglishName = "Allow New Registrations?",
                        Description =
                            "Check this to allow users register themselves. Leave blank for register through User Manager only."
                    };
                baseSettings.Add("SITESETTINGS_ALLOW_NEW_REGISTRATION", allowNewRegistrations);

                // MH: added dynamic load of register types depending on the  content in the DesktopModules/Register/ folder
                // Register
                var regPages = new Hashtable();

                foreach (var registerPage in
                    Directory.GetFiles(
                        HttpContext.Current.Server.MapPath(
                            Path.ApplicationRoot + "/DesktopModules/CoreModules/Register/"),
                        "register*.ascx",
                        SearchOption.AllDirectories))
                {
                    var registerPageDisplayName = registerPage.Substring(
                        registerPage.LastIndexOf("\\") + 1,
                        registerPage.LastIndexOf(".") - registerPage.LastIndexOf("\\") - 1);

                    // string registerPageName = registerPage.Substring(registerPage.LastIndexOf("\\") + 1);
                    var registerPageName = registerPage.Replace(Path.ApplicationPhysicalPath, "~/").Replace("\\", "/");
                    regPages.Add(registerPageDisplayName, registerPageName.ToLower());
                }

                // Register Layout Setting
                var regType = new SettingItem<string, ListControl>(new CustomListDataType(regPages, "Key", "Value"))
                    {
                        Required = true,
                        Value = "RegisterFull.ascx",
                        EnglishName = "Register Type",
                        Description = "Choose here how Register Page should look like.",
                        Order = groupOrderBase + 15,
                        Group = group
                    };
                baseSettings.Add("SITESETTINGS_REGISTER_TYPE", regType);

                // MH:end
                // Register Layout Setting module id reference by manu
                var regModuleId = new SettingItem<int, TextBox>
                    {
                        Value = 0,
                        Required = true,
                        Order = groupOrderBase + 16,
                        Group = group,
                        EnglishName = "Register Module ID",
                        Description =
                            "Some custom registration may require additional settings, type here the ID of the module from where we should load settings (0= not used). Usually this module is added in an hidden area."
                    };
                baseSettings.Add("SITESETTINGS_REGISTER_MODULEID", regModuleId);

                // Send mail on new registration to
                var onRegisterSendTo = new SettingItem<string, TextBox>
                    {
                        Value = string.Empty,
                        Required = false,
                        Order = groupOrderBase + 17,
                        Group = group,
                        EnglishName = "Send Mail To",
                        Description = "On new registration a mail will be send to the email address you provide here."
                    };
                baseSettings.Add("SITESETTINGS_ON_REGISTER_SEND_TO", onRegisterSendTo);

                // Send mail on new registration to User from
                var onRegisterSendFrom = new SettingItem<string, TextBox>
                    {
                        Value = string.Empty,
                        Required = false,
                        Order = groupOrderBase + 18,
                        Group = group,
                        EnglishName = "Send Mail From",
                        Description =
                            "On new registration a mail will be send to the new user from the email address you provide here."
                    };
                baseSettings.Add("SITESETTINGS_ON_REGISTER_SEND_FROM", onRegisterSendFrom);

                // Terms of service
                var termsOfService = new SettingItem<string, TextBox>(new PortalUrlDataType())
                    {
                        Order = groupOrderBase + 20,
                        Group = group,
                        EnglishName = "Terms file name",
                        Description =
                            "Type here a file name used for showing terms and condition in each register page. Provide localized version adding _<culturename>. E.g. Terms.txt, will search for Terms.txt and for Terms_en-US.txt"
                    };
                baseSettings.Add("SITESETTINGS_TERMS_OF_SERVICE", termsOfService);

                var loginPages = new Hashtable();

                var baseDir = HttpContext.Current.Server.MapPath(Path.ApplicationRoot + "/DesktopModules/");

                foreach (var loginPage in Directory.GetFiles(baseDir, "signin*.ascx", SearchOption.AllDirectories))
                {
                    var loginPageDisplayName =
                        loginPage.Substring(loginPage.LastIndexOf("DesktopModules") + 1).Replace(".ascx", string.Empty);
                    var loginPageName = loginPage.Replace(Path.ApplicationPhysicalPath, "~/").Replace("\\", "/");
                    loginPages.Add(loginPageDisplayName, loginPageName.ToLower());
                }

                var logonType = new SettingItem<string, ListControl>(new CustomListDataType(loginPages, "Key", "Value"))
                    {
                        Required = false,
                        Value = "Signin.ascx",
                        EnglishName = "Login Type",
                        Description = "Choose here how login Page should look like.",
                        Order = groupOrderBase + 21,
                        Group = group
                    };
                baseSettings.Add("SITESETTINGS_LOGIN_TYPE", logonType);

                // ReCaptcha public and private key
                var recaptchaPrivateKey = new SettingItem<string, TextBox>()
                {
                    Required = false,
                    Value = "6LeQmsASAAAAADS-WeMyg9mKo5l3ERKcB4LSQieI",
                    EnglishName = "ReCaptcha private key",
                    Description = "Insert here google's ReCaptcha private key for your portal's captchas.",
                    Order = groupOrderBase + 22,
                    Group = group
                };
                baseSettings.Add("SITESETTINGS_RECAPTCHA_PRIVATE_KEY", recaptchaPrivateKey);

                var recaptchaPublicKey = new SettingItem<string, TextBox>()
                {
                    Required = false,
                    Value = "6LeQmsASAAAAAIx9ZoRJXA44sajtJjPl2L_MFrTS",
                    EnglishName = "ReCaptcha public key",
                    Description = "Insert here google's ReCaptcha public key for your portal's captchas.",
                    Order = groupOrderBase + 23,
                    Group = group
                };
                baseSettings.Add("SITESETTINGS_RECAPTCHA_PUBLIC_KEY", recaptchaPublicKey);

                // Facebook keys
                var facebookAppId = new SettingItem<string, TextBox>()
                {
                    Required = false,
                    Value = "",
                    EnglishName = "Facebook Application ID",
                    Description = "Insert here facebook's Application ID for your portal.",
                    Order = groupOrderBase + 24,
                    Group = group
                };
                baseSettings.Add("SITESETTINGS_FACEBOOK_APP_ID", facebookAppId);

                var facebookAppSecret = new SettingItem<string, TextBox>()
                {
                    Required = false,
                    Value = "",
                    EnglishName = "Facebook Application Secret",
                    Description = "Insert here facebook's Application Secret for your portal.",
                    Order = groupOrderBase + 25,
                    Group = group
                };
                baseSettings.Add("SITESETTINGS_FACEBOOK_APP_SECRET", facebookAppSecret);

                // Twitter keys
                var twitterAppId = new SettingItem<string, TextBox>() {
                    Required = false,
                    Value = "",
                    EnglishName = "Twitter Application ID",
                    Description = "Insert here twitter's Application ID for your portal.",
                    Order = groupOrderBase + 26,
                    Group = group
                };
                baseSettings.Add("SITESETTINGS_TWITTER_APP_ID", twitterAppId);

                var twitterAppSecret = new SettingItem<string, TextBox>() {
                    Required = false,
                    Value = "",
                    EnglishName = "Twitter Application Secret",
                    Description = "Insert here twitter's Application Secret for your portal.",
                    Order = groupOrderBase + 27,
                    Group = group
                };
                baseSettings.Add("SITESETTINGS_TWITTER_APP_SECRET", twitterAppSecret);

                var googleLogin = new SettingItem<bool, CheckBox>() {
                    Required = false,
                    Value = false,

                    EnglishName = "Google Login",
                    Description = "Check if you want to see the google login",
                    Order = groupOrderBase + 28,
                    Group = group
                };
                baseSettings.Add("SITESETTINGS_GOOGLE_LOGIN", googleLogin);

                // LinkedIn keys
                var linkedInAppId = new SettingItem<string, TextBox>()
                {
                    Required = false,
                    Value = "",
                    EnglishName = "LinkedIn Application ID",
                    Description = "Insert here linkedIn's Application ID for your portal.",
                    Order = groupOrderBase + 29,
                    Group = group
                };
                baseSettings.Add("SITESETTINGS_LINKEDIN_APP_ID", linkedInAppId);

                var linkedInAppSecret = new SettingItem<string, TextBox>()
                {
                    Required = false,
                    Value = "",
                    EnglishName = "LinkedIn Application Secret",
                    Description = "Insert here linkedIn's Application Secret for your portal.",
                    Order = groupOrderBase + 30,
                    Group = group
                };
                baseSettings.Add("SITESETTINGS_LINKEDIN_APP_SECRET", linkedInAppSecret);

                groupOrderBase = (int)SettingItemGroup.META_SETTINGS;
                group = SettingItemGroup.META_SETTINGS;

                // added: Jes1111 - page DOCTYPE setting
                var docType = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 5,
                        Group = group,
                        EnglishName = "DOCTYPE string",
                        Description =
                            "Allows you to enter a DOCTYPE string which will be inserted as the first line of the HTML output page (i.e. above the <html> element). Use this to force Quirks or Standards mode, particularly in IE. See <a href=\"http://gutfeldt.ch/matthias/articles/doctypeswitch/table.html\" target=\"_blank\">here</a> for details. NOTE: Appleseed.Zen requires a setting that guarantees Standards mode on all browsers.",
                        Value = string.Empty
                    };

                baseSettings.Add("SITESETTINGS_DOCTYPE", docType);

                // by John Mandia <*****@*****.**>
                var tabTitle = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 10,
                        Group = group,
                        EnglishName = "Page title",
                        Description = "Allows you to enter a default tab / page title (Shows at the top of your browser)."
                    };
                baseSettings.Add("SITESETTINGS_PAGE_TITLE", tabTitle);

                /*
                 * John Mandia: Removed This Setting. Now You can define specific Url Keywords via Tab Settings only. This is to speed up url building.
                 *
                SettingItem TabUrlKeyword = new SettingItem<string, TextBox>;
                TabUrlKeyword.Order = _groupOrderBase + 15;
                TabUrlKeyword.Group = _Group;
                TabUrlKeyword.Value = "Portal";
                TabUrlKeyword.EnglishName = "Keyword to Identify all pages";
                TabUrlKeyword.Description = "This setting is not fully implemented yet. It was to help with search engine optimisation by allowing you to specify a default keyword that would appear in your url.";
                BaseSettings.Add("SITESETTINGS_PAGE_URL_KEYWORD", TabUrlKeyword);
                */
                var tabMetaKeyWords = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 15,
                        Group = group,
                        EnglishName = "Page keywords",
                        Description =
                            "This setting is to help with search engine optimisation. Enter 1-15 Default Keywords that represent what your site is about."
                    };

                // [email protected]: No Default Value In Case People Don't want Meta Keywords; http://sourceforge.net/tracker/index.php?func=detail&aid=915614&group_id=66837&atid=515929
                baseSettings.Add("SITESETTINGS_PAGE_META_KEYWORDS", tabMetaKeyWords);
                var tabMetaDescription = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 20,
                        Group = group,
                        EnglishName = "Page description",
                        Description =
                            "This setting is to help with search engine optimisation. Enter a default description (Not too long though. 1 paragraph is enough) that describes your portal."
                    };

                // [email protected]: No Default Value In Case People Don't want a defautl descripton
                baseSettings.Add("SITESETTINGS_PAGE_META_DESCRIPTION", tabMetaDescription);
                var tabMetaEncoding = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 25,
                        Group = group,
                        EnglishName = "Page encoding",
                        Description =
                            "Every time your browser returns a page it looks to see what format it is retrieving. This allows you to specify the default content type.",
                        Value = "<META http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\" />"
                    };
                baseSettings.Add("SITESETTINGS_PAGE_META_ENCODING", tabMetaEncoding);
                var tabMetaOther = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 30,
                        Group = group,
                        EnglishName = "Default Additional Meta Tag Entries",
                        Description =
                            "This setting allows you to enter new tags into the Tab / Page's HEAD Tag. As an example we have added a portal tag to identify the version, but you could have a meta refresh tag or something else like a css reference instead.",
                        Value = string.Empty
                    };
                baseSettings.Add("SITESETTINGS_PAGE_META_OTHERS", tabMetaOther);
                var tabKeyPhrase = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 35,
                        Group = group,
                        EnglishName = "Default Page Keyphrase",
                        Description =
                            "This setting can be used by a module or by a control. It allows you to define a common message for the entire portal e.g. Welcome to x portal! This can be used for search engine optimisation. It allows you to define a keyword rich phrase to be used throughout your portal.",
                        Value = "Enter your default keyword rich Tab / Page phrase here. "
                    };
                baseSettings.Add("SITESETTINGS_PAGE_KEY_PHRASE", tabKeyPhrase);

                // added: Jes1111 - <body> element attributes setting
                var bodyAttributes = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 45,
                        Group = group,
                        EnglishName = "&lt;body&gt; attributes",
                        Description =
                            "Allows you to enter a string which will be inserted within the <body> element, e.g. leftmargin=\"0\" bottommargin=\"0\", etc. NOTE: not advisable to use this to inject onload() function calls as there is a programmatic function for that. NOTE also that is your CSS is well sorted you should not need anything here.",
                        Required = false
                    };
                baseSettings.Add("SITESETTINGS_BODYATTS", bodyAttributes);

                // end by John Mandia <*****@*****.**>
                var glAnalytics = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 50,
                        Group = group,
                        EnglishName = "Google-Analytics Code",
                        Description = "Allows you get the tracker, with this can view the statistics of your site.",
                        Value = string.Empty
                    };
                baseSettings.Add("SITESETTINGS_GOOGLEANALYTICS", glAnalytics);

                var glAnalyticsCustomVars = new SettingItem<bool, CheckBox>
                    {
                        Order = groupOrderBase + 52,
                        Group = group,
                        EnglishName = "Use Google-Analytics Custom Vars?",
                        Description =
                            "Allows you to use custom vars to track members, authenticated users and their domain names.",
                        Value = false
                    };
                baseSettings.Add("SITESETTINGS_GOOGLEANALYTICS_CUSTOMVARS", glAnalyticsCustomVars);

                var alternativeUrl = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 55,
                        Group = group,
                        EnglishName = "Alternative site url",
                        Description = "Indicate the site url for an alternative way.",
                        Value = string.Empty
                    };
                baseSettings.Add("SITESETTINGS_ALTERNATIVE_URL", alternativeUrl);

                var SnapEngage = new SettingItem<string, TextBox> {
                    Order = groupOrderBase + 57,
                    Group = group,
                    EnglishName = "SnapEngage code",
                    Description = "Allows you create a chat. Need an acount on SnapEngage.",
                    Value = string.Empty
                };
                baseSettings.Add("SITESETTINGS_SNAPENGAGE", SnapEngage);

                var addThisUsername = new SettingItem<string, TextBox>
                    {
                        Order = groupOrderBase + 56,
                        Group = group,
                        EnglishName = "AddThis Username",
                        Description = "Username for AddThis sharing and tracking.",
                        Value = "appleseedapp"
                    };
                baseSettings.Add("SITESETTINGS_ADDTHIS_USERNAME", addThisUsername);

                groupOrderBase = (int)SettingItemGroup.CULTURE_SETTINGS;
                group = SettingItemGroup.CULTURE_SETTINGS;

                var langList =
                    new SettingItem<string, ListControl>(
                        new MultiSelectListDataType(AppleseedCultures, "DisplayName", "Name"))
                        {
                            Group = group,
                            Order = groupOrderBase + 10,
                            EnglishName = "Language list",
                            Value = Config.DefaultLanguage,
                            Required = false,
                            Description =
                                "This is a list of the languages that the site will support. You can select multiples languages by pressing shift in your keyboard"
                        };

                // jes1111 - LangList.Value = ConfigurationSettings.AppSettings["DefaultLanguage"];
                baseSettings.Add("SITESETTINGS_LANGLIST", langList);

                var langDefault =
                    new SettingItem<string, DropDownList>(
                        new ListDataType<string, DropDownList>(AppleseedCultures, "DisplayName", "Name"))
                        {
                            Group = group,
                            Order = groupOrderBase + 20,
                            EnglishName = "Default Language",
                            Value = Config.DefaultLanguage,
                            Required = false,
                            Description = "This is the default language for the site."
                        };

                // jes1111 - LangList.Value = ConfigurationSettings.AppSettings["DefaultLanguage"];
                baseSettings.Add("SITESETTINGS_DEFAULTLANG", langDefault);

                #region Miscellaneous Settings

                groupOrderBase = (int)SettingItemGroup.MISC_SETTINGS;
                group = SettingItemGroup.MISC_SETTINGS;

                // Show modified by summary on/off
                var showModifiedBy = new SettingItem<bool, CheckBox>
                    {
                        Order = groupOrderBase + 10,
                        Group = group,
                        Value = false,
                        EnglishName = "Show modified by",
                        Description = "Check to show by whom the module is last modified."
                    };
                baseSettings.Add("SITESETTINGS_SHOW_MODIFIED_BY", showModifiedBy);

                // Default Editor Configuration used for new modules and workflow modules. [email protected] 13/07/2004
                var defaultEditor = new SettingItem<string, DropDownList>(new HtmlEditorDataType())
                    {
                        Order = groupOrderBase + 20,
                        Group = group,
                        Value = "FCKeditor",
                        EnglishName = "Default Editor",
                        Description = "This Editor is used by workflow and is the default for new modules."
                    };
                baseSettings.Add("SITESETTINGS_DEFAULT_EDITOR", defaultEditor);

                // Default Editor Width. [email protected] 13/07/2004
                var defaultWidth = new SettingItem<int, TextBox>
                    {
                        Order = groupOrderBase + 25,
                        Group = group,
                        Value = 700,
                        EnglishName = "Editor Width",
                        Description = "Default Editor Width"
                    };
                baseSettings.Add("SITESETTINGS_EDITOR_WIDTH", defaultWidth);

                // Default Editor Height. [email protected] 13/07/2004
                var defaultHeight = new SettingItem<int, TextBox>
                    {
                        Order = groupOrderBase + 30,
                        Group = group,
                        Value = 400,
                        EnglishName = "Editor Height",
                        Description = "Default Editor Height"
                    };
                baseSettings.Add("SITESETTINGS_EDITOR_HEIGHT", defaultHeight);

                // Show Upload (Active up editor only). [email protected] 13/07/2004
                var showUpload = new SettingItem<bool, CheckBox>
                    {
                        Value = true,
                        Order = groupOrderBase + 35,
                        Group = group,
                        EnglishName = "Upload?",
                        Description = "Only used if Editor is ActiveUp HtmlTextBox"
                    };
                baseSettings.Add("SITESETTINGS_SHOWUPLOAD", showUpload);

                // Default Image Folder. [email protected] 29/07/2004
                var defaultImageFolder =
                    new SettingItem<string, Panel>(
                        new FolderDataType(
                            HttpContext.Current.Server.MapPath(
                                string.Format("{0}/{1}/images", Path.ApplicationRoot, portalPath)),
                            "default"))
                        {
                            Order = groupOrderBase + 40,
                            Group = group,
                            Value = "default",
                            EnglishName = "Default Image Folder",
                            Description = "Set the default image folder used by Current Editor"
                        };
                baseSettings.Add("SITESETTINGS_DEFAULT_IMAGE_FOLDER", defaultImageFolder);
                groupOrderBase = (int)SettingItemGroup.MISC_SETTINGS;
                group = SettingItemGroup.MISC_SETTINGS;

                // Show module arrows to an administrator
                var showModuleArrows = new SettingItem<bool, CheckBox>
                    {
                        Order = groupOrderBase + 50,
                        Group = group,
                        Value = false,
                        EnglishName = "Show module arrows",
                        Description = "Check to show the arrows in the module title to move modules."
                    };
                baseSettings.Add("SITESETTINGS_SHOW_MODULE_ARROWS", showModuleArrows);

                // BOWEN 11 June 2005
                // Use Recycler Module for deleted modules
                var useRecycler = new SettingItem<bool, CheckBox>
                    {
                        Order = groupOrderBase + 55,
                        Group = group,
                        Value = true,
                        EnglishName = "Use Recycle Bin for Deleted Modules",
                        Description =
                            "Check to make deleted modules go to the recycler instead of permanently deleting them."
                    };
                baseSettings.Add("SITESETTINGS_USE_RECYCLER", useRecycler);

                var detailErrorMessage = new SettingItem<bool, CheckBox> {
                    Order = groupOrderBase + 56,
                    Group = group,
                    Value = false,
                    EnglishName = "Show Detail Error Message",
                    Description =
                        "Check to show Full detail Error Message when showing error."
                };
                baseSettings.Add("DETAIL_ERROR_MESSAGE", detailErrorMessage);

                // BOWEN 11 June 2005
                #endregion

                // Fix: Jes1111 - 27-02-2005 - incorrect setting for cache dependency
                // CacheDependency settingDependancies = new CacheDependency(null, new string[]{Appleseed.Framework.Settings.Cache.Key.ThemeList(ThemeManager.Path)});
                // set up a cache dependency object which monitors the four folders we are interested in
                var settingDependencies =
                    new CacheDependency(
                        new[]
                            {
                                LayoutManager.Path, layoutManager.PortalLayoutPath, ThemeManager.Path,
                                themeManager.PortalThemePath
                            });

                using (settingDependencies)
                {
                    CurrentCache.Insert(Key.PortalBaseSettings(), baseSettings, settingDependencies);
                }
            }
            else
            {
                baseSettings = (Dictionary<string, ISettingItem>)CurrentCache.Get(Key.PortalBaseSettings());
            }

            return baseSettings;
        }
        /// <summary>
        /// Sets the CurrentTheme - allowing custom Theme per module
        /// </summary>
        protected virtual void SetupTheme()
        {
            // changed: Jes1111 - 2004-08-05 - supports custom theme per module
            // (better to do this in OnLoad than in RenderChildren, which is too late)
            var themeName = this.Settings.ContainsKey("MODULESETTINGS_THEME") && Int32.Parse(this.Settings["MODULESETTINGS_THEME"].ToString()) == (int)ThemeList.Alt
                                ? "Alt"
                                : "Default";

            // end: Jes1111

            // added: Jes1111 - 2004-08-05 - supports custom theme per module
            if (this.PortalSettings.CustomSettings.ContainsKey("SITESETTINGS_ALLOW_MODULE_CUSTOM_THEMES") &&
                this.PortalSettings.CustomSettings["SITESETTINGS_ALLOW_MODULE_CUSTOM_THEMES"].ToString().Length != 0 &&
                bool.Parse(this.PortalSettings.CustomSettings["SITESETTINGS_ALLOW_MODULE_CUSTOM_THEMES"].ToString()) &&
                this.Settings.ContainsKey("MODULESETTINGS_MODULE_THEME") &&
                this.Settings["MODULESETTINGS_MODULE_THEME"].ToString().Trim().Length > 0)
            {
                // substitute custom theme for this module
                var tm = new ThemeManager(this.PortalSettings.PortalPath);
                tm.Load(this.Settings["MODULESETTINGS_MODULE_THEME"].ToString());
                this.CurrentTheme = tm.CurrentTheme;

                // get CSS file, add ModuleID to each line and add resulting string to CssImportList
                try
                {
                    var cssHelper = new CssHelper();
                    var selectorPrefix = string.Concat("#mID", this.ModuleID);
                    var cssFileName = this.Page.Server.MapPath(this.CurrentTheme.CssFile);
                    this.Page.RegisterCssImport(
                        this.ModuleID.ToString(), cssHelper.ParseCss(cssFileName, selectorPrefix));
                }
                catch (Exception ex)
                {
                    var error =
                        string.Format(
                            "Failed to load custom theme '{0}' for ModuleID {1}. Continuing with default tab theme. Message was: {2}",
                            this.CurrentTheme.CssFile,
                            this.ModuleID,
                            ex.Message);
                    ErrorHandler.Publish(LogLevel.Error, error);
                    this.CurrentTheme = this.PortalSettings.GetCurrentTheme(themeName);
                }
            }
            else
            {
                // original behaviour unchanged
                this.CurrentTheme = this.PortalSettings.GetCurrentTheme(themeName);
            }

            // end change: Jes1111
        }