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

[Solved] Multiple ImageManager Dialogs w/custom ContentProviders

3 Answers 110 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Eric Fernando
Top achievements
Rank 1
Eric Fernando asked on 10 Nov 2009, 07:03 PM
I have 2 image libraries that I would like to be able to insert images into the Editor from.

I have written 2 custom FileBrowserContentProviders.

I can get the existing ImageManager toolbar button to work with the  custom ContentProviders.

I would like to add a 2nd toolbar button to access the other image library. I would like it to use the same FileBrowser dialog and return the same img information (alt text, longdesc, etc).

I have looked at the examples for adding custom dialogs, but would like to use the existing FileBrowser dialogs.

I have also looked at the RadDialogOpener, and was able to open the FileBrowser dialog from a button.

Any help is appreciated. Thanks.
Eric

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Nov 2009, 09:54 AM
Hello Eric,

You are on the right track. Since you can have only one file browser content provider in RadEditor, the solution is to use RadDialogOpener and create a FileBrowserContentProvider for it too. You can open the RadDialogOpener control from a link / button outside of the editor. If you would like you can create a custom editor's button that will click programmatically the external link / button outside of the editor and hide the external link / button with style="display:none". Therefore you will have two FileBrowserContentProviders in RadEditor.

Best regards,
Rumen
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.
0
Eric Newton
Top achievements
Rank 1
answered on 20 Nov 2009, 04:05 PM
Eric, how did you end up doing this?  I'm building for a client a way to browse local images (file system) and photos in Picasa via a PicasaProvider...

Will probably need to do a double imagemanager but I'm stuck...
0
Eric Fernando
Top achievements
Rank 1
answered on 20 Nov 2009, 04:20 PM
It ended up being a lot easier than I thought, once I found the RadEditor.DialogOpener. ;-)

In the Page_Load, set up your FileManagerDialogParameters and DialogDefinitions, then add them to the RadEditor.

protected

 

void Page_Load(object sender, EventArgs e)

 

{

 

FileManagerDialogParameters corporateFileManagerParameters = new FileManagerDialogParameters();

 

corporateFileManagerParameters.ViewPaths =

new string[] { "Corporate Library" };

 

corporateFileManagerParameters.UploadPaths =

new string[] { "~/Uploads" };

 

corporateFileManagerParameters.DeletePaths =

new string[] { "~/Uploads" };

 

corporateFileManagerParameters.MaxUploadFileSize = 5000000;

 

// If you don't set the following property, the default value will be used

 

 

//corporateFileManagerParameters.SearchPatterns = new string[] { "*.jpg,*.gif,*.png" };

 

corporateFileManagerParameters.FileBrowserContentProviderTypeName =

typeof(CorporateMediaLibraryContentProvider).AssemblyQualifiedName;

 

 

DialogDefinition corporateImageManagerDialog = new DialogDefinition(typeof(ImageManagerDialog), corporateFileManagerParameters);

 

corporateImageManagerDialog.ClientCallbackFunction =

"OnFileSelected";

 

corporateImageManagerDialog.Width =

Unit.Pixel(694);

 

corporateImageManagerDialog.Height =

Unit.Pixel(440);

 

 

//If you need to customize the dialog then register the external dialog files

 

 

//corporateImageManagerDialog.Parameters["ExternalDialogsPath"] = "~/EditorDialogs/";

 

RadEditor1.DialogOpener.DialogDefinitions.Add(

"CorporateImageManager", corporateImageManagerDialog);

 

 

FileManagerDialogParameters localFileManagerParameters = new FileManagerDialogParameters();

 

localFileManagerParameters.ViewPaths =

new string[] { "My Library" };

 

localFileManagerParameters.UploadPaths =

new string[] { "~/Uploads" };

 

localFileManagerParameters.DeletePaths =

new string[] { "~/Uploads" };

 

localFileManagerParameters.MaxUploadFileSize = 5000000;

 

// If you don't set the following property, the default value will be used

 

 

//localFileManagerParameters.SearchPatterns = new string[] { "*.jpg,*.gif,*.png" };

 

localFileManagerParameters.FileBrowserContentProviderTypeName =

typeof(LocalMediaLibraryContentProvider).AssemblyQualifiedName;

 

 

DialogDefinition localImageManagerDialog = new DialogDefinition(typeof(ImageManagerDialog), localFileManagerParameters);

 

localImageManagerDialog.ClientCallbackFunction =

"OnFileSelected";

 

localImageManagerDialog.Width =

Unit.Pixel(694);

 

localImageManagerDialog.Height =

Unit.Pixel(440);

 

 

//If you need to customize the dialog then register the external dialog files

 

 

//localImageManagerDialog.Parameters["ExternalDialogsPath"] = "~/EditorDialogs/";

 

RadEditor1.DialogOpener.DialogDefinitions.Add(

"LocalImageManager", localImageManagerDialog);

 

}



Then just add your buttons (tools) to the RadEditor.

<

 

telerik:RadEditor ID="RadEditor1" runat="server">

 

 

<Content>

 

 

</Content>

 

 

<Tools>

 

 

<telerik:EditorToolGroup>

 

 

<telerik:EditorTool Name="CorporateMediaLibrary" Text="Corporate Media Library" />

 

 

<telerik:EditorTool Name="MyMediaLibrary" Text="My Media Library" />

 

 

</telerik:EditorToolGroup>

 

 

</Tools>

 

 

</telerik:RadEditor>

 


Tags
Editor
Asked by
Eric Fernando
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Eric Newton
Top achievements
Rank 1
Eric Fernando
Top achievements
Rank 1
Share this question
or