portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pau...@apache.org
Subject cvs commit: jakarta-jetspeed/webapp/WEB-INF/conf JetspeedResources.properties
Date Fri, 16 Nov 2001 03:46:56 GMT
paulsp      01/11/15 19:46:56

  Modified:    src/java/org/apache/jetspeed/modules/actions
                        SendConfirmationEmail.java
               webapp/WEB-INF/conf JetspeedResources.properties
  Added:       webapp/WEB-INF/templates/vm/emails NewUserConfirmation.vm
  Log:
  Implement locateEmailTemplate() for the new user Confirmation Email.  This will
  allow for language specific email.  It will also be easier to customize the email
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed/webapp/WEB-INF/templates/vm/emails/NewUserConfirmation.vm
  
  Index: NewUserConfirmation.vm
  ===================================================================
  Dear $user.FirstName $user.LastName,
  Welcome to the Jetspeed Portal from Apache.  Your new account has been 
  created.  Please login using the following secret key to confirm you 
  registration:
  
    $secretkey
  
  You can go to the following URL to confirm your account:
    $urltojetspeed
  
  Thank you,
  Jetspeed Portal Administrator
  
  
  
  
  1.12      +30 -11    jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/SendConfirmationEmail.java
  
  Index: SendConfirmationEmail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/SendConfirmationEmail.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SendConfirmationEmail.java	2001/07/03 17:17:19	1.11
  +++ SendConfirmationEmail.java	2001/11/16 03:46:56	1.12
  @@ -54,12 +54,18 @@
   
   package org.apache.jetspeed.modules.actions;
   
  -
  -// External Stuff
  +// Java stuff
  +import java.io.StringWriter;
   import java.util.Properties;
  +  
  +// jetspeed services
  +import org.apache.jetspeed.services.TemplateLocator;
  +import org.apache.jetspeed.services.resources.JetspeedResources;
  +import org.apache.jetspeed.services.JetspeedSecurity;
  +
  +// Turbine Stuff
   import org.apache.turbine.modules.Action;
   import org.apache.turbine.services.localization.Localization;
  -import org.apache.jetspeed.services.resources.JetspeedResources;
   import org.apache.turbine.om.security.User;
   import org.apache.turbine.util.RunData;
   import org.apache.turbine.util.DynamicURI;
  @@ -67,8 +73,13 @@
   import org.apache.turbine.util.mail.Email;
   import org.apache.turbine.util.db.Criteria;
   import org.apache.turbine.util.Log;
  -import org.apache.jetspeed.services.JetspeedSecurity;
   
  +// turbine velocity
  +import org.apache.turbine.services.velocity.TurbineVelocity;
  +
  +// velocity context
  +import org.apache.velocity.context.Context;
  +
   /**
       This action will attempt to send a confirmation email to the user.
       This class is used in two places, the first one is for new users.
  @@ -98,10 +109,6 @@
               .addPathInfo("secretkey", secretkey)
               .addPathInfo("password", password );
           
  -        String email_body = Localization.getString("SENDCONFIRMATIONEMAIL_BODY1") +
  -        secretkey + "\n\n" + Localization.getString("SENDCONFIRMATIONEMAIL_BODY2") +
  -        "<" + url.toString() + ">";
  -
           Criteria crit = new Criteria();
           String sender = JetspeedResources.getString("confirm.email.from");
           crit.add ( Email.SENDER_EMAIL, sender );
  @@ -109,14 +116,26 @@
           crit.add ( Email.SENDER_NAME, senderName );
           crit.add ( Email.RECEIVER_EMAIL, email );
           crit.add ( Email.RECEIVER_NAME, firstname + " " + lastname );
  +        // FIXME: Need to get language specific subject for e-mail
           crit.add ( Email.EMAIL_SUBJECT, JetspeedResources
                                               .getString("confirm.email.subject") );
  -        crit.add ( Email.EMAIL_BODY, email_body );
  -
  -
           try
           {
  +            //build body via template
  +            StringWriter email_body = new StringWriter();
  +            Context emailContext = TurbineVelocity.getContext();
  +            emailContext.put( "data", data );
  +            emailContext.put( "user", user );
  +            emailContext.put("config",new JetspeedResources());
  +            emailContext.put("urltojetspeed",url);
  +            emailContext.put("secretkey",secretkey);
  +            String templateFile = JetspeedResources.getString("confirm.email.template");
  +            String templatePath = TemplateLocator.locateEmailTemplate(data, templateFile);
  +            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);
  +
               SimpleEmail se = new SimpleEmail(crit);
  +            emailContext.put("email",se);
  +            se.setMsg( email_body.toString() );
   
               Properties props = System.getProperties();
               String mailServerMachine = JetspeedResources.getString( "mail.server" );
  
  
  
  1.44      +3 -3      jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedResources.properties
  
  Index: JetspeedResources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedResources.properties,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- JetspeedResources.properties	2001/11/12 03:43:01	1.43
  +++ JetspeedResources.properties	2001/11/16 03:46:56	1.44
  @@ -1,7 +1,7 @@
   ################################################################################
   # Jetspeed Configuration                             
   # Author: Kevin A. Burton (burton@apache.org)
  -# $Id: JetspeedResources.properties,v 1.43 2001/11/12 03:43:01 taylor Exp $
  +# $Id: JetspeedResources.properties,v 1.44 2001/11/16 03:46:56 paulsp Exp $
   ################################################################################
   # This is the main file you will need to configuration Jetspeed.  If there are 
   # any secondary files they will be pointed to from this file.
  @@ -405,11 +405,11 @@
   # Registration mail support             #
   #########################################
   mail.server=localhost
  -#confirm.email.from=jetspeed@domain
   confirm.email.from=Postmaster@localhost
  -confirm.email.name=Jetspeed Postmaster
  +confirm.email.name=Jetspeed Administrator
   confirm.email.subject=Jetspeed registration
   confirm.email.enable=false
  +confirm.email.template=NewUserConfirmation.vm
   
   #########################################
   # HTTP Page header                      #
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message