FileBrowserContentProvider - Getting selected image folders to load

4 posts, 0 answers
  1. Bob Paul
    Bob Paul avatar
    7 posts
    Member since:
    Dec 2009

    Posted 09 Dec 2009 Link to this post

    Hi

    I'm implementing a custom FileBrowserContentProvider so that I can access images from a db instead of a filesystem and it is all working fine. I convert the the db images to relative paths and insert them in the page. The folders and files all load up correctly.

    The only problem I have is that when I select an image and click on the Image Manager button I cannot get it to open the folders to the selected image. And yet if I navigate to the folder the image is in, the image is shown as selected and shows in the preview pane.

    So the image is selected properly but it does not seem to be firing ResolveRootDirectoryAsTree to open the folders in the path to it.

    The code I got from telerik has notes that indicate "all subdirectories contained in the SelectedUrl property are loaded"

    But they don't load.

    Is this a bug or have I missed something?

     

    ''' <summary>

     

     

    ''' Loads a root directory with given path, where all subdirectories

     

     

    ''' contained in the SelectedUrl property are loaded

     

     

    ''' </summary>

     

     

    ''' <remarks>

     

     

    ''' The ImagesPaths, DocumentsPaths, etc properties of RadEditor

     

     

    ''' allow multiple root items to be specified, separated by comma, e.g.

     

     

    ''' Photos,Paintings,Diagrams. The FileBrowser class calls the

     

     

    ''' ResolveRootDirectoryAsTree method for each of them.

     

     

    ''' </remarks>

     

     

    ''' <param name="path">the root directory path, passed by the FileBrowser</param>

     

     

    ''' <returns>The root DirectoryItem or null if such does not exist</returns>

     

     

    Public Overloads Overrides Function ResolveRootDirectoryAsTree(ByVal path As String) As DirectoryItem

     

     

    ' The files are added in ResolveDirectory()

     

     

     

     

    Dim returnValue As New DirectoryItem(GetName(path), GetDirectoryPath(path), path, String.Empty, GetPermissions(path), Nothing, _

     

    GetChildDirectories(path))

     

    Return returnValue

     

     

    End Function

     


    thanks

    Bob paul


  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 09 Dec 2009 Link to this post

    Hi Bob Paul,

    The provided information is not enough for me to determine the reason for the problem, but I recommend you to compare your code with the one used in this online demo. Also I recommend to check this code library that contains runnable projects (for  RadFileExplorer and RadEditor controls) that can be connected to a SQL Database. The used provider in the code library is the same as the one used in the online demo.

    I hope this helps.


    Greetings,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Bob Paul
    Bob Paul avatar
    7 posts
    Member since:
    Dec 2009

    Posted 09 Dec 2009 Link to this post

    Thanks Fiko

    That online demo doesn't show the functionlaity I'm looking for which is using the ImageManager button in radeditor.

    And that code libray is what I am using.

    If I insert an image using the image button into the text and then click on the image and click on the Image manager button - then i was hoping to open the folders as necessary to show the selected image in the file list in the central pane in the image m,anager.

    However I cannot find a demo of radeditor with Image manager which has this functionalty - so maybe it nerver worked. I just thought it might be possible because the notes in the code library suggested that that is what it was supposed to do.

    None of the following demos seem to open folders as necessary to show the slected image in the central file list

    e.g. take this one
    http://demos.telerik.com/aspnet-ajax/editor/examples/dbfilebrowsercontentprovider/defaultcs.aspx

    1.click somewhere in the text
    2.click on the image manager button
    3.click on folder 1 to open it
    4.click on folder 2 to open it
    5.select 3002.jpg
    6.click on insert
    7.select the image in the text window and click on image button (you may have to scroll up as the image is a layer above the buttons)

    when the image manager dialogue opens, folder 1 is unopened and the selected file is not in the file list or the preview pane. You need to open folder 1 and then folder 2 to navigate back into the same folder as the slected image
  4. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 14 Dec 2009 Link to this post

    Hello Bob,

     The behavior that you experience is the expected one because we use the URL of the selected item in order to restore the selection. When a custom provider is used however, the URL is different than the ItemPath. For example the paths of the items in your scenario (when the DBProvider is used) is similar to this one :

    /AplicationROOTDir/Handler.ashx?path=ROOT%252fImages%252fNature%252fAnimals%252fDoggies.jpg


    In your case you need to implement this steps in order to achieve the desired result:
    • attach an External dialog
    • In the external dialog extract the path from the passed URL
    • Assign the path to the InitialPath property of the RadFileExplorer control
    For your convenience I have attached a demo to this thread.

    I hope this helps.
    Regards,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top