Example #1
0
        public ModuleFeed(SectionInfo section)
        {
            // set the encoding to UTF8
            this.Encoding = Encoding.UTF8;

            // set the section specific information
            this.Id = section.UrlPath;
            this.Title = new AtomContentConstruct("title", section.Title);
            this.Links.Add(new AtomLink(section.UrlPath, Relationship.Alternate, MediaType.TextHtml));

            UriBuilder feed = new UriBuilder(section.UrlPath);
            feed.Query = "feed";

            this.Modified = new AtomDateConstruct("modified", section.Touched);

            // set the feed
            this.Links.Add(new AtomLink(feed.Uri, Relationship.ServiceFeed, MediaType.ApplicationXAtomXml));

            // set description if set
            if (section.MetaProperties["description"] != null)
                this.Info = new AtomContentConstruct("info", section.MetaProperties["description"]);

            // set copyright if set
            if (section.MetaProperties["copyright"] != null)
                this.Copyright = new AtomContentConstruct("copyright", section.MetaProperties["copyright"]);

            // set module specific data
            this._moduleID = section.Module.ID;
        }
        public SectionModuleDataCollection(SectionInfo owner, NameValueCollection properties)
        {
            for(int i = 0; i < properties.Count; i++)
                base.Add(
                    properties.GetKey(i),
                    properties[i]
                    );

            this._owner = owner;
        }
Example #3
0
        public override RolesTasksDictionary GetRolesForSection(SectionInfo section)
        {
            List<SectionRole> dbroles = SectionRole.GetBySectionID(section.Identity);

            // return list of roles
            RolesTasksDictionary roles = new RolesTasksDictionary();

            foreach (SectionRole role in dbroles)
                roles.Add(
                    role.Role,
                    role.Tasks.Split(Common.Delimiter)
                    );

            return roles;
        }
Example #4
0
        public override SectionModuleDataCollection GetModuleDataForSection(SectionInfo section)
        {
            List<SectionProperty> properties = SectionProperty.GetList("SectionID = " + section.Identity + " and PropertyGroup = '" + SectionModuleDataGroup + "'");

            // get all properties for section
            NameValueCollection collection = new NameValueCollection(properties.Count);

            // add all rows to NameValueCollection
            foreach (SectionProperty property in properties)
                collection.Add(
                    property.Name,
                    property.Value
                    );

            // returns a property collection
            return new SectionModuleDataCollection(section, collection);
        }
Example #5
0
        /// <summary>Checks to see if parent has the child in its tree.</summary>
        /// <param name="child">The child to compare.</param>
        /// <param name="parent">The parent that is check for a child.</param>
        /// <param name="compare">Compare the parent and child to see if they are the same section.</param>
        /// <returns>Returns <see langword="true"/> the parent contains the child or are equal depending on the compare value, and <see langword="false"/> if the parent does not contain the child.</returns>
        private static bool IsChildFromParent(SectionInfo child, SectionInfo parent, bool compare)
        {
            // if the child is equal to the parent return true
            if (compare && child == parent)
                return true;

            // check all the parents children to see if they contain or are the children
            foreach (SectionInfo section in parent.Children) {
                if (IsChildFromParent(child, section, true))
                    return true;
            }

            // the child was not found in the parents tree
            return false;
        }
Example #6
0
 private void InvalidateExternalSectionsCollections(object sender, EventArgs e)
 {
     this._ConnectedSection = null;
 }
Example #7
0
        public override bool SectionContainerLinked(SectionInfo section, ContainerInfo container)
        {
            SectionContainerLink link = SectionContainerLink.GetBySectionIDAndContainerID(
                section.Identity,
                container.Identity
                );

            try
            {
                // return if combination is found
                return link.SectionID != 0 && link.ContainerID != 0;
            }
            catch (Exception)
            {
                return false;
            }
        }
Example #8
0
        public override void RemoveRoleForSection(string role, SectionInfo section)
        {
            SectionRole dbrole = SectionRole.GetBySectionIDAndRole(
                section.Identity,
                role
                );

            try
            {
                // remove certain role
                dbrole.Delete();
                dbrole.CommitChanges();
            }
            catch (Exception) { }
        }
Example #9
0
        public override void RemoveAllRolesForSection(SectionInfo section)
        {
            List<SectionRole> dbroles = SectionRole.GetBySectionID(section.Identity);

            try
            {
                // remove all roles for one section
                foreach (SectionRole role in dbroles)
                {
                    role.Delete();
                    role.CommitChanges();
                }
            }
            catch (Exception) { }
        }
Example #10
0
        public override void AddModuleDataForSection(string name, string value, SectionInfo section)
        {
            SectionProperty property = new SectionProperty(
                section.Identity,
                SectionModuleDataGroup,
                name,
                value
                );

            try
            {
                // insert new property
                property.CommitChanges();
            }
            catch (Exception) { }
        }
Example #11
0
        public override void UpdateSectionContainerLink(SectionInfo section, ContainerInfo container, int order, int position)
        {
            SectionContainerLink link = SectionContainerLink.GetBySectionIDAndContainerID(
                section.Identity,
                container.Identity
                );
            link.SortOrder = order;
            link.Position = position;

            try
            {
                // update combination
                link.CommitChanges();
            }
            catch (Exception) { }
        }
Example #12
0
        public override void UpdateRoleForSection(string role, string[] tasks, SectionInfo section)
        {
            SectionRole dbrole = SectionRole.GetBySectionIDAndRole(
                section.Identity,
                role
                );
            dbrole.Tasks = String.Join(Common.Delimiter.ToString(), tasks);

            try
            {
                // update role
                dbrole.CommitChanges();
            }
            catch (Exception) { }
        }
Example #13
0
        public static SectionInfo CreateNew(SectionInfo parent)
        {
            if (parent == null)
                throw new ArgumentNullException("parent");
            if (parent.Identity == TempIdentity)
                throw new ArgumentException("Must be commited to database before a child can be created.");
            if (parent.ConnectedCommunity == null)
                throw new ArgumentNullException("parent", "ConnectedCommunity must be set and commited to database before a child can be created.");
            if (parent.ConnectedCommunity.Identity == CommunityInfo.TempIdentity)
                throw new ArgumentException("ConnectedCommunity must be commited to database before a child can be created.");

            SectionInfo section = new SectionInfo(parent.Identity, parent.ConnectedCommunity.Identity);
            section.SetState(State.Added);

            return section;
        }
Example #14
0
        public static SectionInfo CreateNew()
        {
            SectionInfo section = new SectionInfo(RootSection.Identity, CommunityInfo.NullIdentity);
            section.SetState(State.Added);

            return section;
        }
Example #15
0
        public SectionInfo(
			int id,
			string name,
			string title,
			SectionInfo parent,
			int order,
			bool visible,
			bool syndicated,
			string theme,
			string style,
			SectionModule module,
			string owner,
			DateTime touched,
			CommunityInfo community
			)
            : this(id,
			name,
			title,
			(parent == null) ? RootSection.Identity : parent.Identity,
			order,
			visible,
			syndicated,
			theme,
			style,
			module.Identity,
			owner,
			touched,
			community.Identity)
        {
        }
Example #16
0
        public override int GetSectionContainerLinkOrder(SectionInfo section, ContainerInfo container)
        {
            SectionContainerLink link = SectionContainerLink.GetBySectionIDAndContainerID(
                section.Identity,
                container.Identity
                );

            return (link.SectionID != 0 && link.ContainerID != 0) ? link.SortOrder : -1;
        }
Example #17
0
        public override int GetSectionContainerLinkPosition(SectionInfo section, ContainerInfo container)
        {
            SectionContainerLink link = SectionContainerLink.GetBySectionIDAndContainerID(
                section.Identity,
                container.Identity
                );

            return (link.SectionID != 0 && link.ContainerID != 0) ? link.Position : Int32.MinValue;
        }
Example #18
0
        public override void AddRoleForSection(string role, string[] tasks, SectionInfo section)
        {
            SectionRole dbrole = new SectionRole(
                section.Identity,
                role,
                String.Join(Common.Delimiter.ToString(), tasks)
                );

            try
            {
                // add role
                dbrole.CommitChanges();
            }
            catch (Exception) { }
        }
Example #19
0
 public override void RemoveModuleDataForSection(string name, SectionInfo section)
 {
     SectionProperty property = SectionProperty.GetBySectionIDAndPropertyGroupAndName(
         section.Identity,
         SectionModuleDataGroup,
         name
         );
     try
     {
         // delete property
         property.Delete();
         property.CommitChanges();
     }
     catch (Exception) { }
 }
Example #20
0
        public override void AddSectionContainerLink(SectionInfo section, ContainerInfo container, int order, int position)
        {
            SectionContainerLink link = new SectionContainerLink(
                section.Identity,
                container.Identity,
                order,
                position
                );

            try
            {
                // add combination
                link.CommitChanges();
            }
            catch (Exception) { }
        }
Example #21
0
        public override void RemoveSectionContainerLink(SectionInfo section, ContainerInfo container)
        {
            SectionContainerLink link = SectionContainerLink.GetBySectionIDAndContainerID(
                section.Identity,
                container.Identity
                );

            try
            {
                // delete combination
                link.Delete();
                link.CommitChanges();
            }
            catch (Exception) { }
        }
Example #22
0
 public override void CommitSectionChanges(SectionInfo section)
 {
     switch (section.State)
     {
         case State.Added :		// insert
             Section.Insert((Section)section);
             break;
         case State.Changed :	// commit changes
             Section.Update((Section)section);
             break;
         case State.Deleted :	// remove
             Section.Delete((Section)section);
             break;
     }
 }
Example #23
0
        public override void UpdateGeneralPropertyForSection(string name, string value, SectionInfo section)
        {
            SectionProperty property = SectionProperty.GetBySectionIDAndPropertyGroupAndName(
                section.Identity,
                SectionModuleDataGroup,
                name
                );
            property.Value = value;

            try
            {
                // update property
                property.CommitChanges();
            }
            catch (Exception) { }
        }
Example #24
0
        public override int[] GetContainersInPositionForSection(SectionInfo section, int position)
        {
            // get containers for specific section
            List<SectionContainerLink> links = SectionContainerLink.GetList("SectionID = " + section.Identity + " and Position = " + position);
            List<int> list = new List<int>(links.Count);

            foreach (SectionContainerLink link in links)
                list.Add(link.ContainerID);

            // return array of container ids
            return list.ToArray();
        }
Example #25
0
 public int GetPosition(SectionInfo section)
 {
     return Common.DatabaseProvider.GetSectionContainerLinkPosition(section, this);
 }
Example #26
0
        public override SectionMetaPropertyCollection GetMetaPropertiesForSection(SectionInfo section)
        {
            List<SectionProperty> properties = SectionProperty.GetList("SectionID = " + section.Identity + " and PropertyGroup = '" + SectionMetaPropertiesGroup + "'");
            NameValueCollection collection = new NameValueCollection(properties.Count);

            // add all rows to NameValueCollection
            foreach (SectionProperty property in properties)
                collection.Add(
                    property.Name,
                    property.Value
                    );

            // returns a property collection
            return new ManagedFusion.SectionMetaPropertyCollection(section, collection);
        }