コード例 #1
0
        internal static void Update_MapContainer_MarkerSourceActivities(MapContainer mapContainer, ActivityCollection localCollection, ActivityCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceActivityValue);
            var locationActivities =
                masterCollection.CollectionContent.Select(
                    activity => new { Activity = activity, Locations = activity.LocationCollection.GetIDSelectedArray() });
            Dictionary <string, LocationSpot> locDict = new Dictionary <string, LocationSpot>();

            foreach (var locAct in locationActivities)
            {
                foreach (var location in locAct.Locations)
                {
                    string       key = location.Location.GetLocationText();
                    LocationSpot locSpot;
                    locDict.TryGetValue(key, out locSpot);
                    if (locSpot == null)
                    {
                        locSpot = new LocationSpot {
                            LocationText = key, Location = location.Location
                        };
                        locDict.Add(key, locSpot);
                    }
                    locSpot.AddActivity(locAct.Activity);
                }
            }
            List <MapMarker> markers = new List <MapMarker>();

            foreach (var dictItem in locDict)
            {
                var locSpot = dictItem.Value;
                foreach (var catItem in locSpot.CategorizedActivites)
                {
                    MapMarker marker = MapMarker.CreateDefault();
                    marker.Location     = locSpot.Location;
                    marker.MarkerSource = MapMarker.MarkerSourceActivityValue;
                    marker.IconUrl      = GetIconUrlForCategory(catItem.CategoryName);
                    marker.CategoryName = GetMarkerCategoryName(catItem.CategoryName);
                    //marker.IconUrl = "../oip-additions/oip-assets/oip-images/oip-markers/OIP-marker-meeting.png";
                    marker.LocationText = locSpot.LocationText;
                    marker.SetLocationTextFromLocation(locSpot.Location);
                    marker.PopupTitle = catItem.GetCategoryTitle();
                    StringBuilder strBuilder = new StringBuilder();
                    foreach (var act in catItem.Activities)
                    {
                        ReferenceToInformation referenceToInformation = act.ReferenceToInformation;
                        appendMarkerLink(strBuilder, referenceToInformation);
                    }
                    marker.PopupContent = strBuilder.ToString();
                    markers.Add(marker);
                }
            }

            mapContainer.MapMarkers.CollectionContent.AddRange(markers);
        }
コード例 #2
0
 private static void appendMarkerLink(StringBuilder strBuilder, ReferenceToInformation referenceToInformation)
 {
     if (referenceToInformation == null || referenceToInformation.URL == null || referenceToInformation.Title == null)
     {
         return;
     }
     strBuilder.AppendFormat("<a class=\"oipmapmarkerlink\" href=\"javascript:void(0)\" onclick=\"OipOpenArticle(\\'{0}\\');\" >{1}</a><br>",
                             referenceToInformation.URL, referenceToInformation.Title.Replace("'", ""));
     //strBuilder.AppendFormat("<a class=\"oipmapmarkerlink\" href=\"javascript:void(0)\">{1}</a><br>",
     //                        referenceToInformation.URL, referenceToInformation.Title.Replace("'", ""));
 }
コード例 #3
0
        internal static void Update_MapContainer_MarkerSourceBlogs(MapContainer mapContainer, BlogCollection localCollection, BlogCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceBlogValue);
            var locationBlogs =
                masterCollection.CollectionContent.Select(
                    blog => new { Blog = blog, Locations = blog.LocationCollection.GetIDSelectedArray() });
            Dictionary <string, LocationSpot> locDict = new Dictionary <string, LocationSpot>();

            foreach (var locBlog in locationBlogs)
            {
                foreach (var location in locBlog.Locations)
                {
                    string       key = location.Location.GetLocationText();
                    LocationSpot locSpot;
                    locDict.TryGetValue(key, out locSpot);
                    if (locSpot == null)
                    {
                        locSpot = new LocationSpot {
                            LocationText = key, Location = location.Location
                        };
                        locDict.Add(key, locSpot);
                    }
                    locSpot.AddBlog(locBlog.Blog);
                }
            }
            List <MapMarker> markers = new List <MapMarker>();

            foreach (var dictItem in locDict)
            {
                var       locSpot = dictItem.Value;
                MapMarker marker  = MapMarker.CreateDefault();
                marker.Location     = locSpot.Location;
                marker.MarkerSource = MapMarker.MarkerSourceBlogValue;
                marker.IconUrl      = GetIconUrlForCategory("News");
                marker.CategoryName = GetMarkerCategoryName("News");
                marker.LocationText = locSpot.LocationText;
                marker.SetLocationTextFromLocation(locSpot.Location);
                marker.PopupTitle = "News";
                StringBuilder strBuilder = new StringBuilder();
                foreach (var blogItem in locSpot.Blogs)
                {
                    ReferenceToInformation referenceToInformation = blogItem.ReferenceToInformation;
                    appendMarkerLink(strBuilder, referenceToInformation);
                }
                marker.PopupContent = strBuilder.ToString();
                markers.Add(marker);
            }

            mapContainer.MapMarkers.CollectionContent.AddRange(markers);
        }
コード例 #4
0
ファイル: AddressAndLocation.cs プロジェクト: michlG/Caloom
 public void PerformBeforeStoreUpdate()
 {
     if (ReferenceToInformation == null)
     {
         ReferenceToInformation = ReferenceToInformation.CreateDefault();
     }
     ReferenceToInformation.Title = this.Location.LocationName;
     ReferenceToInformation.URL   = DefaultViewSupport.GetDefaultViewURL(this);
     if (String.IsNullOrEmpty(Location.Latitude.TextValue))
     {
         Location.Latitude.TextValue = "0";
     }
     if (String.IsNullOrEmpty(Location.Longitude.TextValue))
     {
         Location.Longitude.TextValue = "0";
     }
 }
コード例 #5
0
        public static void ExecuteMethod_UpdateAccountContainerMemberships(TBRGroupRoot groupRoot, Group currGroup, GroupSummaryContainer groupSummaryContainer, TBRAccountRoot accountRoot, AccountContainer accountContainer)
        {
            string currRootId             = groupRoot.Group.ID;
            string currReferenceUrlPrefix = String.Format("/auth/grp/{0}/", currRootId);
            var    currRoles = accountContainer.AccountModule.Roles;

            currRoles.MemberInGroups.CollectionContent.RemoveAll(
                refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix));
            currRoles.ModeratorInGroups.CollectionContent.RemoveAll(
                refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix));


            foreach (var acctRole in accountRoot.Account.GroupRoleCollection.CollectionContent.Where(role => role.GroupID == currRootId))
            {
                ReferenceToInformation reference = ReferenceToInformation.CreateDefault();
                reference.URL = string.Format("/auth/grp/{0}/website/oip-group/oip-layout-groups-edit.phtml",
                                              currRootId);
                reference.Title = currGroup.GroupName + " - " + acctRole.GroupRole;
                switch (acctRole.GroupRole.ToLower())
                {
                case "initiator":
                case "moderator":
                    currRoles.ModeratorInGroups.CollectionContent.Add(reference);
                    break;

                case "collaborator":
                case "viewer":
                    currRoles.MemberInGroups.CollectionContent.Add(reference);
                    break;
                }
            }
            currRoles.ModeratorInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle);
            currRoles.MemberInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle);
            // TODO: Update account summary
            //accountContainer.AccountSummary.GroupSummary
        }
コード例 #6
0
 private static int TitleComparer(ReferenceToInformation x, ReferenceToInformation y)
 {
     return String.Compare(x.Title, y.Title);
 }
コード例 #7
0
 private static int TitleComparer(ReferenceToInformation x, ReferenceToInformation y)
 {
     return(String.Compare(x.Title, y.Title));
 }
コード例 #8
0
ファイル: TBAccount.cs プロジェクト: michlG/Caloom
        public void StoreAccountToRoot()
        {
            TBRAccountRoot accountRoot = TBRAccountRoot.RetrieveFromDefaultLocation(this.ID);

            accountRoot.Account = this;
            StorageSupport.StoreInformation(accountRoot);
            return;

            AccountContainer accountContainer = AccountContainer.RetrieveFromOwnerContent(this, "default");

            if (accountContainer == null)
            {
                accountContainer = AccountContainer.CreateDefault();
                accountContainer.SetLocationAsOwnerContent(this, "default");
            }
            accountContainer.AccountModule.Security.LoginInfoCollection = this.Logins;
            foreach (var loginItem in this.Logins.CollectionContent)
            {
                string       loginRootID = TBLoginInfo.GetLoginIDFromLoginURL(loginItem.OpenIDUrl);
                TBRLoginRoot loginRoot   = TBRLoginRoot.RetrieveFromDefaultLocation(loginRootID);
                loginRoot.Account = this;
                StorageSupport.StoreInformation(loginRoot);
                // TODO: Remove invalid group role logins at this stage
                foreach (var groupRoleItem in this.GroupRoleCollection.CollectionContent.Where(grpRole => TBCollaboratorRole.IsRoleStatusValidMember(grpRole.RoleStatus)))
                {
                    string            loginGroupID   = TBRLoginGroupRoot.GetLoginGroupID(groupRoleItem.GroupID, loginRootID);
                    TBRLoginGroupRoot loginGroupRoot = TBRLoginGroupRoot.RetrieveFromDefaultLocation(loginGroupID);
                    if (loginGroupRoot == null)
                    {
                        loginGroupRoot    = TBRLoginGroupRoot.CreateDefault();
                        loginGroupRoot.ID = loginGroupID;
                        loginGroupRoot.UpdateRelativeLocationFromID();
                    }
                    loginGroupRoot.GroupID = groupRoleItem.GroupID;
                    loginGroupRoot.Role    = groupRoleItem.GroupRole;
                    StorageSupport.StoreInformation(loginGroupRoot);
                }
            }
            //accountContainer.AccountModule.Security.EmailCollection = this.Emails;
            foreach (var emailItem in this.Emails.CollectionContent)
            {
                string       emailRootID = TBREmailRoot.GetIDFromEmailAddress(emailItem.EmailAddress);
                TBREmailRoot emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);
                if (emailRoot == null)
                {
                    emailRoot    = TBREmailRoot.CreateDefault();
                    emailRoot.ID = emailRootID;
                    emailRoot.UpdateRelativeLocationFromID();
                }
                emailRoot.Account = this;
                StorageSupport.StoreInformation(emailRoot);
            }
            var roles = accountContainer.AccountModule.Roles;

            roles.MemberInGroups.CollectionContent.Clear();
            roles.ModeratorInGroups.CollectionContent.Clear();
            foreach (var groupRoleItem in this.GroupRoleCollection.CollectionContent)
            {
                var groupRoot = TBRGroupRoot.RetrieveFromDefaultLocation(groupRoleItem.GroupID);
                if (groupRoot == null)
                {
                    continue;
                }
                var grp = groupRoot.Group;
                ReferenceToInformation reference = ReferenceToInformation.CreateDefault();
                reference.URL = string.Format("/auth/grp/{0}/website/oip-group/oip-layout-groups-edit.phtml",
                                              groupRoot.ID);
                reference.Title = grp.Title + " - " + groupRoleItem.GroupRole;
                switch (groupRoleItem.GroupRole.ToLower())
                {
                case "initiator":
                case "moderator":
                    roles.ModeratorInGroups.CollectionContent.Add(reference);
                    break;

                case "collaborator":
                case "viewer":
                    roles.MemberInGroups.CollectionContent.Add(reference);
                    break;
                }
            }
            StorageSupport.StoreInformation(accountContainer);
        }