public override object GetDataSource()
        {
            LightboxFinder finder = new LightboxFinder();

            finder.IsPublic = true;
            finder.SortExpressions.Add(new AscendingSort(Lightbox.Columns.Name));
            return(Lightbox.FindMany(finder));
        }
        public override object GetDataSource()
        {
            Dictionary <Int32, String> ht = new Dictionary <int, string>();

            foreach (Lightbox lb in ContextInfo.LightboxManager.UserLightboxes)
            {
                // Filter out linked lightboxes if required

                if (!lb.IsLinked || !HideLinkedLightboxes)
                {
                    StringBuilder sb = new StringBuilder(lb.Name);

                    JoinableList jList = new JoinableList(", ");

                    if (lb.IsDefault)
                    {
                        jList.Add("default");
                    }

                    if (lb.IsPublic)
                    {
                        jList.Add("public");
                    }

                    if (lb.IsLinked)
                    {
                        jList.Add("linked");
                    }

                    if (jList.Count > 0)
                    {
                        sb.AppendFormat(" ({0})", jList);
                    }

                    ht[lb.LightboxId.GetValueOrDefault()] = sb.ToString();
                }
            }

            if (ShowPublicLightboxes)
            {
                // Initialise finder to get public lightboxes
                LightboxFinder finder = new LightboxFinder {
                    IsPublic = true
                };

                // Non-superadmins should only see public lightboxes which are assigned
                // to a brand to which they are also assigned (so a user cannot see lightboxes
                // assigned to brands to which they do not have access).
                if (SessionInfo.Current.User.UserRole != UserRole.SuperAdministrator && BrandManager.IsMultipleBrandMode)
                {
                    finder.BrandIdList.Add(0);
                    finder.BrandIdList.AddRange(SessionInfo.Current.User.Brands.Select(b => b.BrandId.GetValueOrDefault()));
                }

                // Get the lightboxes
                List <Lightbox> lightboxList = Lightbox.FindMany(finder);

                foreach (Lightbox lb in lightboxList)
                {
                    int lightboxId = lb.LightboxId.GetValueOrDefault();

                    // Check that the lightbox isn't already in the list
                    // (In case the current user has public lightboxes)
                    if (!ht.ContainsKey(lightboxId))
                    {
                        string lightboxName = string.Format("{0} (public)", lb.Name);
                        ht.Add(lightboxId, lightboxName);
                    }
                }
            }

            return(ht);
        }