?? forumcontent_thread.jsp
字號:
<%/** * $RCSfile: forumContent_thread.jsp,v $ * $Revision: 1.2.12.2 $ * $Date: 2003/07/25 03:29:45 $ */%><%@ page import="java.net.*, java.util.*, java.text.*, com.jivesoftware.forum.*, com.jivesoftware.forum.util.*, com.jivesoftware.util.*" errorPage="error.jsp"%><%@ include file="global.jsp" %><%! // Global variables, methods, etc // More methods at the bottom of the page // default range & starting point for the thread iterators private final static int START = 0; private final static int RANGE = 15;%><% // Get parameters long forumID = ParamUtils.getLongParameter(request,"forum",-1L); long threadID = ParamUtils.getLongParameter(request,"thread",-1L); long messageID = ParamUtils.getLongParameter(request,"message",-1L); int start = ParamUtils.getIntParameter(request,"start",START); int range = ParamUtils.getIntParameter(request,"range",RANGE); boolean delete = ParamUtils.getBooleanParameter(request,"delete"); // "nav" indicates if we show the next/prev links boolean nav = false; // Only show nav if the thread starting point and thread range are passed in: int threadStart = ParamUtils.getIntParameter(request,"tstart",-1); int threadRange = ParamUtils.getIntParameter(request,"trange",-1); if (threadStart > -1 && threadRange > -1) { nav = true; // If the starting point is not zero, back it up one (because the last thread // is likely the one before it) if (threadStart > 0) { threadStart--; } // Always increment the range by one since we don't know // if the last thread on the thread list page was clicked: threadRange++; } // Load the forum we're working with Forum forum = forumFactory.getForum(forumID); // Permissions check if (!isSystemAdmin && !forum.isAuthorized(ForumPermissions.FORUM_CATEGORY_ADMIN | ForumPermissions.FORUM_ADMIN | ForumPermissions.MODERATOR)) { throw new UnauthorizedException("You don't have admin privileges to perform this operation."); } // Optionally load the thread we're working with ForumThread thread = null; if (threadID != -1L) { thread = forum.getThread(threadID); } // Optionally load the thread we're working with ForumMessage message = null; if (messageID != -1L) { message = thread.getMessage(messageID); } // Number of replies to this thread int numMessages = thread.getMessageCount(); int numReplies = numMessages-1; // subtract 1 because the root message is counted int numPages = (int)Math.ceil((double)numMessages/(double)range); // Get a thread iterator (for the next/previous thread feature) ForumThreadIterator threadIterator = null; if (nav) { ResultFilter threadFilter = new ResultFilter(); threadFilter.setStartIndex(threadStart); threadFilter.setNumResults(threadRange); threadIterator = forum.getThreads(threadFilter); threadIterator.setIndex(thread); }%><% // special onload command to load the sidebar onload = " onload=\"parent.frames['sidebar'].location.href='sidebar.jsp?sidebar=forum';\"";%><%@ include file="header.jsp" %><p><% // Title of this page and breadcrumbs String title = "Manage Content: Edit Thread"; String[][] breadcrumbs = null; if (!isSystemAdmin && !isCatAdmin && !isForumAdmin && isModerator) { breadcrumbs = new String[][] { {"Main", "main.jsp"}, {"Categories & Forums", "forumContent.jsp"}, {"Manage Content", "forumContent.jsp?forum="+forumID}, {"Edit Thread", "forumContent_thread.jsp?forum="+forumID+"&thread="+threadID+"&message="+messageID} }; } else { breadcrumbs = new String[][] { {"Main", "main.jsp"}, {"Categories & Forums", "forums.jsp?cat=" + forum.getForumCategory().getID()}, {"Edit Forum", "editForum.jsp?forum="+forumID}, {"Manage Content", "forumContent.jsp?forum="+forumID}, {"Edit Thread", "forumContent_thread.jsp?forum="+forumID+"&thread="+threadID+"&message="+messageID} }; }%><%@ include file="title.jsp" %><b><%= thread.getName() %></b></font><br><font size="-1">Created: <%= SkinUtils.formatDate(request,pageUser,thread.getCreationDate()) %>,Modified: <%= SkinUtils.formatDate(request,pageUser,thread.getModificationDate()) %></font><table cellpadding="2" cellspacing="0" border="0"><tr><td> <% String redirect = "forumContent_thread.jsp?forum="+forumID+"&thread="+threadID; %> <a href="editThreadProps.jsp?forum=<%= forumID %>&thread=<%= threadID %>&redirect=<%= URLEncoder.encode(redirect) %>" title="Click to edit extended properties of this thread" ><img src="images/button_edit.gif" width="17" height="17" border="0" ></a> </td><td> <font size="-1"> <a href="editThreadProps.jsp?forum=<%= forumID %>&thread=<%= threadID %>&redirect=<%= URLEncoder.encode(redirect) %>" title="Click to edit extending properties of this thread" >Edit Thread Properties</a> </font> </td> <td> </td> <td> <a href="forumContent_delete.jsp?forum=<%= forumID %>&thread=<%= threadID %>" title="Click to delete this message and its replies..." ><img src="images/button_delete.gif" width="17" height="17" border="0" ></a> </td><td> <font size="-1"> <a href="forumContent_delete.jsp?forum=<%= forumID %>&thread=<%= threadID %>" title="Click to delete this message and its replies..." >Delete This Thread</a> </font> </td></tr></table><br><table cellpadding="0" cellspacing="2" border="0" width="100%" align="center"><tr><td colspan="3"><img src="images/blank.gif" width="1" height="5" border="0"></td></tr><tr> <td width="1%" nowrap><% if (threadIterator != null && threadIterator.hasPrevious()) { ForumThread prevThread = (ForumThread) threadIterator.previous(); // advance the iterator pointer back to the original index threadIterator.next(); String subj = StringUtils.escapeHTMLTags(prevThread.getRootMessage().getUnfilteredSubject()); // Replace any " in the subject subj = StringUtils.replace(subj, "\"", """);%> <a href="forumContent_thread.jsp?forum=<%= forumID %>&thread=<%= prevThread.getID() %>&tstart=<%=threadStart %>&trange=<%= threadRange %>" title="Thread: <%= subj %>"><img src="images/prev.gif" width="10" height="10" hspace="2" border="0"></a> <font size="-1"> <a href="forumContent_thread.jsp?forum=<%= forumID %>&thread=<%= prevThread.getID() %>&tstart=<%=threadStart %>&trange=<%= threadRange %>" title="Thread: <%= subj %>">Previous Thread</a> </font><% } else { %> <% } %> </td> <td width="98%" align="center"> <font size="-1"><a href="forumContent.jsp?forum=<%= forumID %>">Back To Thread List</a></font> </td> <td width="1%" nowrap><% if (threadIterator != null && threadIterator.hasNext()) { ForumThread nextThread = (ForumThread)threadIterator.next(); // reverse the iterator pointer back to the original index threadIterator.previous(); String subj = StringUtils.escapeHTMLTags(nextThread.getRootMessage().getUnfilteredSubject()); // Replace any " in the subject subj = StringUtils.replace(subj, "\"", """);%> <font size="-1"> <a href="forumContent_thread.jsp?forum=<%= forumID %>&thread=<%= nextThread.getID() %>&tstart=<%=threadStart %>&trange=<%= threadRange %>" title="Thread: <%= subj %>">Next Thread</a> </font> <a href="forumContent_thread.jsp?forum=<%= forumID %>&thread=<%= nextThread.getID() %>&tstart=<%=threadStart %>&trange=<%= threadRange %>" title="Thread: <%= subj %>"><img src="images/next.gif" width="10" height="10" hspace="2" border="0"></a><% } else { %> <% } %> </td></tr></table><p><% if (numPages > 1) { %><font size="-1"><%= getThreadPaginator(forumID, threadID, numMessages, numReplies, numPages, start, range) %></font><% } %><% // loop through all threads in the forum ResultFilter filter = new ResultFilter(); filter.setStartIndex(start); filter.setNumResults(range); filter.setSortOrder(ResultFilter.ASCENDING); filter.setSortField(JiveConstants.CREATION_DATE); Iterator messages = thread.getMessages(filter); while (messages.hasNext()) { ForumMessage theMessage = (ForumMessage)messages.next(); User author = theMessage.getUser(); boolean isRootMessage = (theMessage.getID() == thread.getRootMessage().getID()); String subject = theMessage.getSubject();%><table bgcolor="<%= tblBorderColor %>" cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td><table bgcolor="<%= tblBorderColor %>" cellpadding="3" cellspacing="1" border="0" width="100%"><tr> <td bgcolor="<%= (isRootMessage)?"#dddddd":"#eeeeee" %>"> <table cellspacing="2" cellpadding="0" border="0" width="100%"> <tr>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -