?? watches.jsp
字號:
<%@ 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>
»
<a href="index.jsp" title="返回論壇列表"
>論壇</a>
»
<a href="watches.jsp">您的監控信息</a>
<% if (forumID != -1) { %>
»
<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 + -