/// <summary> /// Gets the properties /// </summary> /// <history> /// [cnurse] 02/23/2006 created /// </history> private ProfilePropertyDefinitionCollection GetProperties() { string strKey = ProfileController.PROPERTIES_CACHEKEY + "." + UsersPortalId; if (m_objProperties == null) { m_objProperties = (ProfilePropertyDefinitionCollection)DataCache.GetCache(strKey); if (m_objProperties == null) { m_objProperties = ProfileController.GetPropertyDefinitionsByPortal(UsersPortalId); DataCache.SetCache(strKey, m_objProperties); } } return(m_objProperties); }
private void ManageFavicon() { string strFavicon = Convert.ToString(DataCache.GetCache("FAVICON" + PortalSettings.PortalId)); if (strFavicon == "") { if (File.Exists(PortalSettings.HomeDirectoryMapPath + "favicon.ico")) { strFavicon = PortalSettings.HomeDirectory + "favicon.ico"; if (Globals.PerformanceSetting != Globals.PerformanceSettings.NoCaching) { DataCache.SetCache("FAVICON" + PortalSettings.PortalId, strFavicon); } } } if (!String.IsNullOrEmpty(strFavicon)) { HtmlLink objLink = new HtmlLink(); objLink.Attributes["rel"] = "SHORTCUT ICON"; objLink.Attributes["href"] = strFavicon; Page.Header.Controls.Add(objLink); } }
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"); } }
/// <summary> /// The CreateChildControls method is called when the ASP.NET Page Framework /// determines that it is time to instantiate a server control. /// This method and attempts to resolve any previously cached output of the portal /// module from the ASP.NET cache. /// If it doesn't find cached output from a previous request, then it will instantiate /// and add the portal modules UserControl instance into the page tree. /// </summary> /// <remarks> /// </remarks> protected override void CreateChildControls() { if (_moduleConfiguration != null) { // if user does not have EDIT rights for the module ( content editors can not see cached versions of modules ) if (PortalSecurity.HasEditPermissions(_moduleConfiguration.ModulePermissions) == false) { // Attempt to resolve previously cached content if (_moduleConfiguration.CacheTime != 0) { if (CacheMethod != "D") { _cachedOutput = Convert.ToString(DataCache.GetCache(CacheKey)); } else // cache from disk { if (File.Exists(CacheFileName)) { FileInfo cacheFile = new FileInfo(CacheFileName); if (cacheFile.CreationTime.AddSeconds(_moduleConfiguration.CacheTime) >= DateTime.Now) { try { //Load from Cache StreamReader objStreamReader = cacheFile.OpenText(); _cachedOutput = objStreamReader.ReadToEnd(); objStreamReader.Close(); } catch (Exception) { //locking error _cachedOutput = String.Empty; } } else { try { //Cache Expired so delete it cacheFile.Delete(); } catch (Exception) { //locking error _cachedOutput = String.Empty; } } } } } // If no cached content is found, then instantiate and add the portal // module user control into the portal's page server control tree if (_cachedOutput == "" && _moduleConfiguration.CacheTime > 0) { base.CreateChildControls(); PortalModuleBase objPortalModuleBase = (PortalModuleBase)Page.LoadControl(_moduleConfiguration.ControlSrc); objPortalModuleBase.ModuleConfiguration = this.ModuleConfiguration; // set the control ID to the resource file name ( ie. controlname.ascx = controlname ) // this is necessary for the Localization in PageBase objPortalModuleBase.ID = Path.GetFileNameWithoutExtension(_moduleConfiguration.ControlSrc); // In skin.vb, the call to Me.Controls.Add(objPortalModuleBase) calls CreateChildControls() therefore // we need to indicate the control has already been created. We will manipulate the CacheTime property for this purpose. objPortalModuleBase.ModuleConfiguration.CacheTime = -(objPortalModuleBase.ModuleConfiguration.CacheTime); this.Controls.Add(objPortalModuleBase); } else { // restore the CacheTime property in preparation for the Render() event if (_moduleConfiguration.CacheTime < 0) { _moduleConfiguration.CacheTime = -(_moduleConfiguration.CacheTime); } } } } }