[jboss-svn-commits] JBL Code SVN: r7575 - in labs/jbossforums/trunk/forums/src: main/org/jboss/portlet/forums main/org/jboss/portlet/forums/impl main/org/jboss/portlet/forums/ui/view resources/portal-forums-war/views/forums

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 13 17:08:33 EST 2006


Author: unibrew
Date: 2006-11-13 17:08:28 -0500 (Mon, 13 Nov 2006)
New Revision: 7575

Modified:
   labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
   labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
   labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java
   labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java
   labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java
   labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml
Log:
[JBFORUMS-135] Very big improvement of ForumView efficiency and additionally small improvement of Jumpbox and CategoryView.

Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ForumsModule.java	2006-11-13 21:50:52 UTC (rev 7574)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ForumsModule.java	2006-11-13 22:08:28 UTC (rev 7575)
@@ -10,6 +10,8 @@
  *****************************************/
 package org.jboss.portlet.forums;
 
+import java.util.Collection;
+
 import org.jboss.portal.identity.User;
 import org.jboss.portal.core.modules.ModuleException;
 import org.jboss.portal.jems.hibernate.HibernateProvider;
@@ -471,6 +473,8 @@
 
    Post findLastPost(Topic topic) throws ModuleException;
    
+   Map findLastPostsOfTopics(Collection topics) throws ModuleException;
+   
    Map findLastPostsOfForums() throws ModuleException;
 
    List findForumWatchByUser(User user) throws ModuleException;

Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java	2006-11-13 21:50:52 UTC (rev 7574)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java	2006-11-13 22:08:28 UTC (rev 7575)
@@ -44,6 +44,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -324,7 +325,16 @@
                                             " from CategoryImpl as c " +
                                             " join fetch c.forums " +
                                             " order by c.order asc");
-          return query.list();
+          List categoriesWithDuplicates = query.list();
+          Iterator it = categoriesWithDuplicates.iterator();
+          List categories = new LinkedList();
+          while (it.hasNext()) {
+              Category category = (Category)it.next();
+              if (!categories.contains(category)) {
+                categories.add(category);
+              }
+          }
+          return categories;
        }
        catch (HibernateException e)
        {
@@ -1244,6 +1254,63 @@
          return null;
       }
    }
+   
+    public Map findLastPostsOfTopics(Collection topics)
+       throws ModuleException
+    {
+       try
+       {
+          Session session = getSession();
+          //Query query =
+             // Old query considered as inefficient
+             //session.createQuery("from PostImpl as p where p.topic  = :topicId order by p.createDate desc");           
+            session.createQuery("select topic.lastPostDate as maxDate , topic.id " + 
+                                "from TopicImpl as topic " +
+                                "where topic.forum.id = :forumId ");
+          Iterator it = topics.iterator();
+          List lastPostDates = new ArrayList(topics.size());
+          List dates = new LinkedList();
+          while(it.hasNext()) {
+              Topic tmpTopic = (Topic)it.next();
+              dates.add(tmpTopic.getLastPostDate());
+              lastPostDates.add(new Object[]{tmpTopic.getLastPostDate(),tmpTopic.getId()});
+          }
+          Query query = session.createQuery("select post.createDate, post " +
+                                      "from PostImpl as post " +
+                                      "join fetch post.poster " +
+                                      "where post.createDate IN (:dates) " +
+                                      "order by post.createDate ");
+          query.setParameterList("dates",dates);
+          List posts = query.list();
+          Map forumPostMap = new HashMap(dates.size());
+          Iterator iterator = lastPostDates.iterator();
+          while (iterator.hasNext()) {
+              Object[] dateTopic = (Object[])iterator.next();
+              int index = Collections.binarySearch(posts,
+                                                         dateTopic,
+                                                         new Comparator() {
+                            public int compare(Object o1, Object o2) {
+                                Object[] datePostPair1 = (Object[])o1;
+                                Object[] datePostPair2 = (Object[])o2;
+                                Date postDate1 = (Date)datePostPair1[0];
+                                Date postDate2 = (Date)datePostPair2[0];
+                                return postDate1.compareTo(postDate2);
+                            }
+                        });
+              if (index<0) {
+                continue;
+              }
+              Object[] datePostPair = (Object[])posts.get(index);
+              forumPostMap.put(dateTopic[1],datePostPair[1]);
+          }         
+          return forumPostMap;
+       }
+       catch (HibernateException e)
+       {
+          e.printStackTrace();
+          return null;
+       }
+    }
 
     public Map findLastPostsOfForums()
        throws ModuleException
@@ -1255,7 +1322,6 @@
               session.createQuery("select MAX(topic.lastPostDate) as maxDate , topic.forum.id " + 
                                   "from TopicImpl as topic " +
                                   "group by topic.forum.id ");
-          query.setCacheable(true);
           List createDates = query.list();
           Iterator it = createDates.iterator();
           List dates = new LinkedList();
@@ -1268,7 +1334,6 @@
                                       "where post.createDate IN (:dates) " +
                                       "order by post.createDate ");
           query.setParameterList("dates",dates);
-          query.setCacheable(true);
           List posts = query.list();
           Map forumPostMap = new HashMap(createDates.size());
           Iterator iterator = createDates.iterator();
@@ -1285,7 +1350,7 @@
                                 return postDate1.compareTo(postDate2);
                             }
                         });
-              if (index==-1) {
+              if (index<0) {
                 continue;
               }
               Object[] datePostPair = (Object[])posts.get(index);

Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java	2006-11-13 21:50:52 UTC (rev 7574)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java	2006-11-13 22:08:28 UTC (rev 7575)
@@ -174,9 +174,7 @@
                  while (iterator.hasNext())
                  {
                     Category currentCategory = (Category)iterator.next();
-                    if (!this.getCategories().contains(currentCategory)) {
-                        this.processCategory(currentCategory);
-                    }
+                    this.processCategory(currentCategory);
                  }
              }
          }

Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java	2006-11-13 21:50:52 UTC (rev 7574)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java	2006-11-13 22:08:28 UTC (rev 7575)
@@ -28,6 +28,8 @@
 import java.util.Map;
 import java.util.HashMap;
 
+import java.util.LinkedList;
+
 import org.hibernate.HibernateException;
 import org.hibernate.Query;
 import org.hibernate.Session;
@@ -64,6 +66,9 @@
     private PageNavigator pageNavigator = null;
     private Collection page = new ArrayList();
     private Map topicNavigator = new HashMap();
+    private Map topicLastPosts = null;
+    private List stickyThreads = null;
+    private List announcements = null;
             
     //----------------business data being generated for use by the view components like facelets---------------------------------------------------------------------------------------
     /**
@@ -91,240 +96,298 @@
         return this.topicNavigator;
     }
     //--------------------------------------------------------------------------------------------    
-    /**
-     * 
-     *
-     */
-    public Collection getAnnouncements()
-    {
-        Collection announcements = new ArrayList(); 
-        try {
-            announcements = this.getForumsModule().findAnnouncements(forum);
-        } catch (Exception e) {
-            JSFUtil.handleException(e);
-        }
-        return announcements;
-    }
-    
-    /**
-     * 
-     * TODO: Make a special method in ForumsModule for that.
-     */
-    public boolean isAnnouncementsPresent()
-    {
-        boolean present = false;
-        try {
-            present = this.getForumsModule().findAnnouncements(forum).size()>0;
-        } catch (Exception e) {
-            JSFUtil.handleException(e);
-        }
-        return present;
-    }
-    
-    /**
-     * 
-     * TODO: Make a special method in ForumsModule for that.
-     */
-    public Collection getStickyThreads()
-    {
-        Collection stickyThreads = new ArrayList();
-        if (this.pageNavigator.getCurrentPage()!=0) return stickyThreads;
-        try {
-            //ForumsModule fm = this.getForumsModule();
-            stickyThreads = findTopics(forum,
-                            Constants.POST_STICKY,
-                            -1,
-                            Integer.parseInt(this.userPreferences.getPreference(
-                                                   Constants.TOPICS_FORUM_KEY)),"desc");
-        } catch (Exception e) {
-            JSFUtil.handleException(e);
-        }
-        return stickyThreads;
-    }
-    
-    /**
-     * 
-     * TODO: Make a special method in ForumsModule for that.
-     */
-    public boolean isStickyThreadsPresent()
-    {
-        if (this.pageNavigator.getCurrentPage()!=0) return false;
-        boolean present = false;
-        try {
-            Collection stickyThreads = findTopics(forum,
-                            Constants.POST_STICKY,
-                            -1,
-                            Integer.parseInt(this.userPreferences.getPreference(
-                                                   Constants.TOPICS_FORUM_KEY)),"desc");
-            if (stickyThreads!=null && stickyThreads.size()>0) {
-                present = true;
-            }
-        } catch (Exception e) {
-            JSFUtil.handleException(e);
-        }
-        return present;
-    }
-    
-    /**
-     * 
-     */
-    public Collection getNormalThreads()
-    {
-        return this.page;
-    } 
-    
-    /**
-     * 
-     */
-    public boolean isNormalThreadsPresent()
-    {     
-        return this.page.size()>0;
-    }
-    //------------user preferences-------------------------------------------------------------------------------------------------------------
-    /**
-     * @return Returns the userPreferences.
-     */
-    public PreferenceController getUserPreferences() 
-    {
-        return userPreferences;
-    }
-    /**
-     * @param userPreferences The userPreferences to set.
-     */
-    public void setUserPreferences(PreferenceController userPreferences) 
-    {
-        this.userPreferences = userPreferences;    
-    }             
-    //-------------------------------------------------------------------------------------------------------------------------------------                
-    
-    /**
-     *
-     * TODO: THIS METHOD IS IMPORTED FROM FORUMSMODULE AND MUST BE MOVED THERE BACK
-     *       SINCE IT CONTAINS SERIOUS MISTAKE IN FORUMSMODULE, IT IS HERE FOR A MOMENT
-     *       AND WILL BE MOVED AFTER 1.0 RELEASE
-     *
-     * @param forum
-     * @param type
-     * @param start
-     * @param perPage
-     * @param order
-     * @return
-     * @throws ModuleException
-     */
-     private List findTopics(Forum forum,
-                             int type,
-                             int start,
-                             int perPage,
-                             String order)
-        throws ModuleException
+     /**
+      * 
+      *
+      */
+     public Collection getAnnouncements()
      {
+         if (announcements!=null) {
+             return announcements;
+         }
+         announcements = new ArrayList(); 
+         try {
+             announcements = this.getForumsModule().findAnnouncements(forum);
+         } catch (Exception e) {
+             JSFUtil.handleException(e);
+         }
+         return announcements;
+     }
+     
+     /**
+      * 
+      * TODO: Make a special method in ForumsModule for that.
+      */
+     public boolean isAnnouncementsPresent()
+     {
+         if (announcements!=null) {
+             if (announcements.size()>0) {
+                 return true;
+             } else {
+                 return false;
+             }
+         }
+         boolean present = false;
+         try {
+             announcements= this.getForumsModule().findAnnouncements(forum);
+             if (announcements!=null && announcements.size()>0) {
+                 present = true;
+             }
+         } catch (Exception e) {
+             JSFUtil.handleException(e);
+         }
+         return present;
+     }
+     
+     /**
+      * 
+      * TODO: Make a special method in ForumsModule for that.
+      */
+     public Collection getStickyThreads()
+     {
+         if (this.pageNavigator.getCurrentPage()!=0) {
+             return new ArrayList();
+         }
+         if (stickyThreads !=null) {
+             return stickyThreads;
+         }
+         stickyThreads = new ArrayList();
+         try {
+             //ForumsModule fm = this.getForumsModule();
+             stickyThreads = findTopics(forum,
+                             Constants.POST_STICKY,
+                             -1,
+                             Integer.parseInt(this.userPreferences.getPreference(
+                                                    Constants.TOPICS_FORUM_KEY)),"desc");
+         } catch (Exception e) {
+             JSFUtil.handleException(e);
+         }
+         return stickyThreads;
+     }
+     
+     /**
+      * 
+      * TODO: Make a special method in ForumsModule for that.
+      */
+     public boolean isStickyThreadsPresent()
+     {
+         if (this.pageNavigator.getCurrentPage()!=0) {
+             return false;
+         }
+         if (stickyThreads !=null) {
+             if (stickyThreads.size()>0) {
+                 return true;
+             } else {
+                 return false;
+             }
+         }
+         boolean present = false;
+         try {
+             stickyThreads = findTopics(forum,
+                             Constants.POST_STICKY,
+                             -1,
+                             Integer.parseInt(this.userPreferences.getPreference(
+                                                    Constants.TOPICS_FORUM_KEY)),"desc");
+             if (stickyThreads!=null && stickyThreads.size()>0) {
+                 present = true;
+             }
+         } catch (Exception e) {
+             JSFUtil.handleException(e);
+         }
+         return present;
+     }
+     
+     /**
+      * 
+      */
+     public Collection getNormalThreads()
+     {
+         return this.page;
+     } 
+     
+     /**
+      * 
+      */
+     public boolean isNormalThreadsPresent()
+     {     
+         return this.page.size()>0;
+     }
+     
+     /**
+      * @return Returns the a Map which contains TopicId:LastPost pairs.
+      */
+     public Map getTopicLastPosts() 
+     {
+         if(this.topicLastPosts==null)
+         {
+             this.topicLastPosts = new HashMap();
+         }
+         return this.topicLastPosts;
+     }    
+     
+     //------------user preferences-------------------------------------------------------------------------------------------------------------
+     /**
+      * @return Returns the userPreferences.
+      */
+     public PreferenceController getUserPreferences() 
+     {
+         return userPreferences;
+     }
+     /**
+      * @param userPreferences The userPreferences to set.
+      */
+     public void setUserPreferences(PreferenceController userPreferences) 
+     {
+         this.userPreferences = userPreferences;    
+     }             
+     //-------------------------------------------------------------------------------------------------------------------------------------                
+     
+     /**
+      *
+      * TODO: THIS METHOD IS IMPORTED FROM FORUMSMODULE AND MUST BE MOVED THERE BACK
+      *       SINCE IT CONTAINS SERIOUS MISTAKE IN FORUMSMODULE, IT IS HERE FOR A MOMENT
+      *       AND WILL BE MOVED AFTER 1.0 RELEASE
+      *
+      * @param forum
+      * @param type
+      * @param start
+      * @param perPage
+      * @param order
+      * @return
+      * @throws ModuleException
+      */
+      private List findTopics(Forum forum,
+                              int type,
+                              int start,
+                              int perPage,
+                              String order)
+         throws ModuleException
+      {
+         try
+         {
+            Session session = this.getForumsModule().getHibernate().getSessionFactory().getCurrentSession();
+            Query query =
+               session.createQuery("from TopicImpl as t " +
+                                   "join fetch t.poster " +
+                                   "where t.forum = :forumid " +
+                                   "and t.type = :type " +
+                                   "order by t.lastPostDate " + order);
+            query.setFirstResult(start);
+            query.setMaxResults(perPage);
+            query.setString("forumid", "" + forum.getId());
+            query.setString("type", "" + type);
+            List list = query.list();
+            return list;
+         }
+         catch (HibernateException e)
+         {
+            String message = "Cannot find topics";
+            throw new ModuleException(message, e);
+         } catch (Exception e) {
+             JSFUtil.handleException(e);
+             String message = "Error while using ForumsModule.";
+             throw new ModuleException(message, e);
+         }
+      }
+     
+     
+     /**
+      * 
+      * @author sshah
+      */
+     public ViewForum()
+     { 
+         super();                 
+     }
+     
+     //ui actions supported by this bean----------------------------------------------------------------------------------------------------
+     /**
+      * 
+      */
+     public boolean isInitialized()
+     {
+        boolean initialized = false;
         try
-        {
-           Session session = this.getForumsModule().getHibernate().getSessionFactory().getCurrentSession();
-           Query query =
-              session.createQuery("from TopicImpl as t where t.forum = :forumid and t.type = :type order by t.lastPostDate " + order);
-           query.setFirstResult(start);
-           query.setMaxResults(perPage);
-           query.setString("forumid", "" + forum.getId());
-           query.setString("type", "" + type);
-           return query.list();
+        { 
+            this.execute();
+            initialized = true;
         }
-        catch (HibernateException e)
+        catch(Exception e)
         {
-           String message = "Cannot find topics";
-           throw new ModuleException(message, e);
-        } catch (Exception e) {
             JSFUtil.handleException(e);
-            String message = "Error while using ForumsModule.";
-            throw new ModuleException(message, e);
         }
+        return initialized;
      }
-    
-    
-    /**
-     * 
-     * @author sshah
-     */
-    public ViewForum()
-    { 
-        super();                 
-    }
-    
-    //ui actions supported by this bean----------------------------------------------------------------------------------------------------
-    /**
-     * 
-     */
-    public boolean isInitialized()
-    {
-       boolean initialized = false;
-       try
-       { 
-           this.execute();
-           initialized = true;
-       }
-       catch(Exception e)
-       {
-           JSFUtil.handleException(e);
-       }
-       return initialized;
-    }
-    
-    /**
-     * 
-     *
-     */
-    private void execute() throws Exception
-    {
-        //parse the input parameters
-        String page = ForumUtil.getParameter(Constants.p_page);
-        int forumId = -1;
-        String f = ForumUtil.getParameter(Constants.p_forumId);
-        if(f!=null && f.trim().length()>0)
-        {
-            forumId = Integer.parseInt(f);
-        }
-        
-        //grab the data to be displayed for this page
-        if(forumId!=-1)
-        {
-            //setup the business objects like the forum, topics etc that will be displayed
-            this.forum = BaseController.getForumsModule().findForumById(new Integer(forumId));
-            Object[] topicObjects = findTopics(forum,
-                                               Constants.POST_NORMAL,
-                                               -1,
-                                               Integer.MAX_VALUE,"desc").toArray();
-            
-                                    
-            //setup the pageNavigator for this forum
-            this.pageNavigator = new PageNavigator(
-             topicObjects, //total number of entries to be split up into pages
-             Integer.parseInt(this.userPreferences.getPreference(Constants.TOPICS_FORUM_KEY)), 
-             0 //currently selected page being displayed, first page by default
-            );
-            
-            if(page!=null && page.trim().length()>0)
-            {
-                //setup the page data
-                this.pageNavigator.setCurrentPage(Integer.parseInt(page));	                	                
-            }
-            
-            this.page = this.pageNavigator.getPage();
-            
-            //setup a pageNavigator for each topic being displayed on this page            
-            for(Iterator itr=this.page.iterator();itr.hasNext();)
-            {
-                Topic cour = (Topic)itr.next();
-                Collection posts = cour.getPosts();
-                if(posts!=null && !posts.isEmpty())
-                {
-	                PageNavigator topicNav = new PageNavigator(posts.toArray(),
-	                Integer.parseInt(this.userPreferences.getPreference(Constants.POSTS_TOPIC_KEY)), //this is user's posts per page preference
-	                0 //current page of the navigator
-	                );
-	                this.topicNavigator.put(cour.getId(),topicNav);
-                }
-            }
-        }
-    }
+     
+     /**
+      * 
+      *
+      */
+     private void execute() throws Exception
+     {
+         //parse the input parameters
+         String page = ForumUtil.getParameter(Constants.p_page);
+         int forumId = -1;
+         String f = ForumUtil.getParameter(Constants.p_forumId);
+         if(f!=null && f.trim().length()>0)
+         {
+             forumId = Integer.parseInt(f);
+         }
+         
+         //grab the data to be displayed for this page
+         if(forumId!=-1)
+         {
+             //setup the business objects like the forum, topics etc that will be displayed
+             this.forum = BaseController.getForumsModule().findForumById(new Integer(forumId));
+         
+             Object[] topicObjects = findTopics(forum,
+                                                Constants.POST_NORMAL,
+                                                -1,
+                                                Integer.MAX_VALUE,"desc").toArray();
+                                     
+             //setup the pageNavigator for this forum
+             this.pageNavigator = new PageNavigator(
+              topicObjects, //total number of entries to be split up into pages
+              Integer.parseInt(this.userPreferences.getPreference(Constants.TOPICS_FORUM_KEY)), 
+              0 //currently selected page being displayed, first page by default
+             );
+             
+             if(page!=null && page.trim().length()>0)
+             {
+                 //setup the page data
+                 this.pageNavigator.setCurrentPage(Integer.parseInt(page));                                              
+             }
+             this.page = this.pageNavigator.getPage();
+             
+             // Getting sticky topics for this page
+             Collection stickies = getStickyThreads();
+             
+             // Getting announcements
+             Collection announcements = getAnnouncements();
+             
+             Collection listOfTopics = new LinkedList();
+             
+             listOfTopics.addAll(stickies);
+             listOfTopics.addAll(announcements);
+             listOfTopics.addAll(this.page);
+             
+             // Getting lastPosts for all topics
+             this.topicLastPosts = BaseController.getForumsModule().findLastPostsOfTopics(listOfTopics);
+             
+             // setup dummy pageNavigators for all topics being displayed for topic minipaging
+             for(Iterator itr=listOfTopics.iterator();itr.hasNext();)
+             {
+                 Topic cour = (Topic)itr.next();
+                 if(cour.getReplies()>0)
+                 {
+                     PageNavigator topicNav = new PageNavigator(new Object[cour.getReplies()+1],
+                     Integer.parseInt(this.userPreferences.getPreference(Constants.POSTS_TOPIC_KEY)), //this is user's posts per page preference
+                     0 //current page of the navigator
+                     );
+                     this.topicNavigator.put(cour.getId(),topicNav);
+                 }
+             }
+         }
+     }
     //-------------------------------------------------------------------------------------------------------------------------------------    
 }

Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java	2006-11-13 21:50:52 UTC (rev 7574)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewJumpbox.java	2006-11-13 22:08:28 UTC (rev 7575)
@@ -57,10 +57,7 @@
             }
             try
             {
-                categories = getForumsModule().findCategories();
-                if (categories!= null && !Hibernate.isInitialized(categories)) {
-                    Hibernate.initialize(categories);
-                }
+                categories = getForumsModule().findCategoriesFetchForums();
                 return categories;
             }
             catch(Exception e)

Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml
===================================================================
--- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml	2006-11-13 21:50:52 UTC (rev 7574)
+++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml	2006-11-13 22:08:28 UTC (rev 7575)
@@ -182,7 +182,7 @@
 	        	        <!-- view newest post image -->            			
 	                    <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}" style="text-decoration: none;" 
 	                    alt="#{resource.View_latest_post}" title="#{resource.View_latest_post}">
-							<f:param name="t" value="#{topicrow.lastPost.topic.id}"/>
+							<f:param name="t" value="#{topicrow.id}"/>
 					    	<f:verbatim>
 								<img border="0" src="#{forums:themeURL('resourceIconLatestReplyURL')}"/>
 							</f:verbatim>
@@ -238,19 +238,19 @@
 	    				<!-- last post poster on this topic -->
 	    				<c:choose>
 	        				<c:when test="#{forum.anonymous}">
-	        					${topicrow.lastPost.poster.user.userName} 
+	        					${forum.topicLastPosts[topicrow.id].poster.user.userName} 
 	        				</c:when>
 	        				<c:otherwise>				        				    
 	        					<h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
-	        						<f:param name="uid" value="#{topicrow.lastPost.poster.user.id}"/>
-	        						<h:outputText value="${topicrow.lastPost.poster.user.userName}"/>
+	        						<f:param name="uid" value="#{forum.topicLastPosts[topicrow.id].poster.user.id}"/>
+	        						<h:outputText value="${forum.topicLastPosts[topicrow.id].poster.user.userName}"/>
 	        					</h:outputLink>
 	        				</c:otherwise>
 	    				</c:choose>	
 	    				<!-- link to the last post in the topic -->		                        
 	    				<h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}" style="text-decoration: none;"
 	    				alt="#{resource.View_latest_post}" title="#{resource.View_latest_post}">
-	    					<f:param name="t" value="#{topicrow.lastPost.topic.id}"/>
+	    					<f:param name="t" value="#{topicrow.id}"/>
 	    				    <f:verbatim>
 	    						<img border="0" src="#{forums:themeURL('resourceIconLatestReplyURL')}"/>
 	    					</f:verbatim>
@@ -283,7 +283,7 @@
 	        	        <!-- view newest post image -->            			
 	                    <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}" style="text-decoration: none;" 
 	                    alt="#{resource.View_latest_post}" title="#{resource.View_latest_post}">
-							<f:param name="t" value="#{topicrow.lastPost.topic.id}"/>
+							<f:param name="t" value="#{topicrow.id}"/>
 					    	<f:verbatim>
 								<img border="0" src="#{forums:themeURL('resourceIconLatestReplyURL')}"/>
 							</f:verbatim>
@@ -339,19 +339,19 @@
 	    				<!-- last post poster on this topic -->
 	    				<c:choose>
 	        				<c:when test="#{forum.anonymous}">
-	        					${topicrow.lastPost.poster.user.userName} 
+	        					${forum.topicLastPosts[topicrow.id].poster.user.userName} 
 	        				</c:when>
 	        				<c:otherwise>				        				    
 	        					<h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
-	        						<f:param name="uid" value="#{topicrow.lastPost.poster.user.id}"/>
-	        						<h:outputText value="${topicrow.lastPost.poster.user.userName}"/>
+	        						<f:param name="uid" value="#{forum.topicLastPosts[topicrow.id].poster.user.id}"/>
+	        						<h:outputText value="${forum.topicLastPosts[topicrow.id].poster.user.userName}"/>
 	        					</h:outputLink>
 	        				</c:otherwise>
 	    				</c:choose>	
 	    				<!-- link to the last post in the topic -->		                        
 	    				<h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}" style="text-decoration: none;"
 	    				alt="#{resource.View_latest_post}" title="#{resource.View_latest_post}">
-	    					<f:param name="t" value="#{topicrow.lastPost.topic.id}"/>
+	    					<f:param name="t" value="#{topicrow.id}"/>
 	    				    <f:verbatim>
 	    						<img border="0" src="#{forums:themeURL('resourceIconLatestReplyURL')}"/>
 	    					</f:verbatim>
@@ -384,7 +384,7 @@
 	        	        <!-- view newest post image -->            			
 	                    <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}" style="text-decoration: none;" 
 	                    alt="#{resource.View_latest_post}" title="#{resource.View_latest_post}">
-							<f:param name="t" value="#{topicrow.lastPost.topic.id}"/>
+							<f:param name="t" value="#{topicrow.id}"/>
 					    	<f:verbatim>
 								<img border="0" src="#{forums:themeURL('resourceIconLatestReplyURL')}"/>
 							</f:verbatim>
@@ -439,19 +439,19 @@
 	    				<!-- last post poster on this topic -->
 	    				<c:choose>
 	        				<c:when test="#{forum.anonymous}">
-	        					${topicrow.lastPost.poster.user.userName} 
+	        					${forum.topicLastPosts[topicrow.id].poster.user.userName} 
 	        				</c:when>
 	        				<c:otherwise>				        				    
 	        					<h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
-	        						<f:param name="uid" value="#{topicrow.lastPost.poster.user.id}"/>
-	        						<h:outputText value="${topicrow.lastPost.poster.user.userName}"/>
+	        						<f:param name="uid" value="#{forum.topicLastPosts[topicrow.id].poster.user.id}"/>
+	        						<h:outputText value="${forum.topicLastPosts[topicrow.id].poster.user.userName}"/>
 	        					</h:outputLink>
 	        				</c:otherwise>
 	    				</c:choose>	
 	    				<!-- link to the last post in the topic -->		                        
 	    				<h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}" style="text-decoration: none;"
 	    				alt="#{resource.View_latest_post}" title="#{resource.View_latest_post}">
-	    					<f:param name="t" value="#{topicrow.lastPost.topic.id}"/>
+	    					<f:param name="t" value="#{topicrow.id}"/>
 	    				    <f:verbatim>
 	    						<img border="0" src="#{forums:themeURL('resourceIconLatestReplyURL')}"/>
 	    					</f:verbatim>
@@ -689,7 +689,7 @@
 	                        </forums:isAllowedOtherwise>
                         </forums:isAllowedChoose>
 	      			</span>	      			
-                    <ui:include src="/views/jumpbox.xhtml"/>	      	    	
+                    <ui:include src="/views/jumpbox.xhtml" />
 	      	</span>
 	      </td>
 	   </tr>




More information about the jboss-svn-commits mailing list