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

📄 watches.jsp

📁 Struts+Spring+Hibernate开发的BBS,功能很强大很完善
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page contentType="text/html;charset=ISO8859_1" %>
<%
/*
 * $RCSfile: watches.jsp,v $
 * $Revision: 1.1.1.1 $
 * $Date: 2002/09/09 13:50:09 $
 */
%>

<%@	page import="java.util.*,
	             com.jivesoftware.util.*,
                 com.jivesoftware.forum.*,
                 com.jivesoftware.forum.util.*"
%>

<%@ include file="global.jsp" %>

<%  // Get parameters
	long forumID = ParamUtils.getLongParameter(request,"forum",-1);
	long threadID = ParamUtils.getLongParameter(request,"thread",-1);
	int start = ParamUtils.getIntParameter(request,"start",0);
	int range = ParamUtils.getIntParameter(request,"range",10);
    int type = ParamUtils.getIntParameter(request,"type",WatchManager.NORMAL_WATCH);
    boolean add = ParamUtils.getBooleanParameter(request,"add");
    boolean remove = ParamUtils.getBooleanParameter(request,"remove");
    boolean deleteWatch = ParamUtils.getBooleanParameter(request,"deleteWatch");
    boolean flat = ParamUtils.getBooleanParameter(request,"flat",true);
    boolean edit = ParamUtils.getBooleanParameter(request,"edit");
    boolean save = ParamUtils.getBooleanParameter(request,"save");
    boolean doExpire = ParamUtils.getBooleanParameter(request,"doExpire");
    boolean expire = ParamUtils.getBooleanParameter(request,"expire");
    boolean back = ParamUtils.getBooleanParameter(request, "back");
    String referrer = ParamUtils.getParameter(request,"referrer");
    String redirect = ParamUtils.getParameter(request,"redirect");
    // thread IDs of threads we want to add email watches to
    String[] emailNotifyThreadIDs = request.getParameterValues("emailNotifyThreadID");
    // thread IDs of threads we want to add email watches to (the previous value)
    String[] oldEmailNotifyThreadIDs = request.getParameterValues("oldEmailNotifyThreadID");
    // thread IDs of the threads we want to remove all watches on
    String[] deleteWatchThreadIDs = request.getParameterValues("deleteWatchThreadID");
    // thread IDs of the threads we want to make un-deletable
    String[] saveWatchThreadIDs = request.getParameterValues("saveWatchThreadID");

    // null checks
    if (emailNotifyThreadIDs == null) { emailNotifyThreadIDs = new String[0]; }
    if (oldEmailNotifyThreadIDs == null) { oldEmailNotifyThreadIDs = new String[0]; }
    if (deleteWatchThreadIDs == null) { deleteWatchThreadIDs = new String[0]; }
    if (saveWatchThreadIDs == null) { saveWatchThreadIDs = new String[0]; }

    // set the referrer
    if (referrer == null) {
        referrer = request.getHeader("REFERER");
    }
    // go back if requested
    if (back) {
        if (referrer != null) {
            response.sendRedirect(referrer);
        }
        else {
            response.sendRedirect("index.jsp");
        }
        return;
   }

    // check to see if the user wants to automatically add an email notification
    boolean alwaysEmailNotify = false;
    try {
        alwaysEmailNotify = Boolean.valueOf(
            pageUser.getProperty("alwaysEmailNotify")).booleanValue();
    } catch (Exception e) {}

    // status message to the user
    String message = (String)session.getAttribute("message");
    if (message != null) {
        session.removeAttribute("message");
    }

    // The forum we're interested in
    Forum forum = null;
	// Get the forum
    if (forumID > -1L) {
        forum = myEnv.getForumFactory().getForum(forumID);
    }

    // The watch manager lets us work with the watches
    WatchManager watchManager = myEnv.getForumFactory().getWatchManager();

    // Get an iterator of watched threads for this user
    Iterator watchedThreads = null;
    if (forumID > -1L) {
        watchedThreads = watchManager.getWatchedForumThreads(forum, pageUser, WatchManager.NORMAL_WATCH);
    }
    else {
        watchedThreads = watchManager.getWatchedForumThreads(pageUser, WatchManager.NORMAL_WATCH);
    }

    // All forums
    Iterator forums = myEnv.getForumFactory().forums();

    // total number of watches
    int watchCount = 0;
    if (forumID > -1L) {
        watchCount = watchManager.getWatchCount(forum, pageUser, WatchManager.NORMAL_WATCH);
    }
    else {
        watchCount = watchManager.getWatchCount(pageUser, WatchManager.NORMAL_WATCH);
    }

    boolean errors = false;
    String errorMessage = "";
    if (add) {
        ForumThread thread = forum.getThread(threadID);
        watchManager.createWatch(pageUser, thread, type);
        if (type == WatchManager.NORMAL_WATCH) {
            if (alwaysEmailNotify) {
                watchManager.createWatch(pageUser, thread, WatchManager.EMAIL_NOTIFY_WATCH);
            }
        }
        if (redirect != null) {
            response.sendRedirect(redirect);
        }
        else {
            response.sendRedirect("thread.jsp?forum="+forumID+"&thread="+thread.getID());
        }
        return;
    }
    else if (doExpire) {
        ForumThread thread = forum.getThread(threadID);
        watchManager.setWatchExpirable(pageUser, thread, type, expire);
        if (watchManager.isWatchedThread(pageUser, thread, WatchManager.EMAIL_NOTIFY_WATCH)) {
            watchManager.setWatchExpirable(pageUser, thread, WatchManager.EMAIL_NOTIFY_WATCH, expire);
        }
        if (redirect != null) {
            response.sendRedirect(redirect);
        }
        else {
            response.sendRedirect("thread.jsp?forum="+forumID+"&thread="+thread.getID());
        }
        return;
    }
    else if (remove) {
        ForumThread thread = forum.getThread(threadID);
        watchManager.deleteWatch(pageUser, thread, type);
        if (type == WatchManager.NORMAL_WATCH) {
            if (watchManager.isWatchedThread(pageUser, thread, WatchManager.EMAIL_NOTIFY_WATCH)) {
                watchManager.deleteWatch(pageUser, thread, WatchManager.EMAIL_NOTIFY_WATCH);
            }
        }
        if (redirect != null) {
            response.sendRedirect(redirect);
        }
        else {
            response.sendRedirect("thread.jsp?forum="+forumID+"&thread="+thread.getID());
        }
        return;
    }
    else if (deleteWatch) {
        for (int i=0; i<deleteWatchThreadIDs.length; i++) {
            forumID = ParamUtils.getLongParameter(request, "thread"+deleteWatchThreadIDs[i]+"forumID", -1L);
            forum = myEnv.getForumFactory().getForum(forumID);
            ForumThread thread = forum.getThread(Long.parseLong(deleteWatchThreadIDs[i]));
            watchManager.deleteWatch(pageUser, thread, WatchManager.NORMAL_WATCH);
            if (watchManager.isWatchedThread(pageUser, thread, WatchManager.EMAIL_NOTIFY_WATCH)) {
                watchManager.deleteWatch(pageUser, thread, WatchManager.EMAIL_NOTIFY_WATCH);
            }
        }
        if (deleteWatchThreadIDs.length > 0) {
            // Get a watch manager
            watchManager = myEnv.getForumFactory().getWatchManager();

            // Get an iterator of watched threads for this user
            watchedThreads = watchManager.getWatchedForumThreads(pageUser, WatchManager.NORMAL_WATCH);

            // total number of watches
            watchCount = watchManager.getWatchCount(pageUser, WatchManager.NORMAL_WATCH);
        }
    }
%>

<%  String title ="论坛 - 监控信息"; %>
<%@ include file="header.jsp" %>

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
    <td width="99%" valign="top">

    <font face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.linkColor") %>">
    <b>监控信息</b>
    </font>
    <br>

    <%-- Breadcrumbs --%>

    <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>" color="<%= JiveGlobals.getJiveProperty("skin.default.linkColor") %>">
    <b>
    <a href="<%= JiveGlobals.getJiveProperty("skin.default.homeURL") %>"
    >首页</a>
    &raquo;
    <a href="index.jsp" title="返回论坛列表"
    >论坛</a>
    &raquo;
    <a href="watches.jsp">您的监控信息</a>
    <%  if (forumID != -1) { %>
    &raquo;
    <a href="forum.jsp?forum=<%= forumID %>"><%= forum.getName() %></a>
    <%  } %>
    </b>
    </font>
    <p>
    <font size="-1" face="<%= JiveGlobals.getJiveProperty("skin.default.fontFace") %>"
    color="<%= JiveGlobals.getJiveProperty("skin.default.textColor") %>">
	管理或者删除监控信息,主题监控可以允许您跟踪任何您感兴趣的主题,您可以通过电子邮件
	收到主题更新的监控信息,为了方便您使用,智能监控在一个主题超过30天没有更新的的情况下就
	会自动的从您的列表中删除,您可以点击“保存自动监控”来激活此功能.
    </font>
    </td>
    <td valign="top" width="1%" align="center">
    <%@ include file="loginbox.jsp" %>
    </td>

⌨️ 快捷键说明

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