Modified: 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/util/MailUtil.java
URL: 
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/util/MailUtil.java?view=diff&rev=537945&r1=537944&r2=537945
==============================================================================
--- 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/util/MailUtil.java 
(original)
+++ 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/util/MailUtil.java 
Mon May 14 11:41:57 2007
@@ -1,25 +1,30 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
 package org.apache.roller.util;
 
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ResourceBundle;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.SendFailedException;
@@ -28,19 +33,179 @@
 import javax.mail.Address;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 import org.apache.commons.lang.StringUtils;
+import org.apache.roller.RollerException;
+import org.apache.roller.business.RollerFactory;
+import org.apache.roller.business.UserManager;
+import org.apache.roller.config.RollerRuntimeConfig;
+import org.apache.roller.pojos.PermissionsData;
+import org.apache.roller.pojos.UserData;
+import org.apache.roller.pojos.WeblogEntryData;
+import org.apache.roller.pojos.WebsiteData;
 
-public class MailUtil extends Object {
-   
-       private static Log mLogger = 
-               LogFactory.getFactory().getInstance(MailUtil.class);
 
+/**
+ * A utility class for helping with sending emails.
+ */
+public class MailUtil {
+    
+    private static Log log = LogFactory.getLog(MailUtil.class);
+    
+    
+    /**
+     * Lookup the configured mail Session if possible.
+     *
+     * @returns Mail Session if possible, otherwise null.
+     */
+    public static Session getMailSession() throws RollerException {
+        try {
+            Context ctx = (Context) new 
InitialContext().lookup("java:comp/env");
+            Session mailSession = (Session) ctx.lookup("mail/Session");
+            return mailSession;
+        } catch (NamingException ex) {
+            throw new RollerException("ERROR: Notification email(s) not sent, "
+                    + "Roller's mail session not properly configured", ex);
+        }
+    }
+    
+    
+    /**
+     * Send an email notice that a new pending entry has been submitted.
+     */
+    public static void sendPendingEntryNotice(WeblogEntryData entry) 
+            throws RollerException {
+        
+        Session mailSession = getMailSession();
+        if(mailSession == null) {
+            throw new RollerException("Couldn't get mail Session");
+        }
+        
+        try {
+            UserManager umgr = RollerFactory.getRoller().getUserManager();
+            
+            String userName = entry.getCreator().getUserName();
+            String from = entry.getCreator().getEmailAddress();
+            String cc[] = new String[] {from};
+            String bcc[] = new String[0];
+            String to[];
+            String subject;
+            String content;
+            
+            // list of enabled website authors and admins
+            ArrayList reviewers = new ArrayList();
+            List websiteUsers = umgr.getUsers(
+                    entry.getWebsite(), Boolean.TRUE, null, null, 0, -1);
+            
+            // build list of reviewers (website users with author permission)
+            Iterator websiteUserIter = websiteUsers.iterator();
+            while (websiteUserIter.hasNext()) {
+                UserData websiteUser = (UserData)websiteUserIter.next();
+                if (entry.getWebsite().hasUserPermissions(
+                        websiteUser, PermissionsData.AUTHOR)
+                        && websiteUser.getEmailAddress() != null) {
+                    reviewers.add(websiteUser.getEmailAddress());
+                }
+            }
+            to = (String[])reviewers.toArray(new String[reviewers.size()]);
+            
+            // Figure URL to entry edit page
+            String rootURL = RollerRuntimeConfig.getAbsoluteContextURL();
+            String editURL = rootURL
+                    + "/roller-ui/authoring/weblog.do?method=edit&entryId=" + 
entry.getId();
+            
+            ResourceBundle resources = ResourceBundle.getBundle(
+                    "ApplicationResources", 
entry.getWebsite().getLocaleInstance());
+            StringBuffer sb = new StringBuffer();
+            sb.append(
+                    MessageFormat.format(
+                    resources.getString("weblogEntry.pendingEntrySubject"),
+                    new Object[] {
+                entry.getWebsite().getName(),
+                entry.getWebsite().getHandle()
+            }));
+            subject = sb.toString();
+            sb = new StringBuffer();
+            sb.append(
+                    MessageFormat.format(
+                    resources.getString("weblogEntry.pendingEntryContent"),
+                    new Object[] { userName, userName, editURL })
+                    );
+            content = sb.toString();
+            MailUtil.sendTextMessage(
+                    mailSession, from, to, cc, bcc, subject, content);
+        } catch (MessagingException e) {
+            log.error("ERROR: Problem sending pending entry notification 
email.");
+        }
+    }
+    
+    
+    /**
+     * Send a weblog invitation email.
+     */
+    public static void sendWeblogInvitation(WebsiteData website, 
+                                            UserData user)
+            throws RollerException {
+        
+        Session mailSession = getMailSession();
+        if(mailSession == null) {
+            throw new RollerException("ERROR: Notification email(s) not sent, "
+                    + "Roller's mail session not properly configured");
+        }
+        
+        try {
+            UserManager umgr = RollerFactory.getRoller().getUserManager();
+            
+            String userName = user.getUserName();
+            String from = website.getEmailAddress();
+            String cc[] = new String[] {from};
+            String bcc[] = new String[0];
+            String to[] = new String[] {user.getEmailAddress()};
+            String subject;
+            String content;
+            
+            // Figure URL to entry edit page
+            String rootURL = RollerRuntimeConfig.getAbsoluteContextURL();
+            String url = rootURL + "/roller-ui/yourWebsites.do";
+            
+            ResourceBundle resources = ResourceBundle.getBundle(
+                    "ApplicationResources",
+                    website.getLocaleInstance());
+            StringBuffer sb = new StringBuffer();
+            sb.append(MessageFormat.format(
+                    resources.getString("inviteMember.notificationSubject"),
+                    new Object[] {
+                website.getName(),
+                website.getHandle()})
+                );
+            subject = sb.toString();
+            sb = new StringBuffer();
+            sb.append(MessageFormat.format(
+                    resources.getString("inviteMember.notificationContent"),
+                    new Object[] {
+                website.getName(),
+                website.getHandle(),
+                user.getUserName(),
+                url
+            }));
+            content = sb.toString();
+            MailUtil.sendTextMessage(
+                    mailSession, from, to, cc, bcc, subject, content);
+        } catch (MessagingException e) {
+            throw new RollerException("ERROR: Notification email(s) not sent, "
+                    + "due to Roller configuration or mail server problem.", 
e);
+        }
+    }
+    
+    
     // agangolli: Incorporated suggested changes from Ken Blackler.
-
+    
     /**
      * This method is used to send a Message with a pre-defined
      * mime-type.
-     * 
+     *
      * @param from e-mail address of sender
      * @param to e-mail address(es) of recipients
      * @param subject subject of e-mail
@@ -49,100 +214,91 @@
      * @throws MessagingException the exception to indicate failure
      */
     public static void sendMessage
-    (
-       Session session,
-        String from,
-        String[] to,
-        String[] cc,
-        String[] bcc,
-        String subject,
-        String content,
-        String mimeType
-    ) 
-    throws MessagingException
-    {
+            (
+            Session session,
+            String from,
+            String[] to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content,
+            String mimeType
+            )
+            throws MessagingException {
         Message message = new MimeMessage(session);
-
+        
         // n.b. any default from address is expected to be determined by 
caller.
         if (! StringUtils.isEmpty(from)) {
-                       InternetAddress sentFrom = new InternetAddress(from);
-                       message.setFrom(sentFrom);
-                       if (mLogger.isDebugEnabled()) mLogger.debug("e-mail 
from: " + sentFrom);
+            InternetAddress sentFrom = new InternetAddress(from);
+            message.setFrom(sentFrom);
+            if (log.isDebugEnabled()) log.debug("e-mail from: " + sentFrom);
+        }
+        
+        if (to!=null) {
+            InternetAddress[] sendTo = new InternetAddress[to.length];
+            
+            for (int i = 0; i < to.length; i++) {
+                sendTo[i] = new InternetAddress(to[i]);
+                if (log.isDebugEnabled()) log.debug("sending e-mail to: " + 
to[i]);
+            }
+            message.setRecipients(Message.RecipientType.TO, sendTo);
+        }
+        
+        if (cc != null) {
+            InternetAddress[] copyTo = new InternetAddress[cc.length];
+            
+            for (int i = 0; i < cc.length; i++) {
+                copyTo[i] = new InternetAddress(cc[i]);
+                if (log.isDebugEnabled()) log.debug("copying e-mail to: " + 
cc[i]);
+            }
+            message.setRecipients(Message.RecipientType.CC, copyTo);
+        }
+        
+        if (bcc != null) {
+            InternetAddress[] copyTo = new InternetAddress[bcc.length];
+            
+            for (int i = 0; i < bcc.length; i++) {
+                copyTo[i] = new InternetAddress(bcc[i]);
+                if (log.isDebugEnabled()) log.debug("blind copying e-mail to: 
" + bcc[i]);
+            }
+            message.setRecipients(Message.RecipientType.BCC, copyTo);
         }
-
-               if (to!=null)
-               {
-                       InternetAddress[] sendTo = new 
InternetAddress[to.length];
-       
-                       for (int i = 0; i < to.length; i++) 
-                       {
-                               sendTo[i] = new InternetAddress(to[i]);
-                               if (mLogger.isDebugEnabled()) 
mLogger.debug("sending e-mail to: " + to[i]);
-                       }
-                       message.setRecipients(Message.RecipientType.TO, sendTo);
-               }
-
-               if (cc != null) 
-               {
-                       InternetAddress[] copyTo = new 
InternetAddress[cc.length];
-
-                       for (int i = 0; i < cc.length; i++) 
-                       {
-                               copyTo[i] = new InternetAddress(cc[i]);
-                               if (mLogger.isDebugEnabled()) 
mLogger.debug("copying e-mail to: " + cc[i]);
-                       }
-                       message.setRecipients(Message.RecipientType.CC, copyTo);
-               }               
-
-               if (bcc != null) 
-               {
-                       InternetAddress[] copyTo = new 
InternetAddress[bcc.length];
-
-                       for (int i = 0; i < bcc.length; i++) 
-                       {
-                               copyTo[i] = new InternetAddress(bcc[i]);
-                               if (mLogger.isDebugEnabled()) 
mLogger.debug("blind copying e-mail to: " + bcc[i]);
-                       }
-                       message.setRecipients(Message.RecipientType.BCC, 
copyTo);
-               }               
         message.setSubject((subject == null) ? "(no subject)" : subject);
         message.setContent(content, mimeType);
-        message.setSentDate(new java.util.Date()); 
-
-               // First collect all the addresses together.
+        message.setSentDate(new java.util.Date());
+        
+        // First collect all the addresses together.
         Address[] remainingAddresses = message.getAllRecipients();
         int nAddresses = remainingAddresses.length;
         boolean bFailedToSome = false;
         
         SendFailedException sendex = new SendFailedException("Unable to send 
message to some recipients");
         
-               // Try to send while there remain some potentially good 
addresses
-               do
+        // Try to send while there remain some potentially good addresses
+        do
         {
-                       // Avoid a loop if we are stuck
-                       nAddresses = remainingAddresses.length;
-
-                       try
-                       {
-                               // Send to the list of remaining addresses, 
ignoring the addresses attached to the message
-                       Transport.send(message,remainingAddresses);
-                       }
-                       catch(SendFailedException ex)
-                       {
-                               bFailedToSome=true;
-                               sendex.setNextException(ex);
-                               
-                               // Extract the remaining potentially good 
addresses
-                               remainingAddresses=ex.getValidUnsentAddresses();
-                       }
+            // Avoid a loop if we are stuck
+            nAddresses = remainingAddresses.length;
+            
+            try {
+                // Send to the list of remaining addresses, ignoring the 
addresses attached to the message
+                Transport.send(message,remainingAddresses);
+            } catch(SendFailedException ex) {
+                bFailedToSome=true;
+                sendex.setNextException(ex);
+                
+                // Extract the remaining potentially good addresses
+                remainingAddresses=ex.getValidUnsentAddresses();
+            }
         } while (remainingAddresses!=null && remainingAddresses.length>0 && 
remainingAddresses.length!=nAddresses);
         
         if (bFailedToSome) throw sendex;
     }
-
+    
+    
     /**
      * This method is used to send a Text Message.
-     * 
+     *
      * @param from e-mail address of sender
      * @param to e-mail addresses of recipients
      * @param subject subject of e-mail
@@ -150,53 +306,53 @@
      * @throws MessagingException the exception to indicate failure
      */
     public static void sendTextMessage
-    (
-       Session session,
-        String from,
-        String[] to,
-        String[] cc,
-        String[] bcc,
-        String subject,
-        String content
-    ) 
-    throws MessagingException
-    {
+            (
+            Session session,
+            String from,
+            String[] to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content
+            )
+            throws MessagingException {
         sendMessage(session, from, to, cc, bcc, subject, content, "text/plain; 
charset=utf-8");
     }
     
-       /**
-        * This method overrides the sendTextMessage to specify
-        * one receiver and mulitple cc recipients.
-        * 
-        * @param from e-mail address of sender
-        * @param to e-mail addresses of recipients
-        * @param subject subject of e-mail
-        * @param content the body of the e-mail
-        * @throws MessagingException the exception to indicate failure
-        */
-       public static void sendTextMessage
-       (
-               Session session,
-               String from,
-               String to,
-               String[] cc,
-        String[] bcc,
-               String subject,
-               String content
-       ) 
-       throws MessagingException
-       {
+    
+    /**
+     * This method overrides the sendTextMessage to specify
+     * one receiver and mulitple cc recipients.
+     *
+     * @param from e-mail address of sender
+     * @param to e-mail addresses of recipients
+     * @param subject subject of e-mail
+     * @param content the body of the e-mail
+     * @throws MessagingException the exception to indicate failure
+     */
+    public static void sendTextMessage
+            (
+            Session session,
+            String from,
+            String to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content
+            )
+            throws MessagingException {
         String[] recipient = null;
-               if (to!=null) recipient = new String[] {to};
-
-               sendMessage(session, from, recipient, cc, bcc, subject, 
content, "text/plain; charset=utf-8");
-       }
-       
+        if (to!=null) recipient = new String[] {to};
+        
+        sendMessage(session, from, recipient, cc, bcc, subject, content, 
"text/plain; charset=utf-8");
+    }
+    
+    
     /**
-        * This method overrides the sendTextMessage to specify
-        * only one receiver and cc recipients, rather than 
-        * an array of recipients.
-     * 
+     * This method overrides the sendTextMessage to specify
+     * only one receiver and cc recipients, rather than
+     * an array of recipients.
+     *
      * @param from e-mail address of sender
      * @param to e-mail address of recipient
      * @param cc e-mail address of cc recipient
@@ -205,31 +361,31 @@
      * @throws MessagingException the exception to indicate failure
      */
     public static void sendTextMessage
-    (
-       Session session,
-        String from,
-        String to,
-        String cc,
-        String bcc,
-        String subject,
-        String content
-    ) 
-    throws MessagingException
-    {
+            (
+            Session session,
+            String from,
+            String to,
+            String cc,
+            String bcc,
+            String subject,
+            String content
+            )
+            throws MessagingException {
         String[] recipient = null;
         String[] copy = null;
         String[] bcopy = null;
-
-               if (to!=null) recipient = new String[] {to};
-               if (cc!=null) copy = new String[] {cc};
-               if (bcc!=null) bcopy = new String[] {bcc};
-
+        
+        if (to!=null) recipient = new String[] {to};
+        if (cc!=null) copy = new String[] {cc};
+        if (bcc!=null) bcopy = new String[] {bcc};
+        
         sendMessage(session, from, recipient, copy, bcopy, subject, content, 
"text/plain; charset=utf-8");
     }
     
+    
     /**
      * This method is used to send a HTML Message
-     * 
+     *
      * @param from e-mail address of sender
      * @param to e-mail address(es) of recipients
      * @param subject subject of e-mail
@@ -237,80 +393,79 @@
      * @throws MessagingException the exception to indicate failure
      */
     public static void sendHTMLMessage
-    (
-       Session session,
-        String from,
-        String[] to,
-        String[] cc,
-        String[] bcc,
-        String subject,
-        String content
-    ) 
-    throws MessagingException
-    {
+            (
+            Session session,
+            String from,
+            String[] to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content
+            )
+            throws MessagingException {
         sendMessage(session, from, to, cc, bcc, subject, content, "text/html; 
charset=utf-8");
     }
     
+    
     /**
      * This method overrides the sendHTMLMessage to specify
      * only one sender, rather than an array of senders.
-     * 
+     *
      * @param from e-mail address of sender
      * @param to e-mail address of recipients
      * @param subject subject of e-mail
      * @param content the body of the e-mail
      * @throws MessagingException the exception to indicate failure
      */
-       public static void sendHTMLMessage
-    (
-       Session session,
-        String from,
-        String to,
-        String cc,
-        String bcc,
-        String subject,
-        String content
-    ) 
-    throws MessagingException
-    {
+    public static void sendHTMLMessage
+            (
+            Session session,
+            String from,
+            String to,
+            String cc,
+            String bcc,
+            String subject,
+            String content
+            )
+            throws MessagingException {
         String[] recipient = null;
         String[] copy = null;
         String[] bcopy = null;
-
-               if (to!=null) recipient = new String[] {to};
-               if (cc!=null) copy = new String[] {cc};
-               if (bcc!=null) bcopy = new String[] {bcc};
-
+        
+        if (to!=null) recipient = new String[] {to};
+        if (cc!=null) copy = new String[] {cc};
+        if (bcc!=null) bcopy = new String[] {bcc};
+        
         sendMessage(session, from, recipient, copy, bcopy, subject, content, 
"text/html; charset=utf-8");
     }
     
-       /**
-        * This method overrides the sendHTMLMessage to specify
-        * one receiver and mulitple cc recipients.
-        * 
-        * @param from e-mail address of sender
-        * @param to e-mail address of recipient
-        * @param cc e-mail addresses of recipients
-        * @param subject subject of e-mail
-        * @param content the body of the e-mail
-        * @throws MessagingException the exception to indicate failure
-        */
-       public static void sendHTMLMessage
-       (
-               Session session,
-               String from,
-               String to,
-               String[] cc,
-               String[] bcc,
-               String subject,
-               String content
-       ) 
-       throws MessagingException
-       {
+    
+    /**
+     * This method overrides the sendHTMLMessage to specify
+     * one receiver and mulitple cc recipients.
+     *
+     * @param from e-mail address of sender
+     * @param to e-mail address of recipient
+     * @param cc e-mail addresses of recipients
+     * @param subject subject of e-mail
+     * @param content the body of the e-mail
+     * @throws MessagingException the exception to indicate failure
+     */
+    public static void sendHTMLMessage
+            (
+            Session session,
+            String from,
+            String to,
+            String[] cc,
+            String[] bcc,
+            String subject,
+            String content
+            )
+            throws MessagingException {
         String[] recipient = null;
-               if (to!=null) recipient = new String[] {to};
-
-               sendMessage(session, from, recipient, cc, bcc, subject, 
content, "text/html; charset=utf-8");
-       }
+        if (to!=null) recipient = new String[] {to};
+        
+        sendMessage(session, from, recipient, cc, bcc, subject, content, 
"text/html; charset=utf-8");
+    }
+    
 }
-

Modified: 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/adminprotocol/RollerUserHandler.java
URL: 
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/adminprotocol/RollerUserHandler.java?view=diff&rev=537945&r1=537944&r2=537945
==============================================================================
--- 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/adminprotocol/RollerUserHandler.java
 (original)
+++ 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/adminprotocol/RollerUserHandler.java
 Mon May 14 11:41:57 2007
@@ -182,7 +182,10 @@
     
     private void updateUserData(UserData ud, UserEntry entry) throws 
HandlerException {
         // user name cannot be updated
-        
+
+        if (entry.getScreenName() != null) {
+            ud.setScreenName(entry.getScreenName());
+        }
         if (entry.getFullName() != null) {
             ud.setFullName(entry.getFullName());
         }
@@ -243,6 +246,7 @@
         // we never return password field
         
         UserEntry ue = new UserEntry(ud.getUserName(), getUrlPrefix());
+        ue.setScreenName(ud.getScreenName());
         ue.setFullName(ud.getFullName());
         ue.setLocale(ud.getLocale());
         ue.setTimezone(ud.getTimeZone());
@@ -282,7 +286,10 @@
         //
         UserData ud = new UserData();
         ud.setUserName(ue.getName());
-        
+
+        if (ue.getScreenName() != null) {
+            ud.setScreenName(ue.getScreenName());
+        }
         if (ue.getFullName() != null) {
             ud.setFullName(ue.getFullName());
         }

Modified: 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntry.java
URL: 
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntry.java?view=diff&rev=537945&r1=537944&r2=537945
==============================================================================
--- 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntry.java
 (original)
+++ 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntry.java
 Mon May 14 11:41:57 2007
@@ -39,6 +39,7 @@
     static interface Tags {
         public static final String USER = "user";
         public static final String NAME = "name";
+        public static final String SCREEN_NAME = "screen-name";
         public static final String FULL_NAME = "full-name";
         public static final String PASSWORD = "password";
         public static final String EMAIL_ADDRESS = "email-address";
@@ -49,6 +50,7 @@
     }
     
     private String name;
+    private String screenName;
     private String fullName;
     private String password;
     private Locale locale;
@@ -154,7 +156,16 @@
             nameElement.addContent(nameText);
             userElement.addContent(nameElement);
         }
-        
+
+        // screen name
+        String screenName = getScreenName();
+        if (screenName != null) {
+            Element screenNameElement = new Element(Tags.SCREEN_NAME, 
NAMESPACE);
+            Text screenNameText = new Text(screenName);
+            screenNameElement.addContent(screenNameText);
+            userElement.addContent(screenNameElement);
+        }
+
         // full name
         String fullName = getFullName();
         if (fullName != null) {
@@ -230,7 +241,17 @@
     public void setName(String name) {
         this.name = name;
     }
-    
+
+    /** Get the screen name of this user entry. */
+    public String getScreenName() {
+        return screenName;
+    }
+
+    /** Set the screen name of this user entry. */
+    public void setScreenName(String screenName) {
+        this.screenName = screenName;
+    }
+
     /** Get the full name of this user entry. */
     public String getFullName() {
         return fullName;

Modified: 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java
URL: 
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java?view=diff&rev=537945&r1=537944&r2=537945
==============================================================================
--- 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java
 (original)
+++ 
roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java
 Mon May 14 11:41:57 2007
@@ -237,7 +237,8 @@
                 }
                 lastname += toker.nextToken();
             }
-            
+
+            // TODO: Should screen name be renamed nickname and used here?
             // populates user information to return as a result
             Hashtable result = new Hashtable();
             result.put("nickname", user.getUserName());

Modified: 
roller/branches/roller_4.0_newbackend/tests/org/apache/roller/TestUtils.java
URL: 
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/TestUtils.java?view=diff&rev=537945&r1=537944&r2=537945
==============================================================================
--- 
roller/branches/roller_4.0_newbackend/tests/org/apache/roller/TestUtils.java 
(original)
+++ 
roller/branches/roller_4.0_newbackend/tests/org/apache/roller/TestUtils.java 
Mon May 14 11:41:57 2007
@@ -73,6 +73,7 @@
         UserData testUser = new UserData();
         testUser.setUserName(username);
         testUser.setPassword("password");
+        testUser.setScreenName("Test User Screen Name");
         testUser.setFullName("Test User");
         testUser.setEmailAddress("[EMAIL PROTECTED]");
         testUser.setLocale("en_US");

Modified: 
roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/UserTest.java
URL: 
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/UserTest.java?view=diff&rev=537945&r1=537944&r2=537945
==============================================================================
--- 
roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/UserTest.java
 (original)
+++ 
roller/branches/roller_4.0_newbackend/tests/org/apache/roller/business/UserTest.java
 Mon May 14 11:41:57 2007
@@ -68,6 +68,7 @@
         UserData testUser = new UserData();
         testUser.setUserName("testUser");
         testUser.setPassword("password");
+        testUser.setScreenName("Test User Screen Name");
         testUser.setFullName("Test User");
         testUser.setEmailAddress("[EMAIL PROTECTED]");
         testUser.setLocale("en_US");
@@ -91,6 +92,7 @@
         assertEquals(testUser, user);
         
         // modify user and save
+        user.setScreenName("testtesttest");
         user.setFullName("testtesttest");
         mgr.saveUser(user);
         TestUtils.endSession(true);
@@ -99,8 +101,9 @@
         user = null;
         user = mgr.getUser(id);
         assertNotNull(user);
+        assertEquals("testtesttest", user.getScreenName());
         assertEquals("testtesttest", user.getFullName());
-        
+
         // remove test user
         mgr.removeUser(user);
         TestUtils.endSession(true);

Modified: 
roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/ApplicationResources.properties
URL: 
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/ApplicationResources.properties?view=diff&rev=537945&r1=537944&r2=537945
==============================================================================
--- 
roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/ApplicationResources.properties
 (original)
+++ 
roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/ApplicationResources.properties
 Mon May 14 11:41:57 2007
@@ -1380,6 +1380,7 @@
 userAdmin.editEntries=Edit Entries
 userAdmin.manage=Manage
 
+userAdmin.tip.screenName=User's screen name (with no HTML).
 userAdmin.tip.fullName=User's full name (with no HTML).
 userAdmin.tip.userName=A short one-word username for the user account.\
 Please limit it to simple ASCII alphanumeric characters (a-z, A-Z and 0-9), \
@@ -1400,6 +1401,7 @@
 userRegister.button.save=Register User
 userRegister.button.cancel=Cancel
 
+userRegister.tip.screenName=Your desired screen name (with no HTML).
 userRegister.tip.fullName=Your full name (with no HTML).
 userRegister.tip.userName=A short one-word username for your user account. \
 Please limit it to simple ASCII alphanumeric characters (a-z, A-Z and 0-9), \
@@ -1418,6 +1420,7 @@
 
 userSettings.userSettings=User Settings
 userSettings.username=Username
+userSettings.screenname=Screen Name
 userSettings.fullname=Full Name
 userSettings.password=Password
 userSettings.passwordConfirm=Password (Confirm)


Reply via email to