Aby utworzyć URL, można użyć <portlet:renderURL>
lub <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"
jest to portletId portletu, który chcesz otworzyć.
windowState="<%=LiferayWindowState.POP_UP.toString() %>"
Jest to ważne, aby tylko pokazać portlet w pop-up, albo byłoby otworzyć pełne Liferay stron z nawigacji i wszystkich.
javascript, który można napisać w JSP używać powyższy URL i otworzyć okienko i portlet w:
// 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']
);
Możesz po prostu zadzwonić do nich javascript funkcjonuje coś takiego:
<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>
portletu który będzie wyświetlany wewnątrz iframe
z pop-up albo powinien mieć <add-default-resource>true</add-default-resource>
w liferay-portlet.xml
jak:
<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>
Albo powinien mieć właściwość portlet.add.default.resource.check.whitelist
w portal-ext.properties
jak:
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
Aby sprawdzić ten kod w akcji można pobrać z 2 portletów oraz zapoznać się z instrukcjami w this liferay forum.
Mam nadzieję, że pomoże to lepiej zrozumieć liferay.