📄 cmsgrouptransferlist.java
字号:
/*
* File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/CmsGroupTransferList.java,v $
* Date : $Date: 2006/03/27 14:52:49 $
* Version: $Revision: 1.3 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software GmbH, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.workplace.tools.accounts;
import org.opencms.file.CmsGroup;
import org.opencms.file.CmsUser;
import org.opencms.jsp.CmsJspActionElement;
import org.opencms.main.CmsException;
import org.opencms.main.CmsRuntimeException;
import org.opencms.security.CmsPrincipal;
import org.opencms.util.CmsRequestUtil;
import org.opencms.util.CmsStringUtil;
import org.opencms.util.CmsUUID;
import org.opencms.workplace.list.A_CmsListDialog;
import org.opencms.workplace.list.CmsHtmlList;
import org.opencms.workplace.list.CmsListColumnAlignEnum;
import org.opencms.workplace.list.CmsListColumnDefinition;
import org.opencms.workplace.list.CmsListDefaultAction;
import org.opencms.workplace.list.CmsListDirectAction;
import org.opencms.workplace.list.CmsListItem;
import org.opencms.workplace.list.CmsListItemDetails;
import org.opencms.workplace.list.CmsListItemDetailsFormatter;
import org.opencms.workplace.list.CmsListMetadata;
import org.opencms.workplace.list.CmsListOrderEnum;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
/**
* Allows to select a group to transfer the permissions and attributes from another one.<p>
*
* @author Michael Moossen
*
* @version $Revision: 1.3 $
*
* @since 6.0.0
*/
public class CmsGroupTransferList extends A_CmsListDialog {
/** list action id constant. */
public static final String LIST_ACTION_TRANSFER = "at";
/** list column id constant. */
public static final String LIST_COLUMN_DESCRIPTION = "cc";
/** list column id constant. */
public static final String LIST_COLUMN_NAME = "cn";
/** list column id constant. */
public static final String LIST_COLUMN_PARENT = "cp";
/** list column id constant. */
public static final String LIST_COLUMN_TRANSFER = "ct";
/** list column id constant. */
public static final String LIST_COLUMN_USERS = "cu";
/** list action id constant. */
public static final String LIST_DEFACTION_TRANSFER = "dt";
/** list item detail id constant. */
public static final String LIST_DETAIL_CHILDS = "dc";
/** list item detail id constant. */
public static final String LIST_DETAIL_USERS = "du";
/** List id constant. */
public static final String LIST_ID = "lgt";
/** Stores the value of the group name, could be a list of names. */
private String m_groupName;
/** Stores the value of the request parameter for the group id, could be a list of ids. */
private String m_paramGroupid;
/**
* Public constructor.<p>
*
* @param jsp an initialized JSP action element
*/
public CmsGroupTransferList(CmsJspActionElement jsp) {
this(LIST_ID, jsp);
}
/**
* Public constructor with JSP variables.<p>
*
* @param context the JSP page context
* @param req the JSP request
* @param res the JSP response
*/
public CmsGroupTransferList(PageContext context, HttpServletRequest req, HttpServletResponse res) {
this(new CmsJspActionElement(context, req, res));
}
/**
* Protected constructor.<p>
*
* @param listId the id of the specialized list
* @param jsp an initialized JSP action element
*/
protected CmsGroupTransferList(String listId, CmsJspActionElement jsp) {
super(
jsp,
listId,
Messages.get().container(Messages.GUI_GROUPS_TRANSFER_LIST_NAME_0),
LIST_COLUMN_NAME,
CmsListOrderEnum.ORDER_ASCENDING,
LIST_COLUMN_NAME);
}
/**
* This method should handle every defined list multi action,
* by comparing <code>{@link #getParamListAction()}</code> with the id
* of the action to execute.<p>
*
* @throws CmsRuntimeException to signal that an action is not supported
*
*/
public void executeListMultiActions() throws CmsRuntimeException {
throwListUnsupportedActionException();
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
*/
public void executeListSingleActions() throws IOException, ServletException, CmsRuntimeException {
if (getParamListAction().equals(LIST_DEFACTION_TRANSFER) || getParamListAction().equals(LIST_ACTION_TRANSFER)) {
try {
getCms().deleteGroup(new CmsUUID(getParamGroupid()), new CmsUUID(getSelectedItem().getId()));
CmsRequestUtil.forwardRequest(getParamCloseLink(), getJsp().getRequest(), getJsp().getResponse());
setForwarded(true);
} catch (CmsException e) {
throw new CmsRuntimeException(Messages.get().container(
Messages.ERR_TRANSFER_GROUP_1,
getSelectedItem().get(LIST_COLUMN_NAME)), e);
}
} else {
throwListUnsupportedActionException();
}
listSave();
}
/**
* Returns the group Name.<p>
*
* @return the group Name
*/
public String getGroupName() {
return m_groupName;
}
/**
* Returns the group id parameter value.<p>
*
* @return the group id parameter value
*/
public String getParamGroupid() {
return m_paramGroupid;
}
/**
* Sets the group id parameter value.<p>
*
* @param groupId the group id parameter value
*/
public void setParamGroupid(String groupId) {
m_paramGroupid = groupId;
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#customHtmlStart()
*/
protected String customHtmlStart() {
StringBuffer result = new StringBuffer(2048);
result.append(dialogBlockStart(Messages.get().container(Messages.GUI_GROUPS_TRANSFER_NOTICE_0).key(getLocale())));
result.append("\n");
if (getCurrentToolPath().indexOf("/edit/") < 0) {
result.append(key(Messages.GUI_GROUP_DEPENDENCIES_SELECTED_GROUPS_0));
result.append(":<br>\n");
List users = CmsStringUtil.splitAsList(getGroupName(), CmsHtmlList.ITEM_SEPARATOR, true);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -