Desired Functionality:
I would like to provide a link in the dockbar that will load a custom Portlet Plugin into a Dockbar Underlay. I want this to work just like the "addApplication" feature that loads the Layout_Configuration portlet.
What I'm trying:
I have a created a simple portlet plugin called about-portlet and the liferay-portlet.xml <portlet> entry looks like below:
1<portlet>
2 <portlet-name>about-portlet</portlet-name>
3 <icon>/icon.png</icon>
4 <instanceable>false</instanceable>
5 <ajaxable>true</ajaxable>
6 <header-portlet-css>/css/portlet.css</header-portlet-css>
7 <footer-portlet-javascript>
8 /js/javascript.js
9 </footer-portlet-javascript>
10 <css-class-wrapper>aboutportlet-portlet</css-class-wrapper>
11 <add-default-resource>true</add-default-resource>
12 <system>true</system>
13 </portlet>
This portlet works as expected (I set <system> to false and am able to add the portlet to any of my pages and it shows just fine).
I have a hook plugin that overrides the view.jsp for the Dockbar, and I have added what is almost a duplicate of the AUI javascript function that loads the addApplication portlet (p_p_id = 87). The following appears just before the addApplication.on('click'.... code in /dockbar/view.jsp:
1
2var aboutPortal = A.one('#aboutPortal');
3 if(aboutPortal){
4 aboutPortal.on('click',
5 function(event){
6 alert(themeDisplay.getPlid());
7 if(!Liferay.Dockbar.aboutUnderlay){
8 instance.addUnderlay(
9 {
10 className: 'about_portal',
11 io: {
12 data: { p_l_id: themeDisplay.getPlid(),
13 p_p_id: 'aboutportlet_WAR_aboutportlet',
14 p_p_state: 'exclusive'
15 },
16 uri: themeDisplay.getPathMain() + '/portal/render_portlet'
17 },
18 name: 'aboutUnderlay',
19 width: '400px'
20 });
21 //end instance.addUnderlay
22 }
23 else {
24 Liferay.Dockbar.aboutUnderlay.show();
25 }
26 Liferay.Dockbar.aboutUnderlay.focus();
27 });
28 //end event definition for aboutPortal.on()
29 }
I also know this js is good, as It loads and shows the "addApplication" portlet or the login portlet just fine if I change the p_P_id parameter to 87 or 58 respectively.
It seems there would be a way to configure a portlet plugin to be available to the render_portlet action WITHOUT having it added to a Layout somewhere within the portal.
Additional Notes:
-If I make the portlet a non-system portlet (<system>false</system>) and add it to a page, then call my js from that page, the portlet shows in the Underlay just fine.
-I have tried removing the p_l_id paramter from my AJAX call so that the render_portlet action does not look at a specific layout for the portlet, and it still does not work.
-I do receive the following JS error when the portlet has not been added to any page which I believe is the Underlay initialization blowing up due to a null portlet instance:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER)" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)"
-My portlet plugin is a liferay MVCPortlet
-I have been able to debug and watch the RenderPortletAction fire and complete with no errors when I make the ajax call.
-Using Liferay 6.0.4
What am I missing? Thank you!
Please sign in to flag this as inappropriate.