Author: taylor
Date: Wed Nov 30 16:09:20 2005
New Revision: 350081

URL: http://svn.apache.org/viewcvs?rev=350081&view=rev
Log:
localization of j2-admin features, part 1
patch from Chris Schaefer

Added:
    
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/
    
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/ForgottenPasswordResources_en.properties
    
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/UserRegistrationResources_en.properties
Modified:
    
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/ForgottenPasswordPortlet.java
    
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java
    
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml
    
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswd.vm
    
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswdEmail.vm
    
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistration.vm
    
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistrationEmail.vm

Modified: 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/ForgottenPasswordPortlet.java
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/ForgottenPasswordPortlet.java?rev=350081&r1=350080&r2=350081&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/ForgottenPasswordPortlet.java
 (original)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/ForgottenPasswordPortlet.java
 Wed Nov 30 16:09:20 2005
@@ -170,6 +170,8 @@
         String email = request.getParameter(RP_EMAIL_ADDRESS);
         String guid = request.getParameter("guid");
 
+        ResourceBundle resource = 
getPortletConfig().getResourceBundle(request.getLocale());
+
         if (guid != null) 
         {
             if(isValidGUID(guid)) 
@@ -178,19 +180,15 @@
                 {
                     updatePasswordFromGUID(guid);
                     context
-                            .put(CTX_CHANGEDPW_MSG,
-                                    "Your password has been updated!  Please 
login using it!");
+                            .put(CTX_CHANGEDPW_MSG, 
resource.getString("forgotten.successful_pw_update"));
                 } catch (Exception e)
                 {
-                    context
-                            .put(CTX_CHANGEDPW_MSG,
-                                    "<font color=\"red\">unable to update your 
password, try again please</font>");
+                    
context.put(CTX_MESSAGE,resource.getString("forgotten.unable_to_update_pw"));
                 }
             } else {
                 // invalid GUID
                 context
-                .put(CTX_CHANGEDPW_MSG,
-                        "<font color=\"red\">I'm sorry that change password 
link is invalid</font>");
+                
.put(CTX_CHANGEDPW_MSG,resource.getString("forgotten.password_update_link_invalid"));
             }
         } else {
             // might be returning from initial request
@@ -217,12 +215,13 @@
         List errors = new LinkedList();
 
         String email = request.getParameter(RP_EMAIL_ADDRESS);
+        ResourceBundle resource = 
getPortletConfig().getResourceBundle(request.getLocale());
 
         // validation
         if (!ValidationHelper.isEmailAddress(email, true, 80))
         {
             // TODO: get error message from localized resource
-            errors.add("Please enter a valid Email address.");
+            
errors.add(resource.getString("forgotten.invalid_email_format_entered"));
         }
 
         if (errors.size() > 0)
@@ -241,7 +240,7 @@
             publishRenderMessage(
                     request,
                     MSG_MESSAGE,
-                    makeMessage("Sorry but we could not find this email 
address on file. Are you sure you typed it in correctly?"));
+                    
makeMessage(resource.getString("forgotten.email_address_not_found")));
             return;
         }
 
@@ -286,7 +285,7 @@
                     request,
                     MSG_CHANGEDPW_MSG,
                     // TODO: localize this!
-                    makeMessage("An email has been sent to you.  Please follow 
the link in the email"));
+                    makeMessage(resource.getString("an_email_has_been_sent")));
             
             response.sendRedirect(generateRedirectURL(request, response));
         } 
@@ -298,7 +297,7 @@
         catch (Exception e)
         {
             publishRenderMessage(request, CTX_MESSAGE,
-                    makeMessage("Failed to send password: " + e.toString()));
+                    makeMessage(resource.getString("failed_to_send") + 
e.toString()));
         }
 
     }

Modified: 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java?rev=350081&r1=350080&r2=350081&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java
 (original)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/UserRegistrationPortlet.java
 Wed Nov 30 16:09:20 2005
@@ -291,29 +291,33 @@
             }
         }
 
+        ResourceBundle resource = 
getPortletConfig().getResourceBundle(actionRequest.getLocale());
+
+        publishRenderMessage(actionRequest, MSG_USERINFO, userInfo);
+        
         if (!ValidationHelper.isAny((String) userInfo.get("user.name.given"),
-                true, 25))
+                true, 30))
         {
             // TODO: get error message from localized resource
-            errors.add("You must enter a first name");
+            errors.add(resource.getString("error.lacking.first_name"));
         }
         if (!ValidationHelper.isAny((String) userInfo.get("user.name.family"),
-                true, 25))
+                true, 30))
         {
             // TODO: get error message from localized resource
-            errors.add("You must enter a last name");
+            errors.add(resource.getString("error.lacking.last_name"));
         }
         if (!ValidationHelper.isAny((String) userInfo.get("user.name"), true,
-                25))
+                80))
         {
             // TODO: get error message from localized resource
-            errors.add("You must enter a username");
+            errors.add(resource.getString("error.lacking.username"));
         }
         if (!ValidationHelper.isEmailAddress((String) userInfo
                 .get(USER_ATTRIBUTE_EMAIL), true, 80))
         {
             // TODO: get error message from localized resource
-            errors.add("Please enter a valid Email address.");
+            errors.add(resource.getString("error.email_invalid_format"));
         }
         if (!this.optionForceGeneratedPasswords)
         {
@@ -321,7 +325,7 @@
                     true, 25))
             {
                 // TODO: get error message from localized resource
-                errors.add("You must enter a password");
+                errors.add(resource.getString("error.lacking.password"));
             }
         }
 
@@ -344,7 +348,7 @@
         {
             // TODO: localize messages
             errors
-                    .add("Requested User ID already exists.  Please select 
another User Id.");
+                    .add(resource.getString("error.userid_already_exists"));
             publishRenderMessage(actionRequest, MSG_MESSAGE, errors);
             return;
         }
@@ -364,7 +368,7 @@
             {
                 // TODO: localize messages
                 errors
-                        .add("The requested email address is already being 
used in the system.  If you already have an account, consider using the 
forgotten password portlet to retreive your password");
+                        .add(resource.getString("error.email_already_exists"));
                 publishRenderMessage(actionRequest, MSG_MESSAGE, errors);
                 return;
             }
@@ -389,7 +393,7 @@
                 {
                     //                  TODO: localize messages
                     errors
-                            .add("The two passwords do not match, please 
re-type them");
+                            
.add(resource.getString("error.two_passwords_do_not_match"));
                     publishRenderMessage(actionRequest, MSG_MESSAGE, errors);
                     return;
                 }
@@ -398,13 +402,14 @@
         catch (Exception e)
         {
             // TODO: localize messages
-            errors.add("Failed to add user. " + e.toString());
+            errors.add(resource.getString("error.failed_to_add") + 
e.toString());
             publishRenderMessage(actionRequest, MSG_MESSAGE, errors);
         }
         // make sure no errors have occurred
         if (errors.size() > 0)
         {
             publishRenderMessage(actionRequest, MSG_MESSAGE, errors);
+            return;
         }
 
         // Ok, we think we're good to go, let's create the user!
@@ -431,16 +436,18 @@
                     .get(USER_ATTRIBUTE_EMAIL), getEmailSubject(actionRequest),
                     this.emailTemplate, userInfo);
 
-            publishRenderMessage(actionRequest, MSG_REGED_USER_MSG,
-                    "You have completed the user registration process.  Please 
login above");
+            publishRenderMessage(actionRequest, 
MSG_REGED_USER_MSG,resource.getString("success.login_above"));
 
+            // put an empty map to "erase" all the user info going forward
+            publishRenderMessage(actionRequest, MSG_USERINFO, new HashMap());
+            
             
actionResponse.sendRedirect(this.generateRedirectURL(actionRequest, 
actionResponse));
 
         } 
         catch (Exception e)
         {
             // TODO: localize messages
-            errors.add("Failed to add user. " + e.toString());
+            errors.add(resource.getString("error.failed_to_add") + 
e.toString());
             publishRenderMessage(actionRequest, MSG_MESSAGE, errors);
         }
     }

Added: 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/ForgottenPasswordResources_en.properties
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/ForgottenPasswordResources_en.properties?rev=350081&view=auto
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/ForgottenPasswordResources_en.properties
 (added)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/ForgottenPasswordResources_en.properties
 Wed Nov 30 16:09:20 2005
@@ -0,0 +1,8 @@
+forgotten.successful_pw_update = Your password has been updated!  Please login 
using it!
+forgotten.unable_to_update_pw=unable to update your password, try again please
+forgotten.password_update_link_invalid=I'm sorry that change password link is 
invalid
+forgotten.invalid_email_format_entered=Please enter a valid Email address.
+forgotten.email_address_not_found=Sorry but we could not find this email 
address on file. Are you sure you typed it in correctly?
+an_email_has_been_sent=An email has been sent to you.  Please follow the link 
in the email
+email.subject.forgotten.password=Password Notification
+failed_to_send=Failed to send password:
\ No newline at end of file

Added: 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/UserRegistrationResources_en.properties
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/UserRegistrationResources_en.properties?rev=350081&view=auto
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/UserRegistrationResources_en.properties
 (added)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/registration/resources/UserRegistrationResources_en.properties
 Wed Nov 30 16:09:20 2005
@@ -0,0 +1,11 @@
+error.lacking.first_name=You must enter a first name
+error.lacking.last_name=You must enter a last name
+error.lacking.username=You must enter a username
+error.email_invalid_format=Please enter a valid Email address.
+error.lacking.password=You must enter a password
+error.userid_already_exists=Requested User ID already exists.  Please select 
another User Id.
+error.email_already_exists=The requested email address is already being used 
in the system.  If you already have an account, consider using the forgotten 
password portlet to retreive your password.
+error.two_passwords_do_not_match=The two passwords do not match, please 
re-type them
+error.failed_to_add=Failed to add user.
+success.login_above=You have completed the user registration process.  Please 
login above
+       
\ No newline at end of file

Modified: 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml?rev=350081&r1=350080&r2=350081&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml 
(original)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/portlet.xml 
Wed Nov 30 16:09:20 2005
@@ -865,6 +865,7 @@
     <display-name>Forgotten Password Portlet</display-name>
     <description>Provides users with the ability to request a new password to 
be sent to their email address</description>
     
<portlet-class>org.apache.jetspeed.portlets.registration.ForgottenPasswordPortlet</portlet-class>
+    
<resource-bundle>org.apache.jetspeed.portlets.registration.resources.ForgottenPasswordResources</resource-bundle>
     <expiration-cache>-1</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>
@@ -948,6 +949,7 @@
     <display-name>User Registration Portlet</display-name>
     <description>Provides users with the ability register anew with the 
portal</description>
     
<portlet-class>org.apache.jetspeed.portlets.registration.UserRegistrationPortlet</portlet-class>
+    
<resource-bundle>org.apache.jetspeed.portlets.registration.resources.UserRegistrationResources</resource-bundle>
     <expiration-cache>-1</expiration-cache>
     <supports>
       <mime-type>text/html</mime-type>

Modified: 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswd.vm
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswd.vm?rev=350081&r1=350080&r2=350081&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswd.vm
 (original)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswd.vm
 Wed Nov 30 16:09:20 2005
@@ -1,23 +1,23 @@
 <div id="ForgottenPassword"  class="portlet-section-text"> 
        #if($updatedPWMsg)
                <table>
-                       <tr><td colspan="2" ><font color="green" size="+1" 
>$updatedPWMsg</font></td></tr>
+                       <tr><td colspan="2" ><p 
class="portlet-msg-success">$updatedPWMsg</p></td></tr>
                </table>
-       #else
-       <form name="forgottenPasswordForm" 
action="$renderResponse.createActionURL()" method="post" >
-       <table>
-               <tr><td colspan="2" > 
-                       If you have forgotten your password, we can create a 
new one and send it to you via your email address.
-                       You must enter the exact same email address with which 
you originally registered. 
-                       #if($MSG )
-                               <br>
-                               <font color="red">$!MSG</font>
-                       #end    
-               </td></tr>
-               
-               <tr><td>email address:</td><td><input type="text" name="email" 
value="$!email" /></td></tr>
-               <tr><td colspan="2" > <input type="submit" value="Request New 
Password"  name="Request New Password" /> </td></tr>
-       </table>
-    </form>
+       #else   
+               <form name="forgottenPasswordForm" 
action="$renderResponse.createActionURL()" method="post" >
+               <table>
+                       <tr><td colspan="2" > 
+                               If you have forgotten your password, we can 
create a new one and send it to you via your email address.
+                               You must enter the exact same email address 
with which you originally registered. 
+                               #if($MSG )
+                                       <br>
+                                       <p class="portlet-msg-error">$!MSG</p>
+                               #end
+                       </td></tr>
+                       
+                       <tr><td>email address:</td><td><input type="text" 
name="email" value="$!email" /></td></tr>
+                       <tr><td colspan="2" > <input type="submit" 
value="Request New Password"  name="Request New Password" /> </td></tr>
+               </table>
+           </form>
     #end
 </div>

Modified: 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswdEmail.vm
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswdEmail.vm?rev=350081&r1=350080&r2=350081&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswdEmail.vm
 (original)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/forgottenPasswdEmail.vm
 Wed Nov 30 16:09:20 2005
@@ -1,6 +1,6 @@
 Hello  $!{map.get("user.name.given")} $!{map.get("user.name.family")}:
 
-Thank you for requesting a new password for your account. 
+You have requested a new password for your account. 
 The account username: $!{map.get("username")}
 The new password is : $!{map.get("password")}
 To activate the new password you MUST click on the following link:
@@ -12,3 +12,4 @@
 Thanks,  
 
 The Jetspeed Team.
+

Modified: 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistration.vm
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistration.vm?rev=350081&r1=350080&r2=350081&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistration.vm
 (original)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistration.vm
 Wed Nov 30 16:09:20 2005
@@ -1,7 +1,7 @@
 <div id="UserRegistration"  class="portlet-section-text"> 
        #if($registeredUserMsg)
-               <table>
-                       <tr><td colspan="2" ><font color="green" size="+1" 
>$registeredUserMsg</font></td></tr>
+               <table >
+                       <tr><td colspan="2" ><p class="portlet-msg-success" 
>$registeredUserMsg</p></td></tr>
                </table>
        #else
        <form name="userRegistrationForm" 
action="$renderResponse.createActionURL()" method="post" >
@@ -9,20 +9,19 @@
                <tr><td colspan="2" > 
                        Welcome.  Please fill out the following form to become 
a registered user.
                        #if($MSG )
-                               <br>
-                               <font color="red">$!MSG</font>
+                               <p class="portlet-msg-error">$!MSG</p>
                        #end    
                </td></tr>
                
                #if($CTX_Option_Use_Email_As_Username)
                #else
-               <tr><td>username:</td><td><input type="text" name="user.name" 
value="$!user.name" /></td></tr>
+               <tr><td>username:</td><td><input type="text" name="user.name" 
value="$!{user.get("user.name")}" /></td></tr>
                #end
-               <tr><td>first name:</td><td><input type="text" 
name="user.name.given" value="$!user.name.given" /></td></tr>
-               <tr><td>last name:</td><td><input type="text" 
name="user.name.family" value="$!user.name.family" /></td></tr>
-               <tr><td>department: <font color="blue" 
size="-2">(optional)</font></td><td><input type="text" name="user.department" 
value="$!user.department" /></td></tr>
-               <tr><td>employer: <font color="blue" 
size="-2">(optional)</font></td><td><input type="text" name="user.employer" 
value="$!user.employer" /></td></tr>
-               <tr><td>email address:</td><td><input type="text" 
name="user.business-info.online.email" 
value="$!user.business-info.online.email" /></td></tr>
+               <tr><td>first name:</td><td><input type="text" 
name="user.name.given" value="$!{user.get("user.name.given")}" /></td></tr>
+               <tr><td>last name:</td><td><input type="text" 
name="user.name.family" value="$!{user.get("user.name.family")}" /></td></tr>
+               <tr><td>department: <font color="blue" 
size="-2">(optional)</font></td><td><input type="text" name="user.department" 
value="$!{user.get("user.department")}" /></td></tr>
+               <tr><td>employer: <font color="blue" 
size="-2">(optional)</font></td><td><input type="text" name="user.employer" 
value="$!{user.get("user.employer")}" /></td></tr>
+               <tr><td>email address:</td><td><input type="text" 
name="user.business-info.online.email" 
value="$!{user.get("user.business-info.online.email")}" /></td></tr>
                
                #if($CTX_Option_Generate_Passwords)
                #else

Modified: 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistrationEmail.vm
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistrationEmail.vm?rev=350081&r1=350080&r2=350081&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistrationEmail.vm
 (original)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/userreg/userRegistrationEmail.vm
 Wed Nov 30 16:09:20 2005
@@ -1,5 +1,13 @@
-This is a place holder for now.
+Hello $!{map.get("user.name.given")} $!{map.get("user.name.family")}:
 
-Hello $!{map.get("user.name.given")}
+Welcome to Jetspeed! 
+Thanks you for registering.  Jetspeed is a powerful component based
+portlet container system conforming to JSR-168.
+
+Your username is: $!{map.get("user.name")}
+Your password is: $!{map.get("password")}
+
+You may change your password online.
+
+Thanks
 
-Hopefully more interesting stuff will happen later.
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to