Fórum
How to open a portlet in a new popup
LOUIS Nicolas, modificado 13 Anos atrás.
How to open a portlet in a new popup
New Member Postagens: 5 Data de Entrada: 22/07/10 Postagens Recentes
Hello,
I need some help to find a better solution for my problem! I find a working version, but i think it's not correct.
I want to show a portlet in a jQuery popup !
So i created a link in the dock.vm to open the popup on the different page of my website like this :
This link open my popup correctly but i have to define the p_l_id, otherwise, it's not working.
To define a p_l_id, i put my portlet in a hidden page to get the p_l_id, and it's working, but this number could change in the future...i can't put a number like this ! And if i put the current p_l_id, the portlet doesn't show.
Do you understand my problem ?
Thanks for your help, and sorry for my bad english !
Nicolas.
I need some help to find a better solution for my problem! I find a working version, but i think it's not correct.
I want to show a portlet in a jQuery popup !
So i created a link in the dock.vm to open the popup on the different page of my website like this :
<a href="javascript:showPopup('13309', 'PopupViewPortlet_WAR_projectportlet')">Open the popup</a>
<script type="text/javascript">
function showPopup(plid, ppid) {
var instance = this;
// var plid = themeDisplay.getPlid();
if (!instance.menu) {
instance.menu = true;
var url = themeDisplay.getPathMain() + '/portal/render_portlet';
instance._dialog = Liferay.Popup( {
title : 'Popup Title',
width : 310,
height : 'auto',
modal : true,
resizable : false,
message : '<div class="loading-animation" />',
onClose : function() {
instance.menu = null;
}
});
jQuery.ajax( {
url : url,
data : {
p_l_id : plid,
p_p_id : ppid,
p_p_state : 'exclusive'
},
success : function(message) {
instance._dialog.html(message);
}
});
}
}
</script>
This link open my popup correctly but i have to define the p_l_id, otherwise, it's not working.
To define a p_l_id, i put my portlet in a hidden page to get the p_l_id, and it's working, but this number could change in the future...i can't put a number like this ! And if i put the current p_l_id, the portlet doesn't show.
Do you understand my problem ?
Thanks for your help, and sorry for my bad english !
Nicolas.
Peter Shin, modificado 13 Anos atrás.
RE: How to open a portlet in a new popup
Regular Member Postagens: 121 Data de Entrada: 24/09/07 Postagens Recentes
Hi Louis, here's one way to dynamically get the plid
<%= PortalUtil.getPlidFromPortletId(themeDisplay.getParentGroupId(), "PopupViewPortlet_WAR_projectportlet") %>
LOUIS Nicolas, modificado 13 Anos atrás.
RE: How to open a portlet in a new popup
New Member Postagens: 5 Data de Entrada: 22/07/10 Postagens Recentes
Thanks ! It's working :-)
I use this command :
I would like to know if i have to put this portlet in a hidden page ? How can i delete this portlet keeping the same behavior ?
Thanks,
Nicolas.
I use this command :
#set ($plid_popup = $portalUtil.getPlidFromPortletId($portalUtil.getScopeGroupId($request), "PopupViewPortlet_WAR_projectportlet"))
I would like to know if i have to put this portlet in a hidden page ? How can i delete this portlet keeping the same behavior ?
Thanks,
Nicolas.
Peter Shin, modificado 13 Anos atrás.
RE: How to open a portlet in a new popup
Regular Member Postagens: 121 Data de Entrada: 24/09/07 Postagens Recentes
The portlet can be on any page in the current community/organization.
If the portlet isn't found it'll return 0 and in that case it'd probably be better to hide the link.
If the portlet isn't found it'll return 0 and in that case it'd probably be better to hide the link.
jelmer kuperus, modificado 13 Anos atrás.
RE: How to open a portlet in a new popup
Liferay Legend Postagens: 1191 Data de Entrada: 10/03/10 Postagens Recentes
What I do is this :
In liferay-portlet.xml configure the popup portlet like this :
Then construct a url like this and load it in the popup
In some cases you also needed to add the portletId to the portlet.add.default.resource.check.whitelist property, but i dont quite remember what the criteria was for that
In liferay-portlet.xml configure the popup portlet like this :
<portlet>
<portlet-name>yourportletid</portlet-name>
<add-default-resource>true</add-default-resource>
</portlet>
Then construct a url like this and load it in the popup
PortletURL url = PortletURLFactoryUtil.create(request, "yourportletid_WAR_yourwarname",
layout.getPlid(), PortletRequest.RENDER_PHASE);
url.setWindowState(LiferayWindowState.EXCLUSIVE);
In some cases you also needed to add the portletId to the portlet.add.default.resource.check.whitelist property, but i dont quite remember what the criteria was for that
santhosh kumar, modificado 11 Anos atrás.
RE: How to open a portlet in a new popup
New Member Postagens: 19 Data de Entrada: 11/04/11 Postagens Recentes
Hi
On click of link i'm triggering below mentioned code but on load of page its throeing JS error "Expected ';' "
function parentPage() {
alert("hi");
PortletURL url = PortletURLFactoryUtil.create(request,"PLDoc_WAR_PLDocportlet",layout.getPlid(),PortletRequest.RENDER_PHASE);
url.setWindowState(LiferayWindowState.EXCLUSIVE);
var popup = Liferay.Popup(
{
stack: true,
draggable:false,
title: 'Parent Page',
position:[110,50],
modal:true,
width:450,
height:365,
url:url
}
);
}
On click of link i'm triggering below mentioned code but on load of page its throeing JS error "Expected ';' "
function parentPage() {
alert("hi");
PortletURL url = PortletURLFactoryUtil.create(request,"PLDoc_WAR_PLDocportlet",layout.getPlid(),PortletRequest.RENDER_PHASE);
url.setWindowState(LiferayWindowState.EXCLUSIVE);
var popup = Liferay.Popup(
{
stack: true,
draggable:false,
title: 'Parent Page',
position:[110,50],
modal:true,
width:450,
height:365,
url:url
}
);
}