private void ManageStyleSheets(bool PortalCSS) { // initialize reference paths to load the cascading style sheets string id; Hashtable objCSSCache = (Hashtable)DataCache.GetCache("CSS"); if (objCSSCache == null) { objCSSCache = new Hashtable(); } if (PortalCSS == false) { // default style sheet ( required ) id = Globals.CreateValidID(Globals.HostPath); AddStyleSheet(id, Globals.HostPath + "default.css"); // skin package style sheet id = Globals.CreateValidID(PortalSettings.ActiveTab.SkinPath); if (objCSSCache.ContainsKey(id) == false) { if (File.Exists(Server.MapPath(PortalSettings.ActiveTab.SkinPath) + "skin.css")) { objCSSCache[id] = PortalSettings.ActiveTab.SkinPath + "skin.css"; } else { objCSSCache[id] = ""; } if (Globals.PerformanceSetting != Globals.PerformanceSettings.NoCaching) { DataCache.SetCache("CSS", objCSSCache); } } if (objCSSCache[id].ToString() != "") { AddStyleSheet(id, objCSSCache[id].ToString()); } // skin file style sheet id = Globals.CreateValidID(PortalSettings.ActiveTab.SkinSrc.Replace(".ascx", ".css")); if (objCSSCache.ContainsKey(id) == false) { if (File.Exists(Server.MapPath(PortalSettings.ActiveTab.SkinSrc.Replace(".ascx", ".css")))) { objCSSCache[id] = PortalSettings.ActiveTab.SkinSrc.Replace(".ascx", ".css"); } else { objCSSCache[id] = ""; } if (Globals.PerformanceSetting != Globals.PerformanceSettings.NoCaching) { DataCache.SetCache("CSS", objCSSCache); } } if (objCSSCache[id].ToString() != "") { AddStyleSheet(id, objCSSCache[id].ToString()); } } else { // portal style sheet id = Globals.CreateValidID(PortalSettings.HomeDirectory); AddStyleSheet(id, PortalSettings.HomeDirectory + "portal.css"); } }
private void LoadStylesheets() { string id; Hashtable stylesheetCache = DataCache.GetCache("CSS") as Hashtable ?? new Hashtable(); // module stylesheet bool saveCache = false; ModuleInfo moduleConfiguration = this.RespondControl.ModuleConfiguration; if (moduleConfiguration.ControlSrc.ToLower().EndsWith(".ascx")) { // Get module.css from Path to control id = Globals.CreateValidID(Globals.ApplicationPath + "/" + moduleConfiguration.ControlSrc.Substring(0, moduleConfiguration.ControlSrc.LastIndexOf("/"))); if (!stylesheetCache.ContainsKey(id)) { string moduleControlStylesheetPath = Globals.ApplicationPath + "/" + moduleConfiguration.ControlSrc.Substring(0, moduleConfiguration.ControlSrc.LastIndexOf("/") + 1); if (File.Exists(HostingEnvironment.MapPath(moduleControlStylesheetPath) + "module.css")) { stylesheetCache[id] = moduleControlStylesheetPath + "module.css"; } else { stylesheetCache[id] = string.Empty; } saveCache = true; } } else { // Get module.css from Folder id = Globals.CreateValidID(Globals.ApplicationPath + "/" + moduleConfiguration.FolderName); if (!stylesheetCache.ContainsKey(id)) { string moduleStylesheetPath = Globals.ApplicationPath + "/" + moduleConfiguration.FolderName + "/module.css"; if (File.Exists(HostingEnvironment.MapPath(moduleStylesheetPath))) { stylesheetCache[id] = moduleStylesheetPath; } else { stylesheetCache[id] = string.Empty; } saveCache = true; } } if (saveCache && Globals.PerformanceSetting != Globals.PerformanceSettings.NoCaching) { DataCache.SetCache("CSS", stylesheetCache); } if (!string.IsNullOrEmpty(stylesheetCache[id].ToString())) { // Add it to beginning of style list this.AddStylesheet(id, stylesheetCache[id].ToString()); } // default style sheet ( required ) id = Globals.CreateValidID(Globals.HostPath); this.AddStylesheet(id, Globals.HostPath + "default.css"); // skin package style sheet id = Globals.CreateValidID(this.PortalSettings.ActiveTab.SkinPath); if (!stylesheetCache.ContainsKey(id)) { if (File.Exists(HostingEnvironment.MapPath(this.PortalSettings.ActiveTab.SkinPath) + "skin.css")) { stylesheetCache[id] = this.PortalSettings.ActiveTab.SkinPath + "skin.css"; } else { stylesheetCache[id] = string.Empty; } if (Globals.PerformanceSetting != Globals.PerformanceSettings.NoCaching) { DataCache.SetCache("CSS", stylesheetCache); } } if (!string.IsNullOrEmpty(stylesheetCache[id].ToString())) { this.AddStylesheet(id, stylesheetCache[id].ToString()); } // skin file style sheet string skinFileStylesheetPath = this.PortalSettings.ActiveTab.SkinSrc.Replace(".ascx", ".css"); id = Globals.CreateValidID(skinFileStylesheetPath); if (!stylesheetCache.ContainsKey(id)) { if (File.Exists(HostingEnvironment.MapPath(skinFileStylesheetPath))) { stylesheetCache[id] = skinFileStylesheetPath; } else { stylesheetCache[id] = string.Empty; } if (Globals.PerformanceSetting != Globals.PerformanceSettings.NoCaching) { DataCache.SetCache("CSS", stylesheetCache); } } if (!string.IsNullOrEmpty(stylesheetCache[id].ToString())) { this.AddStylesheet(id, stylesheetCache[id].ToString()); } // portal style sheet id = Globals.CreateValidID(this.PortalSettings.HomeDirectory); this.AddStylesheet(id, this.PortalSettings.HomeDirectory + "portal.css"); }