removeForum.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:4k
源码类别:
电子政务应用
开发平台:
Java
- <%
- /**
- * $RCSfile: removeForum.jsp,v $
- * $Revision: 1.3 $
- * $Date: 2000/12/18 02:06:21 $
- */
- %>
- <%@ page import="java.util.*,
- com.coolservlets.forum.*,
- com.coolservlets.forum.util.*,
- com.coolservlets.forum.util.admin.*"%>
- <jsp:useBean id="adminBean" scope="session"
- class="com.coolservlets.forum.util.admin.AdminBean"/>
- <% ////////////////////////////////
- // Jive authorization check
- // check the bean for the existence of an authorization token.
- // Its existence proves the user is valid. If it's not found, redirect
- // to the login page
- Authorization authToken = adminBean.getAuthToken();
- if( authToken == null ) {
- response.sendRedirect( "/mainctrl/bbs/admin" );
- return;
- }
- %>
- <% ////////////////////
- // Security check
- // make sure the user is authorized to administer users:
- ForumFactory forumFactory = ForumFactory.getInstance(authToken);
- ForumPermissions permissions = forumFactory.getPermissions(authToken);
- boolean isSystemAdmin = permissions.get(ForumPermissions.SYSTEM_ADMIN);
- boolean isUserAdmin = permissions.get(ForumPermissions.FORUM_ADMIN);
- // redirect to error page if we're not a forum admin or a system admin
- if( !isUserAdmin && !isSystemAdmin ) {
- request.setAttribute("message","您没有权限管理论坛!");
- response.sendRedirect("error.jsp");
- return;
- }
- %>
- <% ////////////////////
- // get parameters
- int forumID = ParamUtils.getIntParameter(request,"forum",-1);
- boolean doDelete = ParamUtils.getBooleanParameter(request,"doDelete");
- %>
- <% //////////////////////////////////
- // global error variables
- String errorMessage = "";
- boolean noForumSpecified = (forumID < 0);
- boolean errors = (noForumSpecified);
- %>
- <% ////////////////////
- // make a profile manager
- ProfileManager manager = forumFactory.getProfileManager();
- %>
- <% /////////////////////
- // delete forum if specified
- if( doDelete && !errors ) {
- String message = "";
- try {
- Forum deleteableForum = forumFactory.getForum(forumID);
- forumFactory.deleteForum(deleteableForum);
- message = "论坛删除成功!";
- }
- catch( ForumNotFoundException fnfe ) {
- message = "此论坛不存在!";
- }
- catch( UnauthorizedException ue ) {
- message = "您没有权限删除此论坛!";
- }
- request.setAttribute("message",message);
- response.sendRedirect("forums.jsp");
- return;
- }
- %>
- <html>
- <head>
- <title></title>
- <link rel="stylesheet" href="style/global.css">
- </head>
- <body background="images/shadowBack.gif" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
- <% ///////////////////////
- // pageTitleInfo variable (used by include/pageTitle.jsp)
- String[] pageTitleInfo = { "论坛 : 删除论坛" };
- %>
- <% ///////////////////
- // pageTitle include
- %><%@ include file="include/pageTitle.jsp" %>
- <p>
- <% ////////////////////
- // display a list of forums to remove if no group was specified:
- if( noForumSpecified ) {
- String formAction = "remove";
- %>
- <%@ include file="forumChooser.jsp"%>
- <% out.flush();
- return;
- }
- %>
- <% /////////////////////
- // at this point, we know there is a forum to work with:
- Forum forum = null;
- try {
- forum = forumFactory.getForum(forumID);
- } catch( ForumNotFoundException fnfe ) {
- } catch( UnauthorizedException ue ) {
- }
- String forumName = forum.getName();
- int threadCount = forum.getThreadCount();
- int messageCount = forum.getMessageCount();
- %>
- 删除论坛 <b><%= forumName %></b>?
- (论题数量: <%= threadCount %>,帖子数量: <%= messageCount %>,
- <a href="forumContent.jsp?forum=<%=forumID%>">查看具体内容</a>
- )
- <p>
- <ul>
- 警告:这将删除此论坛中<b>所有</b>的帖子、论题,你确定要这样作吗?
- (但<b>不会</b>删除拥有访问此论坛的用户和用户组。)
- </ul>
- <form action="removeForum.jsp" name="deleteForm">
- <input type="hidden" name="doDelete" value="true">
- <input type="hidden" name="forum" value="<%= forumID %>">
- <input type="submit" value=" 删除论坛 ">
-
- <input type="submit" name="cancel" value=" 取消 " style="font-weight:bold;"
- onclick="location.href='forums.jsp';return false;">
- </form>
- <script language="JavaScript" type="text/javascript">
- <!--
- document.deleteForm.cancel.focus();
- //-->
- </script>
- </body>
- </html>