[jboss-svn-commits] JBL Code SVN: r10736 - in labs/jbossforums/branches/forums101P24/forums/src: main/org/jboss/portlet/forums and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Apr 3 18:23:13 EDT 2007
Author: unibrew
Date: 2007-04-03 18:23:13 -0400 (Tue, 03 Apr 2007)
New Revision: 10736
Added:
labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java
labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java
labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java
labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml
Removed:
labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForums.java
Modified:
labs/jbossforums/branches/forums101P24/forums/src/bin/portal-forums-war/default_graphics/forums_styles.css
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/WEB-INF/forums-config.xml
labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml
Log:
[JBFORUMS-201] ViewAllSubscribedTopics view finished.
Modified: labs/jbossforums/branches/forums101P24/forums/src/bin/portal-forums-war/default_graphics/forums_styles.css
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/bin/portal-forums-war/default_graphics/forums_styles.css 2007-04-03 22:18:58 UTC (rev 10735)
+++ labs/jbossforums/branches/forums101P24/forums/src/bin/portal-forums-war/default_graphics/forums_styles.css 2007-04-03 22:23:13 UTC (rev 10736)
@@ -208,7 +208,13 @@
border-left:1px solid #94aebd;
border-bottom:1px solid #233345;
}
+.forumtablestyle .forumheader250px {
+ border-left:1px solid #94aebd;
+ border-bottom:1px solid #233345;
+ width:250px;
+}
+
.forumtablestyle .forumheaderlast {
border-left:1px solid #94aebd;
border-bottom:1px solid #233345;
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-04-03 22:18:58 UTC (rev 10735)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ForumsModule.java 2007-04-03 22:23:13 UTC (rev 10736)
@@ -546,6 +546,8 @@
List findTopicWatchedByUserFetchTopicWatches(User user) throws ModuleException;
+ List findTopicWatchedByUserFetchTopicWatches(User user,Date date) 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-04-03 22:18:58 UTC (rev 10735)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2007-04-03 22:23:13 UTC (rev 10736)
@@ -1579,7 +1579,7 @@
" select tw.topic.id " +
" from TopicWatchImpl tw " +
" where tw.poster.userId = :userId ) " +
- "order by t.lastPostDate ");
+ "order by t.lastPostDate desc ");
query.setString("userId", user.getId().toString());
return query.list();
}
@@ -1590,6 +1590,31 @@
throw new ModuleException(message, e);
}
}
+
+ public List findTopicWatchedByUserFetchTopicWatches(User user,Date datePoint) throws ModuleException
+ {
+ try
+ {
+ Session session = getSession();
+ Query query = session.createQuery("select t " +
+ "from TopicImpl as t " +
+ "where t.id IN ( " +
+ " select tw.topic.id " +
+ " from TopicWatchImpl tw " +
+ " where tw.poster.userId = :userId ) " +
+ "and (t.lastPostDate > :datePoint) " +
+ "order by t.lastPostDate desc ");
+ query.setString("userId", user.getId().toString());
+ query.setTimestamp("datePoint", datePoint);
+ return query.list();
+ }
+ catch (HibernateException e)
+ {
+ String message = "Cannot find topic watched";
+ 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-04-03 22:18:58 UTC (rev 10735)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2007-04-03 22:23:13 UTC (rev 10736)
@@ -209,6 +209,9 @@
TEMP_VIEW_ID_TO_NAME.put("my","/views/myforums/myforums_main.jsf");
TEMP_VIEW_NAME_TO_ID.put("/views/myforums/myforums_main.jsf","my");
+ TEMP_VIEW_ID_TO_NAME.put("ma","/views/myforums/myforums_viewall.jsf");
+ TEMP_VIEW_NAME_TO_ID.put("/views/myforums/myforums_viewall.jsf","ma");
+
VIEW_ID_TO_NAME = Collections.unmodifiableSortedMap(TEMP_VIEW_ID_TO_NAME);
VIEW_NAME_TO_ID = Collections.unmodifiableSortedMap(TEMP_VIEW_NAME_TO_ID);
Deleted: labs/jbossforums/branches/forums101P24/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 2007-04-03 22:18:58 UTC (rev 10735)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForums.java 2007-04-03 22:23:13 UTC (rev 10736)
@@ -1,351 +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.
-*/
-package org.jboss.portlet.forums.ui.view;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-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.ThemeHelper;
-import org.jboss.portlet.forums.ui.action.PreferenceController;
-import org.jboss.portlet.forums.model.Post;
-import org.jboss.portlet.forums.model.Topic;
-import org.jboss.portlet.forums.model.Forum;
-
-/**
- *
- * @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 Map forumImageDescriptions;
- private Map forumImages;
- private Collection watchedTopics;
- private Collection watchedTopicsWithNewPosts;
- private Map topicNavigator = new HashMap();
-
- /**
- *
- */
- public Collection getWatchedForums()
- {
- if (watchedForums==null)
- {
- try
- {
- watchedForums = BaseController.getForumsModule().findForumWatchedByUserFetchForumWatches(PortalUtil.getUser());
- } catch (Exception e)
- {
- JSFUtil.handleException(e);
- }
- }
- return watchedForums;
- }
-
- /**
- *
- */
- public void setWatchedForums(Collection watchedForums)
- {
- this.watchedForums = watchedForums;
- }
-
- /**
- * @return Returns the forumImageDescriptions.
- */
- public Map getForumImageDescriptions()
- {
- if(this.forumImageDescriptions==null)
- {
- this.forumImageDescriptions = new HashMap();
- }
- return this.forumImageDescriptions;
- }
- /**
- * @return Returns the forumImages.
- */
- public Map getForumImages()
- {
- if(this.forumImages==null)
- {
- this.forumImages = new HashMap();
- }
- return forumImages;
- }
-
- /**
- *
- */
- public Collection getWatchedTopics()
- {
- if (watchedTopics==null)
- {
- try
- {
- watchedTopics = BaseController.getForumsModule().findTopicWatchedByUserFetchTopicWatches(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())
- {
- Topic topic = (Topic)it.next();
- 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
- {
- Collection watched = getWatchedTopics();
- Set temporaryContainer = new HashSet(watched.size());
- Iterator it = watched.iterator();
- while (it.hasNext())
- {
- Topic topic = (Topic)it.next();
- temporaryContainer.add(topic);
- }
- topicsLastPosts = BaseController.getForumsModule().findLastPostsOfTopics(temporaryContainer);
- } 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;
- }
-
- //------------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;
- }
-
- // -------- Business logic ----------------------------------------------------------------------------------------------------------------
-
- /**
- *
- */
- 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() throws Exception
- {
- // 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();)
- {
- Topic courTopic = (Topic)itr.next();
- if(courTopic.getReplies()>0)
- {
- PageNavigator topicNav = new PageNavigator(courTopic.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(courTopic.getId(),topicNav);
- }
- }
-
- Collection forums = getWatchedForums();
- Date userLastLogin = PortalUtil.getUserLastLoginDate();
-
- for (Iterator iter = forums.iterator(); iter.hasNext();)
- {
- Forum currentForum = (Forum) iter.next();
-
- // setup folderLook based on whats specified in the theme
- String folderImage = ThemeHelper.getInstance().getResourceForumURL();
- String folderAlt = "No_new_posts"; //bundle key
- if (this.forumsLastPosts!=null && this.forumsLastPosts.containsKey(currentForum.getId()))
- {
- Post lastPost = (Post)this.forumsLastPosts.get(currentForum.getId());
- Date lastPostDate = lastPost.getCreateDate();
- if (lastPostDate!=null && userLastLogin!=null && lastPostDate.compareTo(userLastLogin)>0)
- {
- folderAlt = "New_posts"; //bundle key
- folderImage = ThemeHelper.getInstance().getResourceForumNewURL();
- }
- }
- if (currentForum.getStatus() == Constants.FORUM_LOCKED)
- {
- folderImage = ThemeHelper.getInstance().getResourceForumLockedURL();
- folderAlt = "Forum_locked"; //bundle key
- }
- this.getForumImages().put(currentForum.getId(),folderImage);
- this.getForumImageDescriptions().put(currentForum.getId(),folderAlt);
- }
- }
-
-}
Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java (from rev 10735, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsAllSubscribed.java 2007-04-03 22:23:13 UTC (rev 10736)
@@ -0,0 +1,61 @@
+/*
+* 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 org.jboss.portlet.forums.ui.BaseController;
+import org.jboss.portlet.forums.ui.JSFUtil;
+import org.jboss.portlet.forums.ui.PortalUtil;
+
+public class ViewMyForumsAllSubscribed extends ViewMyForumsBase
+{
+
+ /**
+ *
+ */
+ public Collection getWatchedTopics()
+ {
+ if (watchedTopics==null)
+ {
+ try
+ {
+ watchedTopics = BaseController.getForumsModule().findTopicWatchedByUserFetchTopicWatches(PortalUtil.getUser());
+ } catch (Exception e)
+ {
+ JSFUtil.handleException(e);
+ }
+ }
+ return watchedTopics;
+ }
+
+ /**
+ *
+ */
+ public void setWatchedTopics(Collection watchedTopics)
+ {
+ this.watchedTopics = watchedTopics;
+ }
+
+ // -------- Business logic ----------------------------------------------------------------------------------------------------------------
+
+}
Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java (from rev 10735, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsBase.java 2007-04-03 22:23:13 UTC (rev 10736)
@@ -0,0 +1,175 @@
+/*
+* 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.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Iterator;
+
+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.action.PreferenceController;
+import org.jboss.portlet.forums.model.Topic;
+
+/**
+ *
+ * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ *
+ */
+public abstract class ViewMyForumsBase extends BaseController
+{
+
+ //preference related data
+ private PreferenceController userPreferences = null;
+
+ // Map<TopicId,LastPost>
+ private Map topicsLastPosts;
+ protected Collection watchedTopics;
+ private Map topicNavigator = new HashMap();
+
+ public abstract Collection getWatchedTopics();
+ public abstract void setWatchedTopics(Collection watchedTopics);
+
+ /**
+ *
+ */
+ public Map getTopicsLastPosts()
+ {
+ if (topicsLastPosts==null)
+ {
+ try
+ {
+ Collection watched = getWatchedTopics();
+ Set temporaryContainer = new HashSet(watched.size());
+ Iterator it = watched.iterator();
+ while (it.hasNext())
+ {
+ Topic topic = (Topic)it.next();
+ temporaryContainer.add(topic);
+ }
+ topicsLastPosts = BaseController.getForumsModule().findLastPostsOfTopics(temporaryContainer);
+ } catch (Exception e)
+ {
+ JSFUtil.handleException(e);
+ }
+ }
+ return topicsLastPosts;
+ }
+
+ /**
+ *
+ */
+ public void setTopicsLastPosts(Map topicsLastPosts)
+ {
+ this.topicsLastPosts = topicsLastPosts;
+ }
+
+ /**
+ *
+ */
+ public Map getTopicNavigator()
+ {
+ return this.topicNavigator;
+ }
+
+ //------------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;
+ }
+
+ // -------- Business logic ----------------------------------------------------------------------------------------------------------------
+
+ /**
+ *
+ */
+ public ViewMyForumsBase ()
+ {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean isInitialized()
+ {
+ boolean initialized = false;
+ try
+ {
+ this.execute();
+ initialized = true;
+ }
+ catch(Exception e)
+ {
+ JSFUtil.handleException(e);
+ }
+ return initialized;
+ }
+
+ /**
+ *
+ */
+ public void execute() throws Exception
+ {
+ // Forcing initialization of collections
+ getWatchedTopics();
+ getTopicsLastPosts();
+
+ Collection topics = getWatchedTopics();
+
+ // setup dummy pageNavigators for all topics being displayed for topic minipaging
+ for(Iterator itr=topics.iterator();itr.hasNext();)
+ {
+ Topic courTopic = (Topic)itr.next();
+ if(courTopic.getReplies()>0)
+ {
+ PageNavigator topicNav = new PageNavigator(courTopic.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(courTopic.getId(),topicNav);
+ }
+ }
+
+
+ }
+
+}
Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java (from rev 10735, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewMyForumsMain.java 2007-04-03 22:23:13 UTC (rev 10736)
@@ -0,0 +1,234 @@
+/*
+* 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.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import org.jboss.portlet.forums.model.Forum;
+import org.jboss.portlet.forums.model.Post;
+import org.jboss.portlet.forums.model.Topic;
+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.ThemeHelper;
+
+public class ViewMyForumsMain extends ViewMyForumsBase
+{
+
+ // Map<ForumId,LastPost>
+ private Map forumsLastPosts;
+
+ private Collection watchedForums;
+
+ private Map forumImageDescriptions;
+ private Map forumImages;
+
+
+ /**
+ *
+ */
+ public Collection getWatchedTopics()
+ {
+ if (watchedTopics==null)
+ {
+ try {
+ Date lastLoginDate = PortalUtil.getUserLastLoginDate();
+ if (lastLoginDate==null)
+ {
+ return watchedTopics;
+ }
+ watchedTopics = BaseController.getForumsModule().
+ findTopicWatchedByUserFetchTopicWatches(PortalUtil.getUser(),lastLoginDate);
+ /*
+ watchedTopics = new LinkedList();
+ Iterator it = topics.iterator();
+ while (it.hasNext())
+ {
+ Topic topic = (Topic)it.next();
+ if (topic.getLastPostDate().compareTo(lastLoginDate)>0)
+ {
+ watchedTopics.add(topic);
+ }
+ }*/
+ } catch (Exception e)
+ {
+ JSFUtil.handleException(e);
+ }
+ }
+ return watchedTopics;
+ }
+
+ /**
+ *
+ */
+ public void setWatchedTopics(Collection watchedTopics)
+ {
+ this.watchedTopics = watchedTopics;
+ }
+
+ /**
+ *
+ */
+ public Collection getWatchedForums()
+ {
+ if (watchedForums==null)
+ {
+ try
+ {
+ watchedForums = BaseController.getForumsModule().findForumWatchedByUserFetchForumWatches(PortalUtil.getUser());
+ } catch (Exception e)
+ {
+ JSFUtil.handleException(e);
+ }
+ }
+ return watchedForums;
+ }
+
+ /**
+ *
+ */
+ public void setWatchedForums(Collection watchedForums)
+ {
+ this.watchedForums = watchedForums;
+ }
+
+ /**
+ * @return Returns the forumImageDescriptions.
+ */
+ public Map getForumImageDescriptions()
+ {
+ if(this.forumImageDescriptions==null)
+ {
+ this.forumImageDescriptions = new HashMap();
+ }
+ return this.forumImageDescriptions;
+ }
+
+ /**
+ * @return Returns the forumImages.
+ */
+ public Map getForumImages()
+ {
+ if(this.forumImages==null)
+ {
+ this.forumImages = new HashMap();
+ }
+ return forumImages;
+ }
+
+ /**
+ *
+ */
+ 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;
+ }
+
+ // -------- Business logic ----------------------------------------------------------------------------------------------------------------
+
+ /**
+ *
+ */
+ public ViewMyForumsMain ()
+ {
+ super();
+ }
+
+ /**
+ *
+ */
+ public boolean isInitialized()
+ {
+ boolean initialized = false;
+ try
+ {
+ super.execute();
+ this.execute();
+ initialized = true;
+ }
+ catch(Exception e)
+ {
+ JSFUtil.handleException(e);
+ }
+ return initialized;
+ }
+
+ /**
+ *
+ */
+ public void execute () throws Exception {
+
+ Collection forums = getWatchedForums();
+ Date userLastLogin = PortalUtil.getUserLastLoginDate();
+
+ for (Iterator iter = forums.iterator(); iter.hasNext();)
+ {
+ Forum currentForum = (Forum) iter.next();
+
+ // setup folderLook based on whats specified in the theme
+ String folderImage = ThemeHelper.getInstance().getResourceForumURL();
+ String folderAlt = "No_new_posts"; //bundle key
+ if (this.forumsLastPosts!=null && this.forumsLastPosts.containsKey(currentForum.getId()))
+ {
+ Post lastPost = (Post)this.forumsLastPosts.get(currentForum.getId());
+ Date lastPostDate = lastPost.getCreateDate();
+ if (lastPostDate!=null && userLastLogin!=null && lastPostDate.compareTo(userLastLogin)>0)
+ {
+ folderAlt = "New_posts"; //bundle key
+ folderImage = ThemeHelper.getInstance().getResourceForumNewURL();
+ }
+ }
+ if (currentForum.getStatus() == Constants.FORUM_LOCKED)
+ {
+ folderImage = ThemeHelper.getInstance().getResourceForumLockedURL();
+ folderAlt = "Forum_locked"; //bundle key
+ }
+ this.getForumImages().put(currentForum.getId(),folderImage);
+ this.getForumImageDescriptions().put(currentForum.getId(),folderAlt);
+ }
+ }
+
+}
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-04-03 22:18:58 UTC (rev 10735)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2007-04-03 22:23:13 UTC (rev 10736)
@@ -2011,6 +2011,7 @@
Subscribed_forums_info=Subscribed Forums
NoNewPosts=There are no new posts to your subscribed threads.
ViewAllSubscribed=View All Subscribed Topics
+Notification=Notification
#
Modified: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2007-04-03 22:18:58 UTC (rev 10735)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2007-04-03 22:23:13 UTC (rev 10736)
@@ -104,6 +104,10 @@
<key>myForums</key>
<value>/views/myforums/myforums_main.jsf</value>
</map-entry>
+ <map-entry>
+ <key>myForumsAll</key>
+ <value>/views/myforums/myforums_viewall.jsf</value>
+ </map-entry>
</map-entries>
</managed-property>
</managed-bean>
@@ -518,7 +522,7 @@
<!-- myforums controller -->
<managed-bean>
<managed-bean-name>myForums</managed-bean-name>
- <managed-bean-class>org.jboss.portlet.forums.ui.view.ViewMyForums</managed-bean-class>
+ <managed-bean-class>org.jboss.portlet.forums.ui.view.ViewMyForumsMain</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>userPreferences</property-name>
@@ -526,4 +530,14 @@
<value>#{prefController}</value>
</managed-property>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>myForumsAll</managed-bean-name>
+ <managed-bean-class>org.jboss.portlet.forums.ui.view.ViewMyForumsAllSubscribed</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>userPreferences</property-name>
+ <property-class>org.jboss.portlet.forums.ui.action.PreferenceController</property-class>
+ <value>#{prefController}</value>
+ </managed-property>
+ </managed-bean>
</faces-config>
Modified: labs/jbossforums/branches/forums101P24/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 2007-04-03 22:18:58 UTC (rev 10735)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_main.xhtml 2007-04-03 22:23:13 UTC (rev 10736)
@@ -47,12 +47,12 @@
<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="forumheader250px">${resource.Last_Post}</td>
<td class="forumheadercentered">${resource.Delete}</td>
</tr>
- <c:if test="${forums:collectionSize(myForums.watchedTopicsWithNewPosts) gt 0}">
- <c:forEach items="#{myForums.watchedTopicsWithNewPosts}" var="topicrow" varStatus="status" >
+ <c:if test="${forums:collectionSize(myForums.watchedTopics) gt 0}">
+ <c:forEach items="#{myForums.watchedTopics}" var="topicrow" varStatus="status" >
<tr class='${(status.index%2==0)?"evenRow":"oddRow"}'>
<td class="forumlisticon">
<img src="#{forums:folderTypeURL(topicrow,myForums.anonymous)}"
@@ -173,7 +173,7 @@
</c:forEach>
</c:if>
- <c:if test="${forums:collectionSize(myForums.watchedTopicsWithNewPosts) eq 0}">
+ <c:if test="${forums:collectionSize(myForums.watchedTopics) eq 0}">
<tr>
<td class="nonewpostRow" colspan="6">
${resource.NoNewPosts}
@@ -181,17 +181,16 @@
</tr>
</c:if>
-<!-- TODO: MOUNT VIEW ALL SUBSCRIBED TOPICS ACTION -->
<tr>
<td class="footerrow" colspan="6">
+ <h:outputLink value="#{forums:outputLink(shared.links['myForumsAll'],true)}">
+ ${resource.ViewAllSubscribed}
+ </h:outputLink>
<a href="#">
- ${resource.ViewAllSubscribed}
+
</a>
</td>
</tr>
-<!-- TODO: MOUNT VIEW ALL SUBSCRIBED TOPICS ACTION -->
-
-
<tr>
<td class="spacerRow" colspan="6"><img src="#{forums:themeURL('resourceSpacerURL')}" /></td>
</tr>
Copied: labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml (from rev 10735, labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/resources/portal-forums-war/views/myforums/myforums_viewall.xhtml 2007-04-03 22:23:13 UTC (rev 10736)
@@ -0,0 +1,207 @@
+<!--
+/*
+* 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="#{myForumsAll.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="forumheaderopen">${resource.Last_Post}</td>
+ <td class="forumheaderopen">${resource.Notification}</td>
+ <td class="forumheadercentered">${resource.Delete}</td>
+ </tr>
+
+ <c:if test="${forums:collectionSize(myForumsAll.watchedTopics) gt 0}">
+ <c:forEach items="#{myForumsAll.watchedTopics}" var="topicrow" varStatus="status" >
+ <tr class='${(status.index%2==0)?"evenRow":"oddRow"}'>
+ <td class="forumlisticon">
+ <img src="#{forums:folderTypeURL(topicrow,myForumsAll.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="#{myForumsAll.topicNavigator[topicrow.id] ne null && myForumsAll.topicNavigator[topicrow.id].totalPages gt 1}">
+  ( 
+ <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>
+  
+ <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="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 2}">
+  
+ <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="#{myForumsAll.topicNavigator[topicrow.id].totalPages gt 3}">
+  … 
+ <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}">
+ <f:param name="t" value="#{topicrow.id}"/>
+ <f:param name="page" value="#{myForumsAll.topicNavigator[topicrow.id].totalPages-1}"/>
+ <h:outputText value="${resource.Last_page}"/>
+ </h:outputLink>
+ </c:if>
+  )
+ </c:if>
+ <br />
+ ${resource.By} 
+ <c:choose>
+
+ <c:when test="#{myForumsAll.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="forumlistlast">
+ <a href="#{forums:postPermlink(myForumsAll.topicsLastPosts[topicrow.id].id)}">
+ <c:choose>
+
+ <c:when test="#{forums:isLongerThan(myForumsAll.topicsLastPosts[topicrow.id].message.subject,25)}">
+ #{forums:subString(myForumsAll.topicsLastPosts[topicrow.id].message.subject,25)}…
+ </c:when>
+
+ <c:otherwise>
+ #{myForumsAll.topicsLastPosts[topicrow.id].message.subject}
+ </c:otherwise>
+
+ </c:choose>
+ </a>
+ <br />
+ ${resource.By}
+ <c:choose>
+
+ <c:when test="#{myForumsAll.anonymous}">
+ ${myForumsAll.topicsLastPosts[topicrow.id].poster.user.userName}
+ </c:when>
+
+ <c:otherwise>
+ <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}">
+ <f:param name="uid" value="#{myForumsAll.topicsLastPosts[topicrow.id].poster.user.id}"/>
+ <h:outputText value="${myForumsAll.topicsLastPosts[topicrow.id].poster.user.userName}"/>
+ </h:outputLink>
+ </c:otherwise>
+
+ </c:choose>
+ <br />
+ #{myForumsAll.topicsLastPosts[topicrow.id].createDate}
+ </td>
+
+<!-- TODO: EDIT VIEW MUST BE HOOKED HERE -->
+ <td class="forumlistopen">
+ ${resource.None} (
+ <a href="#">
+ ${resource.Edit}
+ </a>
+ )
+ </td>
+<!-- TODO: EDIT VIEW MUST BE HOOKED HERE -->
+
+ <td class="forumlistcentered">
+ <h:form>
+ <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>
+ </h:form>
+ </td>
+ </tr>
+ </c:forEach>
+ </c:if>
+</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>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list