[jboss-svn-commits] JBL Code SVN: r9069 - in labs/jbossforums/branches/forums22: forums/src/main/org/jboss/portlet/forums/impl and 8 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Jan 29 07:42:41 EST 2007
Author: unibrew
Date: 2007-01-29 07:42:41 -0500 (Mon, 29 Jan 2007)
New Revision: 9069
Added:
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/util/
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/util/NotificationEngine.java
labs/jbossforums/branches/forums22/thirdparty/jboss-system/lib/mail.jar
Removed:
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/util/NotificationEngine.java
Modified:
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/Constants.java
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java
labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml
labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml
labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/posting_reply_body.xhtml
labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml
labs/jbossforums/branches/forums22/thirdparty/jboss-system/README.txt
labs/jbossforums/branches/forums22/tools/etc/buildfragments/libraries.ent
Log:
[JBFORUMS-155] E-mail notification engine.
Modified: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ForumsModule.java 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ForumsModule.java 2007-01-29 12:42:41 UTC (rev 9069)
@@ -597,5 +597,11 @@
* @throws CommandException
*/
Result invoke(ActionCommand cmd) throws CommandException;
+
+ /**
+ *
+ *
+ */
+ public void processNotifications (Integer postId, int watchType , String postUrl , String replyUrl );
}
\ No newline at end of file
Modified: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2007-01-29 12:42:41 UTC (rev 9069)
@@ -11,34 +11,35 @@
package org.jboss.portlet.forums.impl;
import org.apache.log4j.Logger;
-import org.jboss.portal.common.command.result.Result;
+import org.hibernate.HibernateException;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
import org.jboss.portal.common.command.CommandException;
+import org.jboss.portal.common.command.filter.CommandFilter;
import org.jboss.portal.common.command.filter.CompositeFilter;
import org.jboss.portal.common.command.filter.ExecuteFilter;
-import org.jboss.portal.common.command.filter.CommandFilter;
+import org.jboss.portal.common.command.result.Result;
+import org.jboss.portal.core.modules.AbstractModule;
+import org.jboss.portal.core.modules.ModuleException;
import org.jboss.portal.core.model.User;
-import org.jboss.portal.core.modules.ModuleException;
-import org.jboss.portal.core.modules.AbstractModule;
import org.jboss.portal.core.hibernate.HibernateProvider;
+import org.jboss.portlet.command.ActionCommand;
import org.jboss.portlet.forums.ForumsConstants;
import org.jboss.portlet.forums.ForumsModule;
-import org.jboss.portlet.forums.model.Poster;
+import org.jboss.portlet.forums.interceptors.FloodControlInterceptor;
+import org.jboss.portlet.forums.model.Attachment;
+import org.jboss.portlet.forums.model.Category;
import org.jboss.portlet.forums.model.Forum;
+import org.jboss.portlet.forums.model.ForumWatch;
+import org.jboss.portlet.forums.model.Message;
import org.jboss.portlet.forums.model.Poll;
import org.jboss.portlet.forums.model.Post;
-import org.jboss.portlet.forums.model.Message;
+import org.jboss.portlet.forums.model.Poster;
import org.jboss.portlet.forums.model.Topic;
-import org.jboss.portlet.forums.model.Category;
-import org.jboss.portlet.forums.model.ForumWatch;
+import org.jboss.portlet.forums.model.TopicWatch;
import org.jboss.portlet.forums.model.Watch;
-import org.jboss.portlet.forums.model.TopicWatch;
-import org.jboss.portlet.forums.model.Attachment;
-import org.jboss.portlet.forums.interceptors.FloodControlInterceptor;
-import org.jboss.portlet.command.ActionCommand;
-import org.hibernate.Session;
-import org.hibernate.HibernateException;
-import org.hibernate.Query;
-import org.hibernate.SessionFactory;
+import org.jboss.portlet.forums.util.NotificationEngine;
import java.util.Date;
import java.util.Iterator;
@@ -51,7 +52,6 @@
import java.util.LinkedList;
import java.util.Map;
-
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute </a>
* @author <a href="mailto:boleslaw.dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
@@ -69,7 +69,8 @@
private HibernateProvider hibernate;
private SessionFactory factory;
-
+ private NotificationEngine notificationEngine;
+
private int floodInterval;
private String fromAddress;
@@ -88,12 +89,12 @@
factory = hibernate.getSessionFactory();
+ notificationEngine = new NotificationEngine(this);
+ notificationEngine.setFrom(fromAddress);
// Define the chain of interceptors
chain = compositeInterceptor = new CompositeFilter();
// resourceInterceptor = new ResourceCacheInvalidatorInterceptor();
// indexInterceptor = new IndexInterceptor();
-// notificationInterceptor = new NotificationInterceptor(this);
-// notificationInterceptor.setFrom(fromAddress);
floodControlInterceptor = new FloodControlInterceptor();
floodControlInterceptor.setFloodInterval(floodInterval);
executeInterceptor = new ExecuteFilter();
@@ -671,6 +672,7 @@
forum.addPostSize();
post.setTopic(topic);
+ notificationEngine.scheduleForNotification(post.getId(), NotificationEngine.MODE_POST);
return post;
}
catch (HibernateException e)
@@ -768,6 +770,7 @@
session.save(topic);
//forum.setLastPost(post);
forum.addPostSize();
+ notificationEngine.scheduleForNotification(post.getId(), NotificationEngine.MODE_REPLY);
return post;
}
catch (HibernateException e)
@@ -1694,6 +1697,10 @@
return chain.filter(cmd);
}
+ public void processNotifications (Integer postId, int watchType , String postUrl , String replyUrl ) {
+ notificationEngine.schedule(postId, watchType, postUrl , replyUrl );
+ }
+
protected Session getSession () {
return factory.getCurrentSession();
}
Modified: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/Constants.java
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2007-01-29 12:42:41 UTC (rev 9069)
@@ -57,6 +57,8 @@
public static final String p_page = "page";
public static final String p_watchId = "w";
public static final String p_viewId = "v";
+ public static final String p_notified_post_id = "notified_post_id";
+ public static final String p_notified_watch_type = "notified_watch_type";
//other constants-------------------------------------------------------------------------------------------------------------------------------
public static final String QUOTE = "quote";
public static final String NOTIFY_REPLY_KEY = "notifyreply";
Modified: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2007-01-29 12:42:41 UTC (rev 9069)
@@ -293,6 +293,12 @@
facesContext.setViewRoot(new UIViewRoot());
}
+ PortalUtil.executeNotifications();
+
+ // Removing notification parameters from RenderRequest
+ newParams.remove(Constants.p_notified_post_id);
+ newParams.remove(Constants.p_notified_watch_type);
+
if (map.get(VIEW)!=null) {
String viewName = ((String[])newParams.get(VIEW))[0];
newParams.put(MyFacesGenericPortlet.VIEW_ID,new String[]{getNameForId(viewName)});
Modified: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2007-01-29 12:42:41 UTC (rev 9069)
@@ -51,6 +51,7 @@
import javax.portlet.PortletPreferences;
import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.PortletRequest;
@@ -72,7 +73,6 @@
import org.jboss.portlet.forums.impl.PollOptionImpl;
import org.jboss.portlet.forums.model.Message;
import org.jboss.portlet.forums.impl.MessageImpl;
-import org.jboss.portlet.forums.model.Topic;
import org.jboss.portlet.forums.model.Forum;
import org.jboss.portlet.forums.helper.TempFileBinding;
@@ -191,6 +191,67 @@
}
/**
+ *
+ *
+ */
+ public static void executeNotifications () {
+
+ Object responseObj =
+ FacesContext.getCurrentInstance().getExternalContext().getResponse();
+
+ Object requestObj =
+ FacesContext.getCurrentInstance().getExternalContext().getRequest();
+
+ // Initializing url values
+ String postUrl = "";
+ String replyUrl = "";
+
+ if (requestObj instanceof RenderRequest) {
+
+ PortletRequest request = (PortletRequest)requestObj;
+
+ // Checking whether there is watched post id in RenderParameters and scheduling notification e-mails.
+ String watchedPostId = request.getParameter(Constants.p_notified_post_id);
+ String watchedType = request.getParameter(Constants.p_notified_watch_type);
+
+ if (watchedPostId!=null && watchedPostId.trim().length()>0 &&
+ watchedType!=null && watchedType.trim().length()>0 ) {
+
+ // Creating permament link to post
+ PortletURL portletURL = ((RenderResponse)responseObj).createActionURL();
+ postUrl = portletURL.toString();
+ if (postUrl.contains("/auth")) {
+ postUrl = postUrl.replaceFirst("/auth","");
+ }
+ postUrl += "&"+Constants.p_viewId+"=t&"+Constants.p_postId+"="+watchedPostId+"#"+watchedPostId;
+
+ portletURL = ((RenderResponse)responseObj).createRenderURL();
+ replyUrl = portletURL.toString();
+ replyUrl += "&"+Constants.p_viewId+"=z&"+Constants.p_postId+"="+watchedPostId;
+
+ // Generate hostUrl to servlet
+ String hostURL = ((request.isSecure()) ? "https" : "http")
+ + "://"
+ + request.getServerName()
+ + ((request.getServerPort() == 80) ? "" : ":"
+ + request.getServerPort());
+
+ postUrl= hostURL + postUrl;
+ replyUrl = hostURL + replyUrl;
+
+ Integer postId = new Integer(watchedPostId);
+ int type = Integer.parseInt(watchedType);
+
+ try {
+ BaseController.getForumsModule().processNotifications(postId,type,postUrl,replyUrl);
+ } catch (Exception e) {
+ JSFUtil.handleException(e);
+ }
+ }
+ }
+ }
+
+ /**
*
* @param preferenceKey
* @return
@@ -492,23 +553,7 @@
return votePercent;
}
-
- /**
- *
- *
- */
- public static boolean isWatchingTopic(Topic topic)
- {
- boolean isWatchingTopic = false;
- //check if this topic is being watched by the currently logged in user
- //this is not implemented yet....This will be done
- //after the JSF refactoring effort. This seems like a new feature and
- //needs modifications in the Forums Module layer
-
- return isWatchingTopic;
- }
-
/**
*
*
Modified: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java 2007-01-29 12:42:41 UTC (rev 9069)
@@ -45,10 +45,15 @@
/**
* @author <a href="mailto:sohil.shah at jboss.com">Sohil Shah</a>
+ * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
*
*/
public class ReplyTopic extends PostAction
-{
+{
+
+ // Variable describing whether bean was initialized.
+ private boolean initialized;
+
//----------------------------------------------------------------------------------------------------------------------------------------
/**
*
@@ -68,12 +73,15 @@
public String start()
{
String navState = null;
+ this.initialized=false;
try
{
int forumId = -1;
int topicId = -1;
+ int postId = -1;
String f = ForumUtil.getParameter(Constants.p_forumId);
String t = ForumUtil.getParameter(Constants.p_topicId);
+ String p = ForumUtil.getParameter(Constants.p_postId);
if(f!=null && f.trim().length()>0)
{
forumId = Integer.parseInt(f);
@@ -82,25 +90,43 @@
{
topicId = Integer.parseInt(t);
}
-
- //grab the forum where this topic will be added
- if(forumId!=-1)
- {
- Topic topic = this.getForumsModule().findTopicById(new Integer(topicId));
-
- //re-initialize this controller to add a reply post in a topic
- //to the specified forum
- this.cleanup();
-
- //set the selected forum's id and topic's id
- this.forumId = forumId;
- this.topicId = topicId;
-
- //set the subject information
- this.subject = "Re: " + topic.getSubject();
- }
-
+ if(p!=null && p.trim().length()>0)
+ {
+ postId = Integer.parseInt(p);
+ }
+
+ Topic topic = null;
+
+ if (topicId==-1 && postId!=-1) {
+ // If topicId was not given and postId is available we get topicId from Post
+ Post post = getForumsModule().findPostById(new Integer(postId));
+ if (post!=null) {
+ topic = post.getTopic();
+ topicId = topic.getId().intValue();
+ }
+ } else {
+ topic = getForumsModule().findTopicById(new Integer(topicId));
+ }
+
+ if (forumId==-1 && topic!=null) {
+ forumId = topic.getForum().getId().intValue();
+ }
+
+ //re-initialize this controller to add a reply post in a topic
+ //to the specified forum
+ this.cleanup();
+
+ //set the selected forum's id and topic's id
+ this.forumId = forumId;
+ this.topicId = topicId;
+
+ //set the subject information
+ this.subject = "Re: " + topic.getSubject();
+
navState = Constants.START_REPLY;
+
+ this.initialized = true;
+
}
catch(Exception e)
{
@@ -149,6 +175,17 @@
this.preview();
return navState;
}
+
+ public boolean isInitialized() {
+
+ // Lets try to initialize maybe the view was executed from permament link.
+ if (this.initialized==false) {
+ this.start();
+ }
+
+ return this.initialized;
+ }
+
//--------execute-------------------------------------------------------------------------------------------------------------
/**
*
@@ -216,6 +253,7 @@
if(success)
{
this.cleanup();
+ this.initialized=false;
}
}
return navState;
Copied: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/util (from rev 9068, labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/util)
Deleted: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/util/NotificationEngine.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/util/NotificationEngine.java 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/util/NotificationEngine.java 2007-01-29 12:42:41 UTC (rev 9069)
@@ -1,443 +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.util;
-
-import java.io.StringWriter;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.mail.Address;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.Message.RecipientType;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.portlet.ActionResponse;
-import javax.rmi.PortableRemoteObject;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.common.transaction.Transactions;
-import org.jboss.portal.format.render.bbcodehtml.ToTextRenderer;
-import org.jboss.portal.format.template.TemplateLoader;
-import org.jboss.portal.identity.User;
-import org.jboss.portlet.forums.ForumsConstants;
-import org.jboss.portlet.forums.ForumsModule;
-import org.jboss.portlet.forums.auth.Authorization;
-import org.jboss.portlet.forums.auth.AuthorizationInterface;
-import org.jboss.portlet.forums.auth.JSFUIContext;
-import org.jboss.portlet.forums.model.Category;
-import org.jboss.portlet.forums.model.Forum;
-import org.jboss.portlet.forums.model.Message;
-import org.jboss.portlet.forums.model.Post;
-import org.jboss.portlet.forums.model.Topic;
-import org.jboss.portlet.forums.model.TopicWatch;
-import org.jboss.portlet.forums.model.Watch;
-import org.jboss.portlet.forums.ui.Constants;
-
-import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
-import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
- */
-public class NotificationEngine
-{
- // Types of post
- public static final int MODE_POST = 0;
- public static final int MODE_REPLY = 1;
- public static final int MODE_REPOST = 2;
-
- private ForumsModule forumsModule;
- private TemplateLoader mailTemplates;
- private String from;
- private QueuedExecutor executor;
- private TransactionManager tm;
- private final Logger log = Logger.getLogger(NotificationEngine.class);
-
- public NotificationEngine(ForumsModule module)
- {
- try
- {
- this.forumsModule = module;
- InitialContext ctx = new InitialContext();
- tm = (TransactionManager)ctx.lookup("java:TransactionManager");
- executor = new QueuedExecutor(new LinkedQueue());
- }
- catch (NamingException e)
- {
- log.error("Cannot create notification interceptor", e);
- }
- }
-
- public void stop()
- {
- executor.shutdownAfterProcessingCurrentTask();
- executor = null;
- forumsModule = null;
- tm = null;
- }
-
- public void setFrom(String from)
- {
- this.from = from;
- }
-
- public TemplateLoader getMailTemplates()
- {
- return mailTemplates;
- }
-
- public void scheduleForNotification(Integer postId, int mode) {
- Object responseObj = FacesContext.getCurrentInstance().getExternalContext().getResponse();
-
- if (responseObj instanceof ActionResponse) {
-
- ActionResponse response = (ActionResponse)responseObj;
- response.setRenderParameter(Constants.p_notified_post_id, postId.toString());
- response.setRenderParameter(Constants.p_notified_watch_type, Integer.toString(mode));
-
- } else {
- // TODO: IMPLEMENT NOTIFICATION FOR STANDALONE VERSION OF FORUMS.
- log.warn("NOTIFICATION FOR STANDALONE HAS NOT BEEN YET IMPLEMENTED");
- }
-
- }
-
- public void schedule(Integer postId, int mode, String absViewURL , String absReplyURL )
- {
- try
- {
-
- if (postId==null || mode == -1) {
- log.warn("Request didn't have needed parameters.");
- return;
- }
-
- // Getting ResourceBundle with current Locale
- // Too bad for now we support notifications sent in the locale of the poster :-(
-
- FacesContext ctx = FacesContext.getCurrentInstance();
- UIViewRoot uiRoot = ctx.getViewRoot();
- Locale locale = uiRoot.getLocale();
- ClassLoader ldr = Thread.currentThread().getContextClassLoader();
- ResourceBundle bundle = ResourceBundle.getBundle("ResourceJSF",locale,ldr);
-
- // Getting Authorization realm
- AuthorizationInterface realm = Authorization.getProvider();
-
- // Create task
- NotificationTask task = new NotificationTask(tm, absViewURL, absReplyURL ,
- postId, mode, bundle , realm );
-
- //Register at the end of the current tx to broadcast notifications
- Transaction tx = tm.getTransaction();
- tx.registerSynchronization(task);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- private String getFrom(Post post)
- {
- StringBuffer fromBuf = null;
- if ((post.getPoster().getUser().getGivenName() != null)
- && (post.getPoster().getUser().getFamilyName() != null))
- {
- fromBuf = new StringBuffer(post.getPoster().getUser().getGivenName()
- + " " + post.getPoster().getUser().getFamilyName() + " <");
- }
- else
- {
- fromBuf = new StringBuffer(post.getPoster().getUser().getUserName() + " <");
- }
- fromBuf.append(from + ">");
- return fromBuf.toString();
- }
-
- /**
- * The notification task.
- */
- class NotificationTask implements Transactions.Runnable, Synchronization
- {
-
- private final TransactionManager tm;
- private final int mode;
- private final Integer postId;
- private final ResourceBundle bundle;
- private final String viewURL;
- private final String replyURL;
- private final AuthorizationInterface realm;
-
- NotificationTask(TransactionManager tm, String viewURL, String replyURL,
- final Integer postId, int mode, ResourceBundle bundle , AuthorizationInterface realm)
- {
- this.tm = tm;
- this.mode = mode;
- this.postId = postId;
- this.viewURL = viewURL;
- this.replyURL = replyURL;
- this.bundle = bundle;
- this.realm = realm;
- }
-
- public Object run() throws Exception
- {
- try
- {
- Post post = forumsModule.findPostById(postId);
- Topic topic = post.getTopic();
- Forum forum = topic.getForum();
- Category category = forum.getCategory();
-
- Message message = post.getMessage();
- String from = getFrom(post);
- // Hold the notified users to avoid duplicated
- Set notifieds = new HashSet();
-
- // If this is not an anonymous post, put the user in the notified list
- // he won't be notified of his own action
- User poster = post.getPoster().getUser();
- if (poster != null)
- {
- notifieds.add(poster.getId());
- }
-
- char[] chars = message.getText().toCharArray();
- StringWriter out = new StringWriter();
- ToTextRenderer renderer = new ToTextRenderer();
- renderer.setWriter(out);
- renderer.render(chars, 0, chars.length);
-
- String forumEmbededArgsSubject = "[" + forum.getName() + "] - "
- + message.getSubject()
- + (mode == MODE_REPOST ? " (Repost)" : "");
-
- String forumEmbededArgsText = out.toString() + "\n\n"
- + bundle.getString("EMAIL_VIEWORIGINAL") + " : "
- + viewURL.toString() + "\n\n"
- + bundle.getString("EMAIL_REPLY") + " : "
- + replyURL.toString();
-
- // Notify the forum watchers
- for (Iterator i = forum.getWatches().iterator(); i.hasNext();)
- {
- try
- {
- Watch watch = (Watch)i.next();
- User watcher = watch.getPoster().getUser();
- Object watcherId = watcher.getId();
-
- if (!notifieds.contains(watcherId))
- {
-
- boolean securityFlag = true;
-
- // Creating security context for the user
- JSFUIContext securityContext = new JSFUIContext(watcher,FacesContext.getCurrentInstance());
-
- // Checking if user has privileges to read category
- securityContext.setFragment("acl://readCategory");
- securityContext.setContextData(new Object[]{category});
- securityFlag = realm.hasAccess(securityContext) && securityFlag;
-
- // Checking if user has privileges to read forum
- securityContext.setFragment("acl://readForum");
- securityContext.setContextData(new Object[]{forum});
- securityFlag = realm.hasAccess(securityContext) && securityFlag;
-
- if (securityFlag)
- {
- notifieds.add(watcherId);
- String subject = null;
- String text = null;
- if (watch.getMode() == ForumsConstants.WATCH_MODE_LINKED)
- {
- }
- else
- {
- subject = forumEmbededArgsSubject;
- text = forumEmbededArgsText;
- }
-
- notify ( watcher, from , subject, text );
-
- }
- else
- {
- // Not authorized anymore, we remove the watch
- forumsModule.removeWatch(watch);
- }
- }
- }
- catch (Exception e)
- {
- log.error("Cannot send an email notification", e);
- }
- }
-
- if (mode == MODE_REPLY)
- {
- // Notify the reply watchers
- for (Iterator i = topic.getWatches().iterator(); i.hasNext();)
- {
- try
- {
- TopicWatch watch = (TopicWatch)i.next();
- User watcher = watch.getPoster().getUser();
- Object watcherId = watcher.getId();
- if (!notifieds.contains(watcherId))
- {
- boolean securityFlag = true;
-
- // Creating security context for the user
- JSFUIContext securityContext = new JSFUIContext(watcher,FacesContext.getCurrentInstance());
-
- // Checking if user has privileges to read category
- securityContext.setFragment("acl://readCategory");
- securityContext.setContextData(new Object[]{category});
- securityFlag = realm.hasAccess(securityContext) && securityFlag;
-
- // Checking if user has privileges to read forum
- securityContext.setFragment("acl://readForum");
- securityContext.setContextData(new Object[]{forum});
- securityFlag = realm.hasAccess(securityContext) && securityFlag;
-
- if (securityFlag)
- {
- // Authorized
- notifieds.add(watcherId);
-
- notify( watcher, from , forumEmbededArgsSubject , forumEmbededArgsText );
- }
- else
- {
- // Not authorized anymore, we remove the watch
- forumsModule.removeWatch(watch);
- }
- }
- }
- catch (Exception e)
- {
- log.error("Cannot send email notification", e);
- }
- }
- }
- }
- catch (IllegalArgumentException e)
- {
- log.error("", e);
- }
-
- return null;
- }
-
- public void beforeCompletion()
- {
- }
-
- private void notify (User watcher, String from , String subject, String text) {
-
- Session session = null;
-
- try {
- session = (Session) PortableRemoteObject
- .narrow(new InitialContext().lookup("java:Mail"),
- Session.class);
- try {
-
- StringBuffer buffer = null;
- Address[] to = null;
- MimeMessage m = new MimeMessage(session);
- String email = watcher.getRealEmail();
- if ( email != null ) {
- m.setFrom(new InternetAddress(from));
- to = new InternetAddress[] { new InternetAddress(
- email) };
- m.setRecipients(RecipientType.TO, to);
- m.setSubject(subject);
-
- m.setSentDate(new Date());
- buffer = new StringBuffer();
-
- buffer.append("This message is generated automaticcaly. Please do not reply.<br />\n<br />\n");
- buffer.append(text);
-
- m.setContent(buffer.toString(),
- "text/html; charset=\"UTF-8\"");
- Transport.send(m);
-
- }
- } catch (javax.mail.MessagingException e) {
- log.error(e);
- }
- } catch (javax.naming.NamingException e) {
- log.error(e);
- }
- }
-
- public void afterCompletion(int status)
- {
- // When transaction succesfully commits broadcast the notification
- if (status == Status.STATUS_COMMITTED)
- {
- try
- {
- // Do it asynch
- executor.execute(new Runnable()
- {
- public void run()
- {
- try
- {
- // Wrap with a tx
- Transactions.required(tm, NotificationTask.this);
- }
- catch (Exception e)
- {
- log.error("Cannot broadcast nofication for post id", e);
- }
- }
- });
- }
- catch (InterruptedException ignored)
- {
- }
- }
- }
- }
-}
\ No newline at end of file
Copied: labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/util/NotificationEngine.java (from rev 9068, labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/util/NotificationEngine.java)
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/util/NotificationEngine.java (rev 0)
+++ labs/jbossforums/branches/forums22/forums/src/main/org/jboss/portlet/forums/util/NotificationEngine.java 2007-01-29 12:42:41 UTC (rev 9069)
@@ -0,0 +1,443 @@
+/*
+* 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.util;
+
+import java.io.StringWriter;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.mail.Address;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.Message.RecipientType;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.portlet.ActionResponse;
+import javax.rmi.PortableRemoteObject;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.transaction.Transactions;
+import org.jboss.portal.format.render.bbcodehtml.ToTextRenderer;
+import org.jboss.portal.format.template.TemplateLoader;
+import org.jboss.portal.identity.User;
+import org.jboss.portlet.forums.ForumsConstants;
+import org.jboss.portlet.forums.ForumsModule;
+import org.jboss.portlet.forums.auth.Authorization;
+import org.jboss.portlet.forums.auth.AuthorizationInterface;
+import org.jboss.portlet.forums.auth.JSFUIContext;
+import org.jboss.portlet.forums.model.Category;
+import org.jboss.portlet.forums.model.Forum;
+import org.jboss.portlet.forums.model.Message;
+import org.jboss.portlet.forums.model.Post;
+import org.jboss.portlet.forums.model.Topic;
+import org.jboss.portlet.forums.model.TopicWatch;
+import org.jboss.portlet.forums.model.Watch;
+import org.jboss.portlet.forums.ui.Constants;
+
+import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
+import EDU.oswego.cs.dl.util.concurrent.QueuedExecutor;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ */
+public class NotificationEngine
+{
+ // Types of post
+ public static final int MODE_POST = 0;
+ public static final int MODE_REPLY = 1;
+ public static final int MODE_REPOST = 2;
+
+ private ForumsModule forumsModule;
+ private TemplateLoader mailTemplates;
+ private String from;
+ private QueuedExecutor executor;
+ private TransactionManager tm;
+ private final Logger log = Logger.getLogger(NotificationEngine.class);
+
+ public NotificationEngine(ForumsModule module)
+ {
+ try
+ {
+ this.forumsModule = module;
+ InitialContext ctx = new InitialContext();
+ tm = (TransactionManager)ctx.lookup("java:TransactionManager");
+ executor = new QueuedExecutor(new LinkedQueue());
+ }
+ catch (NamingException e)
+ {
+ log.error("Cannot create notification interceptor", e);
+ }
+ }
+
+ public void stop()
+ {
+ executor.shutdownAfterProcessingCurrentTask();
+ executor = null;
+ forumsModule = null;
+ tm = null;
+ }
+
+ public void setFrom(String from)
+ {
+ this.from = from;
+ }
+
+ public TemplateLoader getMailTemplates()
+ {
+ return mailTemplates;
+ }
+
+ public void scheduleForNotification(Integer postId, int mode) {
+ Object responseObj = FacesContext.getCurrentInstance().getExternalContext().getResponse();
+
+ if (responseObj instanceof ActionResponse) {
+
+ ActionResponse response = (ActionResponse)responseObj;
+ response.setRenderParameter(Constants.p_notified_post_id, postId.toString());
+ response.setRenderParameter(Constants.p_notified_watch_type, Integer.toString(mode));
+
+ } else {
+ // TODO: IMPLEMENT NOTIFICATION FOR STANDALONE VERSION OF FORUMS.
+ log.warn("NOTIFICATION FOR STANDALONE HAS NOT BEEN YET IMPLEMENTED");
+ }
+
+ }
+
+ public void schedule(Integer postId, int mode, String absViewURL , String absReplyURL )
+ {
+ try
+ {
+
+ if (postId==null || mode == -1) {
+ log.warn("Request didn't have needed parameters.");
+ return;
+ }
+
+ // Getting ResourceBundle with current Locale
+ // Too bad for now we support notifications sent in the locale of the poster :-(
+
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ UIViewRoot uiRoot = ctx.getViewRoot();
+ Locale locale = uiRoot.getLocale();
+ ClassLoader ldr = Thread.currentThread().getContextClassLoader();
+ ResourceBundle bundle = ResourceBundle.getBundle("ResourceJSF",locale,ldr);
+
+ // Getting Authorization realm
+ AuthorizationInterface realm = Authorization.getProvider();
+
+ // Create task
+ NotificationTask task = new NotificationTask(tm, absViewURL, absReplyURL ,
+ postId, mode, bundle , realm );
+
+ //Register at the end of the current tx to broadcast notifications
+ Transaction tx = tm.getTransaction();
+ tx.registerSynchronization(task);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private String getFrom(Post post)
+ {
+ StringBuffer fromBuf = null;
+ if ((post.getPoster().getUser().getGivenName() != null)
+ && (post.getPoster().getUser().getFamilyName() != null))
+ {
+ fromBuf = new StringBuffer(post.getPoster().getUser().getGivenName()
+ + " " + post.getPoster().getUser().getFamilyName() + " <");
+ }
+ else
+ {
+ fromBuf = new StringBuffer(post.getPoster().getUser().getUserName() + " <");
+ }
+ fromBuf.append(from + ">");
+ return fromBuf.toString();
+ }
+
+ /**
+ * The notification task.
+ */
+ class NotificationTask implements Transactions.Runnable, Synchronization
+ {
+
+ private final TransactionManager tm;
+ private final int mode;
+ private final Integer postId;
+ private final ResourceBundle bundle;
+ private final String viewURL;
+ private final String replyURL;
+ private final AuthorizationInterface realm;
+
+ NotificationTask(TransactionManager tm, String viewURL, String replyURL,
+ final Integer postId, int mode, ResourceBundle bundle , AuthorizationInterface realm)
+ {
+ this.tm = tm;
+ this.mode = mode;
+ this.postId = postId;
+ this.viewURL = viewURL;
+ this.replyURL = replyURL;
+ this.bundle = bundle;
+ this.realm = realm;
+ }
+
+ public Object run() throws Exception
+ {
+ try
+ {
+ Post post = forumsModule.findPostById(postId);
+ Topic topic = post.getTopic();
+ Forum forum = topic.getForum();
+ Category category = forum.getCategory();
+
+ Message message = post.getMessage();
+ String from = getFrom(post);
+ // Hold the notified users to avoid duplicated
+ Set notifieds = new HashSet();
+
+ // If this is not an anonymous post, put the user in the notified list
+ // he won't be notified of his own action
+ User poster = post.getPoster().getUser();
+ if (poster != null)
+ {
+ notifieds.add(poster.getId());
+ }
+
+ char[] chars = message.getText().toCharArray();
+ StringWriter out = new StringWriter();
+ ToTextRenderer renderer = new ToTextRenderer();
+ renderer.setWriter(out);
+ renderer.render(chars, 0, chars.length);
+
+ String forumEmbededArgsSubject = "[" + forum.getName() + "] - "
+ + message.getSubject()
+ + (mode == MODE_REPOST ? " (Repost)" : "");
+
+ String forumEmbededArgsText = out.toString() + "\n\n"
+ + bundle.getString("EMAIL_VIEWORIGINAL") + " : "
+ + viewURL.toString() + "\n\n"
+ + bundle.getString("EMAIL_REPLY") + " : "
+ + replyURL.toString();
+
+ // Notify the forum watchers
+ for (Iterator i = forum.getWatches().iterator(); i.hasNext();)
+ {
+ try
+ {
+ Watch watch = (Watch)i.next();
+ User watcher = watch.getPoster().getUser();
+ Object watcherId = watcher.getId();
+
+ if (!notifieds.contains(watcherId))
+ {
+
+ boolean securityFlag = true;
+
+ // Creating security context for the user
+ JSFUIContext securityContext = new JSFUIContext(watcher,FacesContext.getCurrentInstance());
+
+ // Checking if user has privileges to read category
+ securityContext.setFragment("acl://readCategory");
+ securityContext.setContextData(new Object[]{category});
+ securityFlag = realm.hasAccess(securityContext) && securityFlag;
+
+ // Checking if user has privileges to read forum
+ securityContext.setFragment("acl://readForum");
+ securityContext.setContextData(new Object[]{forum});
+ securityFlag = realm.hasAccess(securityContext) && securityFlag;
+
+ if (securityFlag)
+ {
+ notifieds.add(watcherId);
+ String subject = null;
+ String text = null;
+ if (watch.getMode() == ForumsConstants.WATCH_MODE_LINKED)
+ {
+ }
+ else
+ {
+ subject = forumEmbededArgsSubject;
+ text = forumEmbededArgsText;
+ }
+
+ notify ( watcher, from , subject, text );
+
+ }
+ else
+ {
+ // Not authorized anymore, we remove the watch
+ forumsModule.removeWatch(watch);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Cannot send an email notification", e);
+ }
+ }
+
+ if (mode == MODE_REPLY)
+ {
+ // Notify the reply watchers
+ for (Iterator i = topic.getWatches().iterator(); i.hasNext();)
+ {
+ try
+ {
+ TopicWatch watch = (TopicWatch)i.next();
+ User watcher = watch.getPoster().getUser();
+ Object watcherId = watcher.getId();
+ if (!notifieds.contains(watcherId))
+ {
+ boolean securityFlag = true;
+
+ // Creating security context for the user
+ JSFUIContext securityContext = new JSFUIContext(watcher,FacesContext.getCurrentInstance());
+
+ // Checking if user has privileges to read category
+ securityContext.setFragment("acl://readCategory");
+ securityContext.setContextData(new Object[]{category});
+ securityFlag = realm.hasAccess(securityContext) && securityFlag;
+
+ // Checking if user has privileges to read forum
+ securityContext.setFragment("acl://readForum");
+ securityContext.setContextData(new Object[]{forum});
+ securityFlag = realm.hasAccess(securityContext) && securityFlag;
+
+ if (securityFlag)
+ {
+ // Authorized
+ notifieds.add(watcherId);
+
+ notify( watcher, from , forumEmbededArgsSubject , forumEmbededArgsText );
+ }
+ else
+ {
+ // Not authorized anymore, we remove the watch
+ forumsModule.removeWatch(watch);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Cannot send email notification", e);
+ }
+ }
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ log.error("", e);
+ }
+
+ return null;
+ }
+
+ public void beforeCompletion()
+ {
+ }
+
+ private void notify (User watcher, String from , String subject, String text) {
+
+ Session session = null;
+
+ try {
+ session = (Session) PortableRemoteObject
+ .narrow(new InitialContext().lookup("java:Mail"),
+ Session.class);
+ try {
+
+ StringBuffer buffer = null;
+ Address[] to = null;
+ MimeMessage m = new MimeMessage(session);
+ String email = watcher.getRealEmail();
+ if ( email != null ) {
+ m.setFrom(new InternetAddress(from));
+ to = new InternetAddress[] { new InternetAddress(
+ email) };
+ m.setRecipients(RecipientType.TO, to);
+ m.setSubject(subject);
+
+ m.setSentDate(new Date());
+ buffer = new StringBuffer();
+
+ buffer.append("This message is generated automaticcaly. Please do not reply.<br />\n<br />\n");
+ buffer.append(text);
+
+ m.setContent(buffer.toString(),
+ "text/html; charset=\"UTF-8\"");
+ Transport.send(m);
+
+ }
+ } catch (javax.mail.MessagingException e) {
+ log.error(e);
+ }
+ } catch (javax.naming.NamingException e) {
+ log.error(e);
+ }
+ }
+
+ public void afterCompletion(int status)
+ {
+ // When transaction succesfully commits broadcast the notification
+ if (status == Status.STATUS_COMMITTED)
+ {
+ try
+ {
+ // Do it asynch
+ executor.execute(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ // Wrap with a tx
+ Transactions.required(tm, NotificationTask.this);
+ }
+ catch (Exception e)
+ {
+ log.error("Cannot broadcast nofication for post id", e);
+ }
+ }
+ });
+ }
+ catch (InterruptedException ignored)
+ {
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml 2007-01-29 12:42:41 UTC (rev 9069)
@@ -135,15 +135,6 @@
</function>
<!--
- function to get isWatchingTopic
- -->
- <function>
- <function-name>isWatchingTopic</function-name>
- <function-class>org.jboss.portlet.forums.ui.PortalUtil</function-class>
- <function-signature>boolean isWatchingTopic(org.jboss.portlet.forums.model.Topic)</function-signature>
- </function>
-
- <!--
function to get isWatchingForum
-->
<function>
Modified: labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml 2007-01-29 12:42:41 UTC (rev 9069)
@@ -629,10 +629,7 @@
styleClass="mainoption"
tabindex="5"/>
 
- <!--h:commandButton action="#{editPost.execute}" value="${resource.Submit}"
- onclick="return checkForm(this.parentNode)"
- styleClass="mainoption"
- accesskey="s" tabindex="6"/-->
+ <!--TODO: Missing execution of javascript checking form - onclick="return checkForm(this.parentNode)" -->
<h:commandButton action="#{editPost.execute}" value="${resource.Submit}"
styleClass="mainoption"
accesskey="s" tabindex="6"/>
Modified: labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/posting_reply_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/posting_reply_body.xhtml 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/posting_reply_body.xhtml 2007-01-29 12:42:41 UTC (rev 9069)
@@ -278,6 +278,10 @@
//-->
</script>
+
+<!-- Checking whether bean was initialized. If not, the initialization should execute. -->
+<c:if test="#{replyTopic.initialized}"></c:if>
+
<c:if test="#{replyTopic.preview}">
<ui:include src="/views/topics/posting_reply_preview.xhtml"/>
@@ -531,10 +535,7 @@
styleClass="mainoption"
tabindex="5"/>
 
- <!--h:commandButton action="#{replyTopic.execute}" value="${resource.Submit}"
- onclick="return checkForm(this.parentNode)"
- styleClass="mainoption"
- accesskey="s" tabindex="6"/-->
+ <!--TODO: Missing execution of javascript checking form - onclick="return checkForm(this.parentNode)" -->
<h:commandButton action="#{replyTopic.execute}" value="${resource.Submit}"
styleClass="mainoption"
accesskey="s" tabindex="6"/>
Modified: labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2007-01-29 12:42:41 UTC (rev 9069)
@@ -199,20 +199,28 @@
<c:if test="#{shared.anonymous==false}">
<td align="right" valign="middle" class="nav" width="100%">
- <c:choose>
- <!-- TODO: PLACE FOR UNSUBSCRIBE BUTTON -->
- <c:when test="#{topicWatch.watched}">
- <h:commandLink action="#{topicWatch.deActivateWatch}" value="TopicUnWatch" >
- <f:param name="t" value="#{topic.topic.id}"/>
- </h:commandLink>
- </c:when>
- <c:otherwise>
- <!-- TODO: PLACE FOR SUBSCRIBE BUTTON -->
- <h:commandLink action="#{topicWatch.activateWatch}" value="TopicWatch" >
- <f:param name="t" value="#{topic.topic.id}"/>
- </h:commandLink>
- </c:otherwise>
- </c:choose>
+ <h:form id="topicWatchFormId" >
+ <c:choose>
+ <!-- TODO: PLACE FOR UNSUBSCRIBE BUTTON -->
+ <c:when test="#{topicWatch.watched}">
+ <h:commandLink id="deActivateWatch" action="#{topicWatch.deActivateWatch}">
+ <f:param name="t" value="#{topic.topic.id}"/>
+ <f:verbatim>
+ <h:outputText value="TopicUnWatch" />
+ </f:verbatim>
+ </h:commandLink>
+ </c:when>
+ <c:otherwise>
+ <!-- TODO: PLACE FOR SUBSCRIBE BUTTON -->
+ <h:commandLink id="activateWatch" action="#{topicWatch.activateWatch}">
+ <f:param name="t" value="#{topic.topic.id}"/>
+ <f:verbatim>
+ <h:outputText value="TopicWatch" />
+ </f:verbatim>
+ </h:commandLink>
+ </c:otherwise>
+ </c:choose>
+ </h:form>
</td>
</c:if>
@@ -698,53 +706,7 @@
</tr>
</c:if>
</table>
-
- <!--
- integrate topicWatch function here, also make sure this widget is diplayed only when the user is non-anonymous,
- this feature is deferred until next forums release. The ForumsModule does not have the necessary functions on it
- for it to be part of this refactoring effort
- -->
- <!--table width="100%" cellspacing="2" border="0" align="center">
- <tr>
- <td width="40%" valign="top" nowrap="nowrap" align="left">
- <span class="gensmall">
-
- <c:choose>
-
- <c:when test="#{forums:isWatchingTopic(topic.topic)}">
-
- <h:commandLink id="watchDeActivator" action="#{topicWatch.deActivateWatch}" >
-
- <f:param name="t" value="#{topic.topic.id}"/>
-
- <h:outputText>Stop watching this topic for replies</h:outputText>
-
- </h:commandLink>
- </c:when>
-
- <c:otherwise>
-
- <h:commandLink id="watchActivator" action="#{topicWatch.activateWatch}" >
-
- <f:param name="t" value="#{topic.topic.id}"/>
-
- <h:outputText>Watch this topic for replies</h:outputText>
-
- </h:commandLink>
-
- </c:otherwise>
-
- </c:choose>
-
- </span>
-
- <br/>
-  
- <br/>
- </td>
- </tr>
- </table-->
-
+
<table width="100%" cellspacing="2" border="0" align="center">
<tr>
<forums:isAllowed fragment="acl://reply" contextData="#{topic.topic}">
Modified: labs/jbossforums/branches/forums22/thirdparty/jboss-system/README.txt
===================================================================
--- labs/jbossforums/branches/forums22/thirdparty/jboss-system/README.txt 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/thirdparty/jboss-system/README.txt 2007-01-29 12:42:41 UTC (rev 9069)
@@ -1,5 +1,6 @@
jboss-common-4.0.3SP1.jar
jboss-jmx-4.0.3SP1.jar
-jboss-system-4.0.3SP1.jar
+jboss-system-4.0.3SP1.jar
+mail-4.0.4.jar
licence : LGPL
Copied: labs/jbossforums/branches/forums22/thirdparty/jboss-system/lib/mail.jar (from rev 9068, labs/jbossforums/trunk/thirdparty/jboss-system/lib/mail.jar)
===================================================================
(Binary files differ)
Modified: labs/jbossforums/branches/forums22/tools/etc/buildfragments/libraries.ent
===================================================================
--- labs/jbossforums/branches/forums22/tools/etc/buildfragments/libraries.ent 2007-01-29 12:04:05 UTC (rev 9068)
+++ labs/jbossforums/branches/forums22/tools/etc/buildfragments/libraries.ent 2007-01-29 12:42:41 UTC (rev 9069)
@@ -57,6 +57,7 @@
<pathelement path="${jboss.system.lib}/jboss-jmx.jar"/>
<pathelement path="${jboss.system.lib}/jboss-system.jar"/>
<pathelement path="${jboss.system.lib}/jbossall-client.jar"/>
+ <pathelement path="${jboss.system.lib}/mail.jar"/>
</path>
<!-- JUnit -->
More information about the jboss-svn-commits
mailing list