Failed to open portlet in liferay dialog
I have a dialog in my portal that opens a portlet. When I click on the link and the dialog opens, the dialog displays
You do not have the required roles to access this portlet.
However, if I add the same portlet to the page, the portlet opens without any delay, both on the page and in the dialog. What am I missing here? Anyone got it?
My codes:
#set ($profile_url = $portletURLFactory.create($request, "profile_WAR_profileportlet", $getterUtil.getLong($plid), "RENDER_PHASE"))
$profile_url.setParameter("p_p_state", "exclusive")
<a href="#" id="profile" onclick="openDialog('$profile_url','preferences-dialog',500,500)"> Profile </a>
window,
'openDialog', //function name
function(url, popupID, wd, ht) { // parameters to the function
var A = AUI();
popupDialog = new A.Dialog({
id: popupID, // popupId passed so that it would be easy to close it through events other than the close button
centered: false, // all the different parameters function you can check in the Alloy API
draggable: true,
resizable: false,
width: wd,
stack: true,
modal: true,
height: ht,
scrollbars: true,
xy: [getWidth()/2-wd/2,10]
}
).plug(
A.Plugin.IO,
{
uri: url
}
);
popupDialog.render();
},
['aui-dialog','aui-dialog-iframe']
);
Thanks in advance for any help anyone can provide.
I think the following configuration is missing in the liferay-portlet.xml
portlet profile_WAR_profileportlet
:
<add-default-resource>true</add-default-resource>
For a portlet that opens in a popup dialog must be installed true
, here is the documentation for that item.
For more information you can look at this answer , points 4 and 5 of the answer will help you.
Maybe you are setting $ profile_url but actually opening a dialog to $ preferences_url? My guess is that preferences_url was defined earlier - and preferences (such as portlet editing mode) usually require more permissions than just the regular rendering phase. Crosscheck by referring to this as an administrator.
Add the following two lines to the portal-ext.properties file
portlet.add.default.resource.check.enabled=true
portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,103,113,145,164,166,170,33,---here append the portlet id which you want to display