0

open new Liferay porlet in a popup.

  • Asked - Jan 3, 2013, 11:06 AM
    / Viewed 41394 Times
    Hi,
    I have requirement in which i need to open a new porlet in a popup window.And is it possible to add a portlet in a popup window without adding it on any page.
    i use liferay 6.0.5 version.


    Regards
    Santhosh

    2 Answers

    0
    Answered - Apr 25, 2013, 07:51 AM
    (Edited)
    Hi,
    Try the following link:
    http://www.liferaysolution.com/2011/11/popup-in-liferay.html#.UXjfxLXIbsw
    Replied - Apr 25, 2013, 09:07 AM
    (Edited)
    Hi Alireza.....

    thanks for replying...... but where should i keep the code? in web form portlet view.jsp?
    and how to give the portlet id here in this case?

    thanks.....
    Replied - Jun 28, 2014, 06:39 PM
    (Edited)
    Hi, i have a similar requirement on Liferay version 6.1.2-ce-ga2. I need to open a web form portlet (such as feedback form) on click of button on the home page (in navigation menu), how to do it? Please help.
    1
    Answered - Jan 3, 2013, 11:11 AM
    (Edited)
    Hi Prakash,

    With help of Below code i'm able to get a popup but not the particular portlat.
    Please guide me

    function parentPage() {
    Liferay.YourPlugin.displayPopup("http://localhost:8089/web/guest/home?p_p_id=adddocumentportlet_WAR_adddocumentportlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view","HI");
    }

    AUI().use('aui-dialog', function(A) {
    Liferay.YourPlugin = {
    closePopup: function() {
    var instance = this;
    var popup = instance._getPopup();
    if (popup) {
    popup.hide();
    }
    },
    displayPopup: function(url, title) {
    alert("hi display");
    var instance = this;
    var popup = instance._getPopup();
    popup.show();
    popup.set('title', title);
    popup.io.set('uri', url);
    popup.io.start();
    },
    _getPopup: function() {
    var instance = this;
    if (!instance._popup) {
    instance._popup = new A.Dialog(
    {
    resizable: true,
    width: 600,
    xy: [150,150]
    }
    ).plug(
    A.Plugin.IO,
    {
    autoLoad: false
    }
    ).render();
    } return instance._popup;
    }
    }
    });


    Regards
    Santhosh
    Replied - Jan 11, 2013, 01:10 PM
    (Edited)
    It might be quite late, but here it is anyway if you have not yet figured it out.

    I have attached a zip file which contain source code for the following two portlets:
    1) ShowPopup
    2) testPopup

    You can just include the folders inside the zip in your plugin-portlet, build and deploy.

    The showPopup portlet contains the script which displays the testPopUp portlet inside a dialog-iframe. I have included two ways in which the opening of a pop-up is possible. Please go through view.jsp of this portlet and you would understand the script.

    The testPopup portlet need not be put on any page, this just needs to be deployed. Please go through the view.jsp and also the liferay-portlet.xml for this portlet, I have included some comments for explanation.

    The contents of the portlets are self-explanatory.

    Here are the steps to test:
    1) Put in the plugins-sdk the two folders
    2) Deploy the two portlets
    3) Add the showPopup portlet on any page
    4) Click on the links as mentioned in the view page itself
    5) Hurray! you see the test-portlet

    Also if you want to show any liferay portlet inside the pop-up than you need to include the portlet-id in the following property in your portal-ext.properties file:

    portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,87,88,103,113,145,164,166,170,177,my_portlet_ID


    Hope this helps.
    Replied - Apr 25, 2013, 07:08 AM
    (Edited)
    The above mentioned code and two portlets are not compatible with liferay CE 6.1.0 ??????

    I have a requirement similar to this......
    I need to open a web form portlet on click.
    and the button is present in theme, on click of which the web form should open...


    Please rply if anyone has any idea...... m in big trouble........ emoticon

    Thanks.....