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

Is it possible to set ViewPath on the client, or otherwise communicate with the Image Manager from the client?

5 Answers 73 Views
Editor
This is a migrated thread and some comments may be shown as answers.
LeBear
Top achievements
Rank 1
LeBear asked on 19 Jul 2011, 01:42 AM
I have a scenario where I'm editing the descriptions of products via an ajax-enabled UI where the user selects a product, and then edits the description for that product.  Each image has its own image gallery, which I am handling through a custom FileBrowserContent Provider in order to be able to provide access to the specific product's images while editing the description.

I've chosen to set the ViewPaths of the editor to tell the image manager which image library to access.

Since this is done via a completely Ajax-enabled interface, I need to be able to set the ViewPaths from the client when the user selects the product (at the same time an Ajax function is called to get the current description from the database and populate the editor with that content).

Of course, I'm open to any other suggestions for passing the Product ID to the Image Manager if there's a better way.

I thought of setting a session variable when the Ajax method is called, but that would interfere with the ability to have two windows open at the same time, and I'd prefer not to have that sort of limitation.

Thank you for your assistance.

5 Answers, 1 is accepted

Sort by
0
LeBear
Top achievements
Rank 1
answered on 19 Jul 2011, 09:11 PM
As a follow-on, is it possible to force a refresh when someone selects a folder from the image manager?

I'm using the session variable as a workaround for now, but when I select a new product, open the editor, and then select the image gallery, I see the images for the previous product.  I hit refresh, and they update to the current product.  Can I work this so that the user isn't forced to do a refresh each time?

BTW, I also was able to get a reference to the image gallery, but only if it has been opened once.  I used
var MyImageManager = MyEditor.getToolByName('ImageManager');

If I haven't loaded the image gallery at least once, this returns a null.  After that, it does give me a reference to an object. 

So, assuming I can pass some information to the image manager, I want to be able to force a refresh, and now I also want to know if I can get a reference to the image manager before the user has attempted to open it once.

Thank you.
0
Dobromir
Telerik team
answered on 21 Jul 2011, 03:31 PM
Hi Lebear,

It is not possible to modify the ViewPaths / DeletePaths / UploadPaths properties client-side. RadEditor is using RadFileExplorer to provide the file browsing functionality for its dialogs. The corresponding properties of the explorer can be set only server-side (or in the markup) and the latest moment of the page lifecycle where they can be modified is the Page_Load event.

For the described scenario I would suggest you to use the AJAX call used to populate the editor with the new data to change the value of the ViewPaths property. But you will need to do this in the Page_Load event, so to achieve this you need to check the control that initiates the AJAX request and according to it set the properties value. For your convenience I have attached a sample page demonstrating this approach.

Please note that in order to change the ViewPaths of the ImageManager, the RadEditor should be updated during the AJAX request, thus should be inside the updatepanel, and this will solve the issue with displaying the files for the previously selected product.

Best wishes,
Dobromir
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
LeBear
Top achievements
Rank 1
answered on 21 Jul 2011, 07:15 PM
Thank you for your assistance.

Unfortunately, I do not use update panels.  I prefer to use direct Ajax calls to web services or page methods.

For now, I will use the session to store the Product ID so that I can return the images for that product. 

I may continue to look at this, but I need a little more information.  I don't need to actually change the ViewPath if there is some other way to set a value somewhere client-side, and then access that from the FileBrowserContent Provider.

Is there a client-side event that fires when the image manager / file explorer opens, and is there a way to tap into this? 
Is there any way to force a refresh every time the user selects a folder?
When using the FileBrowserContent Provider, is there any way to access any other information about the editor or image manager, and if so, is there a way to set that on the client?

Thank you.
0
Dobromir
Telerik team
answered on 26 Jul 2011, 02:28 PM
Hi Lebear,

Yes, it is possible to access the page from within the content provider, please review the following KB article for an example:
Get reference to the Page object inside a custom FileBrowserContentProvider

Regarding the client-side event, you can use the OnClientCommandExecuting event and handle the ImageManager command to intercept the display of the dialog. However, because of the way RadEditor's built-in dialogs are displayed it will not be possible to force the RadFileExplorer to reload, which will be needed to reflect the changes in the session and / or any client-side modification on the page.

In order to implement the required functionality I would recommend you to implement a custom dialog to RadEditor that will fulfill the requirements. You can find a tutorial on how to implement a custom dialog in the following live demo:
Editor / Custom Dialogs

All the best,
Dobromir
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Trevor
Top achievements
Rank 1
answered on 30 Aug 2017, 07:47 PM
It has been 6 years since this post, is it possible to change the paths for the imagemanager from the client now without using updatepanels???
Tags
Editor
Asked by
LeBear
Top achievements
Rank 1
Answers by
LeBear
Top achievements
Rank 1
Dobromir
Telerik team
Trevor
Top achievements
Rank 1
Share this question
or