Exemple #1
0
        private Control loadSkin()
        {
            Control skin = (Control)Context.Cache[masterSkinInfo.masterSkinName + "/" + _skinName];

            if (skin == null)
            {
                string skinPath = OrionGlobals.AppPath + masterSkinInfo.masterSkinName + "/controls/" + _skinFileName;
                if (!File.Exists(HttpContext.Current.Server.MapPath(skinPath)))
                {
                    MasterSkinInfo m = MasterSkinUtility.getDefaultMasterSkinInfo();
                    skinPath = OrionGlobals.AppPath + m.masterSkinName + "/controls/" + _skinFileName;
                }
                skin = Page.LoadControl(skinPath);
                Context.Cache[masterSkinInfo.masterSkinName + "/" + _skinName] = skin;
            }
            return(skin);
        }
Exemple #2
0
        protected override void OnInit(EventArgs e)
        {
            Context.Trace.Write("BasePageModule", "OnInit");

            Control skin;

            // Determinar a skin pedida
            SectionInfo sectionInfo = (SectionInfo)HttpContext.Current.Items["SectionInfo"];
            PageInfo    pageInfo    = (PageInfo)HttpContext.Current.Items["PageInfo"];

            masterSkinInfo = (MasterSkinInfo)HttpContext.Current.Items["MasterSkinInfo"];

            string skinFileName;

            if (_sectionContent != string.Empty && sectionInfo.sectionContent != _sectionContent)
            {
                _fileName = "InvalidAccess.ascx";
            }
            else
            {
                _fileName = _fileName == null?pageInfo.pageName:_fileName;
            }

            skinFileName = String.Format("{0}{1}/content/{2}.ascx", OrionGlobals.AppPath, masterSkinInfo.masterSkinName, _fileName);

            if (!File.Exists(HttpContext.Current.Server.MapPath(skinFileName)))
            {
                masterSkinInfo = MasterSkinUtility.getDefaultMasterSkinInfo();
                skinFileName   = String.Format("{0}{1}/content/{2}.ascx", OrionGlobals.AppPath, masterSkinInfo.masterSkinName, _fileName);
            }

            Context.Trace.Write("BasePageModule", "Loading Module: " + skinFileName);
            try {
                skin = Page.LoadControl(skinFileName);
            } catch (Exception ex) {
                throw new Exception("Error Loading " + skinFileName + " - " + ex.Message, ex);
            }
            Controls.Add(skin);
        }