← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12458: login page locale related changes - recovery and account page translation

 

------------------------------------------------------------
revno: 12458
committer: James Chang <jamesbchang@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-07 16:33:02 +0700
message:
  login page locale related changes - recovery and account page translation
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/accountStrings.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/recoveryStrings.vm
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/account.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/recovery.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/account.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/recovery.vm
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_es.properties


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/account.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/account.js	2013-10-01 16:44:42 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/account.js	2013-10-07 09:33:02 +0000
@@ -39,8 +39,19 @@
 	}
 };
 
+
+var login = {};
+login.localeCookie = "dhis2.locale";
+
 $( document ).ready( function() {
-	
+
+    var locale = $.cookie( login.localeCookie );
+    
+    if ( undefined !== locale && locale )
+    {
+    	login.changeLocale( locale );
+    }
+    
 	Recaptcha.create( "6LcM6tcSAAAAANwYsFp--0SYtcnze_WdYn8XwMMk", "recaptchaDiv", {
 		theme: "white"
 	} );
@@ -84,3 +95,22 @@
 {
 	Recaptcha.reload();
 }
+
+login.changeLocale = function( locale )
+{	
+	$.get( 'accountStrings.action?loc=' + locale, function( json ) {
+		$('#create_new_account').html( json.create_new_account );
+		$('#label_firstName').html( json.name );
+		$('#firstName').attr( "placeholder", json.first_name );
+		$('#surname').attr( "placeholder", json.last_name );
+		$('#label_username').html( json.user_name );
+		$('#label_password').html( json.password );
+		$('#label_retypePassword').html( json.confirm_password );
+		$('#label_email').html( json.email );
+		$('#label_mobile_phone').html( json.mobile_phone );
+		$('#label_employer').html( json.employer );
+		$('#label_recaptchaDiv').html( json.prove_not_robot );
+		$('#cant_read_words').html( json.cant_read_words );
+		$('#submitButton').val( json.create );
+	} );	
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/recovery.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/recovery.js	2013-10-06 11:32:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/recovery.js	2013-10-07 09:33:02 +0000
@@ -3,7 +3,14 @@
 login.localeCookie = "dhis2.locale";
 
 $( document ).ready( function() {
-	
+
+    var locale = $.cookie( login.localeCookie );
+    
+    if ( undefined !== locale && locale )
+    {
+    	login.changeLocale( locale );
+    }
+    
 } );
 
 function recoverAccount()
@@ -31,3 +38,15 @@
 		}
 	} );
 }
+
+
+login.changeLocale = function( locale )
+{		
+	$.get( 'recoveryStrings.action?loc=' + locale, function( json ) {				
+		$('#account_recovery').html( json.account_recovery );
+		$('#label_username').html( json.user_name );
+		$('#recoveryButton').val( json.recover );
+		$('#recoverySuccessMessage').html( json.recover_success_message );
+		$('#recoveryErrorMessage').html( json.recover_error_message );
+	} );	
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js	2013-10-06 11:32:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js	2013-10-07 09:33:02 +0000
@@ -29,13 +29,13 @@
 	if ( locale )
 	{
 		login.changeLocale( locale );	
-		$.cookie( login.localeCookie, locale );
+		$.cookie( login.localeCookie, locale, { expires : 356*10 } );
 	}
 }
 
 login.changeLocale = function( locale )
 {	
-	$.get( 'loginStrings.action?loc=' + locale, function( json ) {
+	$.get( 'loginStrings.action?keyApplication=Y&loc=' + locale, function( json ) {
 		$( '#createAccountButton' ).html( json.create_an_account );
 		$( '#usernameLabel' ).html( json.login_username );
 		$( '#passwordLabel' ).html( json.login_password );

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/account.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/account.vm	2013-10-06 11:32:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/account.vm	2013-10-07 09:33:02 +0000
@@ -21,47 +21,47 @@
 
 <div id="accountInput">
 
-<h3>$i18n.getString( "create_new_account" )</h3>
+<h3><span id="create_new_account">$i18n.getString( "create_new_account" )</span></h3>
 
 <form id="accountForm">
 
 <table>
     <tr>
-        <td style="width:140px"><label for="firstName">$i18n.getString( "name" )</label></td>
+        <td style="width:140px"><label id="label_firstName" for="firstName">$i18n.getString( "name" )</label></td>
         <td><input type="text" id="firstName" name="firstName" autocomplete="off" style="width:11.7em; margin-right:7px;" placeholder="First">
             <input type="text" id="surname" name="surname" autocomplete="off" style="width:11.7em" placeholder="Last"></td>
     </tr>
     <tr>
-        <td><label for="username">$i18n.getString( "user_name" )</label></td>
+        <td><label id="label_username" for="username">$i18n.getString( "user_name" )</label></td>
         <td><input type="text" id="username" name="username" autocomplete="off"></td>
     </tr>
     <tr>
-        <td><label for="password">$i18n.getString( "password" )</label></td>
+        <td><label id="label_password" for="password">$i18n.getString( "password" )</label></td>
         <td><input type="password" id="password" name="password" autocomplete="off" placeholder="$i18n.getString( 'password_hint' )"></td>
     </tr>
     <tr>
-        <td><label for="retypePassword">$i18n.getString( "confirm_password" )</label></td>
+        <td><label id="label_retypePassword" for="retypePassword">$i18n.getString( "confirm_password" )</label></td>
         <td><input type="password" id="retypePassword" name="retypePassword" autocomplete="off"></td>
     </tr>
     <tr>
-        <td><label for="email">$i18n.getString( "email" )</label></td>
+        <td><label id="label_email" for="email">$i18n.getString( "email" )</label></td>
         <td><input type="text" id="email" name="email"></td>
     </tr>
     <tr>
-        <td><label for="phoneNumber">$i18n.getString( "mobile_phone" )</label></td>
+        <td><label id="label_phoneNumber" for="phoneNumber">$i18n.getString( "mobile_phone" )</label></td>
         <td style="padding-bottom: 5px"><input type="text" id="phoneNumber" name="phoneNumber"></td>
     </tr>
     <tr>
-        <td><label for="employer">$i18n.getString( "employer" )</label></td>
+        <td><label id="label_employer" for="employer">$i18n.getString( "employer" )</label></td>
         <td style="padding-bottom: 5px"><input type="text" id="employer" name="employer"></td>
     </tr>
     <tr>
-    	<td><label>$i18n.getString( "prove_you_are_not_a_robot" )</label></td>
+    	<td><label id="label_recaptchaDiv">$i18n.getString( "prove_you_are_not_a_robot" )</label></td>
     	<td style="padding-bottom: 5px"><div id="recaptchaDiv"></div></td>
 	</tr>
     <tr>
         <td></td>
-        <td><a href="javascript:reloadRecaptcha()">$i18n.getString( "cant_read_the_words_try_another_one" )</a></span></td>
+        <td><a id="cant_read_words" href="javascript:reloadRecaptcha()">$i18n.getString( "cant_read_the_words_try_another_one" )</a></span></td>
     </tr>
 	<tr>
 		<td></td>

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/accountStrings.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/accountStrings.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/accountStrings.vm	2013-10-07 09:33:02 +0000
@@ -0,0 +1,15 @@
+{
+"create_new_account": "$!i18nObject.getString( "create_new_account" )",
+"name": "$!i18nObject.getString( "new_user_account_name" )",
+"first_name": "$!i18nObject.getString( "new_user_account_first_name" )",
+"last_name": "$!i18nObject.getString( "new_user_account_last_name" )",
+"user_name": "$!i18nObject.getString( "user_name" )",
+"password": "$!i18nObject.getString( "password" )",
+"confirm_password": "$!i18nObject.getString( "confirm_password" )",
+"email": "$!i18nObject.getString( "email" )",
+"mobile_phone": "$!i18nObject.getString( "mobile_phone" )",
+"employer": "$!i18nObject.getString( "employer" )",
+"prove_not_robot": "$!i18nObject.getString( "prove_you_are_not_a_robot" )",
+"cant_read_words": "$!i18nObject.getString( "cant_read_the_words_try_another_one" )",
+"create": "$!i18nObject.getString( "create" )"
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/recovery.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/recovery.vm	2013-10-06 11:32:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/recovery.vm	2013-10-07 09:33:02 +0000
@@ -17,13 +17,13 @@
 
 <div id="accountInput">
 
-<h3>$i18n.getString( "account_recovery" )</h3>
+<h3><span id="account_recovery">$i18n.getString( "account_recovery" )</span></h3>
 
 <form id="recoveryForm">
 
 <table>
     <tr>
-        <td style="width:100px"><label for="username">$i18n.getString( "user_name" )</label></td>
+        <td style="width:100px"><label id="label_username" for="username">$i18n.getString( "user_name" )</label></td>
         <td><input type="text" id="username" name="username" autocomplete="off"></td>
     </tr>
     <tr>
@@ -34,16 +34,10 @@
 
 </form>
 
-<div id="recoverySuccessMessage" style="display:none">
-Please check the email account which you registered for this username. We have 
-sent you instructions on how to restore your password.	
-</div>
-
-<div id="recoveryErrorMessage" style="display:none">
-Sorry, we were not able to restore your account. The user name might be invalid, 
-your account might not permit restore or you might have entered an invalid email 
-address for your account.
-</div>
+<div id="recoverySuccessMessage" style="display:none">$i18n.getString( 'recover_success_message' )</div>
+
+<div id="recoveryErrorMessage" style="display:none">$i18n.getString( 'recover_error_message' )</div>
+
 
 </div>
 

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/recoveryStrings.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/recoveryStrings.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/recoveryStrings.vm	2013-10-07 09:33:02 +0000
@@ -0,0 +1,7 @@
+{
+"account_recovery": "$!i18nObject.getString( "account_recovery" )",
+"user_name": "$!i18nObject.getString( "user_name" )",
+"recover": "$!i18nObject.getString( "recover" )",
+"recover_success_message": "$!i18nObject.getString( "recover_success_message" )",
+"recover_error_message": "$!i18nObject.getString( "recover_error_message" )"
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java	2013-10-06 07:45:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java	2013-10-07 09:33:02 +0000
@@ -52,6 +52,13 @@
         this.loc = loc;
     }
 
+//    private String type;
+//
+//    public void setType( String type )
+//    {
+//        this.type = type;
+//    }
+
     private I18n i18nObject;
 
     public I18n getI18nObject()

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2013-10-01 16:44:42 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2013-10-07 09:33:02 +0000
@@ -122,6 +122,14 @@
       <result name="success" type="velocity-json">/dhis-web-commons/security/loginStrings.vm</result>
     </action>
 
+    <action name="accountStrings" class="org.hisp.dhis.i18n.action.GetStringsFromLocaleAction">
+      <result name="success" type="velocity-json">/dhis-web-commons/useraccount/accountStrings.vm</result>
+    </action>
+
+    <action name="recoveryStrings" class="org.hisp.dhis.i18n.action.GetStringsFromLocaleAction">
+      <result name="success" type="velocity-json">/dhis-web-commons/useraccount/recoveryStrings.vm</result>
+    </action>
+
     <action name="account" class="org.hisp.dhis.useraccount.action.IsSelfRegistrationAllowedAction">
       <result name="success" type="velocity">/dhis-web-commons/useraccount/account.vm</result>
       <result name="error" type="redirect">login.action</result>

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2013-10-05 17:11:35 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2013-10-07 09:33:02 +0000
@@ -743,4 +743,15 @@
 forgot_password=Forgot password?
 wrong_username_or_password=Wrong username or password
 powered_by=Powered by
-login=Login
\ No newline at end of file
+login=Login
+
+#-- New User Account page ----------------------------------------------------------------#
+
+new_user_account_name=Name
+new_user_account_first_name=First
+new_user_account_last_name=Last
+
+#-- Recovery page ----------------------------------------------------------------#
+
+recover_success_message=Please check the email account which you registered for this username. We have sent you instructions on how to restore your password.	
+recover_error_message=Sorry, we were not able to restore your account. The user name might be invalid, your account might not permit restore or you might have entered an invalid email address for your account.

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_es.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_es.properties	2013-10-05 17:11:35 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_es.properties	2013-10-07 09:33:02 +0000
@@ -605,10 +605,24 @@
 algeria=Algeria
 global_fund=El Fondo Mundial
 timor_leste=Timor Oriental
+
+#-- Login page ----------------------------------------------------------------#
+
 create_an_account=Crear una cuenta
 login_password=Contrasena
 login_username=Nombre de usuario
 forgot_password=�Olvido su contrasena?
 wrong_username_or_password=Nombre de usuario o contrasena incorrecta
 powered_by=Impulsado por
-login=Login
\ No newline at end of file
+login=Login
+
+#-- New User Account page ----------------------------------------------------------------#
+
+new_user_account_name=Nombre
+new_user_account_first_name=Primero
+new_user_account_last_name=Ultimo
+
+#-- Recovery page ----------------------------------------------------------------#
+
+recover_success_message=Compruebe la cuenta de correo electronico que se registro para este nombre de usuario. tenemos te enviaran las instrucciones para restablecer tu contrasena.
+recover_error_message=Lo sentimos, pero no hemos podido recuperar su cuenta. El nombre de usuario no sea valida, su cuenta podria no permitir la restauracion o que podr�haber entrado en un e-mail valida electronico de su cuenta.