예제 #1
0
        // Looking inside a folder
        public MediaTree(IFolder folder, int level, LibrariesManager libMgr)
        {
            this.root     = folder;
            this.libMgr   = libMgr;
            this.filterIn = true;
            if (level <= 0)
            {
                items   = new List <MediaContent>();
                folders = new List <MediaTree>();
                return;
            }

            if (this.root is Library)
            {
                items = libMgr.GetChildItems(root).Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live &&
                                                         i.Parent.Id == root.Id &&
                                                         i.FolderId == null &&
                                                         i.Visible).ToList();
                folders = libMgr.GetChildFolders(root).Where(f => f.ParentId == null).Select <IFolder, MediaTree>(f => new MediaTree(f, level - 1, libMgr)).ToList();
            }
            else
            {
                items = libMgr.GetChildItems(root).Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live &&
                                                         i.FolderId == root.Id &&
                                                         i.Visible).ToList();
                folders = libMgr.GetChildFolders(root).Where(f => f.ParentId == root.Id).Select <IFolder, MediaTree>(f => new MediaTree(f, level - 1, libMgr)).ToList();
            }
        }