Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Ketan Savaliya
action button with popup menu
14. März 2011 03:17
Antwort

Ketan Savaliya

Rang: Junior Member

Nachrichten: 77

Eintrittsdatum: 3. März 2011

Neue Beiträge

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
14. März 2011 04:02
Antwort

Sandeep Nair

Rang: Liferay Legend

Nachrichten: 1693

Eintrittsdatum: 5. November 2008

Neue Beiträge

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
14. März 2011 04:13
Antwort

Ketan Savaliya

Rang: Junior Member

Nachrichten: 77

Eintrittsdatum: 3. März 2011

Neue Beiträge

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
15. März 2011 02:12
Antwort

Sandeep Nair

Rang: Liferay Legend

Nachrichten: 1693

Eintrittsdatum: 5. November 2008

Neue Beiträge

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
15. März 2011 04:58
Antwort

Suresh Chinna Pillai

Rang: New Member

Nachrichten: 16

Eintrittsdatum: 13. Februar 2011

Neue Beiträge

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
15. März 2011 21:36
Antwort

Sandeep Nair

Rang: Liferay Legend

Nachrichten: 1693

Eintrittsdatum: 5. November 2008

Neue Beiträge

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
16. März 2011 01:00
Antwort

Suresh Chinna Pillai

Rang: New Member

Nachrichten: 16

Eintrittsdatum: 13. Februar 2011

Neue Beiträge

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.
Anhänge: Screenshot.bmp (3.060,1k)
Sandeep Nair
RE: action button with popup menu
16. März 2011 04:21
Antwort

Sandeep Nair

Rang: Liferay Legend

Nachrichten: 1693

Eintrittsdatum: 5. November 2008

Neue Beiträge

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
16. März 2011 07:31
Antwort

Dhana Sekar

Rang: New Member

Nachrichten: 7

Eintrittsdatum: 13. Februar 2011

Neue Beiträge

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
16. März 2011 22:23
Antwort

Sandeep Nair

Rang: Liferay Legend

Nachrichten: 1693

Eintrittsdatum: 5. November 2008

Neue Beiträge

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
16. März 2011 22:57
Antwort

Suresh Chinna Pillai

Rang: New Member

Nachrichten: 16

Eintrittsdatum: 13. Februar 2011

Neue Beiträge

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
17. März 2011 07:52
Antwort

Suresh Chinna Pillai

Rang: New Member

Nachrichten: 16

Eintrittsdatum: 13. Februar 2011

Neue Beiträge

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
21. März 2011 03:17
Antwort

Ketan Savaliya

Rang: Junior Member

Nachrichten: 77

Eintrittsdatum: 3. März 2011

Neue Beiträge

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
21. März 2011 05:38
Antwort

Sandeep Nair

Rang: Liferay Legend

Nachrichten: 1693

Eintrittsdatum: 5. November 2008

Neue Beiträge

Hi,

Havent tried the same.

Regards,
Sandeep
Ketan Savaliya
RE: action button with popup menu
21. März 2011 23:37
Antwort

Ketan Savaliya

Rang: Junior Member

Nachrichten: 77

Eintrittsdatum: 3. März 2011

Neue Beiträge

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
22. März 2011 02:27
Antwort

Masroor Khan

Rang: Regular Member

Nachrichten: 117

Eintrittsdatum: 9. September 2008

Neue Beiträge

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
5. April 2011 03:27
Antwort

Suresh Chinna Pillai

Rang: New Member

Nachrichten: 16

Eintrittsdatum: 13. Februar 2011

Neue Beiträge

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
5. April 2011 03:36
Antwort

Raja Nagendra Kumar

Rang: Expert

Nachrichten: 484

Eintrittsdatum: 1. März 2006

Neue Beiträge

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
26. April 2011 05:40
Antwort

Suresh Chinna Pillai

Rang: New Member

Nachrichten: 16

Eintrittsdatum: 13. Februar 2011

Neue Beiträge

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
7. Mai 2011 04:52
Antwort

Raja Nagendra Kumar

Rang: Expert

Nachrichten: 484

Eintrittsdatum: 1. März 2006

Neue Beiträge

>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
16. Mai 2013 22:21
Antwort

peddi srinivas

Rang: Junior Member

Nachrichten: 29

Eintrittsdatum: 22. Februar 2013

Neue Beiträge

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