Hi,
I am implemting a custom FileBrowserContentProvider for the ImageManager of the RadEditor. The purpose of this customer provider is to ensure the images inserted in the content of RadEditor can only we read if the user has logged on to the website and has sufficiant rights. Having that wish just a browsable virutal directory is not an option since the users are also located outside the domain.
During Implementation I found a very nasty problem which I can't solve.. I' am implemting the Telerik.Web.UI.Widgets.FileBrowserContentProvider interface. My problem is.. I build up all the stuff needed (see code below). But when using the ImageManager the tree on the left side is displayed perfectly. The content of the folders is also visible. But when clicking on a image in the content view of the folder only the content of the top image is displayed.
For example I have the folder :
Windows Images
- Koala.jpg
- Desert.jpg
- Flower.jpg
When I click on Koala and Insert, the Koala picture is shown, and inserted in the RadEditor. When I click on Desert, the Koala picture is shown and inserted in the RadEditor. When I click on Flower the Koala picture is shown and inserted.
What is going on here? The generated urls for the Images are 100% correct and shown correctly when I invoke the url of the image directly. When I consult the debugger the content of the FIleItem aray is also correct. Please Help me!
Martijn,
PS. Keep up the good work!
I am implemting a custom FileBrowserContentProvider for the ImageManager of the RadEditor. The purpose of this customer provider is to ensure the images inserted in the content of RadEditor can only we read if the user has logged on to the website and has sufficiant rights. Having that wish just a browsable virutal directory is not an option since the users are also located outside the domain.
During Implementation I found a very nasty problem which I can't solve.. I' am implemting the Telerik.Web.UI.Widgets.FileBrowserContentProvider interface. My problem is.. I build up all the stuff needed (see code below). But when using the ImageManager the tree on the left side is displayed perfectly. The content of the folders is also visible. But when clicking on a image in the content view of the folder only the content of the top image is displayed.
For example I have the folder :
Windows Images
- Koala.jpg
- Desert.jpg
- Flower.jpg
When I click on Koala and Insert, the Koala picture is shown, and inserted in the RadEditor. When I click on Desert, the Koala picture is shown and inserted in the RadEditor. When I click on Flower the Koala picture is shown and inserted.
What is going on here? The generated urls for the Images are 100% correct and shown correctly when I invoke the url of the image directly. When I consult the debugger the content of the FIleItem aray is also correct. Please Help me!
Martijn,
PS. Keep up the good work!
| public override DirectoryItem ResolveDirectory(string path) |
| { |
| // First get the base path |
| string strBasePath = ConfigurationManager.AppSettings["MediaManagerPath"]; |
| DirectoryInfo Directory = new DirectoryInfo(strBasePath + path); |
| FileInfo[] Info = Directory.GetFiles(); |
| FileItem[] Files = new FileItem[Info.Length]; |
| List<DirectoryItem> Subs = new List<DirectoryItem>(); |
| for(int Index = 0; Index < Info.Length; Index++) |
| { |
| string ImageUrl = Security.GetWebsiteRootUrl(Context.Request) + "Gui/ContentManagement/File.aspx?Path=" + HttpUtility.UrlEncode(Info[Index].FullName.Replace(strBasePath, string.Empty)); |
| string ImageThumbUrl = Security.GetWebsiteRootUrl(Context.Request) + "Gui/ContentManagement/File.aspx?Size=thumb&Path=" + HttpUtility.UrlEncode(Info[Index].FullName.Replace(strBasePath, string.Empty)); |
| Files[Index] = new FileItem(Info[Index].Name, Info[Index].Extension, Info[Index].Length, path, ImageUrl,string.Empty, PathPermissions.Delete | PathPermissions.Read | PathPermissions.Upload); |
| } |
| // Ensure we replace the base path so it can not be used for reading the entire file system |
| return new DirectoryItem(Directory.Name, Directory.FullName.Replace(strBasePath, string.Empty), Directory.FullName.Replace(strBasePath, string.Empty), string.Empty , PathPermissions.Delete | PathPermissions.Read | PathPermissions.Upload, Files, Subs.ToArray()); |
| } |
| public override DirectoryItem ResolveRootDirectoryAsTree(string path) |
| { |
| // First get the base path |
| string strBasePath = ConfigurationManager.AppSettings["MediaManagerPath"]; |
| // Define all the variables |
| DirectoryInfo Directory = new DirectoryInfo(strBasePath + path); |
| FileItem[] Files = { }; |
| DirectoryItem[] SubDirs = {}; |
| DirectoryInfo[] SubDirectories = Directory.GetDirectories(); |
| List<DirectoryItem> Subs = new List<DirectoryItem>(); |
| foreach (DirectoryInfo Info in SubDirectories) |
| { |
| Subs.Add(ResolveDirectory(Info.FullName.Replace(strBasePath, string.Empty))); |
| } |
| // Ensure we replace the base path so it can not be used for reading the entire file system |
| return new DirectoryItem(Directory.Name, Directory.FullName.Replace(strBasePath, string.Empty), Directory.FullName.Replace(strBasePath, string.Empty), string.Empty, PathPermissions.Delete | PathPermissions.Read | PathPermissions.Upload, Files, Subs.ToArray()); |
| } |
