Example #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;
        }
Example #2
0
        /// <summary>Escreve um planeta</summary>
        private void writePlanet(Chronos.Core.Planet planet)
        {
            MasterSkinInfo masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];
            string         control        = OrionGlobals.AppPath + masterSkinInfo.masterSkinName + "/controls/" + controlToLoad;

            Control planetPage = Page.LoadControl(control);

            Image img = (Image)planetPage.FindControl("img");

            if (img != null)
            {
                img.ImageUrl        = OrionGlobals.getCommonImagePath("planets/" + planet.Info.Id + ".jpg");
                img.EnableViewState = false;
            }

            ResourcesList resources = (ResourcesList)planetPage.FindControl("resourcesList");

            if (resources != null)
            {
                resources.Manager           = planet;
                resources.Title             = info.getContent("planetResources");
                resources.Category          = "Intrinsic";
                resources.ShowImages        = true;
                resources.ShowOnlyQuantity  = false;
                resources.ShowZeroQuantity  = true;
                resources.ShowDocumentation = false;
            }

            writeGeneral(planet, planetPage);

            Controls.Add(planetPage);
        }
Example #3
0
        /// <summary>
        /// obtem a informacao sobre a pagina do pedido
        /// </summary>
        /// <param name="sectionInfo">a informao da seco corrente</param>
        /// <param name="requestPath">o path da request</param>
        /// <returns>o objecto PageInfo com a informao da pgina ou ento
        /// <code>null</code> se a pgina no for encontrada</returns>
        private PageInfo getPageInfo(SectionInfo sectionInfo, MasterSkinInfo masterSkinInfo, string requestPath)
        {
            // obter o ficheiro do pedido
            string requestFile = OrionGlobals.getPageName(requestPath);

            // se for uma seco ou subsecco
            if (requestFile.ToLower() == "/default.aspx")
            {
                return(new PageInfo(
                           -1,
                           sectionInfo.sectionParentId,
                           sectionInfo.sectionName,
                           sectionInfo.sectionTitle,
                           masterSkinInfo.masterSkinName,
                           sectionInfo.sectionDescription,
                           sectionInfo.sectionContent
                           ));
            }

            PageInfo pageInfo;

            pageInfo = NamedPageUtility.getNamedPageInfo(requestFile.ToLower());
            if (pageInfo != null)
            {
                return(pageInfo);
            }

            // se tudo falhar kaboom, big kaboom
            return(null);
        }
Example #4
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);
        }
Example #5
0
        public static string ResolveForumImagePath(string themefile)
        {
            MasterSkinInfo masterSkinInfo = (MasterSkinInfo)HttpContext.Current.Items["MasterSkinInfo"];

            string appPath = HttpContext.Current.Request.ApplicationPath + "/" + masterSkinInfo.masterSkinName + "/images/";


            //return appPath +"forum/" + themefile;
            return(System.Web.HttpContext.Current.Server.MapPath(appPath + "forum/" + themefile));
        }
Example #6
0
        /// <summary>Pinta o Controlo</summary>
        protected override void OnPreRender(EventArgs args)
        {
            MasterSkinInfo masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];
            string         control        = OrionGlobals.AppPath + masterSkinInfo.masterSkinName + "/controls/ShowPlanetResources.ascx";
            Control        planetSkin     = Page.LoadControl(control);

            foreach (string resource in planet.getResourceInfo("Intrinsic").AvailableFactories.Keys)
            {
                fillResource(resource, planetSkin, planet);
            }

            Controls.Add(planetSkin);
        }
Example #7
0
        protected override void Render(HtmlTextWriter writer)
        {
            string         title = CultureModule.getLanguage().getContent("section_" + _pageTitle.ToLower());
            MasterSkinInfo skin  = (MasterSkinInfo)Context.Items["MasterSkinInfo"];

            if (skin != null && skin.masterSkinName.IndexOf("galaxy") != -1 && title.IndexOf(" ") != -1)
            {
                writer.Write("<table width='{0}'><tr><td align='center'>{1}</tr></td></table>", title.Length * 7, title);
            }
            else
            {
                writer.Write(title);
            }
        }
Example #8
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);
        }
Example #9
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);
        }
Example #10
0
        /// <summary>
        /// obtem a informacao sobre a pagina do pedido
        /// </summary>
        /// <param name="sectionInfo">a informao da seco corrente</param>
        /// <param name="requestPath">o path da request</param>
        /// <returns>o objecto PageInfo com a informao da pgina ou ento
        /// <code>null</code> se a pgina no for encontrada</returns>
        private PageInfo getPageInfo(SectionInfo sectionInfo, MasterSkinInfo masterSkinInfo, string requestPath)
        {
            // obter o ficheiro do pedido
                string requestFile = OrionGlobals.getPageName(requestPath);

                // se for uma seco ou subsecco
                if (requestFile.ToLower() == "/default.aspx")
                    return new PageInfo(
                        -1,
                        sectionInfo.sectionParentId,
                        sectionInfo.sectionName,
                        sectionInfo.sectionTitle,
                        masterSkinInfo.masterSkinName,
                        sectionInfo.sectionDescription,
                        sectionInfo.sectionContent
                    );

                PageInfo pageInfo;

                pageInfo = NamedPageUtility.getNamedPageInfo( requestFile.ToLower() );
                if(pageInfo != null)
                    return pageInfo;

                // se tudo falhar kaboom, big kaboom
                return null;
        }
Example #11
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")));
            }
        }
Example #12
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;
        }
Example #13
0
        /// <summary>
        /// responsvel por gerar o path das imagens
        /// </summary>
        /// <returns>o path das imagens</returns>
        public static string getSkinImagePath(string image)
        {
            MasterSkinInfo masterSkinInfo = (MasterSkinInfo)HttpContext.Current.Items["MasterSkinInfo"];

            return(ImagePath + masterSkinInfo.masterSkinName + "/images/" + image);
        }
Example #14
0
 public OrionImage()
 {
     masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];
     css            = null;
 }
Example #15
0
 public BaseControl()
 {
     masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];
 }
Example #16
0
 public OrionImage()
 {
     masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];
     css = null;
 }
Example #17
0
 public BaseControl()
 {
     masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];
 }
Example #18
0
        /// <summary>
        /// adiciona o conteudo pagina. Esta  a unica pgina em toda a aplicao
        /// </summary>
        /// <param name="e"></param>
        override protected void OnInit(EventArgs e)
        {
            SetResponseHeaders();
            universeLock = null;
            Information.InitMessageControls( );

            // escreve o path original
            Context.RewritePath(Path.GetFileName(Request.RawUrl));

            if (Context.Session["SkinNumber"] == null)
            {
                object number = Context.Items["SkinNumber"];
                if (number == null)
                {
                    number = 1;
                }
                Context.Session["SkinNumber"] = number;
            }

            // obter a section e page info armazenadas no module
            PageInfo pageInfo = (PageInfo)Context.Items["PageInfo"];

            if (pageInfo == null)
            {
                throw new AlnitakException("Context.Items possui a referencia para PageInfo a null @ OrionDefault::OnInit");
            }

            MasterSkinInfo masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];

            // contruir o header
            StringBuilder objBuilder = new StringBuilder();

            //objBuilder.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n");
            //objBuilder.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");

            objBuilder.Append("<html>\n<head>");

            // adicionar o titulo
            objBuilder.AppendFormat("\n<title>Orion's Belt :: {0}</title>", CultureModule.getLanguage().getContent("section_" + pageInfo.pageName.ToLower()));

            // adicionar o style sheet
            string skinCss = OrionGlobals.resolveBase(masterSkinInfo.masterSkinName + "/" + masterSkinInfo.masterSkinStyle);

            objBuilder.AppendFormat("\n<link href=\"{0}\" rel=\"stylesheet\" />", skinCss);
            objBuilder.AppendFormat("<link href='{0}' type='image/png' rel='icon'/>", OrionGlobals.getCommonImagePath("orion.gif"));

            objBuilder.AppendFormat("\n<script src=\"{0}\" type=\"text/javascript\" ></script>", OrionGlobals.resolveBase("skins/commonScripts/common.js"));
            objBuilder.AppendFormat("\n<script src=\"{0}\" type=\"text/javascript\" ></script>", OrionGlobals.resolveBase(masterSkinInfo.masterSkinName + "/" + masterSkinInfo.masterSkinScript));

            // Adicionar o header da pagina
            objBuilder.Append("\n</head>\n<body>\n");

#if DEBUG
            objBuilder.Append("<div style='color: red; background-color: black; text-align:center; padding: 15px;'>DEBUG MODE</div>");
#endif

            Controls.Add(new LiteralControl(objBuilder.ToString()));


            // just in case...
#if MONO_1_1_9_1
                        #warning Mono Hack...
            Context.RewritePath(Context.Request.RawUrl);
#endif

            // criar um Form Control
            HtmlForm pageContent = new HtmlForm();
            pageContent.ID = "pageContent";

            // load da skin da pgina
            Control pageSkin = LoadControl(OrionGlobals.AppPath + masterSkinInfo.masterSkinName + "/page/baseSkin.ascx");

            // Add the Page Content Page Part
            PlaceHolder pagePart = (PlaceHolder)pageSkin.FindControl("content");
            if (pagePart != null)
            {
                pagePart.Controls.Add(Information.GetErrorControl());
                pagePart.Controls.Add(Information.GetInformationControl());
                Control content = getContent(pageInfo);
                pagePart.Controls.Add(content);
            }

            // Add the Page Skin to the Form
            pageContent.Controls.Add(pageSkin);

            //adicionar o conteudo a pagina
            Controls.Add(pageContent);

            // introduzir o cdigo restante
            Controls.Add(new LiteralControl("\n</body>\n</html>"));

            AddInfo();
        }