Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
action button with popup menu Ketan Savaliya March 14, 2011 3:17 AM
RE: action button with popup menu Sandeep Nair March 14, 2011 4:02 AM
RE: action button with popup menu Ketan Savaliya March 14, 2011 4:13 AM
RE: action button with popup menu Sandeep Nair March 15, 2011 2:12 AM
RE: action button with popup menu Suresh Chinna Pillai March 15, 2011 4:58 AM
RE: action button with popup menu Sandeep Nair March 15, 2011 9:36 PM
RE: action button with popup menu Suresh Chinna Pillai March 16, 2011 1:00 AM
RE: action button with popup menu Sandeep Nair March 16, 2011 4:21 AM
RE: action button with popup menu Suresh Chinna Pillai March 16, 2011 10:57 PM
RE: action button with popup menu Suresh Chinna Pillai April 5, 2011 3:27 AM
RE: action button with popup menu Raja Nagendra Kumar April 5, 2011 3:36 AM
RE: action button with popup menu Suresh Chinna Pillai April 26, 2011 5:40 AM
RE: action button with popup menu Raja Nagendra Kumar May 7, 2011 4:52 AM
RE: action button with popup menu peddi srinivas May 16, 2013 10:21 PM
RE: action button with popup menu Dhana Sekar March 16, 2011 7:31 AM
RE: action button with popup menu Sandeep Nair March 16, 2011 10:23 PM
RE: action button with popup menu Suresh Chinna Pillai March 17, 2011 7:52 AM
RE: action button with popup menu Ketan Savaliya March 21, 2011 3:17 AM
RE: action button with popup menu Sandeep Nair March 21, 2011 5:38 AM
RE: action button with popup menu Ketan Savaliya March 21, 2011 11:37 PM
RE: action button with popup menu Masroor Khan March 22, 2011 2:27 AM
Ketan Savaliya
action button with popup menu
March 14, 2011 3:17 AM
Answer

Ketan Savaliya

Rank: Junior Member

Posts: 76

Join Date: March 3, 2011

Recent Posts

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?
Sandeep Nair
RE: action button with popup menu
March 14, 2011 4:02 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

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
Ketan Savaliya
RE: action button with popup menu
March 14, 2011 4:13 AM
Answer

Ketan Savaliya

Rank: Junior Member

Posts: 76

Join Date: March 3, 2011

Recent Posts

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>
Sandeep Nair
RE: action button with popup menu
March 15, 2011 2:12 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

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
RE: action button with popup menu
March 15, 2011 4:58 AM
Answer

Suresh Chinna Pillai

Rank: New Member

Posts: 16

Join Date: February 13, 2011

Recent Posts

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.
Sandeep Nair
RE: action button with popup menu
March 15, 2011 9:36 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

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
RE: action button with popup menu
March 16, 2011 1:00 AM
Answer

Suresh Chinna Pillai

Rank: New Member

Posts: 16

Join Date: February 13, 2011

Recent Posts

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

 1
 2<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
 3<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
 4<%@ page import="java.util.List"%>
 5<%@ page import="com.liferay.portal.model.UserGroup" %>
 6<%@ page import="com.liferay.portal.model.User" %>
 7<%@ page import="com.liferay.portal.service.*" %>
 8<%@ page import="com.liferay.portal.util.PortalUtil"%>
 9<%@ page import="com.liferay.portal.kernel.util.ListUtil"%>
10<%@ page import="com.liferay.portal.service.UserLocalServiceUtil" %>
11
12<%! List<User> users = null;
13int totalNoOfUsers=0;
14String value;
15%>
16<%
17out.println(UserLocalServiceUtil.getUsersCount());
18totalNoOfUsers = UserLocalServiceUtil.getUsersCount();
19users=UserLocalServiceUtil.getUsers(0,totalNoOfUsers);
20%>
21
22<%@page import="javax.portlet.PortletMode"%>
23<%@page import="javax.portlet.ActionRequest"%>
24<%@page import="javax.portlet.ActionResponse"%>
25<%@page import="com.liferay.portal.kernel.dao.search.RowChecker" %>
26<%@page import="com.liferay.portal.kernel.util.PropsUtil"%><portlet:defineObjects />
27<h1>HAI!!!</h1>
28
29<form name="frmList" method="post" action="<portlet:actionURL></portlet:actionURL>">
30
31<liferay-ui:search-container delta="10" emptyResultsMessage="No Users were found" rowChecker="<%=new RowChecker(renderResponse) %>">
32    <liferay-ui:search-container-results
33        results="<%= ListUtil.subList(users,searchContainer.getStart(),searchContainer.getEnd()) %>"
34        total="<%= totalNoOfUsers %>">       
35    </liferay-ui:search-container-results>
36    <liferay-ui:search-container-row className="com.liferay.portal.model.User"
37    modelVar="user">
38    <liferay-ui:search-container-row-parameter name="rowIds" value="<%= user.getUserId()%>"></liferay-ui:search-container-row-parameter>
39        <liferay-ui:search-container-column-text name="UserName" value="<%= user.getScreenName()%>" href="javascript:submitForm();"/>
40        <script type="text/javascript">            
41        function submitForm(){   
42        <%   
43            session.setAttribute("ses1",user.getScreenName());               
44        %>       
45        document.forms["form1"].submit();
46        }
47</script>   
48
49        <liferay-ui:search-container-column-text name="First Name" value="<%= user.getFirstName() %>">
50        </liferay-ui:search-container-column-text>
51       
52        <liferay-ui:search-container-column-text name="Last Name" value="<%= user.getLastName() %>">
53        </liferay-ui:search-container-column-text>
54       
55        <liferay-ui:search-container-column-text name="Title" value="<%= user.getJobTitle() %>">
56        </liferay-ui:search-container-column-text>
57    </liferay-ui:search-container-row>
58    <liferay-ui:search-iterator />
59   
60</liferay-ui:search-container>
61<input type="submit" value="edit" >
62
63</form>
64This is the <b>CheckPortlet</b> portlet in View mode.


/html/checkportlet/edit.jsp

 1
 2<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
 3
 4<portlet:defineObjects />
 5<h1>EDIT</h1>
 6<%
 7out.print("\n"+session.getAttribute("ses1"));
 8%>
 9This 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)
 1
 2
 3package com.test;
 4
 5import java.io.IOException;
 6import javax.portlet.ActionRequest;
 7import javax.portlet.ActionResponse;
 8import javax.portlet.PortletException;
 9import javax.portlet.PortletMode;
10import javax.portlet.RenderRequest;
11import javax.portlet.RenderResponse;
12import com.liferay.portal.kernel.util.ParamUtil;
13import com.liferay.util.bridges.mvc.MVCPortlet;
14import com.liferay.portal.kernel.dao.search.RowChecker;
15
16
17
18public class CheckPortlet extends MVCPortlet {
19   
20    public void processAction(ActionRequest request,ActionResponse response)throws PortletException,IOException{
21        System.out.print("\nAction");
22        long val[]=ParamUtil.getLongValues(request, "rowIds");   
23        System.out.print("\n RowIds :"+val.length);
24        for(int i=0;i<val.length;i++){
25            System.out.print("\n"+val[i]);
26        }
27        response.setPortletMode(PortletMode.EDIT);       
28    }
29   
30    @Override
31    public void doView(RenderRequest renderRequest,
32            RenderResponse renderResponse) throws IOException, PortletException {
33       
34        super.doView(renderRequest, renderResponse);
35    }
36}


In this case the count of selected rows displayed correctly.But all of the values returns 0(zero).

Please reply me.
I am in a critical situation that I will finish this for my project before this month end.
If you have any sample code please send me to email "acm_7888@yahoo.com"

I am using Liferay6.0.5 bundled with Tomcat.
I hope that you will help me..

Thank You,
-Suresh.
Attachments: Screenshot.bmp (3,060.1k)
Sandeep Nair
RE: action button with popup menu
March 16, 2011 4:21 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

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
Dhana Sekar
RE: action button with popup menu
March 16, 2011 7:31 AM
Answer

Dhana Sekar

Rank: New Member

Posts: 7

Join Date: February 13, 2011

Recent Posts

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
Sandeep Nair
RE: action button with popup menu
March 16, 2011 10:23 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

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
RE: action button with popup menu
March 16, 2011 10:57 PM
Answer

Suresh Chinna Pillai

Rank: New Member

Posts: 16

Join Date: February 13, 2011

Recent Posts

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
RE: action button with popup menu
March 17, 2011 7:52 AM
Answer

Suresh Chinna Pillai

Rank: New Member

Posts: 16

Join Date: February 13, 2011

Recent Posts

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.
Ketan Savaliya
RE: action button with popup menu
March 21, 2011 3:17 AM
Answer

Ketan Savaliya

Rank: Junior Member

Posts: 76

Join Date: March 3, 2011

Recent Posts

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
Sandeep Nair
RE: action button with popup menu
March 21, 2011 5:38 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

Hi,

Havent tried the same.

Regards,
Sandeep
Ketan Savaliya
RE: action button with popup menu
March 21, 2011 11:37 PM
Answer

Ketan Savaliya

Rank: Junior Member

Posts: 76

Join Date: March 3, 2011

Recent Posts

Thankx, Liferay Master
but
so, how can i achieve conformation dialog before any action from the action button?


Regards
ketan
Masroor Khan
RE: action button with popup menu
March 22, 2011 2:27 AM
Answer

Masroor Khan

Rank: Regular Member

Posts: 117

Join Date: September 9, 2008

Recent Posts

Hi,

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

Regards,

Masroor
Suresh Chinna Pillai
RE: action button with popup menu
April 5, 2011 3:27 AM
Answer

Suresh Chinna Pillai

Rank: New Member

Posts: 16

Join Date: February 13, 2011

Recent Posts

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.
Raja Nagendra Kumar
RE: action button with popup menu
April 5, 2011 3:36 AM
Answer

Raja Nagendra Kumar

Rank: Expert

Posts: 484

Join Date: March 1, 2006

Recent Posts

You can do this by editing the existing theme's CSS file or through Admin Login with Config Mode.
Suresh Chinna Pillai
RE: action button with popup menu
April 26, 2011 5:40 AM
Answer

Suresh Chinna Pillai

Rank: New Member

Posts: 16

Join Date: February 13, 2011

Recent Posts

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.
Raja Nagendra Kumar
RE: action button with popup menu
May 7, 2011 4:52 AM
Answer

Raja Nagendra Kumar

Rank: Expert

Posts: 484

Join Date: March 1, 2006

Recent Posts

>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
peddi srinivas
RE: action button with popup menu
May 16, 2013 10:21 PM
Answer

peddi srinivas

Rank: Junior Member

Posts: 29

Join Date: February 22, 2013

Recent Posts

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