⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editforum.jsp

📁 非常完整的Java开发的网络办公系统
💻 JSP
字号:

<%
/**
 *	$RCSfile: editForum.jsp,v $
 *	$Revision: 1.4 $
 *	$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 doUpdate = ParamUtils.getBooleanParameter(request,"doUpdate");
	String newForumName = ParamUtils.getParameter(request,"forumName");
	String newForumDescription = ParamUtils.getParameter(request,"forumDescription");
%>

<%	//////////////////////////////////
	// global error variables
	
	String errorMessage = "";
	
	boolean noForumSpecified = (forumID < 0);
%>

<%	////////////////////
	// make a profile manager
	ProfileManager manager = forumFactory.getProfileManager();
%>

<%	/////////////////
	// update forum settings, if no errors
	if( doUpdate && !noForumSpecified ) {
		try {
			Forum tempForum = forumFactory.getForum(forumID);
			if( newForumName != null ) {
				tempForum.setName(newForumName);
			}
			if( newForumDescription != null ) {
				tempForum.setDescription(newForumDescription);
			}
			request.setAttribute("message","论坛属性修改成功!");
			response.sendRedirect("forums.jsp");
			return;
		}
		catch( ForumAlreadyExistsException e ) {
			System.err.println(e); e.printStackTrace();
		}
		catch( ForumNotFoundException fnfe ) {
			System.err.println(fnfe); fnfe.printStackTrace();
		}
		catch( UnauthorizedException ue ) {
			System.err.println(ue); ue.printStackTrace();
		}
	}
%>

<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 groups to edit if no group was specified:
	if( noForumSpecified ) {
		String formAction = "edit";
%>
		<%@ include file="forumChooser.jsp"%>
		
		
		
<%	/////////////////////
	// get an iterator of forums and display a list
	
	forumIterator = forumFactory.forums();
	if( !forumIterator.hasNext() ) {
%>
		没有论坛。
<%
	}
%>
		
<%		out.flush();
		return;
	}
%>

<%	/////////////////////
	// at this point, we know there is a group to work with:
	Forum forum = null;
	try {
		forum                  = forumFactory.getForum(forumID);
	}
	catch( ForumNotFoundException fnfe ) {
	}
	catch( UnauthorizedException ue ) {
	}
	String forumName             = forum.getName();
	String forumDescription      = forum.getDescription();
%>

论坛属性: <%= forumName %>

<p>

<form action="editForum.jsp" method="post">
<input type="hidden" name="doUpdate" value="true">
<input type="hidden" name="forum" value="<%= forumID %>">
	修改论坛名称:
	<input type="text" name="forumName" value="<%= forumName %>">
	
	<p>
	
	修改论坛描述:
	<textarea cols="30" rows="5" wrap="virtual" name="forumDescription"><%= forumDescription %></textarea>
	
	<p>
	
	<input type="submit" value="修改">
</form>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -