Use FileDialog.aspx from Pages other than Editor

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
10/8/2009 4:51:41 PM
Gravatar
Total Posts 131

Use FileDialog.aspx from Pages other than Editor

First, let me say I love the new TinyMCE control and the image upload file dialog. I love it so much, that I want to use it from other pages, but not using the TinyMCE control.

I spent some time reviewing the AvatarUpload dialog as well, and noticed that the AvatarUpload dialog actually saves the image to the user object, instead of passing the value back to the page that called it, like the TinyMCE filedialog file appears to use javascript to pass back to the open dialog box.

My question is this, how do I use the filedialog popup (assume I'll make a copy and modify), but just pass the value back to the calling page. The reason I want to pass the value back is because the image selection is about halfway through a form being filled out, so I don't want to save and reload those values.

My AJAX skills are weak (I'm learning), so this may be easy, I just don't know where to start.

This would be worth a couple of beers, of course.

Oh, one more thing, how would you apply the style to the link calling the popup?

10/9/2009 12:36:56 PM
Gravatar
Total Posts 18439

Re: Use FileDialog.aspx from Pages other than Editor

If you make a copy and modify it you should be able to figure it out by looking at the existing code which has 3 different callbacks based on the 3 different editors which each have their own needs. So each editor is passing in a querystring param to tell the page which editor it is so it knows how to setup the correct javascript for the callback.

Basically you have to have a javascript method in the main page to receive the value and the dialog just calls window.opener.methodname(url) and then closes itself. methodname is the name of the javascript method in the parent page. The javascript method in your main page would store the url in a hidden field and or apply it to an <img src= in your page. Then on postback you get the value from the hidden field and persist it.

To open your custom dialog you might look at using the /Controls/GreyboxHyperlink to open it in a modal window. Then just style it as you would any other link by using a css class.

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.