This is a migrated thread and some comments may be shown as answers.

FileExplorer doesn't show files in the root folder

1 Answer 95 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 30 Sep 2010, 10:35 AM
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.

1 Answer, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 05 Oct 2010, 12:04 PM
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
Tags
FileExplorer
Asked by
Michael
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Share this question
or