alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  
<td width="100%" nowrap> <a class="nav" href="index"> »  <fmt:message key="mvnforum.user.listforums.title"/> </td> </tr> </table> <br/> <% CategoryCache categoryCache = CategoryCache.getInstance(); ForumCache forumCache = ForumCache.getInstance(); Collection categoryBeans = categoryCache.getBeans(); Collection forumBeans = forumCache.getBeans(); if (MVNForumConfig.getEnableMostActiveThreads()) { boolean hasSticky = false; boolean hasAnnouncement = false; boolean hasGlobalAnnouncement = false; %> <table width="95%" align="center"> <tr> <td class="highlight"> </tr> </table> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="theader"> <td colspan="3"> <td> <td align="center"> <td align="center"> <td align="center"> <td align="center"> </tr> <%int index = 1; Collection mostActiveThreads = (Collection)request.getAttribute("MostActiveThreads"); for ( Iterator iter = mostActiveThreads.iterator(); iter.hasNext(); ) { ActiveThread thread = (ActiveThread)iter.next(); String threadIcon = MyUtil.getThreadIconName(onlineUser.getLastLogonTimestamp().getTime(), thread.getLastDate().getTime(), thread.getReplyCount()+1); int postCount = thread.getLastPostCount(); %> <tr class="trow<%=index++%2 + 1%>"> <td width="16"> <td width="16"><%=EnableEmotionFilter.filter(thread.getIcon(), ParamUtil.getContextPath() + MVNForumGlobal.EMOTION_DIR)%> <td> <% String typeImage = ""; switch (thread.getThreadType()) { case ThreadBean.THREAD_TYPE_STICKY: typeImage = "sticky.gif"; hasSticky = true; break; case ThreadBean.THREAD_TYPE_FORUM_ANNOUNCEMENT: typeImage = "announce.gif"; hasAnnouncement = true; break; case ThreadBean.THREAD_TYPE_GLOBAL_ANNOUNCEMENT: typeImage = "global_announce.gif"; hasGlobalAnnouncement = true; break; default:break; } %> <% if ( thread.getThreadType() != ThreadBean.THREAD_TYPE_DEFAULT) { %> <img src="<%=contextPath%>/mvnplugin/mvnforum/images/icon/<%=typeImage%>"/> <% }%> <% if ( thread.getAttachCount() > 0) {%> <img src="<%=contextPath%>/mvnplugin/mvnforum/images/icon/attach.gif" title="<%=thread.getAttachCount()%> <% if (thread.getAttachCount() == 1) {%><% } else {%><%}%>"/> <% } %> <a href="viewthread?thread=<%=thread.getThreadID()%>" class="command"><%=thread.getThreadTopic()%>
(<b><%=postCount%> <% if (postCount == 1) {%><% } else { %><% } %>) </td> <td> <a href="listthreads?forum=<%=thread.getForumID()%>" class="messageTopic"><%=forumCache.getBean(thread.getForumID()).getForumName()%> </td> <td align="center"> <% if ((thread.getAuthor()!=null) && (thread.getAuthor().length()>0)) { %> <a href="viewmember?member=<%=Encoder.encodeURL(thread.getAuthor())%>" class="memberName"><%=thread.getAuthor()%> <% } %> </td> <td align="center"><%=thread.getReplyCount()%> <td align="center"><%=thread.getViewCount()%> <td align="center"> <%=onlineUser.getGMTTimestampFormat(thread.getLastDate())%>
<% if ((thread.getLastMember()!=null) && (thread.getLastMember().length()>0)) { %> <fmt:message key="mvnforum.common.by"/> <%=thread.getLastMember()%>  <% } %> <a href="viewthread?thread=<%=thread.getThreadID()%>&lastpage=yes#lastpost" class="messageTopic"><fmt:message key=" title=""> </td> </tr> <% } // end for each most active thread%> <% if (mostActiveThreads.size() == 0) { %> <tr class="trow1"> <td colspan="8" align="center"> </tr> <% }// if no active threads %> </table> <br/> <%} // end of enable most active threads %> <% int numberOfThreads = MyUtil.getViewableThreads(forumBeans, permission); int numberOfPosts = MyUtil.getViewablePosts(forumBeans, permission); //Copy code from listonlineusers.jsp Collection onlineUserActions = (Collection)request.getAttribute("OnlineUserActions"); int guestCount = 0; int memberCount = 0; int invisibleMemberCount = 0; boolean enableInvisible = MVNForumConfig.getEnableInvisibleUsers(); for (Iterator countIterator = onlineUserActions.iterator(); countIterator.hasNext(); ) { OnlineUserAction onlineUserAction = (OnlineUserAction)countIterator.next(); boolean invisible = onlineUserAction.isInvisibleMember(); int mID = onlineUserAction.getMemberID(); if ( (mID==0) || (mID==MVNForumConstant.MEMBER_ID_OF_GUEST) ) { guestCount++; } else if (enableInvisible) { if ( invisible ) { invisibleMemberCount++; } else { memberCount++; } } else { // disable invisible feature memberCount++; } } %> <table width="95%" align="center"> <tr> <td class="highlight"> (<%=numberOfPosts%> <%=numberOfThreads%> ) </tr> </table> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="theader"> <td colspan="2"> <td align="center"> <td align="center"> <td align="center"> </tr> <% boolean hasANoChangeForum = false; boolean hasAChangedForum = false; for (Iterator catIterator = categoryBeans.iterator(); catIterator.hasNext(); ) { CategoryBean categoryBean = (CategoryBean)catIterator.next(); if (MyUtil.canViewAnyForumInCategory(categoryBean.getCategoryID(), permission) == false) continue; %> <tr class="tcat"> <td colspan="5"> <a onclick="showhide('category_<%=categoryBean.getCategoryID()%>');return false" href="javascript:void(0)"> <img align="middle" border="0" height="13" width="14" src="<%=contextPath%>/mvnplugin/mvnforum/images/icon/arrow-subnav-down.gif"> <b><%=categoryBean.getCategoryName()%>
<%=MyUtil.filter(categoryBean.getCategoryDesc(), false/*html*/, true/*emotion*/, true/*mvnCode*/, true/*newLine*/, true/*URL*/)%> </td> </tr> <tbody id="category_<%=categoryBean.getCategoryID()%>"> <% int forumCountInCurrentCategory = 0; for (Iterator forumIterator = forumBeans.iterator(); forumIterator.hasNext(); ) { ForumBean forumBean = (ForumBean)forumIterator.next(); if ((forumBean.getCategoryID() == categoryBean.getCategoryID()) && permission.canReadPost(forumBean.getForumID()) && (forumBean.getForumStatus() != ForumBean.FORUM_STATUS_DISABLED) ) { forumCountInCurrentCategory++; String forumIcon = MyUtil.getForumIconName(onlineUser.getLastLogonTimestamp().getTime(), forumBean.getForumLastPostDate().getTime()); if (forumIcon.equals("f_norm_no.gif")) { hasANoChangeForum = true; } else if (forumIcon.equals("f_norm_new.gif")) { hasAChangedForum = true; } %> <tr class="trow<%=(forumCountInCurrentCategory+1)%2+1%>"> <td width="16"> <td> <a href="listthreads?forum=<%=forumBean.getForumID()%>" class="messageTopic"><%=forumBean.getForumName()%>
<%=MyUtil.filter(forumBean.getForumDesc(), false/*html*/, true/*emotion*/, true/*mvnCode*/, true/*newLine*/, true/*URL*/)%> </td> <td align="center"><%=forumBean.getForumThreadCount()%> <td align="center"><%=forumBean.getForumPostCount()%> <td align="center" nowrap> <%if ( (forumBean.getLastPostMemberName().length() == 0) || (forumBean.getForumThreadCount() == 0) ) {%> <fmt:message key="mvnforum.user.listforums.table.no_post"/> <%} else {%> <%=onlineUser.getGMTTimestampFormat(forumBean.getForumLastPostDate())%>
<fmt:message key="mvnforum.common.by"/> <a href="viewmember?member=<%=Encoder.encodeURL(forumBean.getLastPostMemberName())%>" class="memberName"><%=forumBean.getLastPostMemberName()%> <%} // else %> </td> </tr> <% }//if the forum is in the current category } //for forumIndex if (forumCountInCurrentCategory == 0) { %> <tr class="trow1"> <td colspan="5" align="center"> </tr> <% }// if no forum in this category%> </tbody> <%} //for catIndex %> <% if (categoryBeans.size() == 0) { %> <tr class="trow1"> <td colspan="5" align="center"> </tr> <% }// if no category %> </table> <br/> <table width="95%" border="0" align="center"> <% if ( hasANoChangeForum ) {%> <tr class="messageText"> <td width="16"> <td> </tr> <%}%> <% if ( hasAChangedForum ) {%> <tr class="messageText"> <td width="16"> <td> </tr> <%}%> </table> <br/> <% if (MVNForumConfig.getEnableSiteStatisticsOverview() || MVNForumConfig.getEnableMostActiveMembers() || MVNForumConfig.getEnableOnlineUsers()) { %> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="theader"> <td colspan="2"> </tr> <% if (MVNForumConfig.getEnableSiteStatisticsOverview()) { MemberBean lastMember = (MemberBean)request.getAttribute("MemberBean"); long numberOfMembers = ((Integer)request.getAttribute("NumberOfMembers")).intValue(); %> <tr class="trow1"> <td class="trow1"> <td width="100%"> <fmt:message key="mvnforum.common.totalcategories"/>: <%=MyUtil.getViewableCategories(categoryBeans, permission)%>
<fmt:message key="mvnforum.common.totalforum"/>: <%=MyUtil.getViewableForums(forumBeans, permission)%>
<fmt:message key="mvnforum.common.totaltopic"/>: <%=numberOfThreads%>
<fmt:message key="mvnforum.common.totalpost"/>: <%=numberOfPosts%>
<fmt:message key="mvnforum.common.totalmember"/>: <%=numberOfMembers%>
<fmt:message key="mvnforum.common.latestmember"/>: <%=lastMember.getMemberName()%>
</td> </tr> <%}%> <%if (MVNForumConfig.getEnableMostActiveMembers() || MVNForumConfig.getEnableOnlineUsers()) {%> <tr class="trow2"> <td class="trow1"> <td width="100%"> <% if (MVNForumConfig.getEnableMostActiveMembers()) {%> <% Collection mostActiveMembers = (Collection)request.getAttribute("MostActiveMembers"); %> <% if (mostActiveMembers.size() == 0) { %> <fmt:message key="mvnforum.common.no_active_members"/> <% } else { %> <fmt:message key="mvnforum.common.most_active_members_since_last_week"/>: <%int index = 0; for ( Iterator iter = mostActiveMembers.iterator(); iter.hasNext(); ) { ActiveMember member = (ActiveMember)iter.next(); int postCount = member.getLastPostCount(); index++; %> <a href="viewmember?memberid=<%=member.getMemberID()%>" class="command"><%=member.getMemberName()%> (<%=postCount%> <% if (postCount == 1) {%><% } else { %><% } %>) <% if (index != mostActiveMembers.size()) {%> , <%-- add comma at here if the element is not the last element--%> <% } // end if } // end for%> <% }// if no active members %> <br/> <% } // end of enable active members %> <%if (MVNForumConfig.getEnableOnlineUsers()) {%> <fmt:message key="mvnforum.common.there_are"/> <%=onlineUserActions.size()%> (<b><%=guestCount%> <%if(guestCount>1) {%><%}else{%><%}%>, <b><%=memberCount%> <%if(memberCount>1){%><%}else{%><%}%> <%if (enableInvisible) {%> ,<%-- last comma if folling exists --%> <b><%=invisibleMemberCount%> <%if(invisibleMemberCount>1){%><%} else {%><%}%> <%}%>) <br/> <fmt:message key="mvnforum.common.online_users"/>: <%boolean canAdmin = permission.canAdminSystem(); for (Iterator iterator = onlineUserActions.iterator(); iterator.hasNext(); ) { OnlineUserAction onlineUserAction = (OnlineUserAction)iterator.next(); boolean userInvisible = onlineUserAction.isInvisibleMember(); int mID = onlineUserAction.getMemberID(); String mName = onlineUserAction.getMemberName(); if ( (mID!=0) && (mID!=MVNForumConstant.MEMBER_ID_OF_GUEST) ) { %> <%if (enableInvisible && userInvisible && !canAdmin) { %> <%----%> <%} else {%> <a href="viewmember?memberid=<%=mID%>" class="memberName"><%=mName%> <%if (enableInvisible && userInvisible && canAdmin) { %>()<%}%> <%}%> <% if (onlineUserAction.getSessionCount() > 1) { %> (<%=onlineUserAction.getSessionCount()%> ) <% } %> <%} /*if (!guest)*/%> <%} /*for*/%> <% } // if enable online users%> </td> </tr> <% } // end of enable any of 2 options %> </table> <% } // end of enable any of 3 options %> <br/> </fmt:bundle> <%@ include file="footer.jsp"%> </body> </html>

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

<%--
 - $Header: /cvsroot/mvnforum/mvnforum/srcweb/mvnplugin/mvnforum/user/listforums.jsp,v 1.74 2005/02/21 18:32:58 minhnn Exp $
 - $Author: minhnn $
 - $Revision: 1.74 $
 - $Date: 2005/02/21 18:32:58 $
 -
 - ====================================================================
 -
 - Copyright (C) 2002-2005 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.*" %>
<%@ page import="net.myvietnam.mvncore.util.*" %>
<%@ page import="net.myvietnam.mvncore.filter.EnableEmotionFilter" %>
<%@ page import="net.myvietnam.mvncore.security.Encoder" %>
<%@ page import="com.mvnforum.db.*" %>
<%@ page import="com.mvnforum.common.*" %>
<%@ page import="com.mvnforum.MyUtil" %>
<%@ page import="com.mvnforum.auth.OnlineUserAction" %>
<%@ page import="com.mvnforum.MVNForumConstant" %>
<%@ page import="com.mvnforum.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ include file="inc_common.jsp"%>
<fmt:bundle basename="mvnForum_i18n">
<html 
<head>
  <title> - 
<%@ include file="/mvnplugin/mvnforum/meta.jsp"%>
<link href="<%=onlineUser.getCssPath()%>" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<%@ include file="header.jsp"%>
<br/>
<script type="text/javascript">
function showhide(category) {
  var category = document.getElementById(category);
  if (category == null) return;

  if ( category.style.display == 'none' ) {
    category.style.display = '';
  } else if ( category.style.display == '' ) {
    category.style.display = 'none';
  }
}
</script>

<table width="95%" align="center">
  <tr class="nav">
    <td>
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.