Exemple #1
0
        /// <summary>Construtor</summary>
        public User(IIdentity _user, string[] _roles)
        {
            reset();
            if (_user.Name == null)
            {
                mail = "";
            }
            else
            {
                mail = _user.Name;
            }

            roles    = _roles;
            identity = _user;
            UserUtility.bd.fillUser(this);

            //carregar a skin
            MasterSkinInfo masterSkin = MasterSkinUtility.getMasterSkinInfoFromId(Skin);

            if (masterSkin == null)
            {
                throw new AlnitakException(string.Format("No foi possivel carregar a skin com o id {0}", skin));
            }
            SkinName   = masterSkin.masterSkinName;
            SkinStyle  = masterSkin.masterSkinStyle;
            SkinScript = masterSkin.masterSkinScript;
        }
Exemple #2
0
        private void Application_BeginRequest(Object source, EventArgs e)
        {
            //obter o HttpContext
            HttpContext Context = HttpContext.Current;

            // verificar o wiki
            string path = CheckWiki(Context.Request.Path);

            // obter os paths do ficheiro e da base
            string requestPath     = OrionGlobals.removePathInfo(path);
            string requestBasePath = OrionGlobals.getSectionPath(requestPath);

            Log.log("Request to: {0}", requestPath);

            try {
                //Descobrir qual a seco pedida e adiciona-la ao Items
                Log.log("Checking for {0} section... ", requestPath);
                SectionInfo sectionInfo = SectionUtility.getSectionInfoFromFullPath(requestPath);
                if (sectionInfo == null)
                {
                    Log.log("\tsectionInfo is null");
                    //normalmente acontece quando e named page
                    sectionInfo = SectionUtility.getSectionInfoFromBasePath(requestBasePath);
                }
                else
                {
                    Log.log("\tsectionInfo ok");
                }

                //quando  imagem cai aqui ou outra coisa qq que n seja seco
                if (sectionInfo == null)
                {
                    Log.log("\tsectionInfo is null");
                    return;
                }

                //adiciona aos items a Items
                Context.Items["SectionInfo"] = sectionInfo;
                Log.log("\tSectionInfo: {0}", sectionInfo.sectionName);

                //Descobrir qual a skin corrente
                MasterSkinInfo masterSkinInfo = MasterSkinUtility.getMasterSkinInfoFromId(sectionInfo.sectionSkinId);
                if (masterSkinInfo == null)
                {
                    masterSkinInfo = MasterSkinUtility.getMasterSkinInfoFromId(1);
                }

                //adiciona o nmero da skin (Caso a skin tenha vrios esquemas de cor)
                storeSkinNumber(masterSkinInfo.masterSkinCount);

                //adiciona aos items a Items
                Context.Items["MasterSkinInfo"] = masterSkinInfo;

                PageInfo pageInfo = getPageInfo(sectionInfo, masterSkinInfo, requestPath);
                if (pageInfo != null)
                {
                    Context.Items["PageInfo"] = pageInfo;
                    Chronos.Utils.Log.log("Request: " + requestPath);

                    Log.log("Rewriting Path to '{0}'...", OrionGlobals.UrlBasePage);
                    if (requestPath.IndexOf(".aspx") >= 0)
                    {
                        Log.log("\tDone!");
                        Context.RewritePath(OrionGlobals.UrlBasePage);
                    }
                    else
                    {
                        Log.log("\tNot rewrited! '{0}' isn't aspx", requestPath);
                    }
                }
                else
                {
                    Log.log("PageInfo is null for '{0}'", requestPath);
                }
            } catch (Exception exception) {
                try {
                    ExceptionLog.log(exception);
                } catch (Exception exp) {
                    HttpContext.Current.Cache[OrionGlobals.SessionId + "AlnitakException"] = new ExceptionInfo(exp);;
                }

                //mostrar a pgina de erro global
                HttpContext.Current.Server.Transfer(OrionGlobals.resolveBase(OrionGlobals.getConfigurationValue("pagePath", "globalError")));
            }
        }
Exemple #3
0
        /// <summary>Altera a skin currente para a skin do utilizador</summary>
        private void setUserSkin(User user)
        {
            MasterSkinInfo masterSkinInfo = MasterSkinUtility.getMasterSkinInfoFromId(user.Skin);

            Context.Items["MasterSkinInfo"] = masterSkinInfo;
        }