Fórum

action button with popup menu

thumbnail
Ketan Savaliya, modificado 13 Anos atrás.

action button with popup menu

Regular Member Postagens: 117 Data de Entrada: 03/03/11 Postagens Recentes
i want action button like in liferay role in control panel, each role have action button and it's open like view, assign member etc...


if i click any of option then go to specific jsp page, so, where is the mapping of this action in which file?
thumbnail
Sandeep Nair, modificado 13 Anos atrás.

RE: action button with popup menu

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Hi,

Check out view_users and user_action.jsp of liferay src

You have to use following to include the jsp which has actions

<liferay-ui:search-container-column-jsp
align="right"
path="/html/portlet/enterprise_admin/user_action.jsp"
/>

And to show buttons you have to use <liferay-ui:icon-menu> in the action.jsp. Check out user_action.jsp to see the action urls defined.

Regards,
Sandeep
thumbnail
Ketan Savaliya, modificado 13 Anos atrás.

RE: action button with popup menu

Regular Member Postagens: 117 Data de Entrada: 03/03/11 Postagens Recentes
thankx for reply,

i test your code, it display action button and also option, but when i click on any one option then i want to go some jsp page then where i mention that file maping?

my code is
================
<liferay-ui:icon-menu>
<portlet:actionURL name="updateStudType" var="editStudTypeURL">
<portlet:param name="resourcePrimKey" value="<%=primKey %>" />
</portlet:actionURL>
</liferay-ui:icon-menu>
thumbnail
Sandeep Nair, modificado 13 Anos atrás.

RE: action button with popup menu

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Is it you custom portlet? If so you need to create an action or renderURL and forward it to your respective jsp page from doView Method.
Suresh Chinna Pillai, modificado 13 Anos atrás.

RE: action button with popup menu

New Member Postagens: 16 Data de Entrada: 14/02/11 Postagens Recentes
Hi Sandeep,

Hi,
Check out view_users and user_action.jsp of liferay src

You have to use following to include the jsp which has actions

<liferay-ui:search-container-column-jsp
align="right"
path="/html/portlet/enterprise_admin/user_action.jsp"
/>

And to show buttons you have to use <liferay-ui:icon-menu> in the action.jsp. Check out user_action.jsp to see the action urls defined.

Regards,
Sandeep


I am new to Liferay, where can I get the src code of the Liferay?
For example as you said that"user_action.jsp","user_action.jsp"
Thanks,
-Suresh.
thumbnail
Sandeep Nair, modificado 13 Anos atrás.

RE: action button with popup menu

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
You can get it from sourceforge. Following are the links for 6.0.5 and 6.0.6

http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.0.6/liferay-portal-src-6.0.6-20110225.zip/download

http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.0.5/liferay-portal-src-6.0.5.zip/download

Regards,
Sandeep
Suresh Chinna Pillai, modificado 13 Anos atrás.

RE: action button with popup menu

New Member Postagens: 16 Data de Entrada: 14/02/11 Postagens Recentes
Hi Sandeep,

Thank you for your reply..

I have two doubts.
1) I want to display the list of users in search container.I achieved it.Please view the attached image.
I want to do when I clicking on a particular UserName on the search container,it will go to another page(for example: edit mode of the same portlet).In that I have to display the details of the selected user.I tried with session but it will result the last user in that page.
How can I achieve this?

2)And I want to know how to use the row checkers in search container.for example, If I select 2 users from the list to delete how can I get the screen name/user id of the selected users in action class?

Please verify my code..
/html/checkportlet/view.jsp


&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;
&lt;%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %&gt;
&lt;%@ page import="java.util.List"%&gt;
&lt;%@ page import="com.liferay.portal.model.UserGroup" %&gt;
&lt;%@ page import="com.liferay.portal.model.User" %&gt;
&lt;%@ page import="com.liferay.portal.service.*" %&gt;
&lt;%@ page import="com.liferay.portal.util.PortalUtil"%&gt;
&lt;%@ page import="com.liferay.portal.kernel.util.ListUtil"%&gt;
&lt;%@ page import="com.liferay.portal.service.UserLocalServiceUtil" %&gt;

&lt;%! List<user> users = null;
int totalNoOfUsers=0;
String value;
%&gt;
&lt;%
out.println(UserLocalServiceUtil.getUsersCount());
totalNoOfUsers = UserLocalServiceUtil.getUsersCount();
users=UserLocalServiceUtil.getUsers(0,totalNoOfUsers);
%&gt;

&lt;%@page import="javax.portlet.PortletMode"%&gt;
&lt;%@page import="javax.portlet.ActionRequest"%&gt;
&lt;%@page import="javax.portlet.ActionResponse"%&gt;
&lt;%@page import="com.liferay.portal.kernel.dao.search.RowChecker" %&gt;
&lt;%@page import="com.liferay.portal.kernel.util.PropsUtil"%&gt;<portlet:defineobjects />
<h1>HAI!!!</h1>

<form name="frmList" method="post" action="<portlet:actionURL></portlet:actionURL>">

<liferay-ui:search-container delta="10" emptyresultsmessage="No Users were found" rowchecker="<%=new RowChecker(renderResponse) %>">
	<liferay-ui:search-container-results results="<%= ListUtil.subList(users,searchContainer.getStart(),searchContainer.getEnd()) %>" total="<%= totalNoOfUsers %>">		
	</liferay-ui:search-container-results>
	<liferay-ui:search-container-row classname="com.liferay.portal.model.User" modelvar="user">
	<liferay-ui:search-container-row-parameter name="rowIds" value="<%= user.getUserId()%>"></liferay-ui:search-container-row-parameter>
		<liferay-ui:search-container-column-text name="UserName" value="<%= user.getScreenName()%>" href="javascript:submitForm();" />
		<script type="text/javascript">			
		function submitForm(){	
		<%	
			session.setAttribute("ses1",user.getScreenName());				
		%>		
		document.forms["form1"].submit();
		}
</script>	

		<liferay-ui:search-container-column-text name="First Name" value="<%= user.getFirstName() %>">
		</liferay-ui:search-container-column-text>
		
		<liferay-ui:search-container-column-text name="Last Name" value="<%= user.getLastName() %>">
		</liferay-ui:search-container-column-text>
		
		<liferay-ui:search-container-column-text name="Title" value="<%= user.getJobTitle() %>">
		</liferay-ui:search-container-column-text>
	</liferay-ui:search-container-row>
	<liferay-ui:search-iterator />
	
</liferay-ui:search-container>
<input type="submit" value="edit">

</form>
This is the <b>CheckPortlet</b> portlet in View mode.

</user>


/html/checkportlet/edit.jsp


&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;

<portlet:defineobjects />
<h1>EDIT</h1>
&lt;%
out.print("\n"+session.getAttribute("ses1"));
%&gt;
This is the <b>CheckPortlet</b> portlet in Edit mode.


This code will result last user(for example : 'sbmuser2' according to the attached image).

Action class(CheckPortlet.java)


package com.test;

import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import com.liferay.portal.kernel.dao.search.RowChecker;



public class CheckPortlet extends MVCPortlet {
	
	public void processAction(ActionRequest request,ActionResponse response)throws PortletException,IOException{
		System.out.print("\nAction");
		long val[]=ParamUtil.getLongValues(request, "rowIds");	
		System.out.print("\n RowIds :"+val.length);
		for(int i=0;i<val.length;i++){ system.out.print("\n"+val[i]); } response.setportletmode(portletmode.edit); @override public void doview(renderrequest renderrequest, renderresponse renderresponse) throws ioexception, portletexception { super.doview(renderrequest, renderresponse); < code></val.length;i++){>
<br><br> In this case the count of selected rows displayed correctly.But all of the values returns 0(zero). <br><br>Please reply me.<br>I am in a critical situation that I will finish this for my project before this month end.<br>If you have any sample code please send me to email "acm_7888@yahoo.com"<br><br>I am using Liferay6.0.5 bundled with Tomcat.<br>I hope that you will help me..<br><br>Thank You,<br>-Suresh.
thumbnail
Sandeep Nair, modificado 13 Anos atrás.

RE: action button with popup menu

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Hi,

I havent looked in your code but, instead of passing screen name in session pass it in hidden parameter. And in processaction use this "actionResponse.setRenderParameter("paramName", paramValue)". You will then be able to use the same in ur edit jsp.

Similarly for the rows that you have checked you can pass as hidden values. You can get comma separate primary key value of the row select if u use the following

Liferay.Util.listCheckedExcept(nameOfForm, "<portlet:namespace />allRowIds");

Regards,
Sandeep
Suresh Chinna Pillai, modificado 13 Anos atrás.

RE: action button with popup menu

New Member Postagens: 16 Data de Entrada: 14/02/11 Postagens Recentes
Thank You for your Reply Sandeep.
It is very helpful to me.

Please keep in touch with me..

Once again Thank you so much!

-Suresh.
Suresh Chinna Pillai, modificado 12 Anos atrás.

RE: action button with popup menu

New Member Postagens: 16 Data de Entrada: 14/02/11 Postagens Recentes
Hi Sandeep,

Is there any possibility to customize portlet using css?
I want to make effects without creating theme. But only with css.
Thanks,
-Suresh.
thumbnail
Raja Nagendra Kumar, modificado 12 Anos atrás.

RE: action button with popup menu

Expert Postagens: 484 Data de Entrada: 02/03/06 Postagens Recentes
You can do this by editing the existing theme's CSS file or through Admin Login with Config Mode.
Suresh Chinna Pillai, modificado 12 Anos atrás.

RE: action button with popup menu

New Member Postagens: 16 Data de Entrada: 14/02/11 Postagens Recentes
Hi All,

I want to restrict the portlet access depending on roles. For example, If a user has required permission he can communicate with the particular portlet. Otherwise, he can do nothing.

Thanks in advance,
-Suresh.
thumbnail
Raja Nagendra Kumar, modificado 12 Anos atrás.

RE: action button with popup menu

Expert Postagens: 484 Data de Entrada: 02/03/06 Postagens Recentes
>I want to restrict the portlet access depending on roles. For example, If a user has required permission he can communicate with the particular portlet. Otherwise, he can do nothing.

You can do this using the isUserInRole() api checks with in render, action methods or in View/Edit JSP pages.

More details at API http://portals.apache.org/pluto/portlet-1.0-apidocs/javax/portlet/PortletRequest.html#isUserInRole(java.lang.String)

Regards,
Nagendra
thumbnail
srinu sri, modificado 10 Anos atrás.

RE: action button with popup menu

Junior Member Postagens: 29 Data de Entrada: 22/02/13 Postagens Recentes
Hi,


I have popup with two buttons .But these two button functionality work in fire fox but not in chrome using jquery.please help me
Dhana Sekar, modificado 13 Anos atrás.

RE: action button with popup menu

New Member Postagens: 7 Data de Entrada: 14/02/11 Postagens Recentes
I am new to lifeary
i have created popup,then how to show information within the popup as grid form like search container rows like ....

can you send sample code for that ..

Thanks,
Dhanasekar.S
thumbnail
Sandeep Nair, modificado 13 Anos atrás.

RE: action button with popup menu

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
I dont have sample code, you have to see existing code of liferay where they are using and try to replicate the same
Suresh Chinna Pillai, modificado 13 Anos atrás.

RE: action button with popup menu

New Member Postagens: 16 Data de Entrada: 14/02/11 Postagens Recentes
Hi Sandeep,

I added custom attributes to the Users.It was fine.
Is there any possibility to add custom attributes for the UserGroup in Liferay.


Pls help me..

Thanks,
-Suresh.
thumbnail
Ketan Savaliya, modificado 13 Anos atrás.

RE: action button with popup menu

Regular Member Postagens: 117 Data de Entrada: 03/03/11 Postagens Recentes
Hi, Liferay Master

How can i call javascript function from the <liferay-ui:icon image"" url="/> and then action method?


Please give me idea about that. or sample code for that

Regards
-Ketan
thumbnail
Sandeep Nair, modificado 13 Anos atrás.

RE: action button with popup menu

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Hi,

Havent tried the same.

Regards,
Sandeep
thumbnail
Ketan Savaliya, modificado 13 Anos atrás.

RE: action button with popup menu

Regular Member Postagens: 117 Data de Entrada: 03/03/11 Postagens Recentes
Thankx, Liferay Master
but
so, how can i achieve conformation dialog before any action from the action button?


Regards
ketan
thumbnail
Masroor Khan, modificado 13 Anos atrás.

RE: action button with popup menu

Regular Member Postagens: 124 Data de Entrada: 09/09/08 Postagens Recentes
Hi,

you can call js onclick function
and in that function you can use
confirm("sometext");

Regards,

Masroor