[jboss-svn-commits] JBL Code SVN: r10597 - in labs/jbossforums/branches/forums101P24/forums/src: main/org/jboss/portlet/forums/impl and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Mar 28 16:14:07 EDT 2007


Author: unibrew
Date: 2007-03-28 16:14:06 -0400 (Wed, 28 Mar 2007)
New Revision: 10597

Added:
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForums.java
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml
Removed:
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml
Modified:
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
   labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/common/common.xhtml
Log:
[JBFORUMS-175] MyForums NewPostsView half done stage.

Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ForumsModule.java	2007-03-28 20:12:17 UTC (rev 10596)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ForumsModule.java	2007-03-28 20:14:06 UTC (rev 10597)
@@ -542,6 +542,10 @@
 
    List findForumWatchByUser(User user) throws ModuleException;
 
+   List findForumWatchByUserFetchForum(User user) throws ModuleException;
+   
+   List findTopicWatchByUserFetchTopic(User user) throws ModuleException;
+   
    Attachment findFindAttachmentById(Integer attachID)
         throws ModuleException;
 

Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java	2007-03-28 20:12:17 UTC (rev 10596)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java	2007-03-28 20:14:06 UTC (rev 10597)
@@ -1545,6 +1545,45 @@
          throw new ModuleException(message, e);
       }
    }
+   
+   public List findForumWatchByUserFetchForum(User user) throws ModuleException
+   {
+      try
+      {
+         Session session = getSession();
+         Query query = session.createQuery("from ForumWatchImpl as f " +
+                                           "join fetch f.forum " +
+                                           "where f.poster.userId = :userId ");
+         query.setString("userId", user.getId().toString());
+         return query.list();
+      }
+      catch (HibernateException e)
+      {
+         String message = "Cannot find forum watch";
+         log.error(message, e);
+         throw new ModuleException(message, e);
+      }
+   }
+   
+   public List findTopicWatchByUserFetchTopic(User user) throws ModuleException
+   {
+      try
+      {
+         Session session = getSession();
+         Query query = session.createQuery("from TopicWatchImpl as t " +
+                                           "join fetch t.topic to " +
+                                           "where t.poster.userId = :userId " +
+                                           "order by to.lastPostDate ");
+         query.setString("userId", user.getId().toString());
+         return query.list();
+      }
+      catch (HibernateException e)
+      {
+         String message = "Cannot find forum watch";
+         log.error(message, e);
+         throw new ModuleException(message, e);
+      }
+   }
 
    public void createWatch(Poster poster, Forum forum, int mode) throws ModuleException
    {

Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java	2007-03-28 20:12:17 UTC (rev 10596)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java	2007-03-28 20:14:06 UTC (rev 10597)
@@ -205,6 +205,10 @@
         TEMP_VIEW_ID_TO_NAME.put("w","/views/watches/forumWatch.jsf");
         TEMP_VIEW_NAME_TO_ID.put("/views/watches/forumWatch.jsf","w");
         
+        // MyForums views
+        TEMP_VIEW_ID_TO_NAME.put("my","/views/myforums/myforums_main.jsf");
+        TEMP_VIEW_NAME_TO_ID.put("/views/myforums/myforums_main.jsf","my");
+        
         VIEW_ID_TO_NAME = Collections.unmodifiableSortedMap(TEMP_VIEW_ID_TO_NAME);
         VIEW_NAME_TO_ID = Collections.unmodifiableSortedMap(TEMP_VIEW_NAME_TO_ID);
 

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForums.java (from rev 10596, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForums.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForums.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForums.java	2007-03-28 20:14:06 UTC (rev 10597)
@@ -0,0 +1,270 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portlet.forums.ui.view;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.LinkedList;
+import java.util.Iterator;
+import java.util.Date;
+
+import org.jboss.portlet.forums.ui.BaseController;
+import org.jboss.portlet.forums.ui.Constants;
+import org.jboss.portlet.forums.ui.JSFUtil;
+import org.jboss.portlet.forums.ui.PortalUtil;
+import org.jboss.portlet.forums.ui.action.PreferenceController;
+import org.jboss.portlet.forums.model.Topic;
+import org.jboss.portlet.forums.model.TopicWatch;
+
+/**
+ * 
+ * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ *
+ */
+public class ViewMyForums extends BaseController
+{
+    
+    //preference related data
+    private PreferenceController userPreferences = null;
+    
+    // Map<ForumId,LastPost>
+    private Map forumsLastPosts;
+    
+    // Map<TopicId,LastPost>
+    private Map topicsLastPosts;
+    
+    private Collection watchedForums;
+    private Collection watchedTopics;
+    private Collection watchedTopicsWithNewPosts;
+    private Map topicNavigator = new HashMap();
+    
+    /**
+     * 
+     */
+    public Collection getWatchedForums()
+    {
+        if (watchedForums==null)
+        {
+            try
+            {
+                watchedForums = BaseController.getForumsModule().findForumWatchByUserFetchForum(PortalUtil.getUser());
+            } catch (Exception e)
+            {
+                JSFUtil.handleException(e);
+            }
+        }
+        return watchedForums;
+    }
+    
+    /**
+     * 
+     */
+    public void setWatchedForums(Collection watchedForums)
+    {
+        this.watchedForums = watchedForums;
+    }
+    
+    /**
+     * 
+     */
+    public Collection getWatchedTopics()
+    {
+        if (watchedTopics==null)
+        {
+            try
+            {
+                watchedTopics = BaseController.getForumsModule().findTopicWatchByUserFetchTopic(PortalUtil.getUser());
+            } catch (Exception e)
+            {
+                JSFUtil.handleException(e);
+            }
+        }
+        return watchedTopics;
+    }
+    
+    /**
+     * 
+     */
+    public void setWatchedTopics(Collection watchedTopics)
+    {
+        this.watchedTopics = watchedTopics;
+    }
+    
+    /**
+     * 
+     */
+    public Collection getWatchedTopicsWithNewPosts()
+    {
+        if (watchedTopicsWithNewPosts==null)
+        {
+            Collection topics = getWatchedTopics();
+            watchedTopicsWithNewPosts = new LinkedList();
+            Date lastLoginDate = PortalUtil.getUserLastLoginDate();
+            if (lastLoginDate==null)
+            {
+                return watchedTopicsWithNewPosts;
+            }
+            Iterator it = topics.iterator();
+            while (it.hasNext())
+            {
+                TopicWatch topicWatch = (TopicWatch)it.next();
+                Topic topic = topicWatch.getTopic();
+                if (topic.getLastPostDate().compareTo(lastLoginDate)>0)
+                {
+                    watchedTopicsWithNewPosts.add(topic);
+                }
+            }
+        }
+        return watchedTopicsWithNewPosts;
+    }
+    
+    /**
+     * 
+     */
+    public void setWatchedTopicsWithNewPosts(Collection watchedTopicsWithNewPosts)
+    {
+        this.watchedTopicsWithNewPosts = watchedTopicsWithNewPosts;
+    }
+    
+    /**
+     * 
+     */
+    public Map getTopicsLastPosts()
+    {
+        if (topicsLastPosts==null)
+        {
+            try
+            {
+                topicsLastPosts = BaseController.getForumsModule().findLastPostsOfTopics(getWatchedTopics());
+            } catch (Exception e)
+            {
+                JSFUtil.handleException(e);
+            }
+        }
+        return topicsLastPosts;
+    }
+    
+    /**
+     * 
+     */
+    public void setTopicsLastPosts(Map topicsLastPosts)
+    {
+        this.topicsLastPosts = topicsLastPosts;
+    }
+    
+    /**
+     * 
+     */
+    public Map getForumsLastPosts()
+    {
+        if (forumsLastPosts==null)
+        {
+            try
+            {
+                forumsLastPosts = BaseController.getForumsModule().findLastPostsOfForums();
+            } catch (Exception e)
+            {
+                JSFUtil.handleException(e);
+            }
+        }
+        return forumsLastPosts;
+    }
+    
+    /**
+     * 
+     */
+    public void setForumsLastPosts(Map forumsLastPosts)
+    {
+        this.forumsLastPosts = forumsLastPosts;
+    }
+    
+    /**
+     *
+     */
+    public Map getTopicNavigator()
+    {
+        return this.topicNavigator;
+    }
+    
+    /**
+     * 
+     */
+    public ViewMyForums ()
+    {
+        super();
+    }
+    
+    /**
+     * 
+     */
+    public boolean isInitialized()
+    {
+        boolean initialized = false;
+        try
+        { 
+            this.execute();
+            initialized = true;
+        }
+        catch(Exception e)
+        {
+            JSFUtil.handleException(e);
+        }
+        return initialized;
+    }
+    
+    /**
+     * 
+     */
+    public void execute()
+    {
+        // Forcing initialization of collections
+        getWatchedForums();
+        getWatchedTopicsWithNewPosts();
+        getForumsLastPosts();
+        getTopicsLastPosts();
+        
+        Collection topics = getWatchedTopicsWithNewPosts();
+        
+        // setup dummy pageNavigators for all topics being displayed for topic minipaging
+        for(Iterator itr=topics.iterator();itr.hasNext();)
+        {
+            TopicWatch courTopicWatch = (TopicWatch)itr.next();
+            Topic cour = courTopicWatch.getTopic();
+            if(cour.getReplies()>0)
+            {
+                PageNavigator topicNav = new PageNavigator(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
+                ) {
+
+                       protected Collection initializePage() {
+                           return null;
+                       }
+                       
+                   };
+                this.topicNavigator.put(cour.getId(),topicNav);
+            }
+        }
+    }
+
+}

Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties	2007-03-28 20:12:17 UTC (rev 10596)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties	2007-03-28 20:14:06 UTC (rev 10597)
@@ -2001,9 +2001,17 @@
 
 Install_No_PCRE=phpBB2 Requires the Perl-Compatible Regular Expressions Module for PHP which your PHP configuration doesn\'t appear to support!
 
+#
+# MyForums View Messages
+#
 
+MyForums_title=MyForums
+MyForums_info=This is your personalized forum view. From here, you can view and manage your subscribed forums, subscribed topics and email notifications.
+Subscribed_topics_info=Subscribed Topics with New Posts
+Subscribed_forums_info=Subscribed Forums
 
 
+
 #
 # From the mod "Watched Topics List" (http://www.netclectic.com/)
 # plus some custom for the forum watches

Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/common/common.xhtml
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/common/common.xhtml	2007-03-28 20:12:17 UTC (rev 10596)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/common/common.xhtml	2007-03-28 20:14:06 UTC (rev 10597)
@@ -61,7 +61,7 @@
         <c:if test="#{shared.anonymous==false}">
         <li>
             &#160;&#160;|&#160;&#160;
-            <h:outputLink value="#{forums:outputLink(shared.links['forumWatch'],true)}">
+            <h:outputLink value="#{forums:outputLink(shared.links['myForums'],true)}">
                 ${resource.My_Forums}
             </h:outputLink>
         </li>

Copied: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums (from rev 10596, labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/myforums)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml	2007-03-28 20:12:17 UTC (rev 10596)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml	2007-03-28 20:14:06 UTC (rev 10597)
@@ -1,350 +0,0 @@
-<!--
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software 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
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
--->
-
-<div  xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:ui="http://java.sun.com/jsf/facelets"
-      xmlns:c="http://java.sun.com/jstl/core"
-      xmlns:h="http://java.sun.com/jsf/html"
-      xmlns:f="http://java.sun.com/jsf/core"
-      xmlns:forums="http://www.jboss.com/products/jbossportal/forums"
-      class="forumscontainer"
->
-
-<ui:composition template="/views/common/common.xhtml">
-<ui:define name="mainContent">
-
-<c:if test="#{myForums.initialized}">
-
-<div class="forumtitletext">
-    <h4>${resource.MyForums_title}</h4>
-    <p>${resource.MyForums_info}</p>
-</div>
-
-<table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
-
-    <tr class="header">
-        <td class="forumheaderfirst" colspan="2">${resource.Subscribed_topics_info}</td>
-        <td class="forumheadercentered">${resource.Replies}</td>
-        <td class="forumheadercentered">${resource.Views}</td>
-        <td class="forumheaderopen">${resource.Last_Post}</td>
-        <td class="forumheadercentered">${resource.Delete}</td>
-    </tr>
-    
-    <c:forEach items="#{myForums.watchedTopicsWithNewPosts}" var="topicrow" varStatus="status" >
-    <tr class='${(status.index%2==0)?"evenRow":"oddRow"}'>
-        <td class="forumlisticon">
-            <img src="#{forums:folderTypeURL(topicrow,myForums.anonymous)}" 
-                 width="11" height="14"
-                 alt="${resource.Topic_Moved}" title="${resource.Topic_Moved}" />
-        </td>
-        <td>
-            <h3>
-                <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
-                    <f:param name="t" value="${topicrow.id}"/>
-                    <h:outputText value="${topicrow.subject}"/>                   
-                </h:outputLink>
-            </h3>
-            
-            <!-- mini post navigator for this topic -->
-            <c:if test="#{myForums.topicNavigator[topicrow.id] ne null &amp;&amp; myForums.topicNavigator[topicrow.id].totalPages gt 1}">
-                &#160;(&#160;
-                <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
-                    <f:param name="t" value="#{topicrow.id}"/>
-                    <f:param name="page" value="0"/>
-                    <h:outputText value="${1}"/>
-                </h:outputLink>
-                &#160;
-                <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
-                    <f:param name="t" value="#{topicrow.id}"/>
-                    <f:param name="page" value="1"/>
-                    <h:outputText value="${2}"/>
-                </h:outputLink>
-                <c:if test="#{myForums.topicNavigator[topicrow.id].totalPages gt 2}">
-                    &#160;
-                    <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
-                        <f:param name="t" value="#{topicrow.id}"/>
-                        <f:param name="page" value="2"/>
-                        <h:outputText value="${3}"/>
-                    </h:outputLink>
-                </c:if>
-                <c:if test="#{myForums.topicNavigator[topicrow.id].totalPages gt 3}">                        
-                    &#160;&#8230;&#160;
-                    <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
-                        <f:param name="t" value="#{topicrow.id}"/>
-                        <f:param name="page" value="#{myForums.topicNavigator[topicrow.id].totalPages-1}"/>
-                        <h:outputText value="${resource.Last_page}"/>
-                    </h:outputLink>
-                </c:if>
-                &#160;)
-            </c:if>
-            <br />
-            ${resource.By}&#160;
-            <c:choose>
-                
-                <c:when test="#{myForums.anonymous}">
-                    ${topicrow.poster.user.userName}
-                </c:when>
-               
-                <c:otherwise>
-                    <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
-                        <f:param name="uid" value="${topicrow.poster.user.id}"/>
-                        <h:outputText value="${topicrow.poster.user.userName}"/>
-                    </h:outputLink>
-                </c:otherwise>
-                            
-            </c:choose>
-        </td>
-        <td class="forumlistcentered">${topicrow.replies}</td>
-        <td class="forumlistcentered">${topicrow.viewCount}</td>
-        <td class="forumlistlast">
-            <a href="#{forums:postPermlink(myForums.topicsLastPosts[topicrow.id].id)}">
-                <c:choose>
-                
-                    <c:when test="#{forums:isLongerThan(myForums.topicsLastPosts[topicrow.id].message.subject,25)}">
-                        #{forums:subString(myForums.topicsLastPosts[topicrow.id].message.subject,25)}&#8230;
-                    </c:when>
-                    
-                    <c:otherwise>
-                        #{forum.topicsLastPosts[topicrow.id].message.subject}
-                    </c:otherwise>
-                    
-                </c:choose>
-            </a>
-            <br />
-            ${resource.By} 
-            <c:choose>
-            
-                <c:when test="#{myForums.anonymous}">
-                    ${forum.topicsLastPosts[topicrow.id].poster.user.userName}
-                </c:when>
-                            
-                <c:otherwise>
-                    <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
-                        <f:param name="uid" value="#{myForums.topicsLastPosts[topicrow.id].poster.user.id}"/>
-                        <h:outputText value="${myForums.topicsLastPosts[topicrow.id].poster.user.userName}"/>
-                    </h:outputLink>
-                </c:otherwise>
-                            
-            </c:choose>
-            <br />
-            #{forum.topicsLastPosts[topicrow.id].createDate}
-        </td>
-        <td class="forumlistcentered">
-            <div class="actionbuttons">
-                <ul>
-                    <li>
-                        <h:commandLink id="deActivateWatch" action="#{topicWatch.deActivateWatch}">
-                            <f:param name="t" value="#{topicrow.id}"/>
-                            <img src="#{forums:themeURL('resourceTopicModeDeleteURL')}"
-                                 alt="${resource.Unsubscribe_from_topic}"
-                                 name="unSubscribe"
-                                 border="0"
-                                 id="unSubscribe" />
-                        </h:commandLink>
-                    </li>
-                </ul>
-            </div>
-        </td>
-    </tr>
-    </c:forEach>
-    
-<!-- TODO: MOUNT VIEW ALL SUBSCRIBED TOPICS ACTION -->
-    <tr>
-        <td class="footerrow" colspan="6">
-            <a href="#">
-                View All Subscribed Topics
-            </a>
-        </td>
-    </tr>
-<!-- TODO: MOUNT VIEW ALL SUBSCRIBED TOPICS ACTION -->
-    
-    
-    <tr>
-        <td class="spacerRow" colspan="6"><img src="#{forums:themeURL('resourceSpacerURL')}" /></td>
-    </tr>
-</table>
-
-<table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
-    <tr class="header">
-        <td class="forumheaderfirst" colspan="2">${resource.Subscribed_forums_info}</td>
-        <td class="forumheadercentered">Topics</td>
-        <td class="forumheadercentered">Posts</td>
-        <td class="forumheaderopen">Last Post </td>
-	    <td class="forumheadercentered">Delete</td>
-    </tr>
-    <tr>
-        <td class="forumlisticon">
-            <img src="images/forum_ico_new_open.gif" width="11" height="14" />
-        </td>
-        <td>
-            <h3>
-                <a href="a">Forum 1 </a>
-            </h3>
-            Forum description
-        </td>
-        <td class="forumlistcentered">76</td>
-        <td class="forumlistcentered">2,000</td>
-        <td class="forumlistlast">
-            <a href="#">New release of JBoss AS&#8230;</a>
-            <br />
-            by 
-            <a href="#">scriptoverloard</a><br />
-            Today 10:26 PM
-        </td>
-        <td class="forumlistcentered">
-            <div class="actionbuttons">
-                <ul>
-                    <li>
-                        <a href="#">
-                            <img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" />
-                        </a>
-                    </li>
-                </ul>
-            </div>
-        </td>
-    </tr>
-    
-    
-    
-    
-          <tr>
-            <td class="forumlisticon"><img src="images/forum_ico_nonew_open.gif" width="11" height="14" /></td>
-            <td><h3><a href="a">Forum 2 </a></h3>
-              Forum description</td>
-            <td class="forumlistcentered">76</td>
-            <td class="forumlistcentered">2,000</td>
-            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
-              by <a href="#">scriptoverloard</a><br />
-              Today 10:26 PM</td>
-            <td class="forumlistcentered"><div class="actionbuttons">
-              <ul>
-                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
-              </ul>
-            </div></td>
-          </tr>
-          <tr>
-            <td class="forumlisticon"><img src="images/forum_ico_new_open.gif" width="11" height="14" /></td>
-            <td><h3><a href="a">Forum 3 </a></h3>
-              Forum description</td>
-            <td class="forumlistcentered">76</td>
-            <td class="forumlistcentered">2,000</td>
-            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
-              by <a href="#">scriptoverloard</a><br />
-              Today 10:26 PM</td>
-            <td class="forumlistcentered"><div class="actionbuttons">
-              <ul>
-                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
-              </ul>
-            </div></td>
-          </tr>
-          <tr>
-            <td class="forumlisticon"><img src="images/forum_ico_nonew_open.gif" width="11" height="14" /></td>
-            <td><h3><a href="a">Forum 4 </a></h3>
-              Forum description</td>
-            <td class="forumlistcentered">76</td>
-            <td class="forumlistcentered">2,000</td>
-            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
-              by <a href="#">scriptoverloard</a><br />
-              Today 10:26 PM</td>
-            <td class="forumlistcentered"><div class="actionbuttons">
-              <ul>
-                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
-              </ul>
-            </div></td>
-          </tr>
-          <tr>
-            <td class="forumlisticon"><img src="images/forum_ico_new_open.gif" width="11" height="14" /></td>
-            <td><h3><a href="a">Forum 5 </a></h3>
-              Forum description</td>
-            <td class="forumlistcentered">76</td>
-            <td class="forumlistcentered">2,000</td>
-            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
-              by <a href="#">scriptoverloard</a><br />
-              Today 10:26 PM</td>
-            <td class="forumlistcentered"><div class="actionbuttons">
-              <ul>
-                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
-              </ul>
-            </div></td>
-          </tr>
-          <tr>
-            <td class="forumlisticon"><img src="images/forum_ico_nonew_open.gif" width="11" height="14" /></td>
-            <td><h3><a href="a">Forum 6 </a></h3>
-              Forum description</td>
-            <td class="forumlistcentered">76</td>
-            <td class="forumlistcentered">2,000</td>
-            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
-              by <a href="#">scriptoverloard</a><br />
-              Today 10:26 PM</td>
-            <td class="forumlistcentered"><div class="actionbuttons">
-              <ul>
-                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
-              </ul>
-            </div></td>
-          </tr>
-          <tr>
-            <td class="forumlisticon"><img src="images/forum_ico_nonew_locked.gif" width="11" height="14" /></td>
-            <td><h3><a href="a">Forum 7 </a></h3>
-              Forum description</td>
-            <td class="forumlistcentered">76</td>
-            <td class="forumlistcentered">2,000</td>
-            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
-              by <a href="#">scriptoverloard</a><br />
-              Today 10:26 PM</td>
-            <td class="forumlistcentered"><div class="actionbuttons">
-              <ul>
-                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
-              </ul>
-            </div></td>
-          </tr>
-          
-          
-          
-          
-          
-</table>
-
-<div class="forumlegend">
-    <hr class="forumdashedHR" />
-    <ul>
-        <li>
-            <img src="${forums:themeURL('resourceForumNewURL')}" alt="${resource.New_posts}" width="11" height="14" />
-            ${resource.New_posts}
-        </li>
-        <li>
-            <img src="${forums:themeURL('resourceForumURL')}" alt="${resource.No_new_posts}" width="11" height="14" />
-            ${resource.No_new_posts}
-        </li>
-        <li>
-            <img src="${forums:themeURL('resourceForumLockedURL')}" alt="${resource.Forum_is_locked}" width="11" height="14" />
-            ${resource.Forum_is_locked}
-        </li>
-    </ul>
-</div>
-
-</c:if>
-
-</ui:define>
-</ui:composition>
-</div>

Copied: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml (from rev 10596, labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml	2007-03-28 20:14:06 UTC (rev 10597)
@@ -0,0 +1,350 @@
+<!--
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+-->
+
+<div  xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:c="http://java.sun.com/jstl/core"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:forums="http://www.jboss.com/products/jbossportal/forums"
+      class="forumscontainer"
+>
+
+<ui:composition template="/views/common/common.xhtml">
+<ui:define name="mainContent">
+
+<c:if test="#{myForums.initialized}">
+
+<div class="forumtitletext">
+    <h4>${resource.MyForums_title}</h4>
+    <p>${resource.MyForums_info}</p>
+</div>
+
+<table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
+
+    <tr class="header">
+        <td class="forumheaderfirst" colspan="2">${resource.Subscribed_topics_info}</td>
+        <td class="forumheadercentered">${resource.Replies}</td>
+        <td class="forumheadercentered">${resource.Views}</td>
+        <td class="forumheaderopen">${resource.Last_Post}</td>
+        <td class="forumheadercentered">${resource.Delete}</td>
+    </tr>
+    
+    <c:forEach items="#{myForums.watchedTopicsWithNewPosts}" var="topicrow" varStatus="status" >
+    <tr class='${(status.index%2==0)?"evenRow":"oddRow"}'>
+        <td class="forumlisticon">
+            <img src="#{forums:folderTypeURL(topicrow,myForums.anonymous)}" 
+                 width="11" height="14"
+                 alt="${resource.Topic_Moved}" title="${resource.Topic_Moved}" />
+        </td>
+        <td>
+            <h3>
+                <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+                    <f:param name="t" value="${topicrow.id}"/>
+                    <h:outputText value="${topicrow.subject}"/>                   
+                </h:outputLink>
+            </h3>
+            
+            <!-- mini post navigator for this topic -->
+            <c:if test="#{myForums.topicNavigator[topicrow.id] ne null &amp;&amp; myForums.topicNavigator[topicrow.id].totalPages gt 1}">
+                &#160;(&#160;
+                <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+                    <f:param name="t" value="#{topicrow.id}"/>
+                    <f:param name="page" value="0"/>
+                    <h:outputText value="${1}"/>
+                </h:outputLink>
+                &#160;
+                <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+                    <f:param name="t" value="#{topicrow.id}"/>
+                    <f:param name="page" value="1"/>
+                    <h:outputText value="${2}"/>
+                </h:outputLink>
+                <c:if test="#{myForums.topicNavigator[topicrow.id].totalPages gt 2}">
+                    &#160;
+                    <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+                        <f:param name="t" value="#{topicrow.id}"/>
+                        <f:param name="page" value="2"/>
+                        <h:outputText value="${3}"/>
+                    </h:outputLink>
+                </c:if>
+                <c:if test="#{myForums.topicNavigator[topicrow.id].totalPages gt 3}">                        
+                    &#160;&#8230;&#160;
+                    <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+                        <f:param name="t" value="#{topicrow.id}"/>
+                        <f:param name="page" value="#{myForums.topicNavigator[topicrow.id].totalPages-1}"/>
+                        <h:outputText value="${resource.Last_page}"/>
+                    </h:outputLink>
+                </c:if>
+                &#160;)
+            </c:if>
+            <br />
+            ${resource.By}&#160;
+            <c:choose>
+                
+                <c:when test="#{myForums.anonymous}">
+                    ${topicrow.poster.user.userName}
+                </c:when>
+               
+                <c:otherwise>
+                    <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
+                        <f:param name="uid" value="${topicrow.poster.user.id}"/>
+                        <h:outputText value="${topicrow.poster.user.userName}"/>
+                    </h:outputLink>
+                </c:otherwise>
+                            
+            </c:choose>
+        </td>
+        <td class="forumlistcentered">${topicrow.replies}</td>
+        <td class="forumlistcentered">${topicrow.viewCount}</td>
+        <td class="forumlistlast">
+            <a href="#{forums:postPermlink(myForums.topicsLastPosts[topicrow.id].id)}">
+                <c:choose>
+                
+                    <c:when test="#{forums:isLongerThan(myForums.topicsLastPosts[topicrow.id].message.subject,25)}">
+                        #{forums:subString(myForums.topicsLastPosts[topicrow.id].message.subject,25)}&#8230;
+                    </c:when>
+                    
+                    <c:otherwise>
+                        #{forum.topicsLastPosts[topicrow.id].message.subject}
+                    </c:otherwise>
+                    
+                </c:choose>
+            </a>
+            <br />
+            ${resource.By} 
+            <c:choose>
+            
+                <c:when test="#{myForums.anonymous}">
+                    ${forum.topicsLastPosts[topicrow.id].poster.user.userName}
+                </c:when>
+                            
+                <c:otherwise>
+                    <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
+                        <f:param name="uid" value="#{myForums.topicsLastPosts[topicrow.id].poster.user.id}"/>
+                        <h:outputText value="${myForums.topicsLastPosts[topicrow.id].poster.user.userName}"/>
+                    </h:outputLink>
+                </c:otherwise>
+                            
+            </c:choose>
+            <br />
+            #{forum.topicsLastPosts[topicrow.id].createDate}
+        </td>
+        <td class="forumlistcentered">
+            <div class="actionbuttons">
+                <ul>
+                    <li>
+                        <h:commandLink id="deActivateWatch" action="#{topicWatch.deActivateWatch}">
+                            <f:param name="t" value="#{topicrow.id}"/>
+                            <img src="#{forums:themeURL('resourceTopicModeDeleteURL')}"
+                                 alt="${resource.Unsubscribe_from_topic}"
+                                 name="unSubscribe"
+                                 border="0"
+                                 id="unSubscribe" />
+                        </h:commandLink>
+                    </li>
+                </ul>
+            </div>
+        </td>
+    </tr>
+    </c:forEach>
+    
+<!-- TODO: MOUNT VIEW ALL SUBSCRIBED TOPICS ACTION -->
+    <tr>
+        <td class="footerrow" colspan="6">
+            <a href="#">
+                View All Subscribed Topics
+            </a>
+        </td>
+    </tr>
+<!-- TODO: MOUNT VIEW ALL SUBSCRIBED TOPICS ACTION -->
+    
+    
+    <tr>
+        <td class="spacerRow" colspan="6"><img src="#{forums:themeURL('resourceSpacerURL')}" /></td>
+    </tr>
+</table>
+
+<table width="100%"  border="0" cellpadding="0" cellspacing="0" class="forumtablestyle">
+    <tr class="header">
+        <td class="forumheaderfirst" colspan="2">${resource.Subscribed_forums_info}</td>
+        <td class="forumheadercentered">Topics</td>
+        <td class="forumheadercentered">Posts</td>
+        <td class="forumheaderopen">Last Post </td>
+	    <td class="forumheadercentered">Delete</td>
+    </tr>
+    <tr>
+        <td class="forumlisticon">
+            <img src="images/forum_ico_new_open.gif" width="11" height="14" />
+        </td>
+        <td>
+            <h3>
+                <a href="a">Forum 1 </a>
+            </h3>
+            Forum description
+        </td>
+        <td class="forumlistcentered">76</td>
+        <td class="forumlistcentered">2,000</td>
+        <td class="forumlistlast">
+            <a href="#">New release of JBoss AS&#8230;</a>
+            <br />
+            by 
+            <a href="#">scriptoverloard</a><br />
+            Today 10:26 PM
+        </td>
+        <td class="forumlistcentered">
+            <div class="actionbuttons">
+                <ul>
+                    <li>
+                        <a href="#">
+                            <img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" />
+                        </a>
+                    </li>
+                </ul>
+            </div>
+        </td>
+    </tr>
+    
+    
+    
+    
+          <tr>
+            <td class="forumlisticon"><img src="images/forum_ico_nonew_open.gif" width="11" height="14" /></td>
+            <td><h3><a href="a">Forum 2 </a></h3>
+              Forum description</td>
+            <td class="forumlistcentered">76</td>
+            <td class="forumlistcentered">2,000</td>
+            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
+              by <a href="#">scriptoverloard</a><br />
+              Today 10:26 PM</td>
+            <td class="forumlistcentered"><div class="actionbuttons">
+              <ul>
+                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
+              </ul>
+            </div></td>
+          </tr>
+          <tr>
+            <td class="forumlisticon"><img src="images/forum_ico_new_open.gif" width="11" height="14" /></td>
+            <td><h3><a href="a">Forum 3 </a></h3>
+              Forum description</td>
+            <td class="forumlistcentered">76</td>
+            <td class="forumlistcentered">2,000</td>
+            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
+              by <a href="#">scriptoverloard</a><br />
+              Today 10:26 PM</td>
+            <td class="forumlistcentered"><div class="actionbuttons">
+              <ul>
+                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
+              </ul>
+            </div></td>
+          </tr>
+          <tr>
+            <td class="forumlisticon"><img src="images/forum_ico_nonew_open.gif" width="11" height="14" /></td>
+            <td><h3><a href="a">Forum 4 </a></h3>
+              Forum description</td>
+            <td class="forumlistcentered">76</td>
+            <td class="forumlistcentered">2,000</td>
+            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
+              by <a href="#">scriptoverloard</a><br />
+              Today 10:26 PM</td>
+            <td class="forumlistcentered"><div class="actionbuttons">
+              <ul>
+                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
+              </ul>
+            </div></td>
+          </tr>
+          <tr>
+            <td class="forumlisticon"><img src="images/forum_ico_new_open.gif" width="11" height="14" /></td>
+            <td><h3><a href="a">Forum 5 </a></h3>
+              Forum description</td>
+            <td class="forumlistcentered">76</td>
+            <td class="forumlistcentered">2,000</td>
+            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
+              by <a href="#">scriptoverloard</a><br />
+              Today 10:26 PM</td>
+            <td class="forumlistcentered"><div class="actionbuttons">
+              <ul>
+                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
+              </ul>
+            </div></td>
+          </tr>
+          <tr>
+            <td class="forumlisticon"><img src="images/forum_ico_nonew_open.gif" width="11" height="14" /></td>
+            <td><h3><a href="a">Forum 6 </a></h3>
+              Forum description</td>
+            <td class="forumlistcentered">76</td>
+            <td class="forumlistcentered">2,000</td>
+            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
+              by <a href="#">scriptoverloard</a><br />
+              Today 10:26 PM</td>
+            <td class="forumlistcentered"><div class="actionbuttons">
+              <ul>
+                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
+              </ul>
+            </div></td>
+          </tr>
+          <tr>
+            <td class="forumlisticon"><img src="images/forum_ico_nonew_locked.gif" width="11" height="14" /></td>
+            <td><h3><a href="a">Forum 7 </a></h3>
+              Forum description</td>
+            <td class="forumlistcentered">76</td>
+            <td class="forumlistcentered">2,000</td>
+            <td class="forumlistlast"><a href="#">New release of JBoss AS&#8230;</a><br />
+              by <a href="#">scriptoverloard</a><br />
+              Today 10:26 PM</td>
+            <td class="forumlistcentered"><div class="actionbuttons">
+              <ul>
+                <li><a href="#"><img src="images/forum_ico_admindelete_norm.gif" alt="Delete" name="delete" border="0" /></a></li>
+              </ul>
+            </div></td>
+          </tr>
+          
+          
+          
+          
+          
+</table>
+
+<div class="forumlegend">
+    <hr class="forumdashedHR" />
+    <ul>
+        <li>
+            <img src="${forums:themeURL('resourceForumNewURL')}" alt="${resource.New_posts}" width="11" height="14" />
+            ${resource.New_posts}
+        </li>
+        <li>
+            <img src="${forums:themeURL('resourceForumURL')}" alt="${resource.No_new_posts}" width="11" height="14" />
+            ${resource.No_new_posts}
+        </li>
+        <li>
+            <img src="${forums:themeURL('resourceForumLockedURL')}" alt="${resource.Forum_is_locked}" width="11" height="14" />
+            ${resource.Forum_is_locked}
+        </li>
+    </ul>
+</div>
+
+</c:if>
+
+</ui:define>
+</ui:composition>
+</div>




More information about the jboss-svn-commits mailing list