Foros de discusión

Popup in Liferay 6

Andreas S, modificado hace 13 años.

Popup in Liferay 6

New Member Mensajes: 20 Fecha de incorporación: 26/10/10 Mensajes recientes
My popup code isn't working anymore in Liferay 6.

var popup = Liferay.Popup({title:"Login",modal:true,width:400,center:true});
jQuery(popup).load(url, {});


I searched a little and saw that jquery has been replaced by Alloy.

I checked Alloy and saw a dialog module which looked similar but when I took a look at the API I didn't see a way to use a url in the popup (just text in bodyContent).

Anyone have any ideas?
thumbnail
jelmer kuperus, modificado hace 13 años.

RE: Popup in Liferay 6

Liferay Legend Mensajes: 1191 Fecha de incorporación: 10/03/10 Mensajes recientes

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) {
				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: false,
							width: 600,
							xy: [15,15]
						}
					).plug(
						A.Plugin.IO,
						{autoLoad: false}
					).render();
				}

				return instance._popup;
			}
		}
	}
);



Liferay.YourPlugin.displayPopup('/your/url');
Brahim TARNAOUI, modificado hace 13 años.

RE: Popup in Liferay 6

Junior Member Mensajes: 64 Fecha de incorporación: 15/06/10 Mensajes recientes
Hi,


just i copy/paste your code, but is not executed.
can you explain me howto execute your code, if i will add some library or other.
and how can'i put the data in the popup using urlData attribute?

thx
thumbnail
ankit yakkundi, modificado hace 13 años.

RE: Popup in Liferay 6

Regular Member Mensajes: 221 Fecha de incorporación: 5/03/10 Mensajes recientes
hi..
can you please explain the steps which i need to follow to get the pop up portlet ie which files i need to use or change.
i want to create simple pop up when will be opened when a button is clicked from the portlet.

Thanks in advance..
Any idea or suggestions are welcome..
thumbnail
ankit yakkundi, modificado hace 13 años.

RE: Popup in Liferay 6

Regular Member Mensajes: 221 Fecha de incorporación: 5/03/10 Mensajes recientes
hi.
I am able to open the popup,but i wanted to know how can i give the url of the another portlet.for example if i have portlet called a-portlet and b-portlet in webapps.i want to open b-portlet as popup to a-portlet then i have url as "/b-portlet/view.jsp..

the popup shows "Failed to retrieve content".

Can you help me on this.

Any help or idea are welcome.
Thanks in advance.
Yan Naing Oo, modificado hace 12 años.

RE: Popup in Liferay 6

Regular Member Mensajes: 179 Fecha de incorporación: 17/02/11 Mensajes recientes
jelmer kuperus:

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) {
				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: false,
							width: 600,
							xy: [15,15]
						}
					).plug(
						A.Plugin.IO,
						{autoLoad: false}
					).render();
				}

				return instance._popup;
			}
		}
	}
);



Liferay.YourPlugin.displayPopup('/your/url');



Hi jelmer ,

If i want to to display when the home page is come out the popup will display. how can i do this ? could you please describe me by step ?

thanks
thumbnail
delang j, modificado hace 12 años.

RE: Popup in Liferay 6

Expert Mensajes: 252 Fecha de incorporación: 14/07/08 Mensajes recientes
hi,
thanks for the code, right now it working fine in my custom portlet.
but new issue arise, how do i set position of pop up from top?
i did tried
centered: true,

and
xy: ['center',10]


but failed.
am i missing something.

below is my code
<portlet:renderurl var="suggestNewPlaceURL" windowstate="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
	<portlet:param name="jspPage" value="/suggest.jsp" />
</portlet:renderurl>
&lt;%
	String newPopup = "Liferay.test.displayPopup('" + suggestNewPlaceURL.toString() + "');";
%&gt;

<aui:button-row>
	<aui:button onClick="<%= newPopup %>" value="suggest-new-place" />
</aui:button-row>

<script type="text/javascript">
AUI().use('aui-dialog', function(A) {
    
    Liferay.test = {

        closePopup: function() {
            var instance = this;

            var popup = instance._getPopup();

            if (popup) {
                popup.hide();
            }
        },

        displayPopup: function(url) {
            var instance = this;

            var popup = instance._getPopup();

            popup.show();
            popup.io.set('uri', url);
            popup.io.start();
        },

        _getPopup: function() {
            var instance = this;

            if (!instance._popup) {
                instance._popup = new A.Dialog(
                    {
                    	title: "suggest-new-place",
                        resizable: false,
                        centered: true,
                        destroyOnClose: true,
                        width: 600,
                        xy: ['center',10]
                    }
                ).plug(
                    A.Plugin.IO,
                    {autoLoad: false}
                ).render();
            }

            return instance._popup;
        }
    }
});
</script>


thanks.
thumbnail
jelmer kuperus, modificado hace 12 años.

RE: Popup in Liferay 6

Liferay Legend Mensajes: 1191 Fecha de incorporación: 10/03/10 Mensajes recientes
In my example code you see these lines :

instance._popup = new A.Dialog(
	{
		resizable: false,
		width: 600,
		xy: [15,15]
	}


if you change xy: [15,15] to centered: true it will center the dialog to the middle of the screen

if you change xy: [15,15] to align: { node: null, points: [A.WidgetPositionAlign.TC, A.WidgetPositionAlign.TC] } it will align the dialog to the top center of the screen
Enrique Ruiz (DiSiD), modificado hace 12 años.

RE: Popup in Liferay 6

New Member Mensaje: 1 Fecha de incorporación: 11/09/07 Mensajes recientes
Hi all,

There is a little bug in jelmer's code, missing ;

Below the fix:

closePopup: function() {
                var instance = this;
                var popup = instance._getPopup();


Regards
thumbnail
Danial Mustofa Habibi, modificado hace 12 años.

RE: Popup in Liferay 6

Regular Member Mensajes: 141 Fecha de incorporación: 1/11/11 Mensajes recientes
Hi there how To pass paramater between page ???in pop Up???
thumbnail
me liferay, modificado hace 11 años.

RE: Popup in Liferay 6

Junior Member Mensajes: 25 Fecha de incorporación: 14/12/11 Mensajes recientes
Enrique Ruiz (DiSiD):
Hi all,

There is a little bug in jelmer's code, missing ;

Below the fix:

closePopup: function() {
                var instance = this;
                var popup = instance._getPopup();


Regards



I am facing one more problem popup gets appear only one time once I close pop up it does not appear again.
If I refresh the page and then click the button then only it appears second time.
Please let me know if you have any idea.
thumbnail
Jobin Mathew, modificado hace 9 años.

RE: Popup in Liferay 6

Junior Member Mensajes: 77 Fecha de incorporación: 4/07/14 Mensajes recientes
hi
i tried the same but no popup appears. and error in mozillla bowser as follows.
"TypeError: a.Dialog is not a constructor"
please help