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

Issue with custom FileBrowserContentProvider

3 Answers 154 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Aleksandar
Top achievements
Rank 1
Aleksandar asked on 02 Dec 2008, 12:58 PM
I implemented custom FileBrowserContentProvider with the new RadControls (2008.03.1125.20), but I have an issue with Save As TextBox in ImageEditor. It shows the url of the item selected in ImageManager, but url is something like domainName.com/SomeFile.ashx?SomeQuery, which is not meaningfull for the user.
How can I change content of this TextBox from the base page (page I open dialogs from)? Or at least make it unvisible (worst solution). I fire dialogs from DialogOpener and I tried with DialogOpener.OnClientOpen event on client. I do not intent to include dialogs as aspx files, I want them to stay in dll.

Second question is how to get SelectedImage object of imageManager from base page in a DialogOpener.OnClientOpen event when opening ImageEditor?

Third question is when is FileBrowser stand alone control scheduled for and will it be based on existing FileBrowserContentProvider?

Regards,
Alex

3 Answers, 1 is accepted

Sort by
0
Nikolay Raykov
Telerik team
answered on 05 Dec 2008, 12:06 PM
Hi Aleksandar,

Regarding your first question about changing the url of the image - you could do that only if you provide a custom implementation of the dialog. There is a help page explaining how to do that:

http://www.telerik.com/help/aspnet-ajax/customizingimagedialog.html

You could find all dialogs in this folder EditorDialogs which is located in your RadControls installation folder. Copy the dialogs to a folder in your project and assign that folder's name to the ExternalDialogsPath property of the RadEdtior. You could then add a custom url and hide the default one or just hide the url text box.

About your second question - you can get the selected image url in the event handler function for the OnClientOpen event using the following code:

function onClientOpen(sender, args) 
{  
   var url = args._parameters.imageSrc; 
 
Regarding your third question - how to get SelectedImage object of imageManager... The FileExplorer is already a stand alone control and uses the same FileBrowserContentProvider the RadEditor is using. You can go to our demo pages to see it:

http://demos.telerik.com/aspnet-ajax/Editor/Examples/FileExplorer/Overview/DefaultCS.aspx

Greetings,
Nikolay Raykov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Aleksandar
Top achievements
Rank 1
answered on 05 Dec 2008, 01:49 PM
Hi Nikolay,
Your answers are not answering my quetions. I will try again:

-How do I get referrence to "Save As" text box (NOT image URL) in image editor from the page opening image manager? It can be at the moment DialogOpener.OnClientOpen is executed or any other time when image editor is fully populated. Again, not the URL of selected image, but reference to TextBox as object on imageeditor page.
Please note that I do not want to customise aspx pages for dialogs as that makes customisation of FileBrowserProvider very unclever. Plus it make distribution of final product based on your product more difficult.

-JavaScript you are presenting as solution to Question 2 is giving string (url), not reference to object (FileItem object).
Again: How can one get image (fileItem) object in a time of DialogOpener.OnClientOpen? I understand it can not be achieved through arguments of a given function (which is very unfortunate), but I am almost sure it can be picked up from the DOM somwhere.

-The file explorer question was not related to "how to get image object..." but to when is full version (not BETA) of file explorer scheduled for? 

I hope I was clearer this time.

Regards,
Alex


PS
Please note that ImageManager's "New Folder" dialog is firing "script window", which activates popup blocker in IE7. This is a major issue, which should be easy to sort out for you for the next release.
0
Nikolay Raykov
Telerik team
answered on 08 Dec 2008, 01:31 PM
Hello Aleksandar,

1)You can get a reference to the text box using the getElementById() function. You need only the id of the text box which you can see in the .ascx file. Here is a sample code showing how to get that reference:

function onClientOpen(sender, args) { 
  sender.get_container().add_pageLoad(function(e) { 
     var textbox = e.get_contentFrame().contentWindow.document.getElementById('NewImageName'); 
  }); 
  sender.get_container().add_show(function(e) { 
     var textbox = e.get_contentFrame().contentWindow.document.getElementById('NewImageName'); 
  }); 

In the event handler of the OnClientOpen event of the Dialog Opener you add two event handlers for the pageLoad and show events of the dialog. Page Load is fired only once when the dialog is opened for first time, but you need it because the first time the Show event is fired the DOM of the dialog is not available and you won't be able to get a reference to the text box. Keep in mind that this is not the recommended way to accomplish your scenario because there might occur some unexpected errors.

2) Getting the image object is a little bit trickier (if you want to get it in OnClientOpen from the Image Editor dialog it might not be available yet). What you can do, though, is when calling the Dialog Opener's open() function you could get the image object and add it to the arguments object. Add the image as a new property, for example if arguments is the object you will pass:

arguments.image = yourImageReference; 
dialogOpener.open('ImageEditor', arguments); 

Then in the OnClientOpen event handler you get the image reference using the code below:

var image = args.get_parameters().image; 

3) The File Explorer full version is scheduled for the next official release which will be in February.

4) If you have defined the Dialog Opener to use Classic Dialogs you might activate the popup blocker, because under the hood we are using the standard window.open() for new windows.

Regards,
Nikolay Raykov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Aleksandar
Top achievements
Rank 1
Answers by
Nikolay Raykov
Telerik team
Aleksandar
Top achievements
Rank 1
Share this question
or