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

📄 listrecentthreads.jsp

📁 用java 写的论坛
💻 JSP
字号:
<%--
 - $Header: /cvsroot/mvnforum/mvnforum/srcweb/mvnplugin/mvnforum/user/listrecentthreads.jsp,v 1.19 2003/06/09 19:52:29 minhnn Exp $
 - $Author: minhnn $
 - $Revision: 1.19 $
 - $Date: 2003/06/09 19:52:29 $
 -
 - ====================================================================
 -
 - Copyright (C) 2002, 2003 by MyVietnam.net
 -
 - This program is free software; you can redistribute it and/or
 - modify it under the terms of the GNU General Public License
 - as published by the Free Software Foundation; either version 2
 - of the License, or any later version.
 -
 - All copyright notices regarding mvnForum MUST remain intact
 - in the scripts and in the outputted HTML.
 - The "powered by" text/logo with a link back to
 - http://www.mvnForum.com and http://www.MyVietnam.net in the
 - footer of the pages MUST remain visible when the pages
 - are viewed on the internet or intranet.
 -
 - This program is distributed in the hope that it will be useful,
 - but WITHOUT ANY WARRANTY; without even the implied warranty of
 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 - GNU General Public License for more details.
 -
 - You should have received a copy of the GNU General Public License
 - along with this program; if not, write to the Free Software
 - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 -
 - Support can be obtained from support forums at:
 - http://www.mvnForum.com/mvnforum/index
 -
 - Correspondence and Marketing Questions can be sent to:
 - info@MyVietnam.net
 -
 - @author: Minh Nguyen  minhnn@MyVietnam.net
 - @author: Mai  Nguyen  mai.nh@MyVietnam.net
 --%>
<%@ page contentType="text/html;charset=utf-8" %>
<%@ page errorPage="fatalerror.jsp"%>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.myvietnam.mvncore.util.ParamUtil" %>
<%@ page import="net.myvietnam.mvncore.util.StringUtil" %>
<%@ page import="net.myvietnam.mvncore.filter.EnableEmotionFilter" %>
<%@ page import="net.myvietnam.mvnplugin.mvnforum.db.*" %>
<%@ page import="net.myvietnam.mvnplugin.mvnforum.MyUtil" %>
<%@ page import="net.myvietnam.mvnplugin.mvnforum.MVNForumGlobal" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ include file="inc_common.jsp"%>
<html>
<head>
    <title>mvnForum - Hiển thị những luồng mới nhất</title>
<%@ include file="/mvnplugin/mvnforum/meta.jsp"%>
</head>
<link href="<%=contextPath%>/mvnplugin/mvnforum/css/style.css" rel=stylesheet type=text/css>
<script language="JavaScript" src="<%=contextPath%>/mvnplugin/mvnforum/js/mvnnav.js"></script>

<body leftmargin=0 topmargin=0>

<%@ include file="header.jsp"%>
<p>

<table width="95%" align="center">
<tr class="nav">
    <td><img src="<%=contextPath%>/mvnplugin/mvnforum/images/nav.gif"></td>
    <td width="100%" nowrap>
    <a class="navLink" href="index">mvnForum</a>&nbsp;&raquo;&nbsp;
    Hiển thị những luồng mới nhất
    </td>
</tr>
</table>
<p>

<%
CategoryCache categoryCache = CategoryCache.getInstance();
ForumCache forumCache = ForumCache.getInstance();
Collection forumBeans = forumCache.getBeans();
Iterator forumIterator = forumBeans.iterator();
int lastCategoryID = -1;
%>
<table width="95%" align="center">
<tr class="messageText"><td>
<form>
Chuyển nhanh tới &raquo; <select name="FastGoForum" onChange="gotoPage(this.options[this.selectedIndex].value)">
<%
while(forumIterator.hasNext()) {
    ForumBean row = (ForumBean)forumIterator.next();
    if (row.getCategoryID() != lastCategoryID) {// to print the category
        lastCategoryID = row.getCategoryID();
        CategoryBean categoryBean = categoryCache.getBean(lastCategoryID);
%>
    <option value=""></option>
    <option value="listforums"><%=categoryBean.getCategoryName()%></option>
    <option value="">---------------------------------</option>
<%
    }//if
%>
    <option value="listthreads?forum=<%=row.getForumID()%>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=row.getForumName()%></option>
<%
}//while
%>
</select>
</form>
</td></tr>
<tr>
    <td></td>
</tr>
</table>

<%
String sort  = ParamUtil.getParameter(request, "sort");
String order = ParamUtil.getParameter(request, "order");
if (sort.length() == 0) sort = "ThreadLastPostDate";
if (order.length() == 0) order = "DESC";
%>
<table width="95%" align="center">
<tr>
  <td nowrap class="messageText">
  <form action="listrecentthreads">
    Sắp xếp theo
    <select name="sort">
    <option value="ThreadLastPostDate" <%if (sort.equals("ThreadLastPostDate")) {%>selected<%}%>>Ngày gửi bài cuối</option>
    <option value="ThreadCreationDate" <%if (sort.equals("ThreadCreationDate")) {%>selected<%}%>>Ngày gửi bài đầu</option>
    <option value="MemberName" <%if (sort.equals("MemberName")) {%>selected<%}%>>Tác giả</option>
    <option value="ThreadReplyCount" <%if (sort.equals("ThreadReplyCount")) {%>selected<%}%>>Số bài trả lời</option>
    <option value="ThreadViewCount" <%if (sort.equals("ThreadViewCount")) {%>selected<%}%>>Số lần xem</option>
    </select>
    Thứ tự
    <select name="order">
    <option value="ASC" <%if (order.equals("ASC")) {%>selected<%}%>>Từ trên xuống</option>
    <option value="DESC" <%if (order.equals("DESC")) {%>selected<%}%>>Từ dưới lên</option>
    </select>

    <input type="button" value="Chuyển" onclick="disabled=true; submit();" class="liteoption">
  </form>
  </td>
</tr>
</table>

<table width="95%" align="center">
<tr>
    <td class="hightlight">Những luồng mới nhất trong tất cả diễn đàn:</td>
</tr>
</table>

<table width="95%" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#999999">
<tr bgcolor="#666699" class="header">
    <td colspan="3">Luồng</td>
    <td>Diễn đàn</td>
    <td align="center">Tác giả</td>
    <td align="center">Số bài trả lời</td>
    <td align="center">Số lần xem</td>
    <td align="center">Bài gửi cuối</td>
</tr>
<%
Collection threadBeans = (Collection) request.getAttribute("ThreadBeans");

int odd = 0;
Iterator iterator = threadBeans.iterator();
while(iterator.hasNext()) {
    odd = (odd + 1)%2;
    ThreadBean threadBean = (ThreadBean)iterator.next();
%>
<%if (odd == 0) {%>
<tr bgColor=#f5f5f5>
<%} else {%>
<tr bgcolor="White">
<%}%>
    <td width="16"><img src="<%=contextPath%>/mvnplugin/mvnforum/images/icon/<%=MyUtil.getThreadIconName(onlineUser.getLastLogonTimestamp().getTime(), threadBean.getThreadLastPostDate().getTime(), threadBean.getThreadReplyCount()+1)%>" border="0"></td>
    <td width="16"><%=EnableEmotionFilter.filter(threadBean.getThreadIcon(), ParamUtil.getContextPath() + MVNForumGlobal.EMOTION_DIR)%></td>
    <td>
        <a class="messageTextBoldBlue" href="viewthread?thread=<%=threadBean.getThreadID()%>">
        <%=MyUtil.filter(threadBean.getThreadTopic(), false/*html*/, true/*emotion*/, false/*mvnCode*/, false/*newLine*/, false/*URL*/)%>
        </a><br>
        <div class="messageText">
        <%=MyUtil.filter(StringUtil.getShorterString(threadBean.getThreadBody()), false/*html*/, true/*emotion*/, false/*mvnCode*/, false/*newLine*/, false/*URL*/)%>
        </div>
    </td>
    <td><a class="messageTopic" href="listthreads?forum=<%=threadBean.getForumID()%>"><%=forumCache.getBean(threadBean.getForumID()).getForumName()%></a></td>
    <td align="center" class="messageText">
        <a href="viewmember?member=<%=threadBean.getMemberName()%>" class="messageTextBoldBlue">
        <%=threadBean.getMemberName()%>
        </a>
    </td>
    <td align="center" class="messageTextBold"><%=threadBean.getThreadReplyCount()%></td>
    <td align="center" class="messageTextBold"><%=threadBean.getThreadViewCount()%></td>
    <td align="center" class="messageText">
        <%=onlineUser.getGMTTimestampFormat(threadBean.getThreadLastPostDate())%><br>bởi
        <a href="viewmember?member=<%=threadBean.getLastPostMemberName()%>" class="messageTextBoldBlue">
        <%=threadBean.getLastPostMemberName()%>
        </a>&nbsp;
        <a href="viewthread?thread=<%=threadBean.getThreadID()%>&lastpage=yes"><img src="<%=contextPath%>/mvnplugin/mvnforum/images/icon/right.gif" border="0" alt="Trang cuối"></a>
    </td>
</tr>
<%
}//while
if (threadBeans.size() == 0) {%>
    <td colspan="8" align="center" bgcolor="#f5f5f5" class="messageText">Hiện tại không có luồng nào</td>
<%}%>
</table>

<table width="95%" border="0" cellspacing="0" cellpadding="3" align="center" bgcolor="#999999">
<tr bgcolor="Silver">
    <td class="messageTextBold">
<%
int totalThreads = ((Integer)request.getAttribute("TotalThreads")).intValue();
int startOffset = ((Integer)request.getAttribute("StartOffset")).intValue();
int lastOffset = ((Integer)request.getAttribute("LastOffset")).intValue();
int previousOffset = ((Integer)request.getAttribute("PreviousOffset")).intValue();
int nextOffset = ((Integer)request.getAttribute("NextOffset")).intValue();

if (previousOffset >= 0) {
%>
    <a href="listrecentthreads?sort=<%=sort%>&order=<%=order%>&offset=<%=previousOffset%>"><img src="<%=contextPath%>/mvnplugin/mvnforum/images/icon/left.gif" border="0" alt="Trang trước"></a>
<%
} else {
%>
    &nbsp;&nbsp;&nbsp;&nbsp;
<%}%>
    &nbsp;&nbsp;<font class="hightlight">Luồng&nbsp;<%=startOffset%>&nbsp;-&nbsp;<%=lastOffset%>&nbsp;của&nbsp;<%=totalThreads%></font>&nbsp;&nbsp;
<%
if (nextOffset >= 0) {
%>
    <a href="listrecentthreads?sort=<%=sort%>&order=<%=order%>&offset=<%=nextOffset%>"><img src="<%=contextPath%>/mvnplugin/mvnforum/images/icon/right.gif" border="0" alt="Trang kế tiếp"></a>
<%
} else {
%>
    &nbsp;&nbsp;&nbsp;&nbsp;
<%}%>
    </td>
</tr>
</table>

<p>
&nbsp;

<p>
<%@ include file="footer.jsp"%></p>

</body>
</html>

⌨️ 快捷键说明

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