jive的源码

源代码在线查看: forum.jsp

软件大小: 8244 K
上传用户: vbkechengsheji
关键词: jive 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

								/**				 *	$RCSfile: forum.jsp,v $				 *	$Revision: 1.6 $				 *	$Date: 2002/10/28 02:35:23 $				 */				%>								                 com.jivesoftware.util.*,				                 com.jivesoftware.forum.*,				                 com.jivesoftware.forum.util.*,				                 com.jivesoftware.base.*"				    errorPage="error.jsp"				%>												    //				    // This page displays content in a forum, specifically the list of topics				    // and some brief details about each topic. Some details of the forum -				    // number of topics and messages and description - will also be displayed.				%>																												    // The ID of the incoming forum:				    long forumID = ParamUtils.getLongParameter(request,"forum",-1L);				    // The starting thread index (more below) -- 0 is the default:				    int start = ParamUtils.getIntParameter(request,"start",0);								    // Load the forum:				    Forum forum = forumFactory.getForum(forumID);								    // The number of topics to show per page				    int range = 20;				%>																				    																								Topics: , Messages: ,				Last Post: 																																    				        [Post New Topic]				         				        [Search this Forum]				    				    				        				            // forum. The number of pages is total number of topics in a forum				            // divided by the number of topics to display per page (the 'range'				            // variable. We also need to add one to the calculation because integer				            // division always rounds down:				            int numPages = (forum.getThreadCount() / range) + 1;								            if (numPages > 1) {				        %>				        				        				            								                Pages: [				                				                    for (int i=0; (i				                        // Add a little bit of logic to determine if this page link				                        // is the current page - this will allow us to specially				                        // designate it via CSS:				                        boolean isCurrent = (start == (i*range));				                %>								                    				                     class=""				                     >								                				                ]								            				        				        				        				    																								    // returns an iterator of all threads in the forum. Since there might be				    // a large number of threads in the system, we'll pass in a ResultFilter				    // object to the threads() method - this allows us to specify a starting				    // index in the list of topics and the number of topics to retrieve. We				    // could also do more advanced things like sort the list of topics by				    // different fields and different orders. By default, topics are returned				    // in descending modification date. The effect of this is that topics with				    // the newest content will be bumped to the top of the topic list. For				    // more information, please read the ResultFilter JavaDocs.				    ResultFilter filter = new ResultFilter();				    filter.setStartIndex(start);				    filter.setNumResults(range);				    Iterator threads = forum.getThreads(filter);				%>												    // in the system and if so, print out an error message:				    if (!threads.hasNext()) {				%>				        There are no topics in this forum.												    else {				%>								    				    				        Subject				        Author				        Replies				        Last Post				    								    				        // keep track of alternating rows:				        int counter = 0;				        while (threads.hasNext()) {				            ForumThread thread = (ForumThread)threads.next();				            counter ++;				            // Get the user of the root message of the thread - this is the				            // user who posted the message:				            User author = thread.getRootMessage().getUser();				            // Note, below 'thread.getName()' is called - this message is a				            // shortcut for 'thread.getRootMessage().getSubect()'.				            // Also, note below that the number of replies in a thread is				            // the total number of messages in the thread minus one - this is				            // because the root message is counted by the getMessageCount method.								            // Figure out if this topic was posted after the last time the page				            // user visited the site. Do this by checking the creation date of				            // the thread compared to the date of the last visit (the last				            // visited time is in a global variable called 'lastVisited' and				            // is initialized in the global.jsp page):				            boolean isNew = lastVisited.getTime() < thread.getCreationDate().getTime();				    %>				        				            				                				                    // new/old content. The CSS should customize the colors				                    // so a new piece of content is visually distinguished from				                    // an old one:				                    if (isNew) {				                %>				                    •								                								                    •								                				            				            								                				                				                 >								            				            				                				                    // the user's username and a link to their profile page:				                    if (author == null) {				                %>				                    Guest								                								                    				                     >								                				            				            				                				            				            				                				            				        								    				        } // end of while loop				    %>								    												    } // end of else				%>											

相关资源