Esempio n. 1
0
        /// <summary>
        /// All configuration settings should "default" if possible.
        /// </summary>
        /// <returns></returns>
        public static AppLocation Default()
        {
            AppLocation app = new AppLocation();
            app.Add(new CSApplicationInternal("blogs/admin", "BlogAdmin", ApplicationType.Weblog));
            app.Add(new CSApplicationInternal("forums/admin", "ForumAdmin", ApplicationType.Forum));
            app.Add(new CSApplicationInternal("galleries/admin", "GalleryAdmin", ApplicationType.Gallery));

            app.Add(new CSApplicationInternal("blogs", "BlogPublic", ApplicationType.Weblog));
            app.Add(new CSApplicationInternal("forums", "ForumPublic", ApplicationType.Forum));
            app.Add(new CSApplicationInternal("galleries", "GalleryPublic", ApplicationType.Gallery));

            return app;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates an instance of AppLocation  for the supplied XmlNode. 
        /// This node will generally be supplied during the ForumsConfiguration
        /// instantiation
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static AppLocation Create(XmlNode node)
        {
            AppLocation app = new AppLocation();

            //Look for AppLocation property values
            XmlAttributeCollection xac = node.Attributes;
            if(xac != null)
            {
                foreach(XmlAttribute att in xac)
                {
                    if(att.Name == "pattern")
                    {
                        app.Pattern = Globals.ApplicationPath + att.Value;
                    }
                    else if(att.Name == "defaultName")
                    {
                        app.DefaultName = att.Value;
                    }

                }

                //loop through the child nodes. For the moment, we will
                //only support add, but it might be worth while allowing applicatoins
                //to stack these settings
                foreach(XmlNode child in node.ChildNodes)
                {
                    if(child.Name == "add")
                    {
                        XmlAttributeCollection csAtt = child.Attributes;
                        if(csAtt != null)
                        {
                            string pattern = Globals.ApplicationPath + csAtt["pattern"].Value;
                            string name = csAtt["name"].Value;
                            ApplicationType appType = (ApplicationType) Enum.Parse(typeof(ApplicationType),csAtt["type"].Value,true);
                            app.Add(new CSApplicationInternal(pattern, name, appType));
                        }
                    }
                }

            }

            return app;
        }