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.jsp.CmsJspActionElement; 032import org.opencms.main.CmsException; 033import org.opencms.main.CmsRuntimeException; 034import org.opencms.workplace.list.CmsListColumnDefinition; 035import org.opencms.workplace.list.CmsListDirectAction; 036import org.opencms.workplace.list.CmsListItemActionIconComparator; 037import org.opencms.workplace.list.CmsListMetadata; 038 039import java.util.List; 040 041import javax.servlet.http.HttpServletRequest; 042import javax.servlet.http.HttpServletResponse; 043import javax.servlet.jsp.PageContext; 044 045/** 046 * User groups overview view.<p> 047 * 048 * @since 6.0.0 049 */ 050public class CmsShowUserGroupsList extends A_CmsUserGroupsList { 051 052 /** list id constant. */ 053 public static final String LIST_ID = "lsug"; 054 055 /** 056 * Public constructor.<p> 057 * 058 * @param jsp an initialized JSP action element 059 */ 060 public CmsShowUserGroupsList(CmsJspActionElement jsp) { 061 062 this(jsp, LIST_ID); 063 } 064 065 /** 066 * Public constructor.<p> 067 * 068 * @param jsp an initialized JSP action element 069 * @param listId the id of the list 070 */ 071 public CmsShowUserGroupsList(CmsJspActionElement jsp, String listId) { 072 073 super(jsp, listId, Messages.get().container(Messages.GUI_USERGROUPS_LIST_NAME_0), false); 074 } 075 076 /** 077 * Public constructor with JSP variables.<p> 078 * 079 * @param context the JSP page context 080 * @param req the JSP request 081 * @param res the JSP response 082 */ 083 public CmsShowUserGroupsList(PageContext context, HttpServletRequest req, HttpServletResponse res) { 084 085 this(new CmsJspActionElement(context, req, res)); 086 } 087 088 /** 089 * @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions() 090 */ 091 @Override 092 public void executeListMultiActions() throws CmsRuntimeException { 093 094 throwListUnsupportedActionException(); 095 } 096 097 /** 098 * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() 099 */ 100 @Override 101 public void executeListSingleActions() throws CmsRuntimeException { 102 103 throwListUnsupportedActionException(); 104 } 105 106 /** 107 * @see org.opencms.workplace.list.A_CmsListDialog#defaultActionHtmlEnd() 108 */ 109 @Override 110 protected String defaultActionHtmlEnd() { 111 112 return "<div class=\"dialogspacer\" unselectable=\"on\"> </div>"; 113 } 114 115 /** 116 * @see org.opencms.workplace.list.A_CmsListDialog#defaultActionHtmlStart() 117 */ 118 @Override 119 protected String defaultActionHtmlStart() { 120 121 return getList().listJs() + dialogContentStart(getParamTitle()); 122 } 123 124 /** 125 * @see org.opencms.workplace.tools.accounts.A_CmsUserGroupsList#getGroups(boolean) 126 */ 127 @Override 128 protected List<CmsGroup> getGroups(boolean withOtherOus) throws CmsException { 129 130 return getCms().getGroupsOfUser(getParamUsername(), false, withOtherOus); 131 } 132 133 /** 134 * @see org.opencms.workplace.tools.accounts.A_CmsUserGroupsList#setDefaultAction(org.opencms.workplace.list.CmsListColumnDefinition) 135 */ 136 @Override 137 protected void setDefaultAction(CmsListColumnDefinition nameCol) { 138 139 // no-op 140 } 141 142 /** 143 * @see org.opencms.workplace.tools.accounts.A_CmsUserGroupsList#setIconAction(org.opencms.workplace.list.CmsListColumnDefinition) 144 */ 145 @Override 146 protected void setIconAction(CmsListColumnDefinition iconCol) { 147 148 // adds a direct group icon 149 CmsListDirectAction dirAction = new CmsGroupStateAction(LIST_ACTION_ICON_DIRECT, true); 150 dirAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_DIRECT_NAME_0)); 151 dirAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_DIRECT_HELP_0)); 152 dirAction.setIconPath(A_CmsUsersList.PATH_BUTTONS + "group.png"); 153 dirAction.setEnabled(false); 154 iconCol.addDirectAction(dirAction); 155 156 // adds an indirect group icon 157 CmsListDirectAction indirAction = new CmsGroupStateAction(LIST_ACTION_ICON_INDIRECT, false); 158 indirAction.setName(Messages.get().container(Messages.GUI_GROUPS_LIST_INDIRECT_NAME_0)); 159 indirAction.setHelpText(Messages.get().container(Messages.GUI_GROUPS_LIST_INDIRECT_HELP_0)); 160 indirAction.setIconPath(A_CmsUsersList.PATH_BUTTONS + "group_indirect.png"); 161 indirAction.setEnabled(false); 162 iconCol.addDirectAction(indirAction); 163 164 iconCol.setListItemComparator(new CmsListItemActionIconComparator()); 165 } 166 167 /** 168 * @see org.opencms.workplace.tools.accounts.A_CmsUserGroupsList#setIndependentActions(org.opencms.workplace.list.CmsListMetadata) 169 */ 170 @Override 171 protected void setIndependentActions(CmsListMetadata metadata) { 172 173 super.setIndependentActions(metadata); 174 175 metadata.getItemDetailDefinition(LIST_DETAIL_OTHEROU).setVisible(false); 176 } 177 178 /** 179 * @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata) 180 */ 181 @Override 182 protected void setMultiActions(CmsListMetadata metadata) { 183 184 // noop 185 } 186 187 /** 188 * @see org.opencms.workplace.tools.accounts.A_CmsUserGroupsList#setStateActionCol(org.opencms.workplace.list.CmsListMetadata) 189 */ 190 @Override 191 protected void setStateActionCol(CmsListMetadata metadata) { 192 193 // no-op 194 } 195}