FileExplorer doesn't show files in the root folder

2 posts, 0 answers
  1. Michael
    Michael avatar
    12 posts
    Member since:
    Jul 2010

    Posted 30 Sep 2010 Link to this post

    Hi all!

    I cannot make FileExplorer to show files and folders in the root folder. Everything is OK for child folders.

    I have custom FileBrowserContentProvider:
         
    public override DirectoryItem ResolveRootDirectoryAsTree(string path)
    {
      Assert.ArgumentNotNull(path, "path");
          if (path.Length == 0)
         {
            path = "/media library/";
         }
       Item item = GetItem(path);
         if (item == null)
         {
        return null;
      }
       PathPermissions permissions = GetPermissions(item);
       DirectoryItem result = new DirectoryItem(item.DisplayName, GetParentPath(item), string.Empty, string.Empty, permissions, GetChildFiles(item), GetChildDirectories(item));
       return result;
    }
    static DirectoryItem[] GetChildDirectories(Item item)
      {
      Assert.ArgumentNotNull(item, "item");
       List<DirectoryItem> result = new List<DirectoryItem>();
          foreach (Item child in item.Children)
         {
            if (child.TemplateID != TemplateIDs.MediaFolder)
            {
          continue;
        }
     
        PathPermissions permissions = GetPermissions(child);
         DirectoryItem directoryItem = new DirectoryItem(child.Name, string.Empty, child.Paths.Path, string.Empty, permissions, null, null);
         result.Add(directoryItem);
      }
       return result.ToArray();
    }
    public override DirectoryItem ResolveDirectory(string path)
    {
      Assert.ArgumentNotNull(path, "path");
      Item item = GetItem(path);
      if (item == null)
      {
        return null;
      }
      PathPermissions permissions = GetPermissions(item);
      return new DirectoryItem(item.DisplayName, string.Empty, item.Paths.Path, string.Empty, permissions, GetChildFiles(item), null);
    }

    static FileItem[] GetChildFiles(Item item)
    {
      Assert.ArgumentNotNull(item, "item");
       List<FileItem> result = new List<FileItem>();
       foreach (Item child in item.Children)
      {
        if (child.TemplateID == TemplateIDs.MediaFolder)
        {
          continue;
        }
         PathPermissions permissions = GetPermissions(child);
         MediaItem mediaItem = child;
         MediaUrlOptions options = new MediaUrlOptions();
         options.UseItemPath = false;
         string url = MediaManager.GetMediaUrl(child, options);
         FileItem directoryItem = new FileItem(child.Name + "." + mediaItem.Extension, mediaItem.Extension, mediaItem.Size, string.Empty, url, string.Empty, permissions);
         result.Add(directoryItem);
      }
       return result.ToArray();
    }
    Any help will be appreciated.
  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 05 Oct 2010 Link to this post

    Hi Michael,

    Could you please make sure that the 'result' returned by the ResolveRootDirectoryAsTree and ResolveDirectory methods contains the corresponding folders/files? Also, if you use a verso 2010.2.826 and later, then I recommend you to override the CheckReadPermissions method as well in order to make sure that the custom provider will work properly with the RadFileExplorer control.

    Regards,
    Fiko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top