Index: lams_admin/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r314c964157e7eefb28c24d94cdb798c2fcc640e7 -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 314c964157e7eefb28c24d94cdb798c2fcc640e7) +++ lams_admin/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -590,5 +590,255 @@ audit.remarks =Remarks config.allow.direct.access.for.integration.learners =Allow direct access to main LAMS page for integration learners. +label.select.country=Select a country +error.country.required=Country is required. +country.AD=Andorra +country.AE=United Arab Emirates +country.AF=Afghanistan +country.AG=Antigua And Barbuda +country.AI=Anguilla +country.AL=Albania +country.AM=Armenia +country.AO=Angola +country.AQ=Antarctica +country.AR=Argentina +country.AS=American Samoa +country.AT=Austria +country.AU=Australia +country.AW=Aruba +country.AX=�land Islands +country.AZ=Azerbaijan +country.BA=Bosnia And Herzegovina +country.BB=Barbados +country.BD=Bangladesh +country.BE=Belgium +country.BF=Burkina Faso +country.BG=Bulgaria +country.BH=Bahrain +country.BI=Burundi +country.BJ=Benin +country.BL=Saint Barth�lemy +country.BM=Bermuda +country.BN=Brunei Darussalam +country.BO=Bolivia +country.BR=Brazil +country.BS=Bahamas +country.BT=Bhutan +country.BV=Bouvet Island +country.BW=Botswana +country.BY=Belarus +country.BZ=Belize +country.CA=Canada +country.CC=Cocos (Keeling) Islands +country.CD=Congo, The Democratic Republic Of The +country.CF=Central African Republic +country.CG=Congo +country.CH=Switzerland +country.CI=C�te D'Ivoire +country.CK=Cook Islands +country.CL=Chile +country.CM=Cameroon +country.CN=China +country.CO=Colombia +country.CR=Costa Rica +country.CU=Cuba +country.CV=Cape Verde +country.CX=Christmas Island +country.CW=Cura�ao +country.CY=Cyprus +country.CZ=Czech Republic +country.DE=Germany +country.DJ=Djibouti +country.DK=Denmark +country.DM=Dominica +country.DO=Dominican Republic +country.DZ=Algeria +country.EC=Ecuador +country.EE=Estonia +country.EG=Egypt +country.EH=Western Sahara +country.ER=Eritrea +country.ES=Spain +country.ET=Ethiopia +country.FI=Finland +country.FJ=Fiji +country.FK=Falkland Islands (Malvinas) +country.FM=Micronesia, Federated States Of +country.FO=Faroe Islands +country.FR=France +country.GA=Gabon +country.GB=United Kingdom +country.GD=Grenada +country.GE=Georgia +country.GF=French Guiana +country.GG=Guernsey +country.GH=Ghana +country.GI=Gibraltar +country.GL=Greenland +country.GM=Gambia +country.GN=Guinea +country.GP=Guadeloupe +country.GQ=Equatorial Guinea +country.GR=Greece +country.GS=South Georgia And The South Sandwich Islands +country.GT=Guatemala +country.GU=Guam +country.GW=Guinea-Bissau +country.GY=Guyana +country.HK=Hong Kong +country.HM=Heard Island And Mcdonald Islands +country.HN=Honduras +country.HR=Croatia +country.HT=Haiti +country.HU=Hungary +country.ID=Indonesia +country.IE=Ireland +country.IL=Israel +country.IM=Isle Of Man +country.IN=India +country.IO=British Indian Ocean Territory +country.IQ=Iraq +country.IR=Iran, Islamic Republic Of +country.IS=Iceland +country.IT=Italy +country.JE=Jersey +country.JM=Jamaica +country.JO=Jordan +country.JP=Japan +country.KE=Kenya +country.KG=Kyrgyzstan +country.KH=Cambodia +country.KI=Kiribati +country.KM=Comoros +country.KN=Saint Kitts And Nevis +country.KP=Korea, Democratic People's Republic Of +country.KR=Korea, Republic Of +country.KW=Kuwait +country.KY=Cayman Islands +country.KZ=Kazakhstan +country.LA=Lao People's Democratic Republic +country.LB=Lebanon +country.LC=Saint Lucia +country.LI=Liechtenstein +country.LK=Sri Lanka +country.LR=Liberia +country.LS=Lesotho +country.LT=Lithuania +country.LU=Luxembourg +country.LV=Latvia +country.LY=Libyan Arab Jamahiriya +country.MA=Morocco +country.MC=Monaco +country.MD=Moldova, Republic Of +country.ME=Montenegro +country.MF=Saint Martin +country.MG=Madagascar +country.MH=Marshall Islands +country.MK=Macedonia, The Former Yugoslav Republic Of +country.ML=Mali +country.MM=Myanmar +country.MN=Mongolia +country.MO=Macao +country.MP=Northern Mariana Islands +country.MQ=Martinique +country.MR=Mauritania +country.MS=Montserrat +country.MT=Malta +country.MU=Mauritius +country.MV=Maldives +country.MW=Malawi +country.MX=Mexico +country.MY=Malaysia +country.MZ=Mozambique +country.NA=Namibia +country.NC=New Caledonia +country.NE=Niger +country.NF=Norfolk Island +country.NG=Nigeria +country.NI=Nicaragua +country.NL=Netherlands +country.NO=Norway +country.NP=Nepal +country.NR=Nauru +country.NU=Niue +country.NZ=New Zealand +country.OM=Oman +country.PA=Panama +country.PE=Peru +country.PF=French Polynesia +country.PG=Papua New Guinea +country.PH=Philippines +country.PK=Pakistan +country.PL=Poland +country.PM=Saint Pierre And Miquelon +country.PN=Pitcairn +country.PR=Puerto Rico +country.PS=Palestinian Territory, Occupied +country.PT=Portugal +country.PW=Palau +country.PY=Paraguay +country.QA=Qatar +country.RE=R�union +country.RO=Romania +country.RS=Serbia +country.RU=Russian Federation +country.RW=Rwanda +country.SA=Saudi Arabia +country.SB=Solomon Islands +country.SC=Seychelles +country.SD=Sudan +country.SE=Sweden +country.SG=Singapore +country.SX=Sint Maarten (Dutch part) +country.SH=Saint Helena +country.SI=Slovenia +country.SJ=Svalbard And Jan Mayen +country.SK=Slovakia +country.SL=Sierra Leone +country.SM=San Marino +country.SN=Senegal +country.SO=Somalia +country.SR=Suriname +country.SS=South Sudan +country.ST=Sao Tome And Principe +country.SV=El Salvador +country.SY=Syrian Arab Republic +country.SZ=Swaziland +country.TC=Turks And Caicos Islands +country.TD=Chad +country.TF=French Southern Territories +country.TG=Togo +country.TH=Thailand +country.TJ=Tajikistan +country.TK=Tokelau +country.TL=Timor-Leste +country.TM=Turkmenistan +country.TN=Tunisia +country.TO=Tonga +country.TR=Turkey +country.TT=Trinidad And Tobago +country.TV=Tuvalu +country.TW=Taiwan +country.TZ=Tanzania, United Republic Of +country.UA=Ukraine +country.UG=Uganda +country.UM=United States Minor Outlying Islands +country.US=United States +country.UY=Uruguay +country.UZ=Uzbekistan +country.VA=Holy See (Vatican City State) +country.VC=Saint Vincent And The Grenadines +country.VE=Venezuela +country.VG=Virgin Islands, British +country.VI=Virgin Islands, U.S. +country.VN=Viet Nam +country.VU=Vanuatu +country.WF=Wallis And Futuna +country.WS=Samoa +country.YE=Yemen +country.YT=Mayotte +country.ZA=South Africa +country.ZM=Zambia +country.ZW=Zimbabwe #======= End labels: Exported 583 labels for en AU ===== Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/UserAction.java =================================================================== diff -u -rfcc5eca8a605afdc9e927366827553a7862000cd -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/UserAction.java (.../UserAction.java) (revision fcc5eca8a605afdc9e927366827553a7862000cd) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/UserAction.java (.../UserAction.java) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -59,6 +59,7 @@ import org.lamsfoundation.lams.usermanagement.UserOrganisationRole; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.CommonConstants; import org.lamsfoundation.lams.util.LanguageUtil; import org.lamsfoundation.lams.util.MessageService; import org.lamsfoundation.lams.util.WebUtil; @@ -86,11 +87,11 @@ if (messageService == null) { messageService = AdminServiceProxy.getMessageService(getServlet().getServletContext()); } - if (UserAction.themeService == null) { - UserAction.themeService = AdminServiceProxy.getThemeService(getServlet().getServletContext()); + if (themeService == null) { + themeService = AdminServiceProxy.getThemeService(getServlet().getServletContext()); } - if (UserAction.timezoneService == null) { - UserAction.timezoneService = AdminServiceProxy.getTimezoneService(getServlet().getServletContext()); + if (timezoneService == null) { + timezoneService = AdminServiceProxy.getTimezoneService(getServlet().getServletContext()); } } @@ -99,24 +100,24 @@ HttpServletResponse response) throws Exception { initServices(); - if (UserAction.locales == null) { - UserAction.locales = service.findAll(SupportedLocale.class); - Collections.sort(UserAction.locales); + if (locales == null) { + locales = service.findAll(SupportedLocale.class); + Collections.sort(locales); } - if (UserAction.authenticationMethods == null) { - UserAction.authenticationMethods = service.findAll(AuthenticationMethod.class); + if (authenticationMethods == null) { + authenticationMethods = service.findAll(AuthenticationMethod.class); } DynaActionForm userForm = (DynaActionForm) form; Integer orgId = WebUtil.readIntParam(request, "orgId", true); Integer userId = WebUtil.readIntParam(request, "userId", true); // Get all the css themess - List themes = UserAction.themeService.getAllThemes(); + List themes = themeService.getAllThemes(); request.setAttribute("themes", themes); // Select the default themes by default - Theme defaultTheme = UserAction.themeService.getDefaultTheme(); + Theme defaultTheme = themeService.getDefaultTheme(); for (Theme theme : themes) { if (theme.getThemeId().equals(defaultTheme.getThemeId())) { userForm.set("userTheme", theme.getThemeId()); @@ -152,7 +153,7 @@ // editing a user if ((userId != null) && (userId != 0)) { User user = (User) service.findById(User.class, userId); - UserAction.log.debug("got userid to edit: " + userId); + log.debug("got userid to edit: " + userId); BeanUtils.copyProperties(userForm, user); userForm.set("password", null); SupportedLocale locale = user.getLocale(); @@ -176,7 +177,7 @@ } // if still null, use the default if (userSelectedTheme == null) { - userSelectedTheme = UserAction.themeService.getDefaultTheme().getThemeId(); + userSelectedTheme = themeService.getDefaultTheme().getThemeId(); } userForm.set("userTheme", userSelectedTheme); userForm.set("initialPortraitId", user.getPortraitUuid()); @@ -188,7 +189,7 @@ SupportedLocale locale = LanguageUtil.getDefaultLocale(); userForm.set("localeId", locale.getLocaleId()); } catch (Exception e) { - UserAction.log.debug(e); + log.debug(e); } } userForm.set("orgId", (org == null ? null : org.getOrganisationId())); @@ -199,7 +200,7 @@ } // Get all available time zones - List availableTimeZones = UserAction.timezoneService.getDefaultTimezones(); + List availableTimeZones = timezoneService.getDefaultTimezones(); TreeSet timezoneDtos = new TreeSet(new TimezoneDTOComparator()); for (Timezone availableTimeZone : availableTimeZones) { String timezoneId = availableTimeZone.getTimezoneId(); @@ -220,8 +221,9 @@ } } - request.setAttribute("locales", UserAction.locales); - request.setAttribute("authenticationMethods", UserAction.authenticationMethods); + request.setAttribute("locales", locales); + request.setAttribute("countryCodes", CommonConstants.COUNTRY_CODES); + request.setAttribute("authenticationMethods", authenticationMethods); return mapping.findForward("user"); } @@ -387,7 +389,7 @@ Integer userId = WebUtil.readIntParam(request, "userId", true); User user = (User) service.findById(User.class, userId); - UserAction.log.debug("enabling user: " + userId); + log.debug("enabling user: " + userId); user.setDisabledFlag(false); service.saveUser(user); Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/UserSaveAction.java =================================================================== diff -u -rfcc5eca8a605afdc9e927366827553a7862000cd -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/UserSaveAction.java (.../UserSaveAction.java) (revision fcc5eca8a605afdc9e927366827553a7862000cd) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/UserSaveAction.java (.../UserSaveAction.java) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -54,21 +54,7 @@ /** * @author Jun-Dir Liew - * - * Created at 12:35:38 on 14/06/2006 */ - -/** - * struts doclets - * - * - * - * - * - * - * - */ - public class UserSaveAction extends LamsDispatchAction { private static Logger log = Logger.getLogger(UserSaveAction.class); @@ -158,6 +144,12 @@ } else if (!ValidationUtil.isEmailValid(userEmail)) { errors.add("email", new ActionMessage("error.valid.email.required")); } + + //country validation + String country = (userForm.get("country") == null) ? null : (String) userForm.get("country"); + if (StringUtils.isBlank(country) || "0".equals(country)) { + errors.add("email", new ActionMessage("error.country.required")); + } if (errors.isEmpty()) { if (edit) { // edit user Index: lams_admin/web/user.jsp =================================================================== diff -u -r39f1f7974c647ec9524ebb630759a27094027c9c -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_admin/web/user.jsp (.../user.jsp) (revision 39f1f7974c647ec9524ebb630759a27094027c9c) +++ lams_admin/web/user.jsp (.../user.jsp) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -16,125 +16,137 @@ @@ -304,15 +316,20 @@ maxlength="64" styleClass="form-control" /> - : - + + : + + + + - : - + + : + + + + @@ -326,16 +343,26 @@ : - + + - : + *: - + + + + + + + + + + + + @@ -364,7 +391,8 @@ - : + : + Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -re59191f853aa9bdaf89c4e430fa9517541c073ed -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision e59191f853aa9bdaf89c4e430fa9517541c073ed) +++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -831,5 +831,256 @@ authoring.tbl.desc.question=These questions are for iRA and tRA. Click "Create Question" to add more questions. authoring.tbl.desc.ae=State the questions for AE. Click "Create Question" to add more questions. +label.select.country=Select a country +error.country.required=Country is required. +country.AD=Andorra +country.AE=United Arab Emirates +country.AF=Afghanistan +country.AG=Antigua And Barbuda +country.AI=Anguilla +country.AL=Albania +country.AM=Armenia +country.AO=Angola +country.AQ=Antarctica +country.AR=Argentina +country.AS=American Samoa +country.AT=Austria +country.AU=Australia +country.AW=Aruba +country.AX=�land Islands +country.AZ=Azerbaijan +country.BA=Bosnia And Herzegovina +country.BB=Barbados +country.BD=Bangladesh +country.BE=Belgium +country.BF=Burkina Faso +country.BG=Bulgaria +country.BH=Bahrain +country.BI=Burundi +country.BJ=Benin +country.BL=Saint Barth�lemy +country.BM=Bermuda +country.BN=Brunei Darussalam +country.BO=Bolivia +country.BR=Brazil +country.BS=Bahamas +country.BT=Bhutan +country.BV=Bouvet Island +country.BW=Botswana +country.BY=Belarus +country.BZ=Belize +country.CA=Canada +country.CC=Cocos (Keeling) Islands +country.CD=Congo, The Democratic Republic Of The +country.CF=Central African Republic +country.CG=Congo +country.CH=Switzerland +country.CI=C�te D'Ivoire +country.CK=Cook Islands +country.CL=Chile +country.CM=Cameroon +country.CN=China +country.CO=Colombia +country.CR=Costa Rica +country.CU=Cuba +country.CV=Cape Verde +country.CX=Christmas Island +country.CW=Cura�ao +country.CY=Cyprus +country.CZ=Czech Republic +country.DE=Germany +country.DJ=Djibouti +country.DK=Denmark +country.DM=Dominica +country.DO=Dominican Republic +country.DZ=Algeria +country.EC=Ecuador +country.EE=Estonia +country.EG=Egypt +country.EH=Western Sahara +country.ER=Eritrea +country.ES=Spain +country.ET=Ethiopia +country.FI=Finland +country.FJ=Fiji +country.FK=Falkland Islands (Malvinas) +country.FM=Micronesia, Federated States Of +country.FO=Faroe Islands +country.FR=France +country.GA=Gabon +country.GB=United Kingdom +country.GD=Grenada +country.GE=Georgia +country.GF=French Guiana +country.GG=Guernsey +country.GH=Ghana +country.GI=Gibraltar +country.GL=Greenland +country.GM=Gambia +country.GN=Guinea +country.GP=Guadeloupe +country.GQ=Equatorial Guinea +country.GR=Greece +country.GS=South Georgia And The South Sandwich Islands +country.GT=Guatemala +country.GU=Guam +country.GW=Guinea-Bissau +country.GY=Guyana +country.HK=Hong Kong +country.HM=Heard Island And Mcdonald Islands +country.HN=Honduras +country.HR=Croatia +country.HT=Haiti +country.HU=Hungary +country.ID=Indonesia +country.IE=Ireland +country.IL=Israel +country.IM=Isle Of Man +country.IN=India +country.IO=British Indian Ocean Territory +country.IQ=Iraq +country.IR=Iran, Islamic Republic Of +country.IS=Iceland +country.IT=Italy +country.JE=Jersey +country.JM=Jamaica +country.JO=Jordan +country.JP=Japan +country.KE=Kenya +country.KG=Kyrgyzstan +country.KH=Cambodia +country.KI=Kiribati +country.KM=Comoros +country.KN=Saint Kitts And Nevis +country.KP=Korea, Democratic People's Republic Of +country.KR=Korea, Republic Of +country.KW=Kuwait +country.KY=Cayman Islands +country.KZ=Kazakhstan +country.LA=Lao People's Democratic Republic +country.LB=Lebanon +country.LC=Saint Lucia +country.LI=Liechtenstein +country.LK=Sri Lanka +country.LR=Liberia +country.LS=Lesotho +country.LT=Lithuania +country.LU=Luxembourg +country.LV=Latvia +country.LY=Libyan Arab Jamahiriya +country.MA=Morocco +country.MC=Monaco +country.MD=Moldova, Republic Of +country.ME=Montenegro +country.MF=Saint Martin +country.MG=Madagascar +country.MH=Marshall Islands +country.MK=Macedonia, The Former Yugoslav Republic Of +country.ML=Mali +country.MM=Myanmar +country.MN=Mongolia +country.MO=Macao +country.MP=Northern Mariana Islands +country.MQ=Martinique +country.MR=Mauritania +country.MS=Montserrat +country.MT=Malta +country.MU=Mauritius +country.MV=Maldives +country.MW=Malawi +country.MX=Mexico +country.MY=Malaysia +country.MZ=Mozambique +country.NA=Namibia +country.NC=New Caledonia +country.NE=Niger +country.NF=Norfolk Island +country.NG=Nigeria +country.NI=Nicaragua +country.NL=Netherlands +country.NO=Norway +country.NP=Nepal +country.NR=Nauru +country.NU=Niue +country.NZ=New Zealand +country.OM=Oman +country.PA=Panama +country.PE=Peru +country.PF=French Polynesia +country.PG=Papua New Guinea +country.PH=Philippines +country.PK=Pakistan +country.PL=Poland +country.PM=Saint Pierre And Miquelon +country.PN=Pitcairn +country.PR=Puerto Rico +country.PS=Palestinian Territory, Occupied +country.PT=Portugal +country.PW=Palau +country.PY=Paraguay +country.QA=Qatar +country.RE=R�union +country.RO=Romania +country.RS=Serbia +country.RU=Russian Federation +country.RW=Rwanda +country.SA=Saudi Arabia +country.SB=Solomon Islands +country.SC=Seychelles +country.SD=Sudan +country.SE=Sweden +country.SG=Singapore +country.SX=Sint Maarten (Dutch part) +country.SH=Saint Helena +country.SI=Slovenia +country.SJ=Svalbard And Jan Mayen +country.SK=Slovakia +country.SL=Sierra Leone +country.SM=San Marino +country.SN=Senegal +country.SO=Somalia +country.SR=Suriname +country.SS=South Sudan +country.ST=Sao Tome And Principe +country.SV=El Salvador +country.SY=Syrian Arab Republic +country.SZ=Swaziland +country.TC=Turks And Caicos Islands +country.TD=Chad +country.TF=French Southern Territories +country.TG=Togo +country.TH=Thailand +country.TJ=Tajikistan +country.TK=Tokelau +country.TL=Timor-Leste +country.TM=Turkmenistan +country.TN=Tunisia +country.TO=Tonga +country.TR=Turkey +country.TT=Trinidad And Tobago +country.TV=Tuvalu +country.TW=Taiwan +country.TZ=Tanzania, United Republic Of +country.UA=Ukraine +country.UG=Uganda +country.UM=United States Minor Outlying Islands +country.US=United States +country.UY=Uruguay +country.UZ=Uzbekistan +country.VA=Holy See (Vatican City State) +country.VC=Saint Vincent And The Grenadines +country.VE=Venezuela +country.VG=Virgin Islands, British +country.VI=Virgin Islands, U.S. +country.VN=Viet Nam +country.VU=Vanuatu +country.WF=Wallis And Futuna +country.WS=Samoa +country.YE=Yemen +country.YT=Mayotte +country.ZA=South Africa +country.ZM=Zambia +country.ZW=Zimbabwe + #======= End labels: Exported 749 labels for en AU ===== Index: lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java =================================================================== diff -u -rb6966cf593629d21ffbdd8d866e7f7b47a3aba6b -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java (.../ProfileAction.java) (revision b6966cf593629d21ffbdd8d866e7f7b47a3aba6b) +++ lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java (.../ProfileAction.java) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -61,6 +61,7 @@ import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.CommonConstants; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.IndexUtils; @@ -240,6 +241,8 @@ } userForm.set("localeId", locale.getLocaleId()); request.setAttribute("locales", locales); + + request.setAttribute("countryCodes", CommonConstants.COUNTRY_CODES); themeService = getThemeService(); Index: lams_central/src/java/org/lamsfoundation/lams/web/ProfileSaveAction.java =================================================================== diff -u -r60e44b19b8de02a00faa437fba8117928baa3d73 -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_central/src/java/org/lamsfoundation/lams/web/ProfileSaveAction.java (.../ProfileSaveAction.java) (revision 60e44b19b8de02a00faa437fba8117928baa3d73) +++ lams_central/src/java/org/lamsfoundation/lams/web/ProfileSaveAction.java (.../ProfileSaveAction.java) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -110,6 +110,12 @@ } else if (!ValidationUtil.isEmailValid(userEmail)) { errors.add("email", new ActionMessage("error.valid.email.required")); } + + //country validation + String country = (userForm.get("country") == null) ? null : (String) userForm.get("country"); + if (StringUtils.isBlank(country) || "0".equals(country)) { + errors.add("email", new ActionMessage("error.country.required")); + } if (!errors.isEmpty()) { saveErrors(request, errors); Index: lams_central/src/java/org/lamsfoundation/lams/web/action/SignupAction.java =================================================================== diff -u -r6f6c59da83b50f953f5af7906da1f5864e74c6e7 -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_central/src/java/org/lamsfoundation/lams/web/action/SignupAction.java (.../SignupAction.java) (revision 6f6c59da83b50f953f5af7906da1f5864e74c6e7) +++ lams_central/src/java/org/lamsfoundation/lams/web/action/SignupAction.java (.../SignupAction.java) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -16,6 +16,7 @@ import org.lamsfoundation.lams.signup.model.SignupOrganisation; import org.lamsfoundation.lams.signup.service.ISignupService; import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.util.CommonConstants; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.Emailer; @@ -34,18 +35,20 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - if (SignupAction.signupService == null) { + if (signupService == null) { WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(getServlet().getServletContext()); - SignupAction.signupService = (ISignupService) wac.getBean("signupService"); + signupService = (ISignupService) wac.getBean("signupService"); } + + request.setAttribute("countryCodes", CommonConstants.COUNTRY_CODES); DynaActionForm signupForm = (DynaActionForm) form; String method = WebUtil.readStrParam(request, "method", true); String context = WebUtil.readStrParam(request, "context", true); SignupOrganisation signupOrganisation = null; if (StringUtils.isNotBlank(context)) { - signupOrganisation = SignupAction.signupService.getSignupOrganisation(context); + signupOrganisation = signupService.getSignupOrganisation(context); request.setAttribute("signupOrganisation", signupOrganisation); } if ((signupForm.get("submitted") == null) || !((Boolean) signupForm.get("submitted"))) { @@ -82,10 +85,11 @@ user.setFirstName(signupForm.getString("firstName")); user.setLastName(signupForm.getString("lastName")); user.setEmail(signupForm.getString("email")); + user.setCountry(signupForm.getString("country")); String salt = HashUtil.salt(); user.setSalt(salt); user.setPassword(HashUtil.sha256(signupForm.getString("password"), salt)); - SignupAction.signupService.signupUser(user, signupForm.getString("context")); + signupService.signupUser(user, signupForm.getString("context")); // send email try { @@ -102,14 +106,14 @@ Emailer.sendFromSupportEmail(subject, user.getEmail(), body, isHtmlFormat); } catch (Exception e) { - SignupAction.log.error(e.getMessage(), e); + log.error(e.getMessage(), e); request.setAttribute("error", e.getMessage()); } return mapping.findForward("success"); } } catch (Exception e) { - SignupAction.log.error(e.getMessage(), e); + log.error(e.getMessage(), e); request.setAttribute("error", e.getMessage()); } @@ -130,7 +134,7 @@ String login = signupForm.getString("usernameTab2"); String password = signupForm.getString("passwordTab2"); String context = signupForm.getString("context"); - SignupAction.signupService.signinUser(login, context); + signupService.signinUser(login, context); HttpSession hses = request.getSession(); hses.setAttribute("login", login); @@ -139,7 +143,7 @@ return null; } } catch (Exception e) { - SignupAction.log.error(e.getMessage(), e); + log.error(e.getMessage(), e); request.setAttribute("error", e.getMessage()); } @@ -155,8 +159,8 @@ errors.add("username", new ActionMessage("error.username.blank")); } else if (!ValidationUtil.isUserNameValid(userName)) { errors.add("username", new ActionMessage("error.username.invalid.characters")); - SignupAction.log.info("username has invalid characters: " + userName); - } else if (SignupAction.signupService.usernameExists(userName)) { + log.info("username has invalid characters: " + userName); + } else if (signupService.usernameExists(userName)) { errors.add("username", new ActionMessage("error.username.exists")); } @@ -166,7 +170,7 @@ errors.add("firstName", new ActionMessage("error.first.name.blank")); } else if (!ValidationUtil.isFirstLastNameValid(firstName)) { errors.add("firstName", new ActionMessage("error.firstname.invalid.characters")); - SignupAction.log.info("firstname has invalid characters: " + firstName); + log.info("firstname has invalid characters: " + firstName); } //last name validation @@ -175,7 +179,7 @@ errors.add("lastName", new ActionMessage("error.last.name.blank")); } else if (!ValidationUtil.isFirstLastNameValid(lastName)) { errors.add("lastName", new ActionMessage("error.lastname.invalid.characters")); - SignupAction.log.info("lastName has invalid characters: " + lastName); + log.info("lastName has invalid characters: " + lastName); } //password validation @@ -197,9 +201,15 @@ } else if (!StringUtils.equals(userEmail, signupForm.getString("confirmEmail"))) { errors.add("email", new ActionMessage("error.emails.unequal")); } + + //country validation + String country = (signupForm.get("country") == null) ? null : (String) signupForm.get("country"); + if (StringUtils.isBlank(country) || "0".equals(country)) { + errors.add("email", new ActionMessage("error.country.required")); + } // courseKey validation - if (!SignupAction.signupService.courseKeyIsValid(signupForm.getString("context"), + if (!signupService.courseKeyIsValid(signupForm.getString("context"), signupForm.getString("courseKey"))) { errors.add("courseKey", new ActionMessage("error.course.key.invalid")); } @@ -214,15 +224,15 @@ if (StringUtils.isBlank(signupForm.getString("passwordTab2"))) { errors.add("passwordTab2", new ActionMessage("error.password.blank")); } - if (!SignupAction.signupService.courseKeyIsValid(signupForm.getString("context"), + if (!signupService.courseKeyIsValid(signupForm.getString("context"), signupForm.getString("courseKeyTab2"))) { errors.add("courseKeyTab2", new ActionMessage("error.course.key.invalid")); } if (errors.isEmpty()) { String login = signupForm.getString("usernameTab2"); String password = signupForm.getString("passwordTab2"); - User user = SignupAction.signupService.getUserByLogin(login); + User user = signupService.getUserByLogin(login); if (user == null) { errors.add("usernameTab2", new ActionMessage("error.login.or.password.incorrect", "", "")); Index: lams_central/web/WEB-INF/struts-config.xml =================================================================== diff -u -r0b4befa34c851fe0ca354488c0d090639dc97cea -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_central/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 0b4befa34c851fe0ca354488c0d090639dc97cea) +++ lams_central/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -74,6 +74,7 @@ + Index: lams_central/web/profile/editprofile.jsp =================================================================== diff -u -r0b4befa34c851fe0ca354488c0d090639dc97cea -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_central/web/profile/editprofile.jsp (.../editprofile.jsp) (revision 0b4befa34c851fe0ca354488c0d090639dc97cea) +++ lams_central/web/profile/editprofile.jsp (.../editprofile.jsp) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -80,9 +80,10 @@
- : + + : + +
@@ -145,9 +146,18 @@ disabled="${!profileEditEnabled}" styleClass="form-control" />
- - + + + + + + + + + + + +
Index: lams_central/web/signup/singupTab.jsp =================================================================== diff -u -r179676e20528b508077ed80c857a28cab08d423c -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_central/web/signup/singupTab.jsp (.../singupTab.jsp) (revision 179676e20528b508077ed80c857a28cab08d423c) +++ lams_central/web/signup/singupTab.jsp (.../singupTab.jsp) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -26,41 +26,32 @@ mustHaveSymbols = ${mustHaveSymbols}; $.validator.addMethod("pwcheck", function(value) { - return (!mustHaveUppercase || /[A-Z]/.test(value)) && // has uppercase letters - (!mustHaveNumerics || /\d/.test(value)) && // has a digit - (!mustHaveLowercase || /[a-z]/.test(value)) && // has a lower case - (!mustHaveSymbols || /[`~!@#$%^&*\(\)_\-+={}\[\]\\|:\;\"\'\<\>,.?\/]/.test(value)); //has symbols + return (!mustHaveUppercase || /[A-Z]/.test(value)) && // has uppercase letters + (!mustHaveNumerics || /\d/.test(value)) && // has a digit + (!mustHaveLowercase || /[a-z]/.test(value)) && // has a lower case + (!mustHaveSymbols || /[`~!@#$%^&*\(\)_\-+={}\[\]\\|:\;\"\'\<\>,.?\/]/.test(value)); //has symbols }); - $.validator.addMethod("charactersAllowed", function(value) { return /^[A-Za-z0-9\d`~!@#$%^&*\(\)_\-+={}\[\]\\|:\;\"\'\<\>,.?\/]*$/ .test(value) - }); $.validator.addMethod("charactersNotAllowed", function(value) { return /^[^<>^!#&()/\\|\"?,:{}= ~`*%$]*$/.test(value) - }); - $.validator.addMethod("charactersNotAllowedName", function(value) { return /^[^<>^*@%$]*$/.test(value) - }); - $.validator - .addMethod( - "emailCheck", - function(value) { - return /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ - .test(value) + $.validator.addMethod("emailCheck", function(value) { + return /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ + .test(value) + }); + $.validator.addMethod("notEqualTo", function(value, element, param) { + return this.optional(element) || value != param; + }, "Please specify a different (non-default) value"); - }); - $(function() { // Setup form validation - - $("#SignupForm") - .validate( - { + $("#SignupForm").validate({ debug : true, errorClass : 'help-block', // validation rules @@ -101,6 +92,10 @@ maxlength : 255, equalTo : $('form input[name="email"]') }, + country : { + required: true, + notEqualTo: "0" + } }, @@ -131,12 +126,15 @@ confirmEmail : { equalTo : "" }, + country: { + required: "", + notEqualTo: "" + } }, submitHandler : function(form) { form.submit(); } - }); - + }); });
@@ -246,8 +244,27 @@
+ +
+ : + + + + + + + + + + + + +
+
: Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180628.sql =================================================================== diff -u -rbfc093eb87907e66a284fd1c30cf0f212122f706 -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180628.sql (.../patch20180628.sql) (revision bfc093eb87907e66a284fd1c30cf0f212122f706) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180628.sql (.../patch20180628.sql) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -3,12 +3,10 @@ SET FOREIGN_KEY_CHECKS=0; ----------------------Put all sql statements below here------------------------- --- LDEV-4609 Bind archived activity marks in batches -DELETE FROM lams_gradebook_user_activity_archive; -DELETE FROM lams_gradebook_user_lesson_archive; +-- LDEV-4605 Codify country for users +UPDATE lams_user SET country=NULL; +ALTER TABLE lams_user CHANGE COLUMN country country VARCHAR(2) NULL DEFAULT NULL ; -ALTER TABLE lams_gradebook_user_lesson_archive ADD COLUMN archive_date DATETIME; -ALTER TABLE lams_gradebook_user_activity_archive ADD COLUMN archive_date DATETIME; ----------------------Put all sql statements above here------------------------- Index: lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java =================================================================== diff -u -r3751037e76fe181b7413af52566405168d36f5e1 -rb959a5f41013249a0537fb19bb7129dd727bb55a --- lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision 3751037e76fe181b7413af52566405168d36f5e1) +++ lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision b959a5f41013249a0537fb19bb7129dd727bb55a) @@ -36,6 +36,7 @@ import java.security.GeneralSecurityException; import java.text.ParseException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -72,6 +73,7 @@ import org.lamsfoundation.lams.usermanagement.UserOrganisationRole; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.util.CSVUtil; +import org.lamsfoundation.lams.util.CommonConstants; import org.lamsfoundation.lams.util.HashUtil; import org.lamsfoundation.lams.util.LanguageUtil; import org.lamsfoundation.lams.util.ValidationUtil; @@ -433,6 +435,15 @@ + "Email format is invalid. External server:" + extServer.getServerid() + ", Username:" + login + ", firstName:" + firstName + ", lastName:" + lastName); } + + //set user's country to default value if it wasn't provided or has a wrong value + String country = userData[7]; + if (StringUtils.isBlank(country) || !Arrays.asList(CommonConstants.COUNTRY_CODES).contains(country)) { + country = userData[13]; + if (StringUtils.isBlank(country) || !Arrays.asList(CommonConstants.COUNTRY_CODES).contains(country)) { + country = LanguageUtil.getDefaultLangCountry()[1]; + } + } User user = new User(); user.setLogin(login); @@ -445,7 +456,7 @@ user.setCity(userData[4]); user.setState(userData[5]); user.setPostcode(userData[6]); - user.setCountry(userData[7]); + user.setCountry(country); user.setDayPhone(userData[8]); user.setMobilePhone(userData[9]); user.setFax(userData[10]);