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

📄 manage.jsp

📁 论坛系统EasyJForum 是一个基于 Java 技术的免费社区论坛软件系统
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page contentType="text/html;charset=gbk"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="com.hongshee.ejforum.util.PageUtils"%>
<%@ page import="com.hongshee.ejforum.util.AppUtils"%>
<%@ page import="com.hongshee.ejforum.common.ForumSetting"%>
<%@ page import="com.hongshee.ejforum.common.IConstants"%>
<%@ page import="com.hongshee.ejforum.common.CacheManager"%>
<%@ page import="com.hongshee.ejforum.data.UserDAO.UserInfo"%>
<%@ page import="com.hongshee.ejforum.data.BoardDAO.BoardVO"%>
<%@ page import="com.hongshee.ejforum.data.SectionDAO.SectionVO"%>
<%@ page import="com.hongshee.ejforum.data.GroupDAO.GroupVO"%>
<%@ page import="com.hongshee.ejforum.data.TopicDAO"%>
<%
	PageUtils.checkReferer(request); // Enhance security
	String ctxPath = request.getContextPath();
	
	UserInfo userinfo = PageUtils.getSessionUser(request);
    PageUtils.checkAdminIP(request);
    if (userinfo == null)
    {
		String fromPath = ctxPath + "/forum.jsp?" + request.getQueryString();
        request.setAttribute("fromPath", fromPath);
        request.getRequestDispatcher("/login.jsp").forward(request, response);
		return;
    }

	String sectionID = request.getParameter("sid");
	String boardID = request.getParameter("fid");

	String[] topicIDs = request.getParameterValues("chkTopicID");
    int totalCount = 0;
	if (topicIDs != null && topicIDs.length > 0)
	{
		totalCount = topicIDs.length;
	}
	else
	{
		request.setAttribute("errorMsg", "没有选中待操作的主题");
		request.getRequestDispatcher("/error.jsp").forward(request, response);
		return;
	}
	
	HashMap topicInfo = null;
	if (totalCount == 1)
	{
		topicInfo = TopicDAO.getInstance().getManageInfo(topicIDs[0]);
	}

	String replyID = request.getParameter("rid");

	CacheManager cache = CacheManager.getInstance();
	SectionVO aSection = cache.getSection(sectionID);
	BoardVO aBoard = cache.getBoard(aSection, boardID);

	GroupVO userGroup = PageUtils.getGroupVO(userinfo, aSection, aBoard);
	boolean isModerator = false;
	if (userGroup.groupID == 'A' || userGroup.groupID == 'M' || userGroup.groupID == 'S')
		isModerator = true;

	String action = request.getParameter("act");
	String actTitle = null;
	
	if (action.equals("highlight"))
		actTitle = "高亮显示";
	else if (action.equals("top"))
		actTitle = "置顶/解除置顶";
	else if (action.equals("digest"))
		actTitle = "加入/解除精华";
	else if (action.equals("close"))
		actTitle = "关闭/打开主题";
	else if (action.equals("delete"))
	{
		if (replyID != null && !replyID.equals("0"))
			actTitle = "删除回复";
		else	
			actTitle = "删除主题";
	}
	else if (action.equals("move"))
	{
		actTitle = "移动主题";
		if (!isModerator)
		{
			char isDigest = 'F';
			if (topicInfo != null)
				isDigest = ((String)topicInfo.get("ISDIGEST")).charAt(0);
			if (isDigest == 'T')
			{
				request.setAttribute("errorMsg", "此主题已被加为精华,不能再移动");
				request.getRequestDispatcher("/error.jsp").forward(request, response);
				return;
			}
			char state = 'N';
			if (topicInfo != null)
				state = ((String)topicInfo.get("STATE")).charAt(0);
			if (state == 'C')
			{
				request.setAttribute("errorMsg", "此主题已经关闭,不能再移动");
				request.getRequestDispatcher("/error.jsp").forward(request, response);
				return;
			}
		}
	}
	else if (action.equals("setbest"))
	{
		actTitle = "设定/取消最佳回复";
		if (!isModerator)
		{
			char state = 'N';
			if (topicInfo != null)
				state = ((String)topicInfo.get("STATE")).charAt(0);
			if (state == 'C')
			{
				request.setAttribute("errorMsg", "此主题已经关闭,不能再设置最佳回复");
				request.getRequestDispatcher("/error.jsp").forward(request, response);
				return;
			}
		}
	}
	
	String forumName = ForumSetting.getInstance().getForumName();
	String title = PageUtils.getTitle(forumName);
	String[] menus = PageUtils.getHeaderMenu(request, userinfo);
	
    ArrayList sections = cache.getSections();
	
	StringBuilder sbuf = new StringBuilder();
	sbuf.append("./forum-").append(aSection.sectionID).append("-").append(aBoard.boardID).append("-1.html");
	String forumUrl = sbuf.toString();
	String homeUrl = "./index.jsp";
	String forumStyle = PageUtils.getForumStyle(request, response, aBoard);
	
	String strPageNo = request.getParameter("page");
	int pageNo = PageUtils.getPageNo(strPageNo);
	if (replyID != null && replyID.equals("0"))
		pageNo = 1;
	
	sbuf.setLength(0);
	sbuf.append("perform.jsp?act=moderate_").append(action).append("&sid=").append(sectionID)
		.append("&fid=").append(boardID).append("&page=").append(String.valueOf(pageNo));
	String performUrl = sbuf.toString();

	ForumSetting setting = ForumSetting.getInstance();
	String showSectionLink = setting.getString(ForumSetting.DISPLAY, "showSectionLink");
	String sectionLink = null;
	if (showSectionLink.equalsIgnoreCase("yes"))
	{
		sbuf.setLength(0);
		sbuf.append(" &raquo;&nbsp; <A href=\"./index.jsp?sid=").append(sectionID)
			.append("\">").append(aSection.sectionName).append("</A>");
		sectionLink = sbuf.toString();
	}

	String topicUrl = null;
	if (replyID != null && replyID.length() > 0 && topicIDs[0] != null)
	{
		String topicTitle = PageUtils.getParam(request, "topic");
		sbuf.setLength(0);
		sbuf.append("<A href=\"./topic-").append(topicIDs[0]).append("-1.html\">").append(topicTitle).append("</A> &raquo; ");
		topicUrl = sbuf.toString();
	}
	else
	{
		topicUrl = "";
	}

	StringBuilder defaultValue = new StringBuilder();
	defaultValue.append("垃圾广告\n").append("恶意灌水\n").append("违规内容\n").append("文不对题\n").append("重复发帖\n\n")
				.append("我很赞同\n").append("精品文章\n").append("原创内容");

	String[] judgeOptions = setting.getHTMLStr(ForumSetting.FUNCTIONS,"judgeOptions",defaultValue.toString())
								   .replace("\\n", "\n").split("\n");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE><%= actTitle %> - <%= aBoard.boardName %> - <%= title %></TITLE>
<LINK href="styles/<%= forumStyle %>/ejforum.css" type=text/css rel=stylesheet>
</HEAD>
<BODY onkeydown="if(event.keyCode==27) return false;">
<SCRIPT src="js/common.js" type=text/javascript></SCRIPT>
<SCRIPT type=text/javascript>
function validate(theform) {
	if (typeof(theform.expiredate) != 'undefined' && !isLegalDate(theform.expiredate.value))
	{
		alert('有效期格式不正确或日期值无效');
		theform.expiredate.focus();
		return false;
	}
	return true;
}
</SCRIPT>
<DIV class=wrap>
<DIV id=header>
<%= PageUtils.getHeader(request, title) %>
</DIV>
<%= menus[0] %>
<DIV id=nav><A href="<%= homeUrl %>"><%= forumName %></A><%= sectionLink==null?"":sectionLink %> &raquo;&nbsp; 
<A href="<%= forumUrl %>"><%= aBoard.boardName %></A> &raquo;&nbsp; <%= topicUrl %>&nbsp;<%= actTitle %></DIV>
<form method="post" action="<%= performUrl %>" id="postform" name="postform" onSubmit="return validate(this)">
	<div class="mainbox formbox">
	<h1><%= actTitle %> -&nbsp; 选中的帖子数: <%= totalCount %></h1>
	<table summary="Operating" cellspacing="0" cellpadding="0">

⌨️ 快捷键说明

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