Update of /cvsroot/roller/roller/src/org/roller/presentation/weblog/actions
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16004/src/org/roller/presentation/weblog/actions
Modified Files:
CommentFormAction.java WeblogEntryFormAction.java
Log Message:
Added emailComments flag and defaultFromAddress to website - allowing the user
to control it. Also fixed NPE's in WeblogEntryFormAction.
Index: CommentFormAction.java
===================================================================
RCS file:
/cvsroot/roller/roller/src/org/roller/presentation/weblog/actions/CommentFormAction.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** CommentFormAction.java 25 May 2004 04:53:43 -0000 1.44
--- CommentFormAction.java 29 May 2004 07:37:16 -0000 1.45
***************
*** 1,4 ****
--- 1,20 ----
package org.roller.presentation.weblog.actions;
+ import java.io.IOException;
+ import java.net.MalformedURLException;
+ import java.util.ArrayList;
+ import java.util.Iterator;
+ import java.util.List;
+ import java.util.Locale;
+
+ import javax.mail.MessagingException;
+ import javax.mail.Session;
+ import javax.naming.Context;
+ import javax.naming.InitialContext;
+ import javax.naming.NamingException;
+ import javax.servlet.ServletException;
+ import javax.servlet.http.HttpServletRequest;
+ import javax.servlet.http.HttpServletResponse;
+
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
***************
*** 13,16 ****
--- 29,33 ----
import org.apache.struts.util.RequestUtils;
import org.roller.RollerException;
+ import org.roller.model.UserManager;
import org.roller.model.WeblogManager;
import org.roller.pojos.CommentData;
***************
*** 19,22 ****
--- 36,40 ----
import org.roller.pojos.UserData;
import org.roller.pojos.WeblogEntryData;
+ import org.roller.pojos.WebsiteData;
import org.roller.presentation.LanguageUtil;
import org.roller.presentation.RollerContext;
***************
*** 27,46 ****
import org.roller.util.MailUtil;
- import java.io.IOException;
- import java.net.MalformedURLException;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Locale;
-
- import javax.mail.MessagingException;
- import javax.mail.Session;
- import javax.naming.Context;
- import javax.naming.InitialContext;
- import javax.naming.NamingException;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
-
/////////////////////////////////////////////////////////////////////////////
--- 45,48 ----
***************
*** 251,259 ****
Locale viewLocale = LanguageUtil.getViewLocale(request);
// Send e-mail to owner (if enabled) and subscribed users
! if ( rollerConfig.getEmailComments().booleanValue() )
{
String from = (StringUtils.isEmpty(cd.getEmail()))
! ? "noreply@xxxxxxxxxxxxx" :
cd.getEmail();
// get all the subscribers to this comment thread
--- 253,279 ----
Locale viewLocale = LanguageUtil.getViewLocale(request);
+ UserManager userMgr = null;
+ WebsiteData site = null;
+ try
+ {
+ userMgr = RollerContext.getRoller(request).getUserManager();
+ site = userMgr.getWebsite(user.getUserName());
+ }
+ catch (RollerException re)
+ {
+ re.printStackTrace();
+ mLogger.error("Couldn't get UserManager from RollerContext",
re.getRootCause());
+ }
+
// Send e-mail to owner (if enabled) and subscribed users
! if ( rollerConfig.getEmailComments().booleanValue() &&
! site.getEmailComments().booleanValue() )
{
+
+ String defaultFromEmail =
(StringUtils.isEmpty(site.getEmailFromAddress())) ?
+ user.getEmailAddress() :
site.getEmailFromAddress();
+
String from = (StringUtils.isEmpty(cd.getEmail()))
! ? defaultFromEmail :
cd.getEmail();
// get all the subscribers to this comment thread
Index: WeblogEntryFormAction.java
===================================================================
RCS file:
/cvsroot/roller/roller/src/org/roller/presentation/weblog/actions/WeblogEntryFormAction.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -d -r1.63 -r1.64
*** WeblogEntryFormAction.java 26 May 2004 02:46:24 -0000 1.63
--- WeblogEntryFormAction.java 29 May 2004 07:37:17 -0000 1.64
***************
*** 229,232 ****
--- 229,246 ----
WebsiteData site = userMgr.getWebsite( user.getUserName() );
WeblogEntryFormEx wf = (WeblogEntryFormEx)actionForm;
+
+ // I was getting column 'x' cannot be null, so I fixed it
here.
+ // A better solution might be to change the table so it allows
+ // nulls for these columns.
+ if (wf.getAllowComments() == null)
+ {
+ wf.setAllowComments(Boolean.FALSE);
+ }
+ if (wf.getRightToLeft() == null)
+ {
+ wf.setRightToLeft(Boolean.FALSE);
+ }
+
+
if (wf.getId()!= null)
{
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|