[cvs] expresso commit by fgalli: SimpleRegistrationController completely

JCorporate Ltd jcorp at jcorporate.com
Thu Jun 30 11:27:09 UTC 2005


Log Message:
-----------
SimpleRegistrationController completely internationalized. New strings marked by appropriate comment. Usage of string constants when applicable.

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller:
        SimpleRegistration.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core:
        MessagesBundle_it.properties
        MessagesBundle_en.properties
    expresso/expresso-web/expresso/doc:
        ChangeLog.xml

Revision Data
-------------
Index: SimpleRegistration.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/SimpleRegistration.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/SimpleRegistration.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/SimpleRegistration.java -u -r1.45 -r1.46
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/SimpleRegistration.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/SimpleRegistration.java
@@ -296,12 +296,12 @@
             String dbname = db.getClass().getName();
             RegistrationObjectMap rom = new RegistrationObjectMap();
             rom.setDataContext(rd.getDataContext());
-            rom.setField("RegDomId", rd.getField("RegDomId"));
-            rom.setField("RegObj", dbname);
+            rom.setField(RegistrationObjectMap.REG_DOMAIN_ID, rd.getField(RegistrationDomain.FLD_REGDOMID));
+            rom.setField(RegistrationObjectMap.REG_OBJ_CLASS, dbname);
 
             if (!rom.find()) {
                 throw new ControllerException("Registration object map not created for domain/dbname '" +
-                        rd.getField("Name") + "/" + dbname + " '");
+                        rd.getField(RegistrationDomain.FLD_NAME) + "/" + dbname + " '");
             }
 
             if (fieldName.equals(rom.getField("UidField"))) {
@@ -433,11 +433,11 @@
         boolean userPasswd = false;
 
         try {
-            if (rd.getField("EmailAsLogin").equals("Y")) {
+            if (rd.getField(RegistrationDomain.FLD_EMAILASLOGIN).equals("Y")) {
                 emailAsLogin = true;
             }
 
-            if (rd.getField("UserPasswd").equals("Y")) {
+            if (rd.getField(RegistrationDomain.FLD_USERPASSWD).equals("Y")) {
                 userPasswd = true;
             }
         } catch (DBException dbe) {
@@ -520,7 +520,7 @@
             password.setDefaultValue(pw);
             password.setDisplayLength(30);
             password.setMaxLength(30);
-            password.setType("password");
+            password.setType(Input.ATTRIBUTE_PASSWORD);
             password.setAttribute(Input.ATTRIBUTE_PASSWORD, "Y");
             errorStyle = (String) response.getFormCacheAttribute("Password");
 
@@ -542,7 +542,7 @@
             password_verify.setDefaultValue(pwv);
             password_verify.setDisplayLength(30);
             password_verify.setMaxLength(30);
-            password_verify.setType("password");
+            password_verify.setType(Input.ATTRIBUTE_PASSWORD);
             password_verify.setAttribute(Input.ATTRIBUTE_PASSWORD, "Y");
             errorStyle = (String) response.getFormCacheAttribute("Password_verify");
 
@@ -591,26 +591,25 @@
         boolean emailValidate = false;
         boolean approvalRequired = false;
         rd.setDataContext(request.getDataContext());
-        rd.setField("Name", regDomain);
+        rd.setField(RegistrationDomain.FLD_NAME, regDomain);
 
         if (!rd.find()) {
-            errors.addError("Registration domain \"" + regDomain +
-                    "\" has not been defined");
+            errors.addError(response.getString("registration.error.regdomainnotdefined", regDomain));
         }
 
-        if (rd.getField("EmailAsLogin").equals("Y")) {
+        if (rd.getField(RegistrationDomain.FLD_EMAILASLOGIN).equals("Y")) {
             emailAsLogin = true;
         }
 
-        if (rd.getField("UserPasswd").equals("Y")) {
+        if (rd.getField(RegistrationDomain.FLD_USERPASSWD).equals("Y")) {
             userPasswd = true;
         }
 
-        if (rd.getField("EmailValidate").equals("Y")) {
+        if (rd.getField(RegistrationDomain.FLD_EMAILVALIDATE).equals("Y")) {
             emailValidate = true;
         }
 
-        if (rd.getField("Approve").equals("Y")) {
+        if (rd.getField(RegistrationDomain.FLD_APPROVE).equals("Y")) {
             approvalRequired = true;
         }
 
@@ -626,27 +625,27 @@
         email = request.getParameter("Email");
         email_verify = request.getParameter("Email_verify");
 
-        if (email.equals("")) {
+        if (email.equals(StringUtil.EMPTY_STRING)) {
             response.setFormCacheAttribute("Email", errorStyle);
-            errors.addError("Please specify a non-blank email address");
+            errors.addError(response.getString("registration.error.emailblank"));
         }
 
         if (!email.equals(email_verify)) {
             response.setFormCacheAttribute("Email", errorStyle);
             response.setFormCacheAttribute("Email_verify", errorStyle);
-            errors.addError("Email address did not match the confirmation email address");
+            errors.addError(response.getString("registration.error.emailnomatch"));
         }
 
         //Unless this site uses the email address as login name, fill in the login name
         if (!emailAsLogin) {
             loginName = request.getParameter("LoginName");
 
-            if (loginName.equals("")) {
+            if (loginName.equals(StringUtil.EMPTY_STRING)) {
                 response.setFormCacheAttribute("LoginName", errorStyle);
-                errors.addError("Please specify a non-blank login name");
+                errors.addError(response.getString("registration.error.loginblank"));
             } else if (loginName.indexOf("%") >= 0) {
                 response.setFormCacheAttribute("LoginName", errorStyle);
-                errors.addError("You cannot have percent signs in your login name");
+                errors.addError(response.getString("registration.error.percent"));
             }
         } else {
             loginName = email;
@@ -656,13 +655,13 @@
             password = StringUtil.notNull(request.getParameter("Password"));
             password_verify = StringUtil.notNull(request.getParameter("Password_verify"));
 
-            if (password.equals("")) {
+            if (password.equals(StringUtil.EMPTY_STRING)) {
                 response.setFormCacheAttribute("Password", errorStyle);
-                errors.addError("Please specify a non-blank password");
+                errors.addError(response.getString("registration.error.passwordblank"));
             } else {
                 if (!password.equals(password_verify)) {
                     response.setFormCacheAttribute("Password_verify", errorStyle);
-                    errors.addError("Password did not match the confirmation password");
+                    errors.addError(response.getString("registration.error.passwordnomatch"));
                 } else {
                     try {
                         int passwordSize = Integer.parseInt(StringUtil.notNull(ConfigManager.getContext(
@@ -674,8 +673,7 @@
                                     errorStyle);
                             response.setFormCacheAttribute("Password_verify",
                                     errorStyle);
-                            errors.addError("Passwords must be greater than " +
-                                    (passwordSize - 1) + " characters in length");
+                            errors.addError(response.getString("registration.error.passwordsmall", String.valueOf(passwordSize-1) ));
                         }
                     } catch (com.jcorporate.expresso.core.misc.ConfigurationException ce) {
                         log.error("Error getting minimum password length for db context " +
@@ -693,28 +691,14 @@
         user.setDataContext(request.getDataContext());
         user.setLoginName(loginName);
 
-        if (user.find()) {
-            FastStringBuffer fsb = new FastStringBuffer(64);
-            fsb.append("Login \"");
-            fsb.append(loginName);
-            fsb.append("\" is already registered in db/context '");
-            fsb.append(request.getDataContext());
-            fsb.append("', please choose a new login name");
-            errors.addError(fsb.toString());
-        }
+        if (user.find())
+			errors.addError(response.getString("registration.error.loginalreadyreg", loginName, request.getDataContext()));
 
         user.clear();
         user.setEmail(email);
 
-        if (user.find()) {
-            FastStringBuffer fsb = new FastStringBuffer(64);
-            fsb.append("Email \"");
-            fsb.append(email);
-            fsb.append("\" is already registered in db/context '");
-            fsb.append(request.getDataContext());
-            fsb.append("'");
-            errors.addError(fsb.toString());
-        }
+        if (user.find())
+			errors.addError(response.getString("registration.error.emailalreadyreg", email, request.getDataContext()));
 
         if (errors.getErrorCount() > 0) {
             delayLogin(); //Make 'em pay :)
@@ -751,7 +735,7 @@
 
         String groupName = null;
 
-        if (rd.getField("RegRequired").equalsIgnoreCase("Y")) {
+        if (rd.getField(RegistrationDomain.FLD_REGREQUIRED).equalsIgnoreCase("Y")) {
             groupName = "NotReg";
         } else {
             groupName = rd.getField(GroupMembers.GROUP_NAME);
@@ -837,11 +821,11 @@
         boolean approvalRequired = false;
 
         //Set up registration domain parameters
-        if (rd.getField("EmailValidate").equalsIgnoreCase("Y")) {
+        if (rd.getField(RegistrationDomain.FLD_EMAILVALIDATE).equalsIgnoreCase("Y")) {
             emailValidate = true;
         }
 
-        if (rd.getField("Approve").equalsIgnoreCase("Y")) {
+        if (rd.getField(RegistrationDomain.FLD_APPROVE).equalsIgnoreCase("Y")) {
             approvalRequired = true;
         }
 
@@ -902,7 +886,7 @@
             if (gm.find()) {
                 String groupName = rd.getField(GroupMembers.GROUP_NAME);
 
-                if ((groupName == null) || (groupName.equals(""))) {
+                if ((groupName == null) || (groupName.equals(StringUtil.EMPTY_STRING))) {
                     groupName = UserGroup.ALL_USERS_GROUP;
                 }
 
@@ -914,13 +898,13 @@
             }
 
             successMessage = new Output("successMessage",
-                    "You are fully registered and may log in now.");
+                    response.getString("registration.validate.successmessage"));
 
             if (!approvalRequired && !emailValidate) {
                 StringBuffer msg = new StringBuffer(128);
                 msg.append(response.getString("loginConfEM",
                         user.getLoginName(),
-                        "<undisclosed for security reasons>",
+                        response.getString("registration.validate.undisclosed"),
                         Setup.getValue(request.getDataContext(), "CompanyName"),
                         Setup.getValue(request.getDataContext(), "HomePageURL")));
 
@@ -1001,18 +985,11 @@
             // Make sure the User record has not been disabled for some reason, or, already authenticated
             if (errors.isEmpty()) {
                 if (user.getAccountStatus().equals("D")) {
-                    errors.addError("Account \"" + loginName +
-                            "\" has been disabled");
+                    errors.addError(response.getString("registration.error.accountdisabled", loginName));
                 } else if (user.getAccountStatus().equals("A")) {
-                    errors.addError("Account \"" + loginName +
-                            "\" was already authenticated");
+					errors.addError(response.getString("registration.error.accountalreadyauth", loginName));
 
-                    Output o = new Output("infoMessage",
-                            "This account has been activated previously.  " +
-                            "Please use the password that was sent to you via email.  " +
-                            "It takes a few minutes after authentication to receive the email.  " +
-                            "If you have not received the email after waiting a reasonable amount of time, " +
-                            "please contact us via email so we can assist you.");
+                    Output o = new Output("infoMessage", response.getString("registration.msg.alreadyactivated"));
                     response.add(o);
                 }
 
@@ -1074,7 +1051,7 @@
                 }
 
                 String groupName = rd.getField(GroupMembers.GROUP_NAME);
-                if ((groupName == null) || (groupName.equals(""))) {
+                if ((groupName == null) || (groupName.equals(StringUtil.EMPTY_STRING))) {
                     groupName = UserGroup.ALL_USERS_GROUP;
                 }
                 gm.clear();
@@ -1089,15 +1066,10 @@
                         msg.toString());
 
                 // Confirmation messages for the UI
-                Output o1 = new Output("successMessage",
-                        "Account \"" + user.getLoginName() +
-                        "\" Validated Successfully");
+                Output o1 = new Output("successMessage", response.getString("registration.msg.infomessage", user.getLoginName()));
                 response.add(o1);
 
-                Output o2 = new Output("infoMessage",
-                        "Your account is now activated.  " +
-                        "An email has been sent to \"" + user.getEmail() +
-                        "\" containing your password.");
+                Output o2 = new Output("infoMessage", response.getString("registration.msg.infomessage2", user.getEmail()));
                 response.add(o2);
 
                 Transition login = new Transition();
@@ -1153,7 +1125,7 @@
         String dbContext = StringUtil.notNull(request.getParameter("dbContext"));
         String loginControllerName = getLoginController(request);
 
-        if (!dbContext.equals("")) {
+        if (!dbContext.equals(StringUtil.EMPTY_STRING)) {
             request.setDataContext(dbContext);
         }
 
@@ -1181,8 +1153,8 @@
         try {
             RegistrationObjectMap rom = new RegistrationObjectMap();
             rom.setDataContext(request.getDataContext());
-            rom.setField("RegDomId", rd.getField("RegDomId"));
-            rom.setField("RegObj", request.getParameter("dbobj"));
+            rom.setField(RegistrationObjectMap.REG_DOMAIN_ID, rd.getField(RegistrationDomain.FLD_REGDOMID));
+            rom.setField(RegistrationObjectMap.REG_OBJ_CLASS, request.getParameter("dbobj"));
 
             if (!rom.find()) {
                 throw new ControllerException("Cannot find registration object map entry");
@@ -1278,9 +1250,9 @@
             //NOTE: the below code is no replacement for individually securing
             //this controller's states.
             //
-            if (loginName.equals("") || loginName.equals(User.UNKNOWN_USER) ||
+            if (loginName.equals(StringUtil.EMPTY_STRING) || loginName.equals(User.UNKNOWN_USER) ||
                     !myUser.find()) {
-                errors.addError("Must login before approving users");
+                errors.addError(response.getString("registration.error.approvalnologin"));
                 response.saveErrors(errors);
                 throw new SecurityException("Must login before approving users");
             }
@@ -1295,8 +1267,7 @@
                 u.setLoginName(loginToApprove);
 
                 if (!u.find()) {
-                    errors.addError("User \"" + loginToApprove +
-                            "\" not found");
+                    errors.addError(response.getString("registration.error.usernotfound", loginToApprove));
                 }
             }
 
@@ -1304,13 +1275,12 @@
 
             if (errors.isEmpty()) {
                 rd.setDataContext(dbContext);
-                rd.setField("Name", u.getRegistrationDomain());
+                rd.setField(RegistrationDomain.FLD_NAME, u.getRegistrationDomain());
 
                 if (!rd.find()) {
-                    errors.addError("Registration domain \"" +
-                            u.getRegistrationDomain() + "\" not found");
+                    errors.addError(response.getString("registration.error.regdomainnotfound", u.getRegistrationDomain()));
                 } else {
-                    String approvers = rd.getField("Approvers");
+                    String approvers = rd.getField(RegistrationDomain.FLD_APPROVERS);
                     StringTokenizer stk = new StringTokenizer(approvers, ",");
                     boolean havePermission = false;
 
@@ -1325,8 +1295,7 @@
                     }
 
                     if (!havePermission) {
-                        errors.addError("You (" + loginName +
-                                ") do not have permission to approve users in this domain");
+                        errors.addError(response.getString("registration.error.approvalnopermission", loginName));
                     }
                 }
             }
@@ -1334,9 +1303,8 @@
             if (errors.isEmpty()) {
                 StringBuffer msg = new StringBuffer();
                 String subject = null;
-                Output successMessage = new Output("successMessage",
-                        "Approval for user \"" + loginToApprove +
-                        "\" processed successfully");
+                Output successMessage = new Output("successMessage", 
+						response.getString("registration.msg.approvalsuccess", loginToApprove));
                 Output infoMessage = null;
 
                 if (cmd.equals("approve")) {
@@ -1358,7 +1326,7 @@
 
                         String groupName = rd.getField(GroupMembers.GROUP_NAME);
 
-                        if ((groupName == null) || (groupName.equals(""))) {
+                        if ((groupName == null) || (groupName.equals(StringUtil.EMPTY_STRING))) {
                             groupName = UserGroup.ALL_USERS_GROUP;
                         }
 
@@ -1376,7 +1344,7 @@
 
                     subject = response.getString("loginApprovedSubject");
 
-                    if (rd.getField("EmailValidate").equalsIgnoreCase("Y")) {
+                    if (rd.getField(RegistrationDomain.FLD_EMAILVALIDATE).equalsIgnoreCase("Y")) {
                         msg.append(response.getString("loginAuthenticatedEM1",
                                 u.getLoginName(),
                                 Setup.getValue(request.getDataContext(),
@@ -1387,7 +1355,7 @@
                                 Setup.getValue(request.getDataContext(),
                                         "CompanyName")));
 
-                        if (rd.getField("UserPasswd").equalsIgnoreCase("Y")) {
+                        if (rd.getField(RegistrationDomain.FLD_USERPASSWD).equalsIgnoreCase("Y")) {
                             msg.append(response.getString("loginAuthenticatedEM3"));
                         } else {
                             String password = u.randomPassword();
@@ -1402,7 +1370,7 @@
                             Setup.getValue(request.getDataContext(),
                                     "HomePageURL")));
                     infoMessage = new Output("infoMessage",
-                            "Registration was approved, user was notified by email");
+							response.getString("registration.msg.infoapproved"));
                 } else if (cmd.equals("postpone")) {
                     ValidationEntry ve = (ValidationEntry) request.getSession()
                             .getPersistentAttribute(ValidationEntry.SESSION_KEY);
@@ -1413,7 +1381,7 @@
                     }
 
                     infoMessage = new Output("infoMessage",
-                            "Registration Decision Postponed");
+                            response.getString("registration.mgs.infopostponed"));
                     successMessage = new Output("successMessage", "Postponement");
                     response.add(infoMessage);
                     response.add(successMessage);
@@ -1426,9 +1394,9 @@
                             Setup.getValue(request.getDataContext(),
                                     "CompanyName"), u.getLoginName(),
                             Setup.getValue(request.getDataContext(),
-                                    "HomePageURL"), "Didn't meet our criteria"));
+                                    "HomePageURL"), response.getString("registration.approval.didntmeet")));
                     infoMessage = new Output("infoMessage",
-                            "Registration was denied, user was notified by email");
+                            response.getString("registration.msg.infodenied"));
                 } else {
                     throw new ControllerException("Invalid Command");
                 }
@@ -1438,7 +1406,7 @@
                 // If email validation is required by the user's registration domain
                 // then just send email for the email validation.  Otherwise, notify
                 // the user that approval has been granted/denied.
-                if (rd.getField("EmailValidate").equalsIgnoreCase("Y")) {
+                if (rd.getField(RegistrationDomain.FLD_EMAILVALIDATE).equalsIgnoreCase("Y")) {
                     setupEmailValidation(request, response, u, rd,
                             loginControllerName);
                 } else {
@@ -1499,8 +1467,8 @@
         try {
             RegistrationObjectMap rom = new RegistrationObjectMap();
             rom.setDataContext(request.getDataContext());
-            rom.setField("RegDomId", rd.getField("RegDomId"));
-            rom.setField("RegObj", dbname);
+            rom.setField(RegistrationObjectMap.REG_DOMAIN_ID, rd.getField(RegistrationDomain.FLD_REGDOMID));
+            rom.setField(RegistrationObjectMap.REG_OBJ_CLASS, dbname);
 
             if (!rom.find()) {
                 throw new ControllerException("Cannot find registration object map entry");
@@ -1550,8 +1518,8 @@
         try {
             RegistrationObjectMap rom = new RegistrationObjectMap();
             rom.setDataContext(request.getDataContext());
-            rom.setField("RegDomId", rd.getField("RegDomId"));
-            rom.setField("RegObj", dbname);
+            rom.setField(RegistrationObjectMap.REG_DOMAIN_ID, rd.getField(RegistrationDomain.FLD_REGDOMID));
+            rom.setField(RegistrationObjectMap.REG_OBJ_CLASS, dbname);
 
             if (!rom.find()) {
                 throw new ControllerException("Cannot find registration object map entry");
@@ -1643,7 +1611,7 @@
 
         String dbContext = StringUtil.notNull(request.getParameter("dbContext"));
 
-        if (!dbContext.equals("")) {
+        if (!dbContext.equals(StringUtil.EMPTY_STRING)) {
             request.setDataContext(dbContext);
         }
 
@@ -1757,8 +1725,8 @@
 
             RegistrationObjectMap rom = new RegistrationObjectMap();
             rom.setDataContext(request.getDataContext());
-            rom.setField("RegDomId", rd.getField("RegDomId"));
-            rom.setField("RegObj", dbname);
+            rom.setField(RegistrationObjectMap.REG_DOMAIN_ID, rd.getField(RegistrationDomain.FLD_REGDOMID));
+            rom.setField(RegistrationObjectMap.REG_OBJ_CLASS, dbname);
 
             if (!rom.find()) {
                 throw new ControllerException("Cannot find registration object map entry");
@@ -1835,7 +1803,7 @@
         String dbContext = StringUtil.notNull(request.getParameter("dbContext"));
         String loginControllerName = getLoginController(request);
 
-        if (!dbContext.equals("")) {
+        if (!dbContext.equals(StringUtil.EMPTY_STRING)) {
             request.setDataContext(dbContext);
         }
 
@@ -1891,9 +1859,9 @@
             myUser.setDataContext(request.getDataContext());
             myUser.setLoginName(loginName);
 
-            if (loginName.equals("") || loginName.equals(User.UNKNOWN_USER) ||
+            if (loginName.equals(StringUtil.EMPTY_STRING) || loginName.equals(User.UNKNOWN_USER) ||
                     !myUser.find()) {
-                errors.addError("Must login before approving users");
+                errors.addError(response.getString("registration.error.approvalnologin"));
                 response.saveErrors(errors);
                 throw new SecurityException("Must login before approving users");
             }
@@ -1905,22 +1873,19 @@
                 u.setLoginName(loginToApprove);
 
                 if (!u.find()) {
-                    errors.addError("User \"" + loginToApprove +
-                            "\" not found");
-                }
+                    errors.addError(response.getString("registration.error.usernotfound", loginToApprove));                }
             }
 
             RegistrationDomain rd = new RegistrationDomain();
 
             if (errors.isEmpty()) {
                 rd.setDataContext(dbContext);
-                rd.setField("Name", u.getRegistrationDomain());
+                rd.setField(RegistrationDomain.FLD_NAME, u.getRegistrationDomain());
 
                 if (!rd.find()) {
-                    errors.addError("Registration domain \"" +
-                            u.getRegistrationDomain() + "\" not found");
+                    errors.addError(response.getString("registration.error.regdomainnotfound", u.getRegistrationDomain()));
                 } else {
-                    String approvers = rd.getField("Approvers");
+                    String approvers = rd.getField(RegistrationDomain.FLD_APPROVERS);
                     StringTokenizer stk = new StringTokenizer(approvers, ",");
                     boolean havePermission = false;
 
@@ -1935,8 +1900,7 @@
                     }
 
                     if (!havePermission) {
-                        errors.addError("You (" + loginName +
-                                ") do not have permission to approve users in this domain");
+                        errors.addError(response.getString("registration.error.approvalnopermission", loginName));
                     }
                 }
             }
@@ -1972,10 +1936,10 @@
                 response.add(new Output("Email", u.getEmail()));
                 response.add(new Output("RegDomain", u.getRegistrationDomain()));
 
-                if (rd.getField("RegRequired").equalsIgnoreCase("Y")) {
+                if (rd.getField(RegistrationDomain.FLD_REGREQUIRED).equalsIgnoreCase("Y")) {
                     RegistrationObjectMap rom = new RegistrationObjectMap();
                     rom.setDataContext(dbContext);
-                    rom.setField("RegDomId", rd.getField("RegDomId"));
+                    rom.setField(RegistrationObjectMap.REG_DOMAIN_ID, rd.getField(RegistrationDomain.FLD_REGDOMID));
 
                     SecuredDBObject db = null;
                     RegistrationObjectMap oneRom = null;
@@ -2047,7 +2011,7 @@
                                     value = StringUtil.notNull(oneDB.getField(fn));
                                 }
 
-                                if (value.equals("")) {
+                                if (value.equals(StringUtil.EMPTY_STRING)) {
                                     value = "&nbsp;";
                                 }
 
@@ -2094,7 +2058,7 @@
         Block formBlock = new Block("DeleteForm");
         formBlock.setForm("true");
 
-        Output msg = new Output("Confirm", "Are you sure you want to delete?");
+        Output msg = new Output("Confirm", response.getString("registration.msg.deleteconfirm"));
         formBlock.add(msg);
 
         Transition cancel = new Transition("Cancel", "Cancel",
@@ -2130,7 +2094,7 @@
             //If that fails, use "default"
             String dbContext = StringUtil.notNull(request.getParameter("dbContext"));
 
-            if (!dbContext.equals("")) {
+            if (!dbContext.equals(StringUtil.EMPTY_STRING)) {
                 request.setDataContext(dbContext);
             }
 
@@ -2144,23 +2108,21 @@
             // Otherwise, set it to "default"
             String regDomain = StringUtil.notNull(request.getParameter("regDomain"));
 
-            if (regDomain.equals("")) {
-                if (regDomain.equals("")) {
-                    try {
-                        regDomain = StringUtil.notNull(Setup.getValue(request.getDataContext(), "defaultRegDomain"));
-                    } catch (DBException dbe) {
-                        // Ignore the exception
-                    }
+            if (regDomain.equals(StringUtil.EMPTY_STRING)) {
+                try {
+                    regDomain = StringUtil.notNull(Setup.getValue(request.getDataContext(), "defaultRegDomain"));
+                } catch (DBException dbe) {
+                    // Ignore the exception
+                }
 
-                    if (regDomain.equals("")) {
-                        regDomain = "default";
-                    }
+                if (regDomain.equals(StringUtil.EMPTY_STRING)) {
+                    regDomain = "default";
                 }
             }
 
             RegistrationDomain rd = new RegistrationDomain(SuperUser.INSTANCE);
             rd.setDataContext(request.getDataContext());
-            rd.setField("Name", regDomain);
+            rd.setField(RegistrationDomain.FLD_NAME, regDomain);
 
             if (!rd.find()) {
                 throw new ControllerException("Registration domain \"" +
@@ -2231,7 +2193,7 @@
         try {
             RegistrationObjectMap rom = new RegistrationObjectMap();
             rom.setDataContext(request.getDataContext());
-            rom.setField("RegObj", dbname);
+            rom.setField(RegistrationObjectMap.REG_OBJ_CLASS, dbname);
 
             if (!rom.find()) {
                 throw new ControllerException("Registration object for db \"" +
@@ -2297,7 +2259,7 @@
 
             RegistrationDomain rd = new RegistrationDomain();
             rd.setDataContext(request.getDataContext());
-            rd.setField("Name", user.getRegistrationDomain());
+            rd.setField(RegistrationDomain.FLD_NAME, user.getRegistrationDomain());
 
             if (!rd.find()) {
                 throw new ControllerException("Domain " +
@@ -2306,7 +2268,7 @@
 
             RegistrationObjectMap rom = new RegistrationObjectMap();
             rom.setDataContext(request.getDataContext());
-            rom.setField("RegDomId", rd.getField("RegDomId"));
+            rom.setField(RegistrationObjectMap.REG_DOMAIN_ID, rd.getField(RegistrationDomain.FLD_REGDOMID));
 
             RegistrationObjectMap oneRom = null;
             SecuredDBObject db = null;
@@ -2366,11 +2328,11 @@
                 recCount = new Output("recCount", Integer.toString(records));
 
                 if ((min > 0) && (records < min)) {
-                    must = new Output("inputNeeded", "Need Additional Data");
+                    must = new Output("inputNeeded", response.getString("registration.msg.needadditionaldata"));
                     block.add(must);
                 } else {
                     must = new Output("inputNotNeeded",
-                            "Additional Data Not Needed");
+                            response.getString("registration.msg.noneedadditionaldata"));
                     block.add(must);
                 }
 
@@ -2472,7 +2434,7 @@
                         + request.getParameter("UserName") +
                         "but user does not exist");
 
-                ec.addError("You entered an invalid email address");
+                ec.addError(response.getString("registration.error.invalidemailaddress"));
             }
 
             if (ec.getErrorCount() > 0) {
Index: MessagesBundle_it.properties
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_it.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_it.properties -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_it.properties -u -r1.4 -r1.5
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_it.properties
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_it.properties
@@ -553,3 +553,41 @@
 Value=Valore
 No_Records_Found=Nessun Record Trovato
 of=di
+
+#registration FG 20050630
+registration.success.approval=Il login "{0}" è stato registrato con successo nel db/contesto "{1}", è necessaria una approvazione di un amministratore
+registration.info.approval=Non appena un amministratore ha approvato o rifiutato la vostra registrazione, verrete notificati via email
+registration.success.validate=Il login "{0}" è stato registrato con successo nel db/contesto "{1}"
+registration.info.validate=Riceverai una email di autorizzazione a "{0}" tra qualche istante. Ti preghiamo di seguire le istruzioni nella mail per continuare col processo di registrazione.
+registration.error.regdomainnotdefined=Il Dominio di Registrazione {0} non è stato definito.
+registration.error.emailblank=Specifica un indirizzo email non vuoto
+registration.error.emailnomatch=La email inserita non è identica a quella inserita come verifica
+registration.error.loginblank=Specifica un login non vuoto
+registration.error.percent=Non puoi avere il carattere percentuale nel login
+registration.error.passwordblank=Specifica una password non vuota
+registration.error.passwordnomatch=La password inserita non è identica a quella inserita come verifica
+registration.error.passwordsmall=La password deve essere più lunga di  {0} caratteri
+registration.error.loginalreadyreg=Il Login "{0}" è già registrato nel db/contesto "{1}", per favore usa un differente login
+registration.error.emailalreadyreg=La Email "{0}" è già registrata nel db/contesto "{1}", per favore usa una email differente
+registration.error.accountdisabled=Account "{0}" è stato disabilitato
+registration.error.accountalreadyauth=Account "{0}" è già stato autenticato  
+registration.error.approvalnologin=Occorre autenticarsi prima di approvare gli utenti
+registration.error.usernotfound=Utente "{0}" non trovato
+registration.error.regdomainnotfound=Dominio di Registrazione "{0}" non trovato
+registration.error.approvalnopermission=Tu ({0}) non hai i diritti per approvare altri utenti in questo dominio
+registration.error.invalidemailaddress=Hai inserito un indirizzo email non valido
+registration.validate.successmessage=Sei completamente registrato e puoi effettuare login adesso.
+registration.validate.undisclosed=<omesso per motivi di sicurezza>
+registration.msg.alreadyactivated=Questo account è già stato attivato.\nTi preghiamo di usare la password che ti è stata inviata per email. \nCi vuole qualche minuto post autenticazione per ricevere questa email. Se non hai ricevuto la mail dopo aver atteso un ragionevole intervallo di tempo, contattaci in modo che possiamo fornirti supporto. 
+registration.msg.validationsuccess1=Account {0} è stato validato con successo 
+registration.msg.validationsuccess2=Il tuo account è adesso Attivato. Una email è stata inviata a {0} contenente la tua password.
+registration.msg.infomessage=Account "{0}" validato con successo.
+registration.msg.infomessage2=Il tuo account è adesso attivato. Una email è stata inviata a {0} contenente la tua password.
+registration.msg.approvalsuccess=Approvazione per "{0}" processata con successo.
+registration.msg.infoapproved=La registrazione è stata approvata, l''utente è stato avvisato per email
+registration.msg.infopostponed=Decisione di registrazione posticipata
+registration.msg.infodenied=La registrazione è stata negata, l''utente è stato avvisato per email
+registration.msg.deleteconfirm=Are you sure you want to delete?
+registration.msg.needadditionaldata=Necessitano ulteriori informazioni
+registration.msg.noneedadditionaldata=Non necessitano ulteriori informazioni
+registration.approval.didntmeet=Non soddisfaceva i nostri criteri
Index: MessagesBundle_en.properties
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_en.properties,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_en.properties -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_en.properties -u -r1.13 -r1.14
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_en.properties
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/MessagesBundle_en.properties
@@ -394,4 +394,38 @@
 Rowkey=Row key
 Targettablename=Target table name
 knownUserSecException=User {0} does not have permission to {1} for database object {2} in db/context {3}. Please contact your system administrator if you feel this is incorrect.
-errors.suffix=.
\ No newline at end of file
+errors.suffix=.
+
+#registration FG 20050630
+registration.error.regdomainnotdefined=Registration domain {0} has not been defined.
+registration.error.emailblank=Please specify a non-blank email address
+registration.error.emailnomatch=Email address did not match the confirmation email address
+registration.error.loginblank=Please specify a non-blank login name
+registration.error.percent=You cannot have percent signs in your login name
+registration.error.passwordblank=Please specify a non-blank password
+registration.error.passwordnomatch=Password did not match the confirmation password
+registration.error.passwordsmall=Passwords must be greater than {0} characters in length
+registration.error.loginalreadyreg=Login "{0}" is already registered in db/context "{1}", please use a different login name
+registration.error.emailalreadyreg=Email "{0}" is already registered in db/context "{1}", please use a different email
+registration.error.accountdisabled=Account "{0}" has been disabled
+registration.error.accountalreadyauth=Account "{0}" was already authenticated  
+registration.error.approvalnologin=Must login before approving users
+registration.error.usernotfound=User "{0}" not found
+registration.error.regdomainnotfound=Registration Domain "{0}" not found
+registration.error.approvalnopermission=You ({0}) do not have permission to approve users in this domain
+registration.error.invalidemailaddress=You entered an invalid email address
+registration.validate.successmessage=You are fully registered and may log in now.
+registration.validate.undisclosed=<undisclosed for security reasons>
+registration.msg.alreadyactivated=This account has been activated previously.\nPlease use the password that was sent to you via email. \nIt takes a few minutes after authentication to receive the email. If you have not received the email after waiting a reasonable amount of time, please contact us via email so we can assist you. 
+registration.msg.validationsuccess1=Account {0} was validated successfully 
+registration.msg.validationsuccess2=Your account is now Activated. An Email was sent to {0} containing your password.
+registration.msg.infomessage=Account "{0}" validated successfully.
+registration.msg.infomessage2=Your account is now activated. An email has ben sent to {0} containing the password.
+registration.msg.approvalsuccess=Approval for user "{0}" processed successfully
+registration.msg.infoapproved=Registration was approved, user was notified by email
+registration.msg.infopostponed=Registration Decision Postponed
+registration.msg.infodenied=Registration was denied, user was notified by email
+registration.msg.deleteconfirm=Are you sure you want to delete?
+registration.msg.needadditionaldata=Additional Data is needed
+registration.msg.noneedadditionaldata=No additional Data is needed
+registration.approval.didntmeet=Didn''t meet our criteria
Index: ChangeLog.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/ChangeLog.xml,v
retrieving revision 1.312
retrieving revision 1.313
diff -Lexpresso-web/expresso/doc/ChangeLog.xml -Lexpresso-web/expresso/doc/ChangeLog.xml -u -r1.312 -r1.313
--- expresso-web/expresso/doc/ChangeLog.xml
+++ expresso-web/expresso/doc/ChangeLog.xml
@@ -5,6 +5,11 @@
 	<project name="Expresso">
 		<version name="5.7" releaseDate="Not released yet">
 			<comment>Continued Updates</comment>
+			<new-feature title="Registration Controller completely i18n">
+				<explanation>The default Registration Controller (SimpleRegistration) is completely internationalized.
+                </explanation>
+				<contributor>Francesco Galli</contributor>
+			</new-feature>
 			<bug-fix title="MultiDBObject uses use getMappedDataContext()">
 				<explanation>MultiDBObject uses use getMappedDataContext() in order to
                 set its db context; default behavior is unchanged if you do not use a


More information about the cvs mailing list