/// <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 = "<body> 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> /// Gets the image menu. /// </summary> /// <returns> /// A System.Collections.Hashtable value... /// </returns> private Hashtable GetImageMenu() { Hashtable imageMenuFiles; if (!CurrentCache.Exists(Key.ImageMenuList(this.PortalSettings.CurrentLayout))) { imageMenuFiles = new Hashtable { { General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)"), string.Empty } }; var layoutManager = new LayoutManager(this.PortalPath); var menuDirectory = Path.WebPathCombine( layoutManager.PortalLayoutPath, this.PortalSettings.CurrentLayout); if (Directory.Exists(menuDirectory)) { menuDirectory = Path.WebPathCombine(menuDirectory, "menuimages"); } else { menuDirectory = Path.WebPathCombine( LayoutManager.Path, this.PortalSettings.CurrentLayout, "menuimages"); } if (Directory.Exists(menuDirectory)) { var menuImages = (new DirectoryInfo(menuDirectory)).GetFiles("*.gif"); foreach (var fi in menuImages.Where(fi => fi.Name != "spacer.gif" && fi.Name != "icon_arrow.gif")) { imageMenuFiles.Add(fi.Name, fi.Name); } } CurrentCache.Insert(Key.ImageMenuList(this.PortalSettings.CurrentLayout), imageMenuFiles, null); } else { imageMenuFiles = (Hashtable)CurrentCache.Get(Key.ImageMenuList(this.PortalSettings.CurrentLayout)); } return imageMenuFiles; }