001: /*
002: * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/CmsShowGroupUsersList.java,v $
003: * Date : $Date: 2008-02-27 12:05:26 $
004: * Version: $Revision: 1.16 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.workplace.tools.accounts;
033:
034: import org.opencms.jsp.CmsJspActionElement;
035: import org.opencms.main.CmsException;
036: import org.opencms.main.CmsRuntimeException;
037: import org.opencms.security.CmsOrganizationalUnit;
038: import org.opencms.workplace.CmsDialog;
039: import org.opencms.workplace.list.CmsListColumnDefinition;
040: import org.opencms.workplace.list.CmsListDefaultAction;
041: import org.opencms.workplace.list.CmsListDirectAction;
042: import org.opencms.workplace.list.CmsListMetadata;
043:
044: import java.io.IOException;
045: import java.util.HashMap;
046: import java.util.List;
047: import java.util.Map;
048:
049: import javax.servlet.ServletException;
050: import javax.servlet.http.HttpServletRequest;
051: import javax.servlet.http.HttpServletResponse;
052: import javax.servlet.jsp.PageContext;
053:
054: /**
055: * User groups overview view.<p>
056: *
057: * @author Michael Moossen
058: * @author Peter Bonrad
059: *
060: * @version $Revision: 1.16 $
061: *
062: * @since 6.0.0
063: */
064: public class CmsShowGroupUsersList extends A_CmsGroupUsersList {
065:
066: /** list action id constant. */
067: public static final String LIST_ACTION_EDIT = "ae";
068:
069: /** list column id constant. */
070: public static final String LIST_COLUMN_LASTLOGIN = "cl";
071:
072: /** list id constant. */
073: public static final String LIST_ID = "lsgu";
074:
075: /**
076: * Public constructor.<p>
077: *
078: * @param jsp an initialized JSP action element
079: */
080: public CmsShowGroupUsersList(CmsJspActionElement jsp) {
081:
082: this (jsp, LIST_ID);
083: }
084:
085: /**
086: * Public constructor with JSP variables.<p>
087: *
088: * @param context the JSP page context
089: * @param req the JSP request
090: * @param res the JSP response
091: */
092: public CmsShowGroupUsersList(PageContext context,
093: HttpServletRequest req, HttpServletResponse res) {
094:
095: this (new CmsJspActionElement(context, req, res));
096: }
097:
098: /**
099: * Protected constructor.<p>
100: * @param jsp an initialized JSP action element
101: * @param listId the id of the specialized list
102: */
103: protected CmsShowGroupUsersList(CmsJspActionElement jsp,
104: String listId) {
105:
106: super (jsp, listId, Messages.get().container(
107: Messages.GUI_GROUPUSERS_LIST_NAME_0), false);
108: }
109:
110: /**
111: * @see org.opencms.workplace.list.A_CmsListDialog#defaultActionHtmlStart()
112: */
113: public String defaultActionHtmlStart() {
114:
115: return getList().listJs() + dialogContentStart(getParamTitle());
116: }
117:
118: /**
119: * @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions()
120: */
121: public void executeListMultiActions() throws CmsRuntimeException {
122:
123: throwListUnsupportedActionException();
124: }
125:
126: /**
127: * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
128: */
129: public void executeListSingleActions() throws IOException,
130: ServletException {
131:
132: String userId = getSelectedItem().getId();
133:
134: Map params = new HashMap();
135: params.put(CmsDialog.PARAM_ACTION, CmsDialog.DIALOG_INITIAL);
136: params.put(A_CmsEditUserDialog.PARAM_USERID, userId);
137: params.put(A_CmsOrgUnitDialog.PARAM_OUFQN, getParamOufqn());
138:
139: if (getParamListAction().equals(LIST_ACTION_EDIT)) {
140: getToolManager().jspForwardTool(
141: this ,
142: getCurrentToolPath().substring(0,
143: getCurrentToolPath().indexOf('/', 2))
144: + "/orgunit/users/edit/user", params);
145: } else {
146: throwListUnsupportedActionException();
147: }
148: }
149:
150: /**
151: * @see org.opencms.workplace.tools.accounts.A_CmsGroupUsersList#getUsers(boolean)
152: */
153: protected List getUsers(boolean withOtherOus) throws CmsException {
154:
155: return getCms().getUsersOfGroup(getParamGroupname(),
156: withOtherOus);
157: }
158:
159: /**
160: * @see org.opencms.workplace.tools.accounts.A_CmsGroupUsersList#setDefaultAction(org.opencms.workplace.list.CmsListColumnDefinition)
161: */
162: protected void setDefaultAction(CmsListColumnDefinition loginCol) {
163:
164: CmsListDefaultAction editAction = new CmsListDefaultAction(
165: LIST_ACTION_EDIT) {
166:
167: /**
168: * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isEnabled()
169: */
170: public boolean isEnabled() {
171:
172: return getItem().get(LIST_COLUMN_ORGUNIT).equals(
173: CmsOrganizationalUnit.SEPARATOR
174: + ((CmsShowGroupUsersList) getWp())
175: .getParamOufqn());
176: }
177: };
178: editAction.setName(Messages.get().container(
179: Messages.GUI_USERS_LIST_ACTION_EDIT_NAME_0));
180: editAction.setHelpText(Messages.get().container(
181: Messages.GUI_USERS_LIST_ACTION_EDIT_HELP_0));
182: loginCol.addDefaultAction(editAction);
183: }
184:
185: /**
186: * @see org.opencms.workplace.tools.accounts.A_CmsGroupUsersList#setIconAction(org.opencms.workplace.list.CmsListColumnDefinition)
187: */
188: protected void setIconAction(CmsListColumnDefinition iconCol) {
189:
190: CmsListDirectAction iconAction = new CmsListDirectAction(
191: LIST_ACTION_ICON) {
192:
193: /**
194: * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#getIconPath()
195: */
196: public String getIconPath() {
197:
198: return ((A_CmsGroupUsersList) getWp())
199: .getIconPath(getItem());
200: }
201: };
202: iconAction.setName(Messages.get().container(
203: Messages.GUI_USERS_LIST_INGROUP_NAME_0));
204: iconAction.setHelpText(Messages.get().container(
205: Messages.GUI_USERS_LIST_INGROUP_HELP_0));
206: iconAction
207: .setIconPath(A_CmsUsersList.PATH_BUTTONS + "user.png");
208: iconAction.setEnabled(false);
209: iconCol.addDirectAction(iconAction);
210: }
211:
212: /**
213: * @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata)
214: */
215: protected void setMultiActions(CmsListMetadata metadata) {
216:
217: // noop
218: }
219:
220: /**
221: * @see org.opencms.workplace.tools.accounts.A_CmsGroupUsersList#setStateActionCol(org.opencms.workplace.list.CmsListMetadata)
222: */
223: protected void setStateActionCol(CmsListMetadata metadata) {
224:
225: // no-op
226: }
227: }
|