掲示板
Programatically remove portlets.
HI..
I know we can add potlets programatically.But i would like to remove the portlet programatically.
How can i do that ???
Thanks
I know we can add potlets programatically.But i would like to remove the portlet programatically.
How can i do that ???
Thanks
13年前 に R K によって更新されました。
RE: Programatically remove portlets.
Junior Member 投稿: 43 参加年月日: 10/05/24 最新の投稿
Has no one tried this???
Guys need help !!!
Guys need help !!!
13年前 に Saranya Sethurajan によって更新されました。
RE: Programatically remove portlets.
Junior Member 投稿: 57 参加年月日: 09/10/08 最新の投稿
To remove the portlet from the Liferay server, Shut down the server, after that go to Tomcat/webapps/select your <portlet> and delete it.
To delete from Plugins, Go to plugins/portlet/select your <portlet> and delete it.Then, plugins/dist/ select the .war file of your portlet and delete it.
To delete from Plugins, Go to plugins/portlet/select your <portlet> and delete it.Then, plugins/dist/ select the .war file of your portlet and delete it.
13年前 に Murat ÇOLAK によって更新されました。
RE: Programatically remove portlets.
Junior Member 投稿: 45 参加年月日: 09/07/28 最新の投稿
You will write a service first Which is delete the portlet war file from autodeploy directory then Call your service
Or delete portletid from db.
I don't understand what you want
Or delete portletid from db.
I don't understand what you want
13年前 に R K によって更新されました。
RE: Programatically remove portlets.
Junior Member 投稿: 43 参加年月日: 10/05/24 最新の投稿
HI..
Thanks for the reply.
Unfortunately shutting down the server is not the right option at runtime.
And i would be needing this portlet at later stages also, so i cant delete frm webapps as well.
My requirement is this.
I have 2 portlets (portlet 1 & portlet 2) on my page.
In portlet 1 i also have a link. On the click of the link i want to remove portlet 2 from
that page.
NOTE :Here the user will still be provided with an option to add portlet 2 when ever he wishes. So i wont be able to remove the portlet details from webapps .
Thanks,
RK
Thanks for the reply.
Unfortunately shutting down the server is not the right option at runtime.
And i would be needing this portlet at later stages also, so i cant delete frm webapps as well.
My requirement is this.
I have 2 portlets (portlet 1 & portlet 2) on my page.
In portlet 1 i also have a link. On the click of the link i want to remove portlet 2 from
that page.
NOTE :Here the user will still be provided with an option to add portlet 2 when ever he wishes. So i wont be able to remove the portlet details from webapps .
Thanks,
RK
13年前 に KK rajput によって更新されました。
RE: Programatically remove portlets.
Expert 投稿: 266 参加年月日: 08/04/10 最新の投稿
Hi R K,
I don't think it is like removing the portlet . I think it is like hiding and showing portlet on click. I hope this idea will help u.
I don't think it is like removing the portlet . I think it is like hiding and showing portlet on click. I hope this idea will help u.
13年前 に R K によって更新されました。
RE: Programatically remove portlets.
Junior Member 投稿: 43 参加年月日: 10/05/24 最新の投稿
Yeah..tats right..
How can i hide the portlet ???
Thanks,
RK
How can i hide the portlet ???
Thanks,
RK
13年前 に Suhail Ahmed によって更新されました。
RE: Programatically remove portlets.
Regular Member 投稿: 126 参加年月日: 08/01/02 最新の投稿
HI
This is the sample code you remove the portlet from your layout(or Page),
Try This may Help You
on red text click you will close the clicked portlet, if want to close other portlet click of this kindly pass the portlet ID of that portlet.
Thanks
Suhail Ahmed
This is the sample code you remove the portlet from your layout(or Page),
Try This may Help You
<%@ include file="/html/common/init.jsp" %>
<portlet:defineobjects />
<%
Portlet portlet = (Portlet)request.getAttribute(WebKeys.RENDER_PORTLET);
PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, portletDisplay.getId());
%>
<c:if test="<%= portletDisplay.isShowCloseIcon() %>">
<span class="portlet-close">
- [color=#FF0000]<a href="<%= portletDisplay.getURLClose() %>"><liferay-ui:message key="close" /></a>[/color]
</span>
</c:if>
on red text click you will close the clicked portlet, if want to close other portlet click of this kindly pass the portlet ID of that portlet.
Thanks
Suhail Ahmed
13年前 に R K によって更新されました。
RE: Programatically remove portlets.
Junior Member 投稿: 43 参加年月日: 10/05/24 最新の投稿
Suhail,
Where do i pass the portlet ID.?
In the sample code, first block is about initialising init.jsp and second is getting the layout and corresponding portlets displayed on the same.
I am not that clear on the third part.Can you kindly explain nd whr should i pass the portlet ID.
Thanks
Where do i pass the portlet ID.?
In the sample code, first block is about initialising init.jsp and second is getting the layout and corresponding portlets displayed on the same.
I am not that clear on the third part.Can you kindly explain nd whr should i pass the portlet ID.
Thanks
13年前 に Suhail Ahmed によって更新されました。
RE: Programatically remove portlets.
Regular Member 投稿: 126 参加年月日: 08/01/02 最新の投稿
R. K,
this code only to remove the portlet in which you placed.
if you want to remove another portlet form other portlet, first get the portletId of which portlet you want to remove from the layout.
May this Help for You,
Thanks
Suhail Ahmed
[color=#FF0000]<%= portletDisplay.getURLClose() %>[/color]
this code only to remove the portlet in which you placed.
if you want to remove another portlet form other portlet, first get the portletId of which portlet you want to remove from the layout.
if (layoutTypePortlet.hasPortletId(portletId)) {
deletePortlet = true;
layoutTypePortlet.removePortletId(userId, portletId);
}
if (deletePortlet) {
String rootPortletId = PortletConstants.getRootPortletId(portletId);
ResourceLocalServiceUtil.deleteResource(
layout.getCompanyId(), rootPortletId,
ResourceConstants.SCOPE_INDIVIDUAL,
PortletPermissionUtil.getPrimaryKey(
layout.getPlid(), portletId));
}
May this Help for You,
Thanks
Suhail Ahmed
13年前 に R K によって更新されました。
RE: Programatically remove portlets.
Junior Member 投稿: 43 参加年月日: 10/05/24 最新の投稿
Thanks for the reply
How can i get the userId ?
I tried request.getAttribute(PortletRequest.USER_INFO) but
I a not sure as how to get userID ofype LONG.
Thanks
How can i get the userId ?
I tried request.getAttribute(PortletRequest.USER_INFO) but
I a not sure as how to get userID ofype LONG.
Thanks
13年前 に Suhail Ahmed によって更新されました。
RE: Programatically remove portlets.
Regular Member 投稿: 126 参加年月日: 08/01/02 最新の投稿
As ways Wel Come,
you get userId of current user in a various ways, followed
Thanks
Suhail Ahmed
you get userId of current user in a various ways, followed
long userId = themeDisplay.getUserId();
OR
long userId = PortalUtil.getUserId(request);
Thanks
Suhail Ahmed
13年前 に R K によって更新されました。
RE: Programatically remove portlets.
Junior Member 投稿: 43 参加年月日: 10/05/24 最新の投稿
Thanks..
Its working
Its working
11年前 に Jing Guo によって更新されました。
RE: Programatically remove portlets.
New Member 投稿: 4 参加年月日: 12/07/24 最新の投稿
Hey,
I think this is working for non-instanceable portlet, but not for instanceable ones since their portlet Id is something like <porltename>_INSTANCE<instance serial>. I am having problem with it right now, I wonder if you could probably help me out a little bit. Thanks
Jing Guo
I think this is working for non-instanceable portlet, but not for instanceable ones since their portlet Id is something like <porltename>_INSTANCE<instance serial>. I am having problem with it right now, I wonder if you could probably help me out a little bit. Thanks
Jing Guo
12年前 に Jhansi Rani によって更新されました。
RE: Programatically remove portlets.
Junior Member 投稿: 32 参加年月日: 11/07/27 最新の投稿
Hi Suhail,
I am very new to liferay and using lifery6.0.5.
The code snippet for removing the portlets is very helpful to me .But I struck up with one issue i.e While the reloading the page or refreshing page I need to hide/remove the portlets which are in that page .
Could you please provide the solution.
Regards
Jhansi Rani.
I am very new to liferay and using lifery6.0.5.
The code snippet for removing the portlets is very helpful to me .But I struck up with one issue i.e While the reloading the page or refreshing page I need to hide/remove the portlets which are in that page .
Could you please provide the solution.
Regards
Jhansi Rani.
10年前 に Suhail Ahmed によって更新されました。
RE: Programatically remove portlets.
Regular Member 投稿: 126 参加年月日: 08/01/02 最新の投稿
Hey Yamini,
I did not understand your problem or issue. Kindly elaborate more on this.
Thanks
I did not understand your problem or issue. Kindly elaborate more on this.
Thanks
12年前 に chandra sekhar によって更新されました。
RE: Programatically remove portlets.
Regular Member 投稿: 149 参加年月日: 09/07/07 最新の投稿
Hi R K,
Can you explain me the how to add the portlets programatically to the Organization pages.
Thanks in advance.
Regards,
Chandrasekhar
Can you explain me the how to add the portlets programatically to the Organization pages.
Thanks in advance.
Regards,
Chandrasekhar
12年前 に Pankaj Kathiriya によって更新されました。
RE: Programatically remove portlets.
Liferay Master 投稿: 722 参加年月日: 10/08/05 最新の投稿
Hi Chandra Shekhar,
If you have layout object that represent pagein place.
Then,You can add portlet to page dynamically by following snippet.
LayoutTypePortlet layoutTypePortlet =(LayoutTypePortlet)layout.getLayoutType();
portletId = layoutTypePortlet.addPortletId(0, portletId, columnId, -1, false);
LayoutLocalServiceUtil.updateLayout(layout.getGroupId(), layout.isPrivateLayout(), layout.getLayoutId(), layout.getTypeSettings());
Hope this helps.
Thanks,
Pankaj
If you have layout object that represent pagein place.
Then,You can add portlet to page dynamically by following snippet.
LayoutTypePortlet layoutTypePortlet =(LayoutTypePortlet)layout.getLayoutType();
portletId = layoutTypePortlet.addPortletId(0, portletId, columnId, -1, false);
LayoutLocalServiceUtil.updateLayout(layout.getGroupId(), layout.isPrivateLayout(), layout.getLayoutId(), layout.getTypeSettings());
Hope this helps.
Thanks,
Pankaj