cmssessionslist.java
来自「找了很久才找到到源代码」· Java 代码 · 共 447 行 · 第 1/2 页
JAVA
447 行
/*
* File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/workplace/broadcast/CmsSessionsList.java,v $
* Date : $Date: 2007-08-13 16:30:17 $
* Version: $Revision: 1.16 $
*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) 2002 - 2007 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.workplace.broadcast;
import org.opencms.file.CmsUser;
import org.opencms.jsp.CmsJspActionElement;
import org.opencms.main.CmsException;
import org.opencms.main.CmsSessionInfo;
import org.opencms.main.OpenCms;
import org.opencms.util.CmsUUID;
import org.opencms.workplace.CmsDialog;
import org.opencms.workplace.list.A_CmsListDialog;
import org.opencms.workplace.list.CmsListColumnAlignEnum;
import org.opencms.workplace.list.CmsListColumnDefinition;
import org.opencms.workplace.list.CmsListDateMacroFormatter;
import org.opencms.workplace.list.CmsListDefaultAction;
import org.opencms.workplace.list.CmsListDirectAction;
import org.opencms.workplace.list.CmsListItem;
import org.opencms.workplace.list.CmsListItemActionIconComparator;
import org.opencms.workplace.list.CmsListItemDetails;
import org.opencms.workplace.list.CmsListItemDetailsFormatter;
import org.opencms.workplace.list.CmsListMetadata;
import org.opencms.workplace.list.CmsListMultiAction;
import org.opencms.workplace.list.CmsListOrderEnum;
import org.opencms.workplace.list.CmsListTimeIntervalFormatter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
/**
* Session list for broadcasting messages.<p>
*
* @author Michael Moossen
*
* @version $Revision: 1.16 $
*
* @since 6.0.0
*/
public class CmsSessionsList extends A_CmsListDialog {
/** list action id constant. */
public static final String LIST_ACTION_MESSAGE = "am";
/** list action id constant. */
public static final String LIST_ACTION_PENDING_DISABLED = "apd";
/** list action id constant. */
public static final String LIST_ACTION_PENDING_ENABLED = "ape";
/** list column id constant. */
public static final String LIST_COLUMN_CREATION = "cc";
/** list column id constant. */
public static final String LIST_COLUMN_INACTIVE = "ci";
/** list column id constant. */
public static final String LIST_COLUMN_MESSAGE = "cm";
/** list column id constant. */
public static final String LIST_COLUMN_ORGUNIT = "cou";
/** list column id constant. */
public static final String LIST_COLUMN_PENDING = "cp";
/** list column id constant. */
public static final String LIST_COLUMN_PROJECT = "cj";
/** list column id constant. */
public static final String LIST_COLUMN_SITE = "cs";
/** list column id constant. */
public static final String LIST_COLUMN_USER = "cu";
/** list action id constant. */
public static final String LIST_DEFACTION_MESSAGE = "dm";
/** list column id constant. */
public static final String LIST_DETAIL_EMAIL = "de";
/** list id constant. */
public static final String LIST_ID = "ls";
/** list action id constant. */
public static final String LIST_MACTION_EMAIL = "me";
/** list action id constant. */
public static final String LIST_MACTION_MESSAGE = "mm";
/** Path to the list buttons. */
public static final String PATH_BUTTONS = "tools/workplace/buttons/";
/**
* Public constructor.<p>
*
* @param jsp an initialized JSP action element
*/
public CmsSessionsList(CmsJspActionElement jsp) {
super(
jsp,
LIST_ID,
Messages.get().container(Messages.GUI_SESSIONS_LIST_NAME_0),
LIST_COLUMN_USER,
CmsListOrderEnum.ORDER_ASCENDING,
LIST_COLUMN_USER);
}
/**
* Public constructor with JSP variables.<p>
*
* @param context the JSP page context
* @param req the JSP request
* @param res the JSP response
*/
public CmsSessionsList(PageContext context, HttpServletRequest req, HttpServletResponse res) {
this(new CmsJspActionElement(context, req, res));
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions()
*/
public void executeListMultiActions() throws IOException, ServletException {
Map params = new HashMap();
params.put(A_CmsMessageDialog.PARAM_SESSIONIDS, getParamSelItems());
// set action parameter to initial dialog call
params.put(CmsDialog.PARAM_ACTION, CmsDialog.DIALOG_INITIAL);
if (getParamListAction().equals(LIST_MACTION_MESSAGE)) {
// execute the send message multiaction
// forward to the edit message screen
getToolManager().jspForwardTool(this, "/workplace/broadcast/message", params);
} else if (getParamListAction().equals(LIST_MACTION_EMAIL)) {
// execute the send email multiaction
// forward to the edit email screen
getToolManager().jspForwardTool(this, "/workplace/broadcast/email", params);
} else {
throwListUnsupportedActionException();
}
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
*/
public void executeListSingleActions() throws IOException, ServletException {
Map params = new HashMap();
params.put(A_CmsMessageDialog.PARAM_SESSIONIDS, getSelectedItem().getId());
// set action parameter to initial dialog call
params.put(CmsDialog.PARAM_ACTION, CmsDialog.DIALOG_INITIAL);
if (getParamListAction().equals(LIST_ACTION_MESSAGE) || getParamListAction().equals(LIST_DEFACTION_MESSAGE)) {
getToolManager().jspForwardTool(this, "/workplace/broadcast/message", params);
} else {
throwListUnsupportedActionException();
}
listSave();
}
/**
* @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
*/
protected void fillDetails(String detailId) {
// get content
List sessions = getList().getAllContent();
Iterator i = sessions.iterator();
while (i.hasNext()) {
CmsListItem item = (CmsListItem)i.next();
CmsSessionInfo session = OpenCms.getSessionManager().getSessionInfo(new CmsUUID(item.getId()));
StringBuffer html = new StringBuffer(32);
if (detailId.equals(LIST_DETAIL_EMAIL)) {
// email
try {
CmsUser user = getCms().readUser(session.getUserId());
html.append(user.getEmail());
} catch (CmsException e) {
// should never happen
}
} else {
continue;
}
item.set(detailId, html.toString());
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?