- With width=100% - the border around the control is correct, but the grid extends beyond the border of the control width-wise and the addressbox does not go to 100%
- With width=640px - the border and the addressbox are correct, but the grid still extends beyond the border of the control width-wise
- With height=100% - the border of the control looks like it's about 100px high, and both the treeview and the grid extend beyond the border of the control height-wise
- With height=340px - the border shows the correct height, but both the tree and the grid still extend beyond their restrictions
8 Answers, 1 is accepted
For the first problem (explorer in splitter), please try the following workaround in the server code:
RadSplitter splitter = (RadSplitter)RadFileExplorer1.FindControl("splitter");
splitter.ResizeWithParentPane = false;
where RadFileExplorer1 is a reference to the file explorer control. I think this is a bug in the explorer code and the above code should fix it.
About issue #2, I am not really sure I understand the scenario. I assume that you have some function that takes either a RadEditor.DocumentManager or a RadFileExplorer.Configuration object and configures the View, Upload, Delete paths of that object. Is that the case? Are you using the default content provider or a custom one? In which place of the page lifecycle does this happen (Load, Init, etc.)?
Sincerely yours,
Lini
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I'll try the splitter bug work-around as you've suggested and let you know whether or not that worked. Is that something that will likely be fixed in future builds or is the work-around permanent?
You are correct about what I'm doing with the second problem, and to answer your questions:
1) I am using a custom FileSystemContentProvider, although it's only very slightly modified to allow for uploading of zip files:
Public Class MBSportsSystemContentProvider |
Inherits FileSystemContentProvider |
Public Sub New(ByVal context As HttpContext, ByVal searchPatters As String(), ByVal viewPaths As String(), ByVal uploadPaths() As String, ByVal deletePaths() As String, ByVal selectedUrl As String, ByVal selectedItemTag As String) |
MyBase.New(context, searchPatters, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag) |
End Sub |
Public Overrides Function StoreFile(ByVal file As UploadedFile, ByVal path As String, ByVal name As String, ByVal ParamArray arguments As String()) As String |
Dim relFolder As String = path |
Dim relFull = IO.Path.Combine(relFolder, name) |
Dim mapFolder As String = MyBase.Context.Server.MapPath(relFolder) |
Dim mapFull As String = MyBase.Context.Server.MapPath(relFull) |
If file.GetExtension = ".zip" Then |
Dim lastValidFile As String = "" |
Using ZIS As New ZipInputStream(file.InputStream) |
Dim ZE As ZipEntry = ZIS.GetNextEntry |
While Not IsNothing(ZE) |
Dim strDir As String = IO.Path.GetDirectoryName(ZE.Name) |
Dim strFil As String = IO.Path.GetFileName(ZE.Name) |
If strDir.Length > 0 Then |
IO.Directory.CreateDirectory(mapFolder & strDir) |
End If |
If strFil <> String.Empty Then |
If IsValidFileTypeAfterUnZip(ZE.Name) Then |
DeleteFileIfAlreadyExists(mapFolder & ZE.Name) |
lastValidFile = relFolder & ZE.Name |
Using FS As FileStream = IO.File.Create(mapFolder & ZE.Name) |
Dim i As Integer = 2048 |
Dim b As Byte() = New Byte(2048) {} |
While True |
i = ZIS.Read(b, 0, b.Length) |
If i > 0 Then |
FS.Write(b, 0, i) |
Else |
Exit While |
End If |
End While |
End Using |
End If |
End If |
ZE = ZIS.GetNextEntry |
End While |
End Using |
DeleteEmptyDirectoriesAfterZip(mapFolder) |
Return lastValidFile |
Else |
DeleteFileIfAlreadyExists(mapFull) |
file.SaveAs(mapFull) |
Return relFull |
End If |
End Function |
Private Sub DeleteFileIfAlreadyExists(ByVal mapFull As String) |
If IO.File.Exists(mapFull) Then |
IO.File.Delete(mapFull) |
End If |
End Sub |
Private Sub DeleteEmptyDirectoriesAfterZip(ByVal mapFolder As String) |
For Each Dir As String In IO.Directory.GetDirectories(mapFolder) |
DeleteEmptyDirectoriesAfterZip(Dir) |
If IO.Directory.GetFiles(Dir).Count = 0 And IO.Directory.GetDirectories(Dir).Count = 0 Then |
IO.Directory.Delete(Dir) |
End If |
Next |
End Sub |
Private Function IsValidFileTypeAfterUnZip(ByVal fileName As String) As Boolean |
Dim strExt As String = Right(fileName, fileName.Length - fileName.LastIndexOf(".")).ToLower |
If strExt = ".zip" Then |
Return False |
Else |
For Each s As String In MyBase.SearchPatterns |
s = Right(s, s.Length - s.LastIndexOf(".")).ToLower |
If s = strExt Then Return True |
Next |
End If |
Return False |
End Function |
End Class |
2) When the code is executed by a RadEditor, it is done in the PreRender event of that editor. In the custom dialog using a FileExplorer, it's executed during the Page_Load. I actually hadn't thought to try it elsewhere - thanks for refreshing my memory about that option. The reason I'm doing it in the PreRender of the editor had to do with a similar problem I was having with executing during Page_Load, so perhaps using the PreRender of the FileExplorer will fix it. I'll try it after lunch as post the results.
Thanks for the help! Be sure to update your Telerik points ;)
Shaun.
I tried the PreRender event of the RadFileExplorer and that did not work at all - no paths appeared to be set. So then I tried Page_Init and it worked as expected. Hopefully that extra info can help in determining whether this is a bug or expected.
In testing that out I also discovered another small bug:
- If you delete a folder that is currently selected it doesn't de-select that folder
- It tries to do a callback with that folder, and fails
- It also does not update the contents in the parent folder without having to manually refresh (which then refreshes the entire tree)
My suggestion would be to select the parent folder if one exists, and re-load the contents of that folder. If no parent exists then select a different root folder from the tree if one exists. If no other parent folders exist in the tree then it's a situation where there are no longer and ViewPaths and I'd suggest throwing a RadAlert saying that the explorer can no longer be used since there are no paths available.
For Problem #1, using the work-around you've suggested seems to have fixed the problem with setting the width (other than the address box, which we've dealt with in another thread). Setting the height seems to have issues still though. I'll be going through and checking to make sure that all parents have their heights set to allow for a 100% height; but with that said I can certainly live with manually setting the height - anybody with a resolution higher than 800 X 600 will have a good experience and the others can suffer as they should ;) In any case, I will make more attempts to get the 100% height sorted out since it may help others in the community.
Shaun.
www.mycal.ca/media/temp/fileexplorerdesignissues.png
Thanks for the report and suggestions related to deleting a folder. We logged this and will be taking care of it shortly.
We are glad to know that you were able to resolve your Issue #2 - indeed, calling your configuration code on PreRender is too late in the life cycle of the control - hence the reason for the problem. We will be adding this information to the RadFileExplorer documentation.
Let me summarize the list of reported issues so far that will be incorporated in the RadFileExplorer:
1. Width of the Address bar textbox will adjust automatically when RadFileExplorer Width = 100%
2. RadSplitter wrapper of RadFileExplorer will not resize automatically when the FileExplorer is nested in another splitter
As far your last screenshot goes - the only problem we were able to spot is the difference in the way the first item in the grid is aligned, when compared to the rest. If this is the case, another customer already reported this - and we will be addressing the problem shortly as well. The issue is related to the RadFileExplorer's current implementation which loads its initial folder from the server-side but then uses client binding for all subsequent requests. We are working on changing this and the change will be implemented soon as well.
With your help and the help of other community members that got to try this new control we have been able to make substantial progress in the last couple of weeks. Thank you very much for your help and efforts.
Greetings,
Tervel
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I just wanted to clarify that calling the code in the Page_Load event also does not work - albeit with different results than in PreRender:
PreRender (of the control) - no paths are set, therefore the tree is completely empty
Page_Load - all ViewPaths are properly set, but the UploadPaths and DeletePaths have strange functionality in that the "root" nodes of the tree work properly and all child nodes (subfolders) are read-only. This is particularly strange since I didn't think it was possible to define a parent folder as writeable and one of its subfolders as read-only.
The other thing that's a bit off with the screenshot provided was that there is no icon for the xlsX file extension, and I'm assuming the same would be true for pptx, docx and all the other Office2007 file extensions.
Overall this new control, and its usage within the dialogs of the RadEditor is truly fantastic and a huge improvement over prior versions. I'm glad that Telerik continues to see eye-to-eye with its customers regarding critical feedback as the best mechanism for improvement. It's probably the most important reason that Telerik is a great company with great products.
Shaun.
The FileBrowser's content provider is initialized in the OnLoad event. Whatever view/upload/delete paths are set at that point will be used by the control. To be on the safe side, you can try populating the paths in the Page_PreLoad event and see if it works then. If the child folders are behaving differently than the root ones, it is possible that you are not setting the correct paths on page postback(ajax request) or the control's ViewState is turned off.
About the file icons - I have added .xlsx and .pptx to the list of supported extensions so they should display the correct icons now.
All the best,
Lini
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
FYI, setting the paths in the Page_Init is working so I'll leave it there for now.