How to open a popup defined on a external or database content (CMS for example)

How to open a popup defined on a external or database content (CMS for example)

  
How to open a popup editor(rich widgets) defined on a external or database content (CMS for example)

1
 - Add the new content and a link where you want to open the popup:   
<a href="http://server.com/eSpaceName/EntryPoint.aspx?Width=250&Height=500">TestLink</a>
 
2 - Next, you’ll need to define a global CSS class to use it on the defined link, for example: "internal_popup", and then add it to the link:
<a class="internal_popup" href="http://server.com/eSpaceName/EntryPoint.aspx?Width=250&Height=500">TestLink</a>
 
3 - In the next step, you’ll need to capture the onclick event for all the links defined with "internal_popup" class, for this create a simple javascrip code like this:
      
   $(document).ready(function(){
                $('.internal_popup').live('click',function(){
                                var width = getURLParameter('Width', $(this).attr('href'));
                                var height = getURLParameter('Height', $(this).attr('href'));
                                var OnlyUrl = $(this).attr('href'); //without parameters
                                if (OnlyUrl.indexOf("?")!=-1)
                                {
                                                OnlyUrl = OnlyUrl.substring(0,OnlyUrl.indexOf("?"));
                                }
                                var conf = OnlyUrl + ';' + width + ';' + height;
                                $('.popup_url').val(conf);
                                $('.popup_url').change();
                                return false;
                }); 
    } 
    
    function getURLParameter(param, url) { // This function is used to get the width and height value from the URL
                return unescape(
        (RegExp(param + '=' + '(.+?)(&Width|&Height|$)').exec(url)||[,''])[1]
       );
   };          
 
- In this code I got width and height values, next you’ll need to get only the URL without parameters;
- On the end concatenate all like this: "http://yourserver.com/eSpaceName/EntryPoint.aspx;250;500.
 
4 - In service studio, first of all on the webscreen, create a div and put inside an hidden button where you can pass the url and the rich widget popup editor web block to 
receive the button id, width and height.
 
5 - Create an input widget with class "popup_url", why create this? as you see on the bottom of the javascript code, there’s one onchange event to notify about the changes on the url. This input need to have a screen action bind it to the on change property, on this you’ll need to have a string split to get the url and the other parameters (width and height), after this you’ll need to refresh the div to apply the new settings, now simple use the widget_click on the button and the popup will appear. 
 
6 - At the end don't forget to clean the input widget.
 
Regards,
Hugo Pinheiro
Good job Hugo!

Moved it to the "Guides and How-tos" forum :)

Regards,

Paulo Tavares