?? manage.jsp
字號:
<%@ 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(" » <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> » ");
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 %> »
<A href="<%= forumUrl %>"><%= aBoard.boardName %></A> » <%= topicUrl %> <%= actTitle %></DIV>
<form method="post" action="<%= performUrl %>" id="postform" name="postform" onSubmit="return validate(this)">
<div class="mainbox formbox">
<h1><%= actTitle %> - 選中的帖子數: <%= totalCount %></h1>
<table summary="Operating" cellspacing="0" cellpadding="0">
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -