/// <summary> /// Read the Path dir and returns an ArrayList with all the Layouts found. /// Static because the list is Always the same. /// </summary> /// <returns> /// A list of public layouts. /// </returns> public static List <LayoutItem> GetPublicLayouts() { // Jes1111 - 27-02-2005 - new version - correct caching List <LayoutItem> baseLayoutList; if (!CurrentCache.Exists(Key.LayoutList(Path))) { // Try to read directories from public Layout path var layouts = Directory.Exists(Path) ? Directory.GetDirectories(Path) : new string[0]; // Ignore CVS and SVN baseLayoutList = layouts.Select(layout => new LayoutItem { Name = layout.Substring(Path.Length + 1) }) .Where(layout => layout.Name != "CVS" && layout.Name != "_svn" && layout.Name != ".svn") .ToList(); CurrentCache.Insert(Key.LayoutList(Path), baseLayoutList, new CacheDependency(Path)); } else { baseLayoutList = (List <LayoutItem>)CurrentCache.Get(Key.LayoutList(Path)); } return(baseLayoutList); }
/// <summary> /// Read the Path dir and returns an ArrayList with all the Themes found. /// Static because the list is Always the same. /// </summary> /// <returns> /// A list of theme items. /// </returns> public static List <ThemeItem> GetPublicThemes() { List <ThemeItem> baseThemeList; if (!CurrentCache.Exists(Key.ThemeList(Path))) { // Initialize array // Try to read directories from public theme path var themes = Directory.Exists(Path) ? Directory.GetDirectories(Path) : new string[0]; // Ignore CVS and SVN. baseThemeList = themes.Select(t1 => new ThemeItem { Name = t1.Substring(Path.Length + 1) }).Where( t => t.Name != "CVS" && t.Name != "_svn").ToList(); CurrentCache.Insert(Key.ThemeList(Path), baseThemeList, new CacheDependency(Path)); } else { baseThemeList = (List <ThemeItem>)CurrentCache.Get(Key.ThemeList(Path)); } return(baseThemeList); }
/// <summary> /// The GetModuleSettings Method returns a hashtable of /// custom module specific settings from the database. This method is /// used by some user control modules to access misc settings. /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="_baseSettings">The _base settings.</param> /// <returns></returns> public static Hashtable GetModuleSettings(int moduleID, Hashtable _baseSettings) { if (!CurrentCache.Exists(Key.ModuleSettings(moduleID))) { // Get Settings for this module from the database Hashtable _settings = new Hashtable(); // Create Instance of Connection and Command Object using (SqlConnection myConnection = Config.SqlConnectionString) { using (SqlCommand myCommand = new SqlCommand("rb_GetModuleSettings", myConnection)) { // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter(strATModuleID, SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.Parameters.Add(parameterModuleID); // Execute the command myConnection.Open(); using (SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection)) { while (dr.Read()) { _settings[dr["SettingName"].ToString()] = dr["SettingValue"].ToString(); } } } } foreach (string key in _baseSettings.Keys) { if (_settings[key] != null) { SettingItem s = ((SettingItem)_baseSettings[key]); if (_settings[key].ToString().Length != 0) { s.Value = _settings[key].ToString(); } } } CurrentCache.Insert(Key.ModuleSettings(moduleID), _baseSettings); } else { _baseSettings = (Hashtable)CurrentCache.Get(Key.ModuleSettings(moduleID)); } return(_baseSettings); }
/// <summary> /// Update Page Custom Settings /// </summary> /// <param name="pageId"> /// The page ID. /// </param> /// <param name="key"> /// The setting key. /// </param> /// <param name="value"> /// The value. /// </param> public static void UpdatePageSettings(int pageId, string key, string value) { // Create Instance of Connection and Command Object using (var connection = Config.SqlConnectionString) using (var command = new SqlCommand("rb_UpdateTabCustomSettings", connection)) { // Mark the Command as a SPROC command.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC var parameterPageId = new SqlParameter("@TabID", SqlDbType.Int, 4) { Value = pageId }; command.Parameters.Add(parameterPageId); var parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50) { Value = key }; command.Parameters.Add(parameterKey); if ((key == "CustomLayout" || key == "CustomTheme" || key == "CustomThemeAlt") && (value == General.GetString("PAGESETTINGS_SITEDEFAULT"))) { value = string.Empty; } var parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500) { Value = value }; command.Parameters.Add(parameterValue); connection.Open(); try { command.ExecuteNonQuery(); } finally { connection.Close(); } } // Invalidate cache if (CurrentCache.Exists(Key.TabSettings(pageId))) { CurrentCache.Remove(Key.TabSettings(pageId)); } // Clear URL builder elements HttpUrlBuilder.Clear(pageId); }
/// <summary> /// Productses the specified tab. /// </summary> /// <param name="tab">The tab.</param> /// <returns></returns> private bool products(int tab) { if (!AutoShopDetect) { return(false); } if (!CurrentCache.Exists(Key.TabNavigationSettings(tab, "Shop"))) { PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; bool exists = new ModulesDB().ExistModuleProductsInPage(tab, portalSettings.PortalID); CurrentCache.Insert(Key.TabNavigationSettings(tab, "Shop"), exists); } return((bool)CurrentCache.Get(Key.TabNavigationSettings(tab, "Shop"))); }
/// <summary> /// Update Page Custom Settings /// </summary> /// <param name="pageID">The page ID.</param> /// <param name="key">The key.</param> /// <param name="value">The value.</param> public static void UpdatePageSettings(int pageID, string key, string value) { // Create Instance of Connection and Command Object using (SqlConnection myConnection = Config.SqlConnectionString) { using (SqlCommand myCommand = new SqlCommand("rb_UpdateTabCustomSettings", myConnection)) { // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterPageID = new SqlParameter("@TabID", SqlDbType.Int, 4); parameterPageID.Value = pageID; myCommand.Parameters.Add(parameterPageID); SqlParameter parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50); parameterKey.Value = key; myCommand.Parameters.Add(parameterKey); SqlParameter parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500); parameterValue.Value = value; myCommand.Parameters.Add(parameterValue); myConnection.Open(); try { myCommand.ExecuteNonQuery(); } finally { myConnection.Close(); } } } //Invalidate cache if (CurrentCache.Exists(Key.TabSettings(pageID))) { CurrentCache.Remove(Key.TabSettings(pageID)); } // Clear url builder elements HttpUrlBuilder.Clear(pageID); }
/// <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); }
/// <summary> /// Read the Path dir and returns /// an ArrayList with all the Themes found, public and privates /// </summary> /// <returns></returns> public ArrayList GetPrivateThemes() { ArrayList privateThemeList; if (!CurrentCache.Exists(Key.ThemeList(PortalThemePath))) { privateThemeList = new ArrayList(); string[] themes; // Try to read directories from private theme path if (Directory.Exists(PortalThemePath)) { themes = Directory.GetDirectories(PortalThemePath); } else { themes = new string[0]; } for (int i = 0; i <= themes.GetUpperBound(0); i++) { ThemeItem t = new ThemeItem(); t.Name = themes[i].Substring(PortalThemePath.Length + 1); if (t.Name != "CVS" && t.Name != "_svn") //Ignore CVS { privateThemeList.Add(t); } } CurrentCache.Insert(Key.ThemeList(PortalThemePath), privateThemeList, new CacheDependency(PortalThemePath)); //Debug.WriteLine("Storing privateThemeList in Cache: item count is " + privateThemeList.Count.ToString()); } else { privateThemeList = (ArrayList)CurrentCache.Get(Key.ThemeList(PortalThemePath)); //Debug.WriteLine("Retrieving privateThemeList from Cache: item count is " + privateThemeList.Count.ToString()); } return(privateThemeList); }
/// <summary> /// Gets the image menu. /// </summary> /// <returns>A System.Collections.Hashtable value...</returns> private Hashtable GetImageMenu() { Hashtable imageMenuFiles; if (!CurrentCache.Exists(Key.ImageMenuList(portalSettings.CurrentLayout))) { imageMenuFiles = new Hashtable(); imageMenuFiles.Add("-Default-", string.Empty); string menuDirectory = string.Empty; LayoutManager layoutManager = new LayoutManager(PortalPath); menuDirectory = Path.WebPathCombine(layoutManager.PortalLayoutPath, portalSettings.CurrentLayout); if (Directory.Exists(menuDirectory)) { menuDirectory = Path.WebPathCombine(menuDirectory, "menuimages"); } else { menuDirectory = Path.WebPathCombine(LayoutManager.Path, portalSettings.CurrentLayout, "menuimages"); } if (Directory.Exists(menuDirectory)) { FileInfo[] menuImages = (new DirectoryInfo(menuDirectory)).GetFiles("*.gif"); foreach (FileInfo fi in menuImages) { if (fi.Name != "spacer.gif" && fi.Name != "icon_arrow.gif") { imageMenuFiles.Add(fi.Name, fi.Name); } } } CurrentCache.Insert(Key.ImageMenuList(portalSettings.CurrentLayout), imageMenuFiles, null); } else { imageMenuFiles = (Hashtable)CurrentCache.Get(Key.ImageMenuList(portalSettings.CurrentLayout)); } return(imageMenuFiles); }
/// <summary> /// Read the Path dir and returns an ArrayList with all the Themes found. /// Static because the list is Always the same. /// </summary> /// <returns></returns> public static ArrayList GetPublicThemes() { ArrayList baseThemeList; if (!CurrentCache.Exists(Key.ThemeList(Path))) { //Initialize array baseThemeList = new ArrayList(); string[] themes; // Try to read directories from public theme path if (Directory.Exists(Path)) { themes = Directory.GetDirectories(Path); } else { themes = new string[0]; } for (int i = 0; i < themes.Length; i++) { ThemeItem t = new ThemeItem(); t.Name = themes[i].Substring(Path.Length + 1); if (t.Name != "CVS" && t.Name != "_svn") //Ignore CVS and _svn folders { baseThemeList.Add(t); } } CurrentCache.Insert(Key.ThemeList(Path), baseThemeList, new CacheDependency(Path)); } else { baseThemeList = (ArrayList)CurrentCache.Get(Key.ThemeList(Path)); } return(baseThemeList); }
/// <summary> /// Read the Path dir and returns /// an ArrayList with all the Themes found, public and privates /// </summary> /// <returns> /// A list of theme items. /// </returns> public List <ThemeItem> GetPrivateThemes() { List <ThemeItem> privateThemeList; if (!CurrentCache.Exists(Key.ThemeList(this.PortalThemePath))) { privateThemeList = new List <ThemeItem>(); // Try to read directories from private theme path var themes = Directory.Exists(this.PortalThemePath) ? Directory.GetDirectories(this.PortalThemePath) : new string[0]; for (var i = 0; i <= themes.GetUpperBound(0); i++) { var t = new ThemeItem { Name = themes[i].Substring(this.PortalThemePath.Length + 1) }; // Ignore CVS and SVN if (t.Name != "CVS" && t.Name != "_svn") { privateThemeList.Add(t); } } CurrentCache.Insert( Key.ThemeList(this.PortalThemePath), privateThemeList, new CacheDependency(this.PortalThemePath)); // Debug.WriteLine("Storing privateThemeList in Cache: item count is " + privateThemeList.Count.ToString()); } else { privateThemeList = (List <ThemeItem>)CurrentCache.Get(Key.ThemeList(this.PortalThemePath)); // Debug.WriteLine("Retrieving privateThemeList from Cache: item count is " + privateThemeList.Count.ToString()); } return(privateThemeList); }
/// <summary> /// Gets module settings. /// </summary> /// <param name="moduleId"> /// The module id. /// </param> /// <param name="baseSettings"> /// The base settings. /// </param> /// <returns> /// A hash table. /// </returns> /// <remarks> /// </remarks> public static Dictionary <string, ISettingItem> GetModuleSettings( int moduleId, Dictionary <string, ISettingItem> baseSettings) { if (!CurrentCache.Exists(Key.ModuleSettings(moduleId))) { var hashtable = new Hashtable(); using (var connection = Config.SqlConnectionString) using (var command = new SqlCommand("rb_GetModuleSettings", connection)) { command.CommandType = CommandType.StoredProcedure; var parameter = new SqlParameter("@ModuleID", SqlDbType.Int, 4) { Value = moduleId }; command.Parameters.Add(parameter); connection.Open(); using (var reader = command.ExecuteReader(CommandBehavior.CloseConnection)) { while (reader.Read()) { hashtable[reader["SettingName"].ToString()] = reader["SettingValue"].ToString(); } } } foreach (var key in baseSettings.Keys.Where(key => hashtable[key] != null).Where( key => hashtable[key].ToString().Length != 0)) { baseSettings[key].Value = hashtable[key]; } CurrentCache.Insert(Key.ModuleSettings(moduleId), baseSettings); return(baseSettings); } baseSettings = (Dictionary <string, ISettingItem>)CurrentCache.Get(Key.ModuleSettings(moduleId)); return(baseSettings); }
/// <summary> /// Loads the theme. /// </summary> /// <param name="currentWebPath"> /// The current web path. /// </param> /// <returns> /// A bool value... /// </returns> private bool LoadTheme(string currentWebPath) { this.currentTheme.WebPath = currentWebPath; // if (!Appleseed.Framework.Settings.Cache.CurrentCache.Exists (Appleseed.Framework.Settings.Cache.Key.CurrentTheme(CurrentWebPath))) if (!CurrentCache.Exists(Key.CurrentTheme(this.currentTheme.Path))) { if (File.Exists(this.currentTheme.ThemeFileName)) { if (this.LoadXml(this.currentTheme.ThemeFileName)) { // Appleseed.Framework.Settings.Cache.CurrentCache.Insert(Appleseed.Framework.Settings.Cache.Key.CurrentTheme(CurrentWebPath), CurrentTheme, new CacheDependency(CurrentTheme.ThemeFileName)); CurrentCache.Insert( Key.CurrentTheme(this.currentTheme.Path), this.currentTheme, new CacheDependency(this.currentTheme.Path)); } else { // failed return(false); } } else { // Return fail return(false); } } else { // CurrentTheme = (Theme) Appleseed.Framework.Settings.Cache.CurrentCache.Get (Appleseed.Framework.Settings.Cache.Key.CurrentTheme(CurrentWebPath)); this.currentTheme = (Theme)CurrentCache.Get(Key.CurrentTheme(this.currentTheme.Path)); } this.currentTheme.WebPath = currentWebPath; return(true); }
/// <summary> /// /// </summary> /// <returns></returns> public ArrayList GetPrivateLayouts() { ArrayList privateLayoutList; if (!CurrentCache.Exists(Key.LayoutList(PortalLayoutPath))) { privateLayoutList = new ArrayList(); string[] layouts; // Try to read directories from private theme path if (Directory.Exists(PortalLayoutPath)) { layouts = Directory.GetDirectories(PortalLayoutPath); } else { layouts = new string[0]; } for (int i = 0; i <= layouts.GetUpperBound(0); i++) { LayoutItem t = new LayoutItem(); t.Name = layouts[i].Substring(PortalLayoutPath.Length + 1); if (t.Name != "CVS" && t.Name != "_svn") //Ignore CVS { privateLayoutList.Add(t); } } CurrentCache.Insert(Key.LayoutList(PortalLayoutPath), privateLayoutList, new CacheDependency(PortalLayoutPath)); } else { privateLayoutList = (ArrayList)CurrentCache.Get(Key.LayoutList(PortalLayoutPath)); } return(privateLayoutList); }
/// <summary> /// Loads the theme. /// </summary> /// <param name="CurrentWebPath">The current web path.</param> /// <returns>A bool value...</returns> private bool LoadTheme(string CurrentWebPath) { CurrentTheme.WebPath = CurrentWebPath; //if (!Rainbow.Framework.Settings.Cache.CurrentCache.Exists (Rainbow.Framework.Settings.Cache.Key.CurrentTheme(CurrentWebPath))) if (!CurrentCache.Exists(Key.CurrentTheme(CurrentTheme.Path))) { if (File.Exists(CurrentTheme.ThemeFileName)) { if (LoadXml(CurrentTheme.ThemeFileName)) { //Rainbow.Framework.Settings.Cache.CurrentCache.Insert(Rainbow.Framework.Settings.Cache.Key.CurrentTheme(CurrentWebPath), CurrentTheme, new CacheDependency(CurrentTheme.ThemeFileName)); CurrentCache.Insert(Key.CurrentTheme(CurrentTheme.Path), CurrentTheme, new CacheDependency(CurrentTheme.Path)); } else { // failed return(false); } } else { //Return fail return(false); } } else { //CurrentTheme = (Theme) Rainbow.Framework.Settings.Cache.CurrentCache.Get (Rainbow.Framework.Settings.Cache.Key.CurrentTheme(CurrentWebPath)); CurrentTheme = (Theme)CurrentCache.Get(Key.CurrentTheme(CurrentTheme.Path)); } CurrentTheme.WebPath = CurrentWebPath; return(true); }
/// <summary> /// Gets the private layouts. /// </summary> /// <returns> /// A list of private layouts. /// </returns> public List <LayoutItem> GetPrivateLayouts() { List <LayoutItem> privateLayoutList; if (!CurrentCache.Exists(Key.LayoutList(this.PortalLayoutPath))) { privateLayoutList = new List <LayoutItem>(); // Try to read directories from private theme path var layouts = Directory.Exists(this.PortalLayoutPath) ? Directory.GetDirectories(this.PortalLayoutPath) : new string[0]; for (var i = 0; i <= layouts.GetUpperBound(0); i++) { var t = new LayoutItem { Name = layouts[i].Substring(this.PortalLayoutPath.Length + 1) }; // Ignore CVS if (t.Name != "CVS" && t.Name != "_svn" && t.Name != ".svn") { privateLayoutList.Add(t); } } CurrentCache.Insert( Key.LayoutList(this.PortalLayoutPath), privateLayoutList, new CacheDependency(this.PortalLayoutPath)); } else { privateLayoutList = (List <LayoutItem>)CurrentCache.Get(Key.LayoutList(this.PortalLayoutPath)); } return(privateLayoutList); }
/// <summary> /// The PageSettings.GetPageCustomSettings Method returns a hash table of /// custom Page specific settings from the database. This method is /// used by Portals to access misc Page settings. /// </summary> /// <param name="pageId"> /// The page ID. /// </param> /// <returns> /// The hash table. /// </returns> public Dictionary <string, ISettingItem> GetPageCustomSettings(int pageId) { Dictionary <string, ISettingItem> baseSettings; if (CurrentCache.Exists(Key.TabSettings(pageId))) { baseSettings = (Dictionary <string, ISettingItem>)CurrentCache.Get(Key.TabSettings(pageId)); } else { baseSettings = this.GetPageBaseSettings(); // Get Settings for this Page from the database var settings = new Hashtable(); // Create Instance of Connection and Command Object using (var connection = Config.SqlConnectionString) using (var command = new SqlCommand("rb_GetTabCustomSettings", connection)) { // Mark the Command as a SPROC command.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC var parameterPageId = new SqlParameter("@TabID", SqlDbType.Int, 4) { Value = pageId }; command.Parameters.Add(parameterPageId); // Execute the command connection.Open(); var dr = command.ExecuteReader(CommandBehavior.CloseConnection); try { while (dr.Read()) { settings[dr["SettingName"].ToString()] = dr["SettingValue"].ToString(); } } finally { dr.Close(); // by Manu, fixed bug 807858 connection.Close(); } } // Thierry (Tiptopweb) // TODO : put back the cache in GetPageBaseSettings() and reset values not found in the database // REVIEW: This code is duplicated in portal settings. foreach (var key in baseSettings.Keys.Where(key => settings[key] != null).Where( key => settings[key].ToString().Length != 0)) { baseSettings[key].Value = settings[key]; } CurrentCache.Insert(Key.TabSettings(pageId), baseSettings); } return(baseSettings); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event. /// </summary> /// <param name="e"> /// The <see cref="T:System.EventArgs"/> object that contains the event data. /// </param> /// <remarks> /// </remarks> protected override void OnLoad(EventArgs e) { if (!this.Page.IsPostBack) { // Invalidate settings cache if (CurrentCache.Exists(Key.TabSettings(this.PageID))) { CurrentCache.Remove(Key.TabSettings(this.PageID)); } } base.OnLoad(e); // Confirm delete if (!this.ClientScript.IsClientScriptBlockRegistered("confirmDelete")) { string[] s = { "CONFIRM_DELETE" }; this.ClientScript.RegisterClientScriptBlock( this.GetType(), "confirmDelete", PortalSettings.GetStringResource("CONFIRM_DELETE_SCRIPT", s)); } //this.TopDeleteBtn.Attributes.Add("00", "return confirmDelete()"); //this.LeftDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()"); //this.RightDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()"); //this.ContentDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()"); //this.BottomDeleteBtn.Attributes.Add("OnClick", "return confirmDelete()"); urlToLoadModules = "'" + HttpUrlBuilder.BuildUrl("~/Appleseed.Core/PageLayout/LoadModule") + "'"; // If first visit to the page, update all entries if (!this.Page.IsPostBack) { this.msgError.Visible = false; this.BindData(); this.SetSecurityAccess(); // 2/27/2003 Start - Ender Malkoc // After up or down button when the page is refreshed, select the previously selected // tab from the list. if (this.Request.Params["selectedmodid"] != null) { try { var modIndex = Int32.Parse(this.Request.Params["selectedmodid"]); //this.SelectModule(this.topPane, this.GetModules("TopPane"), modIndex); //this.SelectModule(this.leftPane, this.GetModules("LeftPane"), modIndex); //this.SelectModule(this.contentPane, this.GetModules("ContentPane"), modIndex); //this.SelectModule(this.rightPane, this.GetModules("RightPane"), modIndex); //this.SelectModule(this.bottomPane, this.GetModules("BottomPane"), modIndex); } catch (Exception ex) { ErrorHandler.Publish( LogLevel.Error, "After up or down button when the page is refreshed, select the previously selected tab from the list.", ex); } } // 2/27/2003 end - Ender Malkoc } // Binds custom settings to table this.EditTable.DataSource = new SortedList(this.PageSettings); this.EditTable.DataBind(); this.ModuleIdField.Value = this.ModuleID.ToString(); this.PageIdField.Value = this.PageID.ToString(); }
/// <summary> /// Read the Path dir and returns an ArrayList with all the Layouts found. /// Static because the list is Always the same. /// </summary> /// <returns></returns> public static ArrayList GetPublicLayouts() { // Jes1111 - 27-02-2005 - new version - correct caching ArrayList baseLayoutList; if (!CurrentCache.Exists(Key.LayoutList(Path))) { // initialize array baseLayoutList = new ArrayList(); string[] layouts; // Try to read directories from public Layout path if (Directory.Exists(Path)) { layouts = Directory.GetDirectories(Path); } else { layouts = new string[0]; } for (int i = 0; i < layouts.Length; i++) { LayoutItem t = new LayoutItem(); t.Name = layouts[i].Substring(Path.Length + 1); if (t.Name != "CVS" && t.Name != "_svn") //Ignore CVS { baseLayoutList.Add(t); } } CurrentCache.Insert(Key.LayoutList(Path), baseLayoutList, new CacheDependency(Path)); } else { baseLayoutList = (ArrayList)CurrentCache.Get(Key.LayoutList(Path)); } return(baseLayoutList); // Jes1111 - old version // if (LayoutManager.cachedLayoutsList == null) // { // //Initialize array // ArrayList layoutsList = new ArrayList(); // // string[] layouts; // // // Try to read directories from public Layout path // if (Directory.Exists(Path)) // { // layouts = Directory.GetDirectories(Path); // } // else // { // layouts = new string[0]; // } // // for (int i = 0; i < layouts.Length; i++) // { // LayoutItem t = new LayoutItem(); // t.Name = layouts[i].Substring(Path.Length + 1); // if(t.Name != "CVS") //Ignore CVS // layoutsList.Add(t); // } // // //store list in cache // lock (typeof(LayoutManager)) // { // if (LayoutManager.cachedLayoutsList == null) // { // LayoutManager.cachedLayoutsList = layoutsList; // } // } // } // // return LayoutManager.cachedLayoutsList; }
/// <summary> /// The PageSettings.GetPageCustomSettings Method returns a hashtable of /// custom Page specific settings from the database. This method is /// used by Portals to access misc Page settings. /// </summary> /// <param name="pageID">The page ID.</param> /// <returns></returns> public Hashtable GetPageCustomSettings(int pageID) { Hashtable _baseSettings; if (!CurrentCache.Exists(Key.TabSettings(pageID))) { _baseSettings = GetPageBaseSettings(); // Get Settings for this Page from the database Hashtable _settings = new Hashtable(); // Create Instance of Connection and Command Object using (SqlConnection myConnection = Config.SqlConnectionString) { using (SqlCommand myCommand = new SqlCommand("rb_GetTabCustomSettings", myConnection)) { // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterPageID = new SqlParameter("@TabID", SqlDbType.Int, 4); parameterPageID.Value = pageID; myCommand.Parameters.Add(parameterPageID); // Execute the command myConnection.Open(); SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection); try { while (dr.Read()) { _settings[dr["SettingName"].ToString()] = dr["SettingValue"].ToString(); } } finally { dr.Close(); //by Manu, fixed bug 807858 myConnection.Close(); } } } // Thierry (Tiptopweb) // TODO : put back the cache in GetPageBaseSettings() and reset values not found in the database foreach (string key in _baseSettings.Keys) { if (_settings[key] != null) { SettingItem s = ((SettingItem)_baseSettings[key]); if (_settings[key].ToString().Length != 0) { s.Value = _settings[key].ToString(); } } else //by Manu // Thierry (Tiptopweb), see the comment in Hashtable GetPageBaseSettings() // this is not resetting key not found in the database { SettingItem s = ((SettingItem)_baseSettings[key]); //s.Value = string.Empty; 3_aug_2004 Cory Isakson. This line caused an error with booleans } } CurrentCache.Insert(Key.TabSettings(pageID), _baseSettings); } else { _baseSettings = (Hashtable)CurrentCache.Get(Key.TabSettings(pageID)); } return(_baseSettings); }