001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.workplace.tools.accounts; 029 030import org.opencms.file.CmsGroup; 031import org.opencms.file.CmsResource; 032import org.opencms.file.CmsUser; 033import org.opencms.i18n.CmsMessageContainer; 034import org.opencms.jsp.CmsJspActionElement; 035import org.opencms.main.CmsException; 036import org.opencms.main.CmsRuntimeException; 037import org.opencms.main.OpenCms; 038import org.opencms.security.CmsAccessControlEntry; 039import org.opencms.security.CmsRole; 040import org.opencms.util.CmsStringUtil; 041import org.opencms.util.CmsUUID; 042import org.opencms.workplace.CmsDialog; 043import org.opencms.workplace.list.A_CmsListDialog; 044import org.opencms.workplace.list.CmsListColumnAlignEnum; 045import org.opencms.workplace.list.CmsListColumnDefinition; 046import org.opencms.workplace.list.CmsListDefaultAction; 047import org.opencms.workplace.list.CmsListDirectAction; 048import org.opencms.workplace.list.CmsListItem; 049import org.opencms.workplace.list.CmsListItemActionIconComparator; 050import org.opencms.workplace.list.CmsListItemDetails; 051import org.opencms.workplace.list.CmsListItemDetailsFormatter; 052import org.opencms.workplace.list.CmsListMetadata; 053import org.opencms.workplace.list.CmsListMultiAction; 054import org.opencms.workplace.list.CmsListOrderEnum; 055import org.opencms.workplace.list.CmsListSearchAction; 056 057import java.io.IOException; 058import java.util.ArrayList; 059import java.util.HashMap; 060import java.util.HashSet; 061import java.util.Iterator; 062import java.util.List; 063import java.util.Map; 064import java.util.Set; 065 066import javax.servlet.ServletException; 067 068/** 069 * Skeleton for a generic group list.<p> 070 * 071 * @since 6.0.0 072 */ 073public abstract class A_CmsGroupsList extends A_CmsListDialog { 074 075 /** list action id constant. */ 076 public static final String LIST_ACTION_ACTIVATE = "aa"; 077 078 /** list action id constant. */ 079 public static final String LIST_ACTION_DEACTIVATE = "ac"; 080 081 /** list action id constant. */ 082 public static final String LIST_ACTION_DELETE = "ad"; 083 084 /** list action id constant. */ 085 public static final String LIST_ACTION_EDIT = "ae"; 086 087 /** list action id constant. */ 088 public static final String LIST_ACTION_USERS = "au"; 089 090 /** list column id constant. */ 091 public static final String LIST_COLUMN_ACTIVATE = "ca"; 092 093 /** list column id constant. */ 094 public static final String LIST_COLUMN_DELETE = "cd"; 095 096 /** list column id constant. */ 097 public static final String LIST_COLUMN_DESCRIPTION = "cc"; 098 099 /** list column id constant. */ 100 public static final String LIST_COLUMN_DISPLAY = "cdn"; 101 102 /** list column id constant. */ 103 public static final String LIST_COLUMN_EDIT = "ce"; 104 105 /** list column id constant. */ 106 public static final String LIST_COLUMN_NAME = "cn"; 107 108 /** list column id constant. */ 109 public static final String LIST_COLUMN_USERS = "cu"; 110 111 /** list action id constant. */ 112 public static final String LIST_DEFACTION_EDIT = "de"; 113 114 /** list item detail id constant. */ 115 public static final String LIST_DETAIL_CHILDREN = "dc"; 116 117 /** list item detail id constant. */ 118 public static final String LIST_DETAIL_PARENT = "dp"; 119 120 /** list item detail id constant. */ 121 public static final String LIST_DETAIL_SET_PERM = "dsp"; 122 123 /** list item detail id constant. */ 124 public static final String LIST_DETAIL_USERS = "du"; 125 126 /** list action id constant. */ 127 public static final String LIST_MACTION_ACTIVATE = "ma"; 128 129 /** list action id constant. */ 130 public static final String LIST_MACTION_DEACTIVATE = "mc"; 131 132 /** list action id constant. */ 133 public static final String LIST_MACTION_DELETE = "md"; 134 135 /** a set of action id's to use for deletion. */ 136 private static Set<String> m_deleteActionIds = new HashSet<String>(); 137 138 /** a set of action id's to use for edition. */ 139 private static Set<String> m_editActionIds = new HashSet<String>(); 140 141 /** Stores the value of the request parameter for the organizational unit fqn. */ 142 private String m_paramOufqn; 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 listId, CmsMessageContainer listName) { 152 153 super(jsp, listId, listName, LIST_COLUMN_DISPLAY, CmsListOrderEnum.ORDER_ASCENDING, null); 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 @Override 165 public void executeListMultiActions() throws CmsRuntimeException { 166 167 if (getParamListAction().equals(LIST_MACTION_DELETE)) { 168 // execute the delete multiaction 169 Map<String, String[]> params = new HashMap<String, String[]>(); 170 params.put(A_CmsEditGroupDialog.PARAM_GROUPID, new String[] {getParamSelItems()}); 171 // set action parameter to initial dialog call 172 params.put(CmsDialog.PARAM_ACTION, new String[] {CmsDialog.DIALOG_INITIAL}); 173 try { 174 getToolManager().jspForwardTool(this, getCurrentToolPath() + "/delete", params); 175 } catch (Exception e) { 176 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DELETE_SELECTED_GROUPS_0), e); 177 } 178 } else if (getParamListAction().equals(LIST_MACTION_ACTIVATE)) { 179 // execute the activate multiaction 180 try { 181 Iterator<CmsListItem> itItems = getSelectedItems().iterator(); 182 while (itItems.hasNext()) { 183 CmsListItem listItem = itItems.next(); 184 String groupName = listItem.get(LIST_COLUMN_NAME).toString(); 185 CmsGroup group = getCms().readGroup(groupName); 186 if (!group.isEnabled()) { 187 group.setEnabled(true); 188 getCms().writeGroup(group); 189 } 190 } 191 } catch (CmsException e) { 192 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_ACTIVATE_SELECTED_GROUPS_0), e); 193 } 194 // refreshing no needed becaus the activate action does not add/remove rows to the list 195 } else if (getParamListAction().equals(LIST_MACTION_DEACTIVATE)) { 196 // execute the activate multiaction 197 try { 198 Iterator<CmsListItem> itItems = getSelectedItems().iterator(); 199 while (itItems.hasNext()) { 200 CmsListItem listItem = itItems.next(); 201 String groupName = listItem.get(LIST_COLUMN_NAME).toString(); 202 CmsGroup group = getCms().readGroup(groupName); 203 if (group.isEnabled()) { 204 group.setEnabled(false); 205 getCms().writeGroup(group); 206 } 207 } 208 } catch (CmsException e) { 209 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DEACTIVATE_SELECTED_GROUPS_0), e); 210 } 211 // refreshing no needed becaus the activate action does not add/remove rows to the list 212 } else { 213 throwListUnsupportedActionException(); 214 } 215 listSave(); 216 } 217 218 /** 219 * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() 220 */ 221 @Override 222 public void executeListSingleActions() throws IOException, ServletException, CmsRuntimeException { 223 224 String groupId = getSelectedItem().getId(); 225 String groupName = getSelectedItem().get(LIST_COLUMN_NAME).toString(); 226 227 Map<String, String[]> params = new HashMap<String, String[]>(); 228 params.put(A_CmsEditGroupDialog.PARAM_GROUPID, new String[] {groupId.toString()}); 229 params.put(A_CmsOrgUnitDialog.PARAM_OUFQN, new String[] {m_paramOufqn}); 230 params.put(A_CmsEditGroupDialog.PARAM_GROUPNAME, new String[] {groupName}); 231 // set action parameter to initial dialog call 232 params.put(CmsDialog.PARAM_ACTION, new String[] {CmsDialog.DIALOG_INITIAL}); 233 234 if (getParamListAction().equals(LIST_DEFACTION_EDIT)) { 235 // forward to the edit user screen 236 getToolManager().jspForwardTool(this, getCurrentToolPath() + "/edit", params); 237 } else if (m_editActionIds.contains(getParamListAction())) { 238 getToolManager().jspForwardTool(this, getCurrentToolPath() + "/edit/group", params); 239 } else if (getParamListAction().equals(LIST_ACTION_USERS)) { 240 getToolManager().jspForwardTool(this, getCurrentToolPath() + "/edit/users", params); 241 } else if (m_deleteActionIds.contains(getParamListAction())) { 242 getToolManager().jspForwardTool(this, getCurrentToolPath() + "/edit/delete", params); 243 } else if (getParamListAction().equals(LIST_ACTION_ACTIVATE)) { 244 // execute the activate action 245 try { 246 CmsGroup group = getCms().readGroup(groupName); 247 group.setEnabled(true); 248 getCms().writeGroup(group); 249 } catch (CmsException e) { 250 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_ACTIVATE_GROUP_1, groupName), e); 251 } 252 } else if (getParamListAction().equals(LIST_ACTION_DEACTIVATE)) { 253 // execute the activate action 254 try { 255 CmsGroup group = getCms().readGroup(groupName); 256 group.setEnabled(false); 257 getCms().writeGroup(group); 258 } catch (CmsException e) { 259 throw new CmsRuntimeException(Messages.get().container(Messages.ERR_DEACTIVATE_GROUP_1, groupName), e); 260 } 261 } else { 262 throwListUnsupportedActionException(); 263 } 264 listSave(); 265 } 266 267 /** 268 * Returns the organizational unit fqn parameter value.<p> 269 * 270 * @return the organizational unit fqn parameter value 271 */ 272 public String getParamOufqn() { 273 274 return m_paramOufqn; 275 } 276 277 /** 278 * Sets the organizational unit fqn parameter value.<p> 279 * 280 * @param ouFqn the organizational unit fqn parameter value 281 */ 282 public void setParamOufqn(String ouFqn) { 283 284 if (ouFqn == null) { 285 ouFqn = ""; 286 } 287 m_paramOufqn = ouFqn; 288 } 289 290 /** 291 * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String) 292 */ 293 @Override 294 protected void fillDetails(String detailId) { 295 296 // get content 297 List<CmsListItem> groups = getList().getAllContent(); 298 Iterator<CmsListItem> itGroups = groups.iterator(); 299 while (itGroups.hasNext()) { 300 CmsListItem item = itGroups.next(); 301 String groupName = item.get(LIST_COLUMN_NAME).toString(); 302 StringBuffer html = new StringBuffer(512); 303 try { 304 if (detailId.equals(LIST_DETAIL_USERS)) { 305 // users 306 List<CmsUser> users = getCms().getUsersOfGroup(groupName, true); 307 Iterator<CmsUser> itUsers = users.iterator(); 308 while (itUsers.hasNext()) { 309 CmsUser user = itUsers.next(); 310 if (user.getOuFqn().equals(getParamOufqn())) { 311 html.append(user.getFullName()); 312 } else { 313 html.append(user.getDisplayName(getCms(), getLocale())); 314 } 315 if (itUsers.hasNext()) { 316 html.append("<br>"); 317 } 318 html.append("\n"); 319 } 320 } else if (detailId.equals(LIST_DETAIL_CHILDREN)) { 321 // childen 322 Iterator<CmsGroup> itChildren = getCms().getChildren(groupName, false).iterator(); 323 while (itChildren.hasNext()) { 324 CmsGroup group = itChildren.next(); 325 if (group.getOuFqn().equals(getParamOufqn())) { 326 html.append(group.getSimpleName()); 327 } else { 328 html.append(group.getDisplayName(getCms(), getLocale())); 329 } 330 if (itChildren.hasNext()) { 331 html.append("<br>"); 332 } 333 html.append("\n"); 334 } 335 } else if (detailId.equals(LIST_DETAIL_PARENT)) { 336 // parent 337 CmsGroup parent = getCms().readGroup(getCms().readGroup(groupName).getParentId()); 338 html.append(parent.getName()); 339 } else if (detailId.equals(LIST_DETAIL_SET_PERM)) { 340 // folder permissions 341 String storedSiteRoot = getCms().getRequestContext().getSiteRoot(); 342 try { 343 getCms().getRequestContext().setSiteRoot("/"); 344 CmsGroup group = getCms().readGroup(groupName); 345 Iterator<CmsResource> itRes = getCms().getResourcesForPrincipal( 346 group.getId(), 347 null, 348 false).iterator(); 349 while (itRes.hasNext()) { 350 CmsResource resource = itRes.next(); 351 html.append(resource.getRootPath()); 352 353 Iterator<CmsAccessControlEntry> itAces = getCms().getAccessControlEntries( 354 resource.getRootPath(), 355 false).iterator(); 356 while (itAces.hasNext()) { 357 CmsAccessControlEntry ace = itAces.next(); 358 if (ace.getPrincipal().equals(group.getId())) { 359 if (CmsStringUtil.isNotEmptyOrWhitespaceOnly( 360 ace.getPermissions().getPermissionString())) { 361 html.append(" (" + ace.getPermissions().getPermissionString() + ")"); 362 } 363 break; 364 } 365 } 366 367 if (itRes.hasNext()) { 368 html.append("<br>"); 369 } 370 html.append("\n"); 371 } 372 } finally { 373 getCms().getRequestContext().setSiteRoot(storedSiteRoot); 374 } 375 } else { 376 continue; 377 } 378 } catch (Exception e) { 379 // ignore 380 } 381 item.set(detailId, html.toString()); 382 } 383 } 384 385 /** 386 * Returns a list of groups.<p> 387 * 388 * @return the list of all groups 389 * 390 * @throws CmsException if something goes wrong 391 */ 392 protected abstract List<CmsGroup> getGroups() throws CmsException; 393 394 /** 395 * @see org.opencms.workplace.list.A_CmsListDialog#getListItems() 396 */ 397 @Override 398 protected List<CmsListItem> getListItems() throws CmsException { 399 400 List<CmsListItem> ret = new ArrayList<CmsListItem>(); 401 // get content 402 List<CmsGroup> groups = getGroups(); 403 Iterator<CmsGroup> itGroups = groups.iterator(); 404 while (itGroups.hasNext()) { 405 CmsGroup group = itGroups.next(); 406 CmsListItem item = getList().newItem(group.getId().toString()); 407 item.set(LIST_COLUMN_NAME, group.getName()); 408 item.set(LIST_COLUMN_DISPLAY, OpenCms.getWorkplaceManager().translateGroupName(group.getName(), false)); 409 item.set(LIST_COLUMN_DESCRIPTION, group.getDescription(getLocale())); 410 ret.add(item); 411 } 412 413 return ret; 414 } 415 416 /** 417 * @see org.opencms.workplace.CmsWorkplace#initMessages() 418 */ 419 @Override 420 protected void initMessages() { 421 422 // add specific dialog resource bundle 423 addMessages(Messages.get().getBundleName()); 424 // add default resource bundles 425 super.initMessages(); 426 } 427 428 /** 429 * @see org.opencms.workplace.list.A_CmsListDialog#setColumns(org.opencms.workplace.list.CmsListMetadata) 430 */ 431 @Override 432 protected void setColumns(CmsListMetadata metadata) { 433 434 // create column for edit 435 CmsListColumnDefinition editCol = new CmsListColumnDefinition(LIST_COLUMN_EDIT); 436 editCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_EDIT_0)); 437 editCol.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_EDIT_HELP_0)); 438 editCol.setWidth("20"); 439 editCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER); 440 editCol.setSorteable(false); 441 442 // add edit action 443 setEditAction(editCol); 444 m_editActionIds.addAll(editCol.getDirectActionIds()); 445 // add it to the list definition 446 metadata.addColumn(editCol); 447 448 // create column for group edition 449 CmsListColumnDefinition usersCol = new CmsListColumnDefinition(LIST_COLUMN_USERS); 450 usersCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_USERS_0)); 451 usersCol.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_USERS_HELP_0)); 452 usersCol.setWidth("20"); 453 usersCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER); 454 usersCol.setSorteable(false); 455 // add groups action 456 CmsListDirectAction usersAction = new CmsListDirectAction(LIST_ACTION_USERS); 457 usersAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_USERS_NAME_0)); 458 usersAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_USERS_HELP_0)); 459 usersAction.setIconPath(A_CmsUsersList.PATH_BUTTONS + "user.png"); 460 usersCol.addDirectAction(usersAction); 461 // add it to the list definition 462 metadata.addColumn(usersCol); 463 464 // create column for activation/deactivation 465 CmsListColumnDefinition actCol = new CmsListColumnDefinition(LIST_COLUMN_ACTIVATE); 466 actCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_ACTIVATE_0)); 467 actCol.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_ACTIVATE_HELP_0)); 468 actCol.setWidth("20"); 469 actCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER); 470 actCol.setListItemComparator(new CmsListItemActionIconComparator()); 471 472 // activate action 473 CmsListDirectAction actAction = new CmsListDirectAction(LIST_ACTION_ACTIVATE) { 474 475 /** 476 * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible() 477 */ 478 @Override 479 public boolean isVisible() { 480 481 if (getItem() != null) { 482 String groupId = getItem().getId(); 483 try { 484 return !getCms().readGroup(new CmsUUID(groupId)).isEnabled(); 485 } catch (CmsException e) { 486 return false; 487 } 488 } 489 return super.isVisible(); 490 } 491 }; 492 actAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_ACTIVATE_NAME_0)); 493 actAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_ACTIVATE_HELP_0)); 494 actAction.setConfirmationMessage(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_ACTIVATE_CONF_0)); 495 actAction.setIconPath(ICON_INACTIVE); 496 actCol.addDirectAction(actAction); 497 498 // deactivate action 499 CmsListDirectAction deactAction = new CmsListDirectAction(LIST_ACTION_DEACTIVATE) { 500 501 /** 502 * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible() 503 */ 504 @Override 505 public boolean isVisible() { 506 507 if (getItem() != null) { 508 String groupId = getItem().getId(); 509 try { 510 return getCms().readGroup(new CmsUUID(groupId)).isEnabled(); 511 } catch (CmsException e) { 512 return false; 513 } 514 } 515 return super.isVisible(); 516 } 517 }; 518 deactAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_DEACTIVATE_NAME_0)); 519 deactAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_DEACTIVATE_HELP_0)); 520 deactAction.setConfirmationMessage(Messages.get().container(Messages.GUI_GROUPS_LIST_ACTION_DEACTIVATE_CONF_0)); 521 deactAction.setIconPath(ICON_ACTIVE); 522 actCol.addDirectAction(deactAction); 523 // add it to the list definition 524 metadata.addColumn(actCol); 525 526 // create column for deletion 527 CmsListColumnDefinition deleteCol = new CmsListColumnDefinition(LIST_COLUMN_DELETE); 528 deleteCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_DELETE_0)); 529 deleteCol.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_DELETE_HELP_0)); 530 deleteCol.setWidth("20"); 531 deleteCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER); 532 deleteCol.setSorteable(false); 533 // add delete action 534 setDeleteAction(deleteCol); 535 m_deleteActionIds.addAll(deleteCol.getDirectActionIds()); 536 // add it to the list definition 537 metadata.addColumn(deleteCol); 538 539 // create column for name 540 CmsListColumnDefinition nameCol = new CmsListColumnDefinition(LIST_COLUMN_NAME); 541 // add it to the list definition 542 metadata.addColumn(nameCol); 543 nameCol.setVisible(false); 544 545 // create column for display name 546 CmsListColumnDefinition displayCol = new CmsListColumnDefinition(LIST_COLUMN_DISPLAY); 547 displayCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_NAME_0)); 548 displayCol.setWidth("35%"); 549 550 // create default edit action 551 CmsListDefaultAction defEditAction = new CmsListDefaultAction(LIST_DEFACTION_EDIT); 552 defEditAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_DEFACTION_EDIT_NAME_0)); 553 defEditAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_DEFACTION_EDIT_HELP_0)); 554 displayCol.addDefaultAction(defEditAction); 555 556 // add it to the list definition 557 metadata.addColumn(displayCol); 558 559 // add column for description 560 CmsListColumnDefinition descriptionCol = new CmsListColumnDefinition(LIST_COLUMN_DESCRIPTION); 561 descriptionCol.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_COLS_DESCRIPTION_0)); 562 descriptionCol.setWidth("65%"); 563 metadata.addColumn(descriptionCol); 564 } 565 566 /** 567 * Sets the needed delete action(s).<p> 568 * 569 * @param deleteCol the list column for deletion. 570 */ 571 protected abstract void setDeleteAction(CmsListColumnDefinition deleteCol); 572 573 /** 574 * Sets the needed edit action(s).<p> 575 * 576 * @param editCol the list column for edition. 577 */ 578 protected abstract void setEditAction(CmsListColumnDefinition editCol); 579 580 /** 581 * @see org.opencms.workplace.list.A_CmsListDialog#setIndependentActions(org.opencms.workplace.list.CmsListMetadata) 582 */ 583 @Override 584 protected void setIndependentActions(CmsListMetadata metadata) { 585 586 // add user users details 587 CmsListItemDetails usersDetails = new CmsListItemDetails(LIST_DETAIL_USERS); 588 usersDetails.setAtColumn(LIST_COLUMN_DISPLAY); 589 usersDetails.setVisible(false); 590 usersDetails.setShowActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_USERS_NAME_0)); 591 usersDetails.setShowActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_USERS_HELP_0)); 592 usersDetails.setHideActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_USERS_NAME_0)); 593 usersDetails.setHideActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_USERS_HELP_0)); 594 usersDetails.setName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_USERS_NAME_0)); 595 usersDetails.setFormatter( 596 new CmsListItemDetailsFormatter(Messages.get().container(Messages.GUI_GROUPS_DETAIL_USERS_NAME_0))); 597 metadata.addItemDetails(usersDetails); 598 599 // add user children details 600 CmsListItemDetails childDetails = new CmsListItemDetails(LIST_DETAIL_CHILDREN); 601 childDetails.setAtColumn(LIST_COLUMN_DISPLAY); 602 childDetails.setVisible(false); 603 childDetails.setShowActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_CHILDREN_NAME_0)); 604 childDetails.setShowActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_CHILDREN_HELP_0)); 605 childDetails.setHideActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_CHILDREN_NAME_0)); 606 childDetails.setHideActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_CHILDREN_HELP_0)); 607 childDetails.setName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_CHILDREN_NAME_0)); 608 childDetails.setFormatter( 609 new CmsListItemDetailsFormatter(Messages.get().container(Messages.GUI_GROUPS_DETAIL_CHILDREN_NAME_0))); 610 metadata.addItemDetails(childDetails); 611 612 // add parent group details 613 CmsListItemDetails parentDetails = new CmsListItemDetails(LIST_DETAIL_PARENT); 614 parentDetails.setAtColumn(LIST_COLUMN_DISPLAY); 615 parentDetails.setVisible(false); 616 parentDetails.setShowActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_PARENT_NAME_0)); 617 parentDetails.setShowActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_PARENT_HELP_0)); 618 parentDetails.setHideActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_PARENT_NAME_0)); 619 parentDetails.setHideActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_PARENT_HELP_0)); 620 parentDetails.setName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_PARENT_NAME_0)); 621 parentDetails.setFormatter( 622 new CmsListItemDetailsFormatter(Messages.get().container(Messages.GUI_GROUPS_DETAIL_PARENT_NAME_0))); 623 metadata.addItemDetails(parentDetails); 624 625 // add folder permission details 626 CmsListItemDetails setPermDetails = new CmsListItemDetails(LIST_DETAIL_SET_PERM); 627 setPermDetails.setAtColumn(LIST_COLUMN_DISPLAY); 628 setPermDetails.setVisible(false); 629 setPermDetails.setShowActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_SET_PERM_NAME_0)); 630 setPermDetails.setShowActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SHOW_SET_PERM_HELP_0)); 631 setPermDetails.setHideActionName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_SET_PERM_NAME_0)); 632 setPermDetails.setHideActionHelpText(Messages.get().container(Messages.GUI_GROUPS_DETAIL_HIDE_SET_PERM_HELP_0)); 633 setPermDetails.setName(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SET_PERM_NAME_0)); 634 setPermDetails.setFormatter( 635 new CmsListItemDetailsFormatter(Messages.get().container(Messages.GUI_GROUPS_DETAIL_SET_PERM_NAME_0))); 636 metadata.addItemDetails(setPermDetails); 637 638 // makes the list searchable 639 CmsListSearchAction searchAction = new CmsListSearchAction(metadata.getColumnDefinition(LIST_COLUMN_DISPLAY)); 640 metadata.setSearchAction(searchAction); 641 } 642 643 /** 644 * @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata) 645 */ 646 @Override 647 protected void setMultiActions(CmsListMetadata metadata) { 648 649 // add delete multi action 650 CmsListMultiAction deleteMultiAction = new CmsListMultiAction(LIST_MACTION_DELETE); 651 deleteMultiAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DELETE_NAME_0)); 652 deleteMultiAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DELETE_HELP_0)); 653 deleteMultiAction.setConfirmationMessage( 654 Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DELETE_CONF_0)); 655 deleteMultiAction.setIconPath(ICON_MULTI_DELETE); 656 metadata.addMultiAction(deleteMultiAction); 657 658 // add the activate user multi action 659 CmsListMultiAction activateUser = new CmsListMultiAction(LIST_MACTION_ACTIVATE); 660 activateUser.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_ACTIVATE_NAME_0)); 661 activateUser.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_ACTIVATE_HELP_0)); 662 activateUser.setConfirmationMessage(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_ACTIVATE_CONF_0)); 663 activateUser.setIconPath(ICON_MULTI_ACTIVATE); 664 metadata.addMultiAction(activateUser); 665 666 // add the deactivate user multi action 667 CmsListMultiAction deactivateUser = new CmsListMultiAction(LIST_MACTION_DEACTIVATE); 668 deactivateUser.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DEACTIVATE_NAME_0)); 669 deactivateUser.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DEACTIVATE_HELP_0)); 670 deactivateUser.setConfirmationMessage( 671 Messages.get().container(Messages.GUI_GROUPS_LIST_MACTION_DEACTIVATE_CONF_0)); 672 deactivateUser.setIconPath(ICON_MULTI_DEACTIVATE); 673 metadata.addMultiAction(deactivateUser); 674 } 675 676 /** 677 * @see org.opencms.workplace.list.A_CmsListDialog#validateParamaters() 678 */ 679 @Override 680 protected void validateParamaters() throws Exception { 681 682 // test the needed parameters 683 OpenCms.getRoleManager().checkRole(getCms(), CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParamOufqn())); 684 OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(), getParamOufqn()).getName(); 685 } 686}