per creare un URL, è possibile utilizzare <portlet:renderURL>
o <liferay-portlet:renderURL>
<liferay-portlet:renderURL
var="testPopupURL"
portletName="testPopup_WAR_testPopupportlet"
windowState="<%=LiferayWindowState.POP_UP.toString() %>">
<liferay-portlet:param name="paramToPopup" value="customParameterToThePortlet" />
</liferay-portlet:renderURL>
portletName="testPopup_WAR_testPopupportlet"
questo è il portletId del portlet che desideri aprire.
windowState="<%=LiferayWindowState.POP_UP.toString() %>"
Questo è importante per mostrare solo il portlet nel pop-up, o altrimenti sarebbe aprire le pagine Liferay completi con navigazione e tutti.
Il javascript cui è possibile scrivere nel vostro JSP per utilizzare l'URL sopra e aprire il pop-up e il portlet entro:
// this is one of creating function
function <portlet:namespace />showPopup(url) {
var url = url;
// this is one way of calling a pop-up in liferay
// this way is specific to liferay
Liferay.Util.openWindow(
{
dialog: {
cache: false,
width:800,
modal: true
},
id: 'testPopupIdUnique',
uri: url
}
);
}
// this is another way of creating a function in liferay
Liferay.provide(
window,
'<portlet:namespace />showAUIPopUP',
function(url) {
var A = AUI();
// this is another way of calling a iframe pop-up
// this way is not specific to liferay
popupDialog = new A.Dialog(
{
id: 'testPopupIdUnique',
centered: true,
draggable: true,
resizable: true,
width: 800,
stack: true
}
).plug(
A.Plugin.DialogIframe,
{
uri: url,
iframeCssClass: 'ogilvy-dialog-iframe'
}
);
popupDialog.render();
},
['aui-dialog','aui-dialog-iframe']
);
Si può semplicemente chiamare questi javascript funzioni o meno così:
<a href="javascript: <portlet:namespace />showPopup('<%=testPopupURL%>')">
Popup using Liferay open-window
</a>
<a href="javascript: <portlet:namespace />showAUIPopUP('<%=testPopupURL%>')">
Pop-up using Alloy UI dialog
</a>
il portlet che verrebbe visualizzato all'interno della iframe
del pop-up o dovrebbe avere <add-default-resource>true</add-default-resource>
in liferay-portlet.xml
come:
<portlet>
<portlet-name>testPopup</portlet-name>
<icon>/icon.png</icon>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>testPopup-portlet</css-class-wrapper>
<!-- This property is necessary otherwise you would see a "Access denied for portlet" message when you try to open this portlet dynamically -->
<add-default-resource>true</add-default-resource>
</portlet>
o dovrebbe avere la proprietà portlet.add.default.resource.check.whitelist
in portal-ext.properties
come:
portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,87,88,103,113,145,164,166,170,177,testPopup_WAR_testPopupportlet
per vedere questo codice in azione è possibile scaricare 2 portlet da e fare riferimento alle istruzioni in this liferay forum.
Spero che questo aiuti a comprendere meglio liferay.