<%@ page contentType="text/html;charset=GBK" %>

<%
/**
 *	$RCSfile: removeUser.jsp,v $
 *	$Revision: 1.1.1.1 $
 *	$Date: 2002/09/09 13:50:17 $
 */
%>

<%@ page import="java.util.*,
                 com.jivesoftware.forum.*,
                 com.jivesoftware.forum.util.*"%>

<%@ include file="global.jsp" %>

<%  // get parameters
	long userID = ParamUtils.getLongParameter(request,"user",-1L);
	boolean delete = ParamUtils.getBooleanParameter(request,"delete");
    String cancelButton = ParamUtils.getParameter(request,"cancelButton");

    // Cancel if requested
    if ("Cancel".equals(cancelButton)) {
        response.sendRedirect("users.jsp");
        return;
    }

    // Get a user manager
	UserManager manager = forumFactory.getUserManager();

    // Load the requested user
    User user = manager.getUser(userID);

    // Put the forum in the session (is needed by the sidebar)
    session.setAttribute("admin.sidebar.users.currentUserID", ""+userID);

    // delete forum if requested
    if (delete) {
        manager.deleteUser(user);
        // save a message in the session
        setOneTimeMessage(session,"admin.users.message","User deleted successfully.");
        // done deleting, so redirect back to the user summary page
		response.sendRedirect("users.jsp");
		return;
	}
%>

<%  // special onload command to load the sidebar
    onload = " onload=\"parent.frames['sidebar'].location.href='sidebar.jsp?sidebar=users';\"";
%>
<%@ include file="header.jsp" %>

<p>

<%  // Title of this page and breadcrumbs
    String title = "删除用户";
    String[][] breadcrumbs = {
        {"主页面", "main.jsp"},
        {"用户概览", "users.jsp"},
        {title, "removeUser.jsp?user="+userID}
    };
%>
<%@ include file="title.jsp" %>

<p>

<%	// determine if the user to be deleted is the current user
    boolean isCurrentUser = (authToken.getUserID() == user.getID());
    if (isCurrentUser) { %>
	<font size="-1" color="<%= errorColor %>">
	<b>警告！你正试图删除你拥有的用户账号。不推荐这样做！</b>
	</font>
    <p>
<%	} %>

<form action="removeUser.jsp" name="deleteForm">
<input type="hidden" name="delete" value="true">
<input type="hidden" name="user" value="<%= userID %>">

<font size="-1"><b>确认用户删除操作</b></font><p>
<ul>
    <font size="-1">
	警告: 这将永久的删除用户。你确认你真的想这样做？? (这<b>不会</b>删除该用户发布的消息。在用户被删除后该用户发布的消息将被标记为"anonymous"。)
    <p>
    </font>
	<input type="submit" value="删除用户">
	&nbsp;
	<input type="submit" name="cancelButton" value="取消">
</ul>
</form>

<script language="JavaScript" type="text/javascript">
<!--
// activate the "cancel" button -- if the user accidentally hits enter or
// space on this page, the default action would be to cancel, not delete
// the user ;)
document.deleteForm.cancelButton.focus();
//-->
</script>


</body>
</html>
