KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > accounts > A_CmsGroupsList


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/A_CmsGroupsList.java,v $
3  * Date : $Date: 2006/10/11 13:41:12 $
4  * Version: $Revision: 1.4 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.workplace.tools.accounts;
33
34 import org.opencms.file.CmsGroup;
35 import org.opencms.file.CmsResource;
36 import org.opencms.file.CmsUser;
37 import org.opencms.i18n.CmsMessageContainer;
38 import org.opencms.jsp.CmsJspActionElement;
39 import org.opencms.main.CmsException;
40 import org.opencms.main.CmsRuntimeException;
41 import org.opencms.security.CmsAccessControlEntry;
42 import org.opencms.util.CmsStringUtil;
43 import org.opencms.util.CmsUUID;
44 import org.opencms.workplace.CmsDialog;
45 import org.opencms.workplace.list.A_CmsListDialog;
46 import org.opencms.workplace.list.CmsListColumnAlignEnum;
47 import org.opencms.workplace.list.CmsListColumnDefinition;
48 import org.opencms.workplace.list.CmsListDefaultAction;
49 import org.opencms.workplace.list.CmsListDirectAction;
50 import org.opencms.workplace.list.CmsListItem;
51 import org.opencms.workplace.list.CmsListItemActionIconComparator;
52 import org.opencms.workplace.list.CmsListItemDetails;
53 import org.opencms.workplace.list.CmsListItemDetailsFormatter;
54 import org.opencms.workplace.list.CmsListMetadata;
55 import org.opencms.workplace.list.CmsListMultiAction;
56 import org.opencms.workplace.list.CmsListOrderEnum;
57
58 import java.io.IOException JavaDoc;
59 import java.util.ArrayList JavaDoc;
60 import java.util.HashMap JavaDoc;
61 import java.util.HashSet JavaDoc;
62 import java.util.Iterator JavaDoc;
63 import java.util.List JavaDoc;
64 import java.util.Map JavaDoc;
65 import java.util.Set JavaDoc;
66
67 import javax.servlet.ServletException JavaDoc;
68
69 /**
70  * Skeleton for a generic group list.<p>
71  *
72  * @author Michael Moossen
73  * @author Peter Bonrad
74  *
75  * @version $Revision: 1.4 $
76  *
77  * @since 6.0.0
78  */

79 public abstract class A_CmsGroupsList extends A_CmsListDialog {
80
81     /** list action id constant. */
82     public static final String JavaDoc LIST_ACTION_ACTIVATE = "aa";
83
84     /** list action id constant. */
85     public static final String JavaDoc LIST_ACTION_DEACTIVATE = "ac";
86
87     /** list action id constant. */
88     public static final String JavaDoc LIST_ACTION_DELETE = "ad";
89
90     /** list action id constant. */
91     public static final String JavaDoc LIST_ACTION_EDIT = "ae";
92
93     /** list action id constant. */
94     public static final String JavaDoc LIST_ACTION_USERS = "au";
95
96     /** list column id constant. */
97     public static final String JavaDoc LIST_COLUMN_ACTIVATE = "ca";
98
99     /** list column id constant. */
100     public static final String JavaDoc LIST_COLUMN_DELETE = "cd";
101
102     /** list column id constant. */
103     public static final String JavaDoc LIST_COLUMN_DESCRIPTION = "cc";
104
105     /** list column id constant. */
106     public static final String JavaDoc LIST_COLUMN_EDIT = "ce";
107
108     /** list column id constant. */
109     public static final String JavaDoc LIST_COLUMN_NAME = "cn";
110
111     /** list column id constant. */
112     public static final String JavaDoc LIST_COLUMN_PARENT = "cp";
113
114     /** list column id constant. */
115     public static final String JavaDoc LIST_COLUMN_USERS = "cu";
116
117     /** list action id constant. */
118     public static final String JavaDoc LIST_DEFACTION_EDIT = "de";
119
120     /** list item detail id constant. */
121     public static final String JavaDoc LIST_DETAIL_CHILDS = "dc";
122
123     /** list item detail id constant. */
124     public static final String JavaDoc LIST_DETAIL_SET_PERM = "dsp";
125
126     /** list item detail id constant. */
127     public static final String JavaDoc LIST_DETAIL_USERS = "du";
128
129     /** list action id constant. */
130     public static final String JavaDoc LIST_MACTION_ACTIVATE = "ma";
131
132     /** list action id constant. */
133     public static final String JavaDoc LIST_MACTION_DEACTIVATE = "mc";
134
135     /** list action id constant. */
136     public static final String JavaDoc LIST_MACTION_DELETE = "md";
137
138     /** a set of action id's to use for deletion. */
139     private static Set JavaDoc m_deleteActionIds = new HashSet JavaDoc();
140
141     /** a set of action id's to use for edition. */
142     private static Set JavaDoc m_editActionIds = new HashSet JavaDoc();
143
144     /**
145      * Public constructor.<p>
146      *
147      * @param jsp an initialized JSP action element
148      * @param listId the id of the list
149      * @param listName the name of the list
150      */

151     public A_CmsGroupsList(CmsJspActionElement jsp, String JavaDoc listId, CmsMessageContainer listName) {
152
153         super(jsp, listId, listName, LIST_COLUMN_NAME, CmsListOrderEnum.ORDER_ASCENDING, LIST_COLUMN_NAME);
154     }
155
156     /**
157      * This method should handle every defined list multi action,
158      * by comparing <code>{@link #getParamListAction()}</code> with the id
159      * of the action to execute.<p>
160      *
161      * @throws CmsRuntimeException to signal that an action is not supported
162      *
163      */

164     public void executeListMultiActions() throws CmsRuntimeException {
165
166         if (getParamListAction().equals(LIST_MACTION_DELETE)) {
167             // execute the delete multiaction
168
Map JavaDoc params = new HashMap JavaDoc();
169             params.put(A_CmsEditGroupDialog.PARAM_GROUPID, getParamSelItems());
170             // set action parameter to initial dialog call
171
params.put(CmsDialog.PARAM_ACTION, CmsDialog.DIALOG_INITIAL);
172             try {
173                 getToolManager().jspForwardTool(this, getCurrentToolPath() + "/delete", params);
174             } catch (Exception JavaDoc e) {
175                 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DELETE_SELECTED_GROUPS_0), e);
176             }
177         } else if (getParamListAction().equals(LIST_MACTION_ACTIVATE)) {
178             // execute the activate multiaction
179
try {
180                 Iterator JavaDoc itItems = getSelectedItems().iterator();
181                 while (itItems.hasNext()) {
182                     CmsListItem listItem = (CmsListItem)itItems.next();
183                     String JavaDoc groupName = listItem.get(LIST_COLUMN_NAME).toString();
184                     CmsGroup group = getCms().readGroup(groupName);
185                     if (!group.isEnabled()) {
186                         group.setEnabled(true);
187                         getCms().writeGroup(group);
188                     }
189                 }
190             } catch (CmsException e) {
191                 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_ACTIVATE_SELECTED_GROUPS_0), e);
192             }
193             // refreshing no needed becaus the activate action does not add/remove rows to the list
194
} else if (getParamListAction().equals(LIST_MACTION_DEACTIVATE)) {
195             // execute the activate multiaction
196
try {
197                 Iterator JavaDoc itItems = getSelectedItems().iterator();
198                 while (itItems.hasNext()) {
199                     CmsListItem listItem = (CmsListItem)itItems.next();
200                     String JavaDoc groupName = listItem.get(LIST_COLUMN_NAME).toString();
201                     CmsGroup group = getCms().readGroup(groupName);
202                     if (group.isEnabled()) {
203                         group.setEnabled(false);
204                         getCms().writeGroup(group);
205                     }
206                 }
207             } catch (CmsException e) {
208                 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DEACTIVATE_SELECTED_GROUPS_0), e);
209             }
210             // refreshing no needed becaus the activate action does not add/remove rows to the list
211
} else {
212             throwListUnsupportedActionException();
213         }
214         listSave();
215     }
216
217     /**
218      * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
219      */

220     public void executeListSingleActions() throws IOException JavaDoc, ServletException JavaDoc, CmsRuntimeException {
221
222         String JavaDoc groupId = getSelectedItem().getId();
223         String JavaDoc groupName = getSelectedItem().get(LIST_COLUMN_NAME).toString();
224
225         Map JavaDoc params = new HashMap JavaDoc();
226         params.put(A_CmsEditGroupDialog.PARAM_GROUPID, groupId);
227         // set action parameter to initial dialog call
228
params.put(CmsDialog.PARAM_ACTION, CmsDialog.DIALOG_INITIAL);
229
230         if (getParamListAction().equals(LIST_DEFACTION_EDIT)) {
231             // forward to the edit user screen
232
getToolManager().jspForwardTool(this, getCurrentToolPath() + "/edit", params);
233         } else if (m_editActionIds.contains(getParamListAction())) {
234             getToolManager().jspForwardTool(this, getCurrentToolPath() + "/edit/group", params);
235         } else if (getParamListAction().equals(LIST_ACTION_USERS)) {
236             getToolManager().jspForwardTool(this, getCurrentToolPath() + "/edit/users", params);
237         } else if (m_deleteActionIds.contains(getParamListAction())) {
238             getToolManager().jspForwardTool(this, getCurrentToolPath() + "/edit/delete", params);
239         } else if (getParamListAction().equals(LIST_ACTION_ACTIVATE)) {
240             // execute the activate action
241
try {
242                 CmsGroup group = getCms().readGroup(groupName);
243                 group.setEnabled(true);
244                 getCms().writeGroup(group);
245             } catch (CmsException e) {
246                 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_ACTIVATE_GROUP_1, groupName), e);
247             }
248         } else if (getParamListAction().equals(LIST_ACTION_DEACTIVATE)) {
249             // execute the activate action
250
try {
251                 CmsGroup group = getCms().readGroup(groupName);
252                 group.setEnabled(false);
253                 getCms().writeGroup(group);
254             } catch (CmsException e) {
255                 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DEACTIVATE_GROUP_1, groupName), e);
256             }
257         } else {
258             throwListUnsupportedActionException();
259         }
260         listSave();
261     }
262
263     /**
264      * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
265      */

266     protected void fillDetails(String JavaDoc detailId) {
267
268         // get content
269
List JavaDoc groups = getList().getAllContent();
270         Iterator JavaDoc itGroups = groups.iterator();
271         while (itGroups.hasNext()) {
272             CmsListItem item = (CmsListItem)itGroups.next();
273             String JavaDoc groupName = item.get(LIST_COLUMN_NAME).toString();
274             StringBuffer JavaDoc html = new StringBuffer JavaDoc(512);
275             try {
276                 if (detailId.equals(LIST_DETAIL_USERS)) {
277                     // users
278
Iterator JavaDoc itUsers = getCms().getUsersOfGroup(groupName).iterator();
279                     while (itUsers.hasNext()) {
280                         html.append(((CmsUser)itUsers.next()).getFullName());
281                         if (itUsers.hasNext()) {
282                             html.append("<br>");
283                         }
284                         html.append("\n");
285                     }
286                 } else if (detailId.equals(LIST_DETAIL_CHILDS)) {
287                     // childs
288
Iterator JavaDoc itChilds = getCms().getChild(groupName).iterator();
289                     while (itChilds.hasNext()) {
290                         html.append(((CmsGroup)itChilds.next()).getName());
291                         if (itChilds.hasNext()) {
292                             html.append("<br>");
293                         }
294                         html.append("\n");
295                     }
296                 } else if (detailId.equals(LIST_DETAIL_SET_PERM)) {
297                     // folder permissions
298
getCms().getRequestContext().saveSiteRoot();
299                     getCms().getRequestContext().setSiteRoot("/");
300                     CmsGroup group = getCms().readGroup(groupName);
301                     Iterator JavaDoc itRes = getCms().getResourcesForPrincipal(group.getId(), null, false).iterator();
302                     while (itRes.hasNext()) {
303                         CmsResource resource = (CmsResource)itRes.next();
304                         html.append(resource.getRootPath());
305                         
306                         Iterator JavaDoc itAces = getCms().getAccessControlEntries(resource.getRootPath(), false).iterator();
307                         while (itAces.hasNext()) {
308                             CmsAccessControlEntry ace = (CmsAccessControlEntry)itAces.next();
309                             if (ace.getPrincipal().equals(group.getId())) {
310                                 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(ace.getPermissions().getPermissionString())) {
311                                     html.append(" (" + ace.getPermissions().getPermissionString() + ")");
312                                 }
313                                 break;
314                             }
315                         }
316                         
317                         if (itRes.hasNext()) {
318                             html.append("<br>");
319                         }
320                         html.append("\n");
321                     }
322                     getCms().getRequestContext().restoreSiteRoot();
323                 } else {
324                     continue;
325                 }
326             } catch (Exception JavaDoc e) {
327                 // ignore
328
}
329             item.set(detailId, html.toString());
330         }
331     }
332
333     /**
334      * Returns a list of groups.<p>
335      *
336      * @return the list of all groups
337      *
338      * @throws CmsException if something goes wrong
339      */

340     protected abstract List JavaDoc getGroups() throws CmsException;
341
342     /**
343      * @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
344      */

345     protected List JavaDoc getListItems() throws CmsException {
346
347         List JavaDoc ret = new ArrayList JavaDoc();
348         // get content
349
List JavaDoc groups = getGroups();
350         Iterator JavaDoc itGroups = groups.iterator();
351         while (itGroups.hasNext()) {
352             CmsGroup group = (CmsGroup)itGroups.next();
353             CmsListItem item = getList().newItem(group.getId().toString());
354             item.set(LIST_COLUMN_NAME, group.getName());
355             item.set(LIST_COLUMN_DESCRIPTION, group.getDescription());
356             try {
357                 item.set(LIST_COLUMN_PARENT, getCms().readGroup(group.getParentId()).getName());
358             } catch (Exception JavaDoc e) {
359                 // ignore
360
}
361             ret.add(item);
362         }
363
364         return ret;
365     }
366
367     /**
368      * @see org.opencms.workplace.CmsWorkplace#initMessages()
369      */

370     protected void initMessages() {
371
372         // add specific dialog resource bundle
373
addMessages(Messages.get().getBundleName());
374         // add default resource bundles
375
super.initMessages();
376     }
377
378     /**
379      * @see org.opencms.workplace.list.A_CmsListDialog#setColumns(org.opencms.workplace.list.CmsListMetadata)
380      */

381     protected void setColumns(CmsListMetadata metadata) {
382
383         // create column for edit
384
CmsListColumnDefinition editCol = new CmsListColumnDefinition(LIST_COLUMN_EDIT);
385         editCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_EDIT_0));
386         editCol.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_EDIT_HELP_0));
387         editCol.setWidth("20");
388         editCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
389         editCol.setSorteable(false);
390
391         // add edit action
392
setEditAction(editCol);
393         m_editActionIds.addAll(editCol.getDirectActionIds());
394         // add it to the list definition
395
metadata.addColumn(editCol);
396
397         // create column for group edition
398
CmsListColumnDefinition usersCol = new CmsListColumnDefinition(LIST_COLUMN_USERS);
399         usersCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_USERS_0));
400         usersCol.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_USERS_HELP_0));
401         usersCol.setWidth("20");
402         usersCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
403         usersCol.setSorteable(false);
404         // add groups action
405
CmsListDirectAction usersAction = new CmsListDirectAction(LIST_ACTION_USERS);
406         usersAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_USERS_NAME_0));
407         usersAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_USERS_HELP_0));
408         usersAction.setIconPath(A_CmsUsersList.PATH_BUTTONS + "user.png");
409         usersCol.addDirectAction(usersAction);
410         // add it to the list definition
411
metadata.addColumn(usersCol);
412
413         // create column for activation/deactivation
414
CmsListColumnDefinition actCol = new CmsListColumnDefinition(LIST_COLUMN_ACTIVATE);
415         actCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_ACTIVATE_0));
416         actCol.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_ACTIVATE_HELP_0));
417         actCol.setWidth("20");
418         actCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
419         actCol.setListItemComparator(new CmsListItemActionIconComparator());
420
421         // activate action
422
CmsListDirectAction actAction = new CmsListDirectAction(LIST_ACTION_ACTIVATE) {
423
424             /**
425              * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible()
426              */

427             public boolean isVisible() {
428
429                 if (getItem() != null) {
430                     String JavaDoc groupId = getItem().getId();
431                     try {
432                         return !getCms().readGroup(new CmsUUID(groupId)).isEnabled();
433                     } catch (CmsException e) {
434                         return false;
435                     }
436                 }
437                 return super.isVisible();
438             }
439         };
440         actAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_ACTIVATE_NAME_0));
441         actAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_ACTIVATE_HELP_0));
442         actAction.setConfirmationMessage(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_ACTIVATE_CONF_0));
443         actAction.setIconPath(ICON_INACTIVE);
444         actCol.addDirectAction(actAction);
445
446         // deactivate action
447
CmsListDirectAction deactAction = new CmsListDirectAction(LIST_ACTION_DEACTIVATE) {
448
449             /**
450              * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible()
451              */

452             public boolean isVisible() {
453
454                 if (getItem() != null) {
455                     String JavaDoc groupId = getItem().getId();
456                     try {
457                         return getCms().readGroup(new CmsUUID(groupId)).isEnabled();
458                     } catch (CmsException e) {
459                         return false;
460                     }
461                 }
462                 return super.isVisible();
463             }
464         };
465         deactAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_DEACTIVATE_NAME_0));
466         deactAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_DEACTIVATE_HELP_0));
467         deactAction.setConfirmationMessage(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_DEACTIVATE_CONF_0));
468         deactAction.setIconPath(ICON_ACTIVE);
469         actCol.addDirectAction(deactAction);
470         // add it to the list definition
471
metadata.addColumn(actCol);
472
473         // create column for deletion
474
CmsListColumnDefinition deleteCol = new CmsListColumnDefinition(LIST_COLUMN_DELETE);
475         deleteCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_DELETE_0));
476         deleteCol.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_DELETE_HELP_0));
477         deleteCol.setWidth("20");
478         deleteCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
479         deleteCol.setSorteable(false);
480         // add delete action
481
setDeleteAction(deleteCol);
482         m_deleteActionIds.addAll(deleteCol.getDirectActionIds());
483         // add it to the list definition
484
metadata.addColumn(deleteCol);
485
486         // create column for name
487
CmsListColumnDefinition nameCol = new CmsListColumnDefinition(LIST_COLUMN_NAME);
488         nameCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_NAME_0));
489         nameCol.setWidth("20%");
490
491         // create default edit action
492
CmsListDefaultAction defEditAction = new CmsListDefaultAction(LIST_DEFACTION_EDIT);
493         defEditAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_DEFACTION_EDIT_NAME_0));
494         defEditAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_DEFACTION_EDIT_HELP_0));
495         nameCol.addDefaultAction(defEditAction);
496
497         // add it to the list definition
498
metadata.addColumn(nameCol);
499
500         // add column for description
501
CmsListColumnDefinition descriptionCol = new CmsListColumnDefinition(LIST_COLUMN_DESCRIPTION);
502         descriptionCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_DESCRIPTION_0));
503         descriptionCol.setWidth("60%");
504         metadata.addColumn(descriptionCol);
505
506         // add column for parent
507
CmsListColumnDefinition parentCol = new CmsListColumnDefinition(LIST_COLUMN_PARENT);
508         parentCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_PARENT_0));
509         parentCol.setWidth("20%");
510         metadata.addColumn(parentCol);
511     }
512
513     /**
514      * Sets the needed delete action(s).<p>
515      *
516      * @param deleteCol the list column for deletion.
517      */

518     protected abstract void setDeleteAction(CmsListColumnDefinition deleteCol);
519
520     /**
521      * Sets the needed edit action(s).<p>
522      *
523      * @param editCol the list column for edition.
524      */

525     protected abstract void setEditAction(CmsListColumnDefinition editCol);
526
527     /**
528      * @see org.opencms.workplace.list.A_CmsListDialog#setIndependentActions(org.opencms.workplace.list.CmsListMetadata)
529      */

530     protected void setIndependentActions(CmsListMetadata metadata) {
531
532         // add user users details
533
CmsListItemDetails usersDetails = new CmsListItemDetails(LIST_DETAIL_USERS);
534         usersDetails.setAtColumn(LIST_COLUMN_NAME);
535         usersDetails.setVisible(false);
536         usersDetails.setShowActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_USERS_NAME_0));
537         usersDetails.setShowActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_USERS_HELP_0));
538         usersDetails.setHideActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_USERS_NAME_0));
539         usersDetails.setHideActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_USERS_HELP_0));
540         usersDetails.setName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_USERS_NAME_0));
541         usersDetails.setFormatter(new CmsListItemDetailsFormatter(Messages.get().container(
542             Messages.GUI_GROUPS_DETAIL_USERS_NAME_0)));
543         metadata.addItemDetails(usersDetails);
544
545         // add user childs details
546
CmsListItemDetails childDetails = new CmsListItemDetails(LIST_DETAIL_CHILDS);
547         childDetails.setAtColumn(LIST_COLUMN_NAME);
548         childDetails.setVisible(false);
549         childDetails.setShowActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_CHILDS_NAME_0));
550         childDetails.setShowActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_CHILDS_HELP_0));
551         childDetails.setHideActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_CHILDS_NAME_0));
552         childDetails.setHideActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_CHILDS_HELP_0));
553         childDetails.setName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_CHILDS_NAME_0));
554         childDetails.setFormatter(new CmsListItemDetailsFormatter(Messages.get().container(
555             Messages.GUI_GROUPS_DETAIL_CHILDS_NAME_0)));
556         metadata.addItemDetails(childDetails);
557
558         // add folder permission details
559
CmsListItemDetails setPermDetails = new CmsListItemDetails(LIST_DETAIL_SET_PERM);
560         setPermDetails.setAtColumn(LIST_COLUMN_NAME);
561         setPermDetails.setVisible(false);
562         setPermDetails.setShowActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_SET_PERM_NAME_0));
563         setPermDetails.setShowActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_SET_PERM_HELP_0));
564         setPermDetails.setHideActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_SET_PERM_NAME_0));
565         setPermDetails.setHideActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_SET_PERM_HELP_0));
566         setPermDetails.setName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SET_PERM_NAME_0));
567         setPermDetails.setFormatter(new CmsListItemDetailsFormatter(Messages.get().container(
568             Messages.GUI_GROUPS_DETAIL_SET_PERM_NAME_0)));
569         metadata.addItemDetails(setPermDetails);
570     }
571
572     /**
573      * @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata)
574      */

575     protected void setMultiActions(CmsListMetadata metadata) {
576
577         // add delete multi action
578
CmsListMultiAction deleteMultiAction = new CmsListMultiAction(LIST_MACTION_DELETE);
579         deleteMultiAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DELETE_NAME_0));
580         deleteMultiAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DELETE_HELP_0));
581         deleteMultiAction.setConfirmationMessage(Messages.get().container(
582             Messages.GUI_GROUPS_LIST_MACTION_DELETE_CONF_0));
583         deleteMultiAction.setIconPath(ICON_MULTI_DELETE);
584         metadata.addMultiAction(deleteMultiAction);
585
586         // add the activate user multi action
587
CmsListMultiAction activateUser = new CmsListMultiAction(LIST_MACTION_ACTIVATE);
588         activateUser.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_ACTIVATE_NAME_0));
589         activateUser.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_ACTIVATE_HELP_0));
590         activateUser.setConfirmationMessage(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_ACTIVATE_CONF_0));
591         activateUser.setIconPath(ICON_MULTI_ACTIVATE);
592         metadata.addMultiAction(activateUser);
593
594         // add the deactivate user multi action
595
CmsListMultiAction deactivateUser = new CmsListMultiAction(LIST_MACTION_DEACTIVATE);
596         deactivateUser.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DEACTIVATE_NAME_0));
597         deactivateUser.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DEACTIVATE_HELP_0));
598         deactivateUser.setConfirmationMessage(Messages.get().container(
599             Messages.GUI_GROUPS_LIST_MACTION_DEACTIVATE_CONF_0));
600         deactivateUser.setIconPath(ICON_MULTI_DEACTIVATE);
601         metadata.addMultiAction(deactivateUser);
602     }
603 }
Popular Tags