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

📄 forum.jsp

📁 论坛系统EasyJForum 是一个基于 Java 技术的免费社区论坛软件系统
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page contentType="text/html;charset=gbk" errorPage="error.jsp"%>
<%@ page import="java.util.ArrayList,java.util.Date"%>
<%@ 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.TopicDAO"%>
<%@ page import="com.hongshee.ejforum.data.TopicDAO.TopicInfo"%>
<%@ page import="com.hongshee.ejforum.data.GroupDAO.GroupVO"%>
<%
	UserInfo userinfo = PageUtils.getSessionUser(request);
	
	String sectionID = request.getParameter("sid");
	String boardID = request.getParameter("fid");

	CacheManager cache = CacheManager.getInstance();
	if (sectionID == null)
	{
		BoardVO tmpBoard = cache.getBoard(boardID);
		if (tmpBoard != null)
			sectionID = tmpBoard.sectionID;
		else
		{
			request.setAttribute("errorMsg", "很抱歉,您所要访问的版块不存在");
			request.getRequestDispatcher("/error.jsp").forward(request, response);
			return;
		}	
	}
	
	SectionVO aSection = cache.getSection(sectionID);
	BoardVO aBoard = cache.getBoard(aSection, boardID);
	if (aBoard == null)
	{
		aBoard = cache.getBoard(boardID);
		if (aBoard != null)
		{
			sectionID = aBoard.sectionID;
			aSection = cache.getSection(sectionID);		
		}
		else
		{
			request.setAttribute("errorMsg", "很抱歉,您所要访问的版块不存在");
			request.getRequestDispatcher("/error.jsp").forward(request, response);
			return;
		}	
	}

	String moderators = PageUtils.getModerators(aSection, aBoard);
	String moderatorLink = PageUtils.getModeratorLink(moderators);
	
	GroupVO userGroup = PageUtils.getGroupVO(userinfo, moderators);
	if (!PageUtils.isPermitted(aBoard,userGroup,IConstants.PERMIT_VISIT_FORUM) 
		|| aBoard.allowGroups.indexOf(userGroup.groupID) < 0)
	{
		if (userinfo == null)  // Guest
		{
			String fromPath = request.getRequestURI();
			String queryStr = request.getQueryString();
			if (queryStr != null)
				fromPath = fromPath + "?" + queryStr;
			request.setAttribute("fromPath", fromPath);
			request.getRequestDispatcher("/login.jsp").forward(request, response);
			return;
		}
		else
		{
			request.setAttribute("errorMsg", "很抱歉,您缺乏足够的访问权限");
			request.getRequestDispatcher("/error.jsp").forward(request, response);
			return;
		}
	}

	String ctxPath = request.getContextPath();
	String serverName = request.getServerName();
	if (!ctxPath.equals("/"))
		serverName = serverName + ctxPath;

	ForumSetting setting = ForumSetting.getInstance();
	
	String strPageNo = request.getParameter("page");
	int pageNo = PageUtils.getPageNo(strPageNo);
	int pageRows = setting.getInt(ForumSetting.DISPLAY, "topicsPerPage");

	String spec = request.getParameter("spec");
	if (spec == null || spec.length() == 0)
		spec = "all";
		
	String forumName = setting.getForumName();
	String title = PageUtils.getTitle(forumName);
	String[] menus = PageUtils.getHeaderMenu(request, userinfo);

	String sortField = request.getParameter("sortfield");
	if (sortField == null || sortField.length() == 0)
	{
		sortField = aBoard.sortField;
		if (sortField == null || sortField.length() == 0)
			sortField = "lastPostTime";
	}

	StringBuilder sbuf = new StringBuilder();
	sbuf.append("./forum-").append(sectionID).append("-").append(boardID);
	String forumUrl = response.encodeURL(sbuf.toString() + "-1.html");
	String homeUrl = response.encodeURL("./index.jsp");
	String forumStyle = PageUtils.getForumStyle(request, response, aBoard);
	
	String rssStyle = setting.getString(ForumSetting.FUNCTIONS, "RssStyle");
	String feedUrl = null;
	
	if (rssStyle.equals("B"))
		feedUrl = sbuf.toString() + "-0.xml";
	else	
		feedUrl = sbuf.toString() + "-1.xml";

    ArrayList sections = cache.getSections();
	
	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 = response.encodeURL(sbuf.toString());
	}

	Object[] result = TopicDAO.getInstance().getTopicList(aSection, aBoard, sortField, spec, pageNo, pageRows);
	
	boolean isModerator = false;
	if (userGroup.groupID == 'A' || userGroup.groupID == 'M' || userGroup.groupID == 'S')
		isModerator = true;
%>
<!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><%= aBoard.boardName %> - <%= title %></TITLE>
<%= PageUtils.getMetas(title, aBoard) %>
<%= PageUtils.getRSSLink(request, forumName, aSection, aBoard) %>
<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>
<DIV class=wrap>
<DIV id=header>
<%= PageUtils.getHeader(request, title) %>
<%= PageUtils.getHeadAdBanner(request, aBoard) %>
</DIV>
<%= menus[0] %>
<DIV id=foruminfo>
<DIV id=nav>
<P><A href="<%= homeUrl %>"><%= forumName %></A><%= sectionLink==null?"":sectionLink %> &raquo;&nbsp; 
<%= aBoard.boardName %></P>
<P>版主: <%= moderatorLink==null?"空缺中":moderatorLink %></P></DIV>
<DIV id=headsearch>
<SCRIPT type=text/javascript>
function doSearch() {
	if(trim($('frmsearch').q.value)=='')
	{
		alert('请输入搜索关键字');
		return false;
	}
	frmsearch.submit();
}
</SCRIPT>
<FORM id="frmsearch" name="frmsearch" 
	  action="http://www.google.cn/search" onsubmit="doSearch(); return false;" method=get target="google_window">
<INPUT type=hidden value="GB2312" name=ie> 
<INPUT type=hidden value="GB2312" name=oe> 
<INPUT type=hidden value=zh-CN name=hl> 
<INPUT type=hidden value="<%= serverName %>" name=sitesearch> 
<div style="padding-left:20px"><div onclick="javascript:window.open('http://www.google.cn/')" 
 style="cursor:pointer;float:left;width:70px;height:23px;background: url(images/google.png)! important;background: none; filter: 
 progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/google.png',sizingMethod='scale')"></div></div>&nbsp;
<INPUT id=q maxLength=255 size=12 name=q class="search">&nbsp; 
<a href="#" onclick="doSearch(); return false;">
<img src="styles/<%= forumStyle %>/images/search.gif" border="0" alt="站内搜索" align="absmiddle"/></a>
</FORM></DIV></DIV>
<DIV id=ad_text></DIV>
<%
	if (aBoard.ruleCode != null && aBoard.ruleCode.length() > 0) {
%>
<DIV class="mainbox forumlist" style="padding-top:0px">
<TABLE cellSpacing=0 cellPadding=0>
  <TBODY class="info">
  <TR><TD class="subject">本版规则</TD></TR>
  <TR><TD><%= aBoard.ruleCode %></TD></TR>
  </TBODY></TABLE></DIV>
<%
	}
%>  
<DIV class=pages_btns>
<%
	if (result != null && result[0] != null)
	{
%>	  
	<%= result[0] %>
<%
	}
%>
<SPAN class=postbtn id="newtopic" onmouseover="$('newtopic').id = 'newtopictmp';this.id = 'newtopic';showMenu(this.id);">
<A href="post.jsp?sid=<%= sectionID %>&fid=<%= boardID %>"><IMG alt=发新话题 
src="styles/<%= forumStyle %>/images/newtopic.gif" border=0></A></SPAN>
</DIV>
<UL class="popmenu_popup newtopicmenu" id="newtopic_menu" style="display: none">
<LI><a href="post.jsp?sid=<%= sectionID %>&fid=<%= boardID %>">发新话题</a></LI>		
<LI class="reward"><a href="post.jsp?sid=<%= sectionID %>&fid=<%= boardID %>&act=reward">发布悬赏</a></LI>
</UL>
<DIV id=headfilter>
<UL class=tabs>
  <LI<%= spec.equals("all")?" class=spec":""%>><A href="<%= forumUrl %>">全部</A></LI>
  <LI<%= spec.equals("digest")?" class=spec":""%>><A 
  		href="forum.jsp?sid=<%= sectionID %>&fid=<%= boardID %>&spec=digest">精华</A></LI>
  <LI<%= spec.equals("reward")?" class=spec":""%>><A 
  		href="forum.jsp?sid=<%= sectionID %>&fid=<%= boardID %>&spec=reward">悬赏</A></LI>
  <LI style="border:none"><A title="RSS Feed" href="<%= feedUrl %>" target=_blank>
  	  <IMG alt="RSS Feed" src="images/rss.gif" border="0"></A></LI>
</UL>
</DIV>
<DIV class="mainbox topiclist">
<H1><A class=bold href="<%= forumUrl %>"><%= aBoard.boardName %></A> </H1>
<%
	if (isModerator) {
		sbuf.setLength(0);
		sbuf.append("manage.jsp?sid=").append(sectionID).append("&fid=").append(boardID)
			.append("&page=").append(pageNo);
%>
<FORM name="frmmanage" action="<%= response.encodeURL(sbuf.toString()) %>" method=post>
<%
	}
%>
<TABLE cellSpacing=0 cellPadding=0>
  <THEAD class=category>
  <TR>
    <TD>&nbsp;</TD>
    <TD>主题</TD>
    <TD class=author>作者</TD>
    <TD class=nums>回复/查看</TD>
    <TD class=lastpost>最后发表</TD></TR></THEAD>
<%
	if (result != null && result[1] != null)
	{
		ArrayList topicList = (ArrayList)result[1];

		TopicInfo aTopic = null;
		String topicUrl = null;

⌨️ 快捷键说明

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