Dynamic ImageBrowser directories

Last post 04-16-2009, 12:52 PM by BruceWMorgan. 5 replies.
Sort Posts: Previous Next
  •  04-08-2009, 12:52 PM 50887

    Dynamic ImageBrowser directories

    In our application, we have 3 different directories on the web app serverwhere a user can select image files to include in a document.
    1. Their own user directory.  The user can upload to this directory.
    2. A directory specific to the document they are creating or editing.  The user can upload to this directory.
    3. A global directory.  The user can only select from this directory; they cannot upload to it.

    We would like to be able to allow the users to select one of these directories on the "InsertImage.aspx" dialog using a dropdown list.  Is there a way to dynamically change the ImageBrowserDirectory during postback of the InsertImage.aspx page?

    Is there an alternative to doing it this way, perhaps by use of 3 different menu buttons on the editor?  That would not be our preference, but if it's the only possible way, we'll have to use it.
     
     
    Bruce
  •  04-08-2009, 1:24 PM 50891 in reply to 50887

    Re: Dynamic ImageBrowser directories

    Bruce,
     
    Please check this example.
     

    Programmatic Security

     
    The source code of this example can be found in the download package.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-10-2009, 1:09 AM 50962 in reply to 50891

    Re: Dynamic ImageBrowser directories

    Thanks, Adam, but that didn't quite get it.  That method works fine except that I need the folders to change without causing the parent page to do a postback.  That's why I had hopes that I could make the dialog page itself change to the selected directory, perhaps with a dropdown like below.  The example only shows how to make the change during a full postback of the page.
     
     
     
  •  04-13-2009, 8:30 AM 51022 in reply to 50962

    Re: Dynamic ImageBrowser directories

    Are there any more suggestions on this?
  •  04-13-2009, 1:04 PM 51029 in reply to 50962

    Re: Dynamic ImageBrowser directories

    Please open CuteSoft_Client\CuteEditor\Dialogs\InsertImage.aspx and modify the following code:
     
    1. protected override void InitOfType()   
    2.             {   
    3.                 this.Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);   
    4.                 string folder=secset.ImageBrowserPath;   
    5.                 if(folder==null||folder=="")folder=secset.ImageGalleryPath;   
    6.                 fs.VirtualRoot=CuteEditor.EditorUtility.ProcessWebPath(Context,null,folder).TrimEnd('/')+"/";   
    7.             }  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-16-2009, 12:52 PM 51170 in reply to 51029

    Re: Dynamic ImageBrowser directories

    I was hopeful that would work, Adam, but it seems that it just wouldn't let me change anything during a postback.  What I ended up doing was very hackish, but it works.  When the dropdown list changed and triggered a postback in the InsertImage.aspx, I have it testing for the value in the dropdownlist.  Depending on the value, I appended a new argument onto the querystring and then called a Response.Redirect to the new URL.  In effect, each time the user selects a different item in the dropdown, the page is refreshed twice:  once for the postback, then again for the Response.Redirect to get rid of the PostBack state.
     
    Is this something done by design?  As best I can tell, the CuteEditor.Dialogs.FileBrowserPage class is discarding any changes to the security settings if the page is in a PostBack operation.  The coding is painful and it really slows down the operation, but it will have to do.  The insert pages are just too complicated to try to reproduce in a custom dialog, so we'll have to settle for this.
     
     
View as RSS news feed in XML