← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1590: Fixed Bug <534825>

 

------------------------------------------------------------
revno: 1590
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-03-09 15:30:08 +0700
message:
  Fixed Bug <534825>
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm
  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_vi_VN.properties
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exceltemplate.js


--
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/i18n/i18n.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js	2009-11-08 20:18:11 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js	2010-03-09 08:30:08 +0000
@@ -1,3 +1,12 @@
+//----------------------------------------------------------
+// Regular Expression using for checking shortname' value
+//----------------------------------------------------------
+
+regexShortName = /^[\w][\w\d]+$/;
+
+//----------------------------------------------------------
+
+
 function updateTranslation()
 {
     var id = document.getElementById("id").value;
@@ -137,3 +146,36 @@
 	document.getElementById('message').style.display = 'block';
 }
 
+
+function applyingPatternForShortName( shortNameValue )
+{
+	return shortNameValue.match( regexShortName );
+}
+
+function validateAddTranslation()
+{
+	var shortNameField = byId( 'shortName' );
+	var shortNameVal = shortNameField.value;
+	
+	if ( shortNameVal.length > 0 )
+	{
+		if ( applyingPatternForShortName( shortNameVal ) == null )
+		{
+			setMessage( shortname_invalidated );
+			shortNameField.select();
+			return false;
+		}
+		else if ( shortNameVal.length > 25 )
+		{
+			setMessage( shortname_length );
+			shortNameField.select();
+			return false;
+		}
+		else
+		{
+			return true;
+		}
+	}
+	
+	return true;
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm	2010-03-08 14:50:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm	2010-03-09 08:30:08 +0000
@@ -1,6 +1,6 @@
-<form id="translateForm" action="translate.action" method="post">
+<form id="translateForm" action="translate.action" method="post" onsubmit="javascript: return validateAddTranslation();">
 
-<h3>$i18n.getString( "translation_translate" ) #openHelp( "translation" )</h3>
+<h3>$i18n.getString( "translation_translate" )</h3>
 
 <div>
 	<input type="hidden" id="id" name="id" value="$objectId">
@@ -49,7 +49,7 @@
 	</tr>
 </table>
 </form>
-<h3>$i18n.getString( "translation_addlocale")</h3>
+<h3>$i18n.getString( "translation_addlocale") #openHelp( "dhis-web-commons.locale" )</h3>
 <table>
 	<tr>
 		<th colspan="2">Details</th>
@@ -72,6 +72,7 @@
 <span id="message"></span>
 
 <script type="text/javascript">
+
     var propNames = new Array()
     #set( $count = 0 )
     #foreach ($propertyName in $propertyNames )
@@ -79,9 +80,12 @@
         #set( $count = $count + 1 )
     #end
 
-    var locale_added = '$i18n.getString( "translation_locale_added" )'
-    var language_must_be_two_chars = '$i18n.getString( "translation_language_must_be_two_chars" )'
-    var country_must_be_two_chars = '$i18n.getString( "translation_country_must_be_two_chars" )'
+    var locale_added = '$i18n.getString( "translation_locale_added" )';
+    var language_must_be_two_chars = '$i18n.getString( "translation_language_must_be_two_chars" )';
+    var country_must_be_two_chars = '$i18n.getString( "translation_country_must_be_two_chars" )';
     var variant_must_be_specified = '$i18n.getString( "translation_variant_must_be_specified" )';
     var locale_already_exists = '$i18n.getString( "translation_locale_already_exists" )';
+	var shortname_invalidated = '$encoder.jsEscape($i18n.getString( 'translation_shortname_wellformed' ) , "'")';
+	var shortname_length = '$encoder.jsEscape($i18n.getString( 'translation_shortname_length' ) , "'")';
+	
 </script>
\ No newline at end of file

=== 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	2010-03-08 14:50:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2010-03-09 08:30:08 +0000
@@ -186,6 +186,8 @@
 translation_country_must_be_two_chars = Country must be two characters
 translation_variant_must_be_specified = Variant must be specified
 translation_locale_already_exists = Locale already exists
+translation_shortname_wellformed  = Please verify Letters, Numbers and Underscore for short name only
+translation_shortname_length      = Shortname's maximum length of 25 charaters
 
 #-- About ----------------------------------------------------------------------#
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties	2010-01-22 03:15:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties	2010-03-09 08:30:08 +0000
@@ -173,6 +173,8 @@
 translation_country_must_be_two_chars 				= M\u00e3 qu\u1ed1c gia ph\u1ea3i c\u00f3 2 k\u00fd t\u1ef1
 translation_variant_must_be_specified 				= Bi\u1ebfn kh\u00f4ng \u0111\u01b0\u1ee3c b\u1ecf tr\u1ed1ng
 translation_locale_already_exists 					= V\u00f9ng n\u00e0y \u0111\u00e3 t\u1ed3n t\u1ea1i
+translation_shortname_wellformed                    = T\u00ean vi\u1ebft t\u1eaft ch\u1ec9 ch\u1ee9a c\u00e1c k\u00fd t\u1ef1 Alphabet(a-z), s\u1ed1(0-9) v\u00e0 d\u1ea5u g\u1ea1ch d\u01b0\u1edbi(_)
+translation_shortname_length                        = \u0110\u1ed9 d\u00e0i t\u1ed1i \u0111a c\u1ee7a t\u00ean vi\u1ebft t\u1eaft l\u00e0 25 k\u00fd t\u1ef1 
 
 #-- About ----------------------------------------------------------------------#
 

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exceltemplate.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exceltemplate.js	2010-03-04 09:44:37 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/exceltemplate.js	2010-03-09 08:30:08 +0000
@@ -72,7 +72,7 @@
 			(
 				'<b>' + i18n_filename_wellformed  + '</b><ul><li>'
 				+ i18n_length_filename_min5_max30 + '</li><li>'
-				+ i18n_use_only_letters_numbers_dot_only + '</li>'
+				+ i18n_use_only_letters_numbers_dot_only + '</li></ul>'
 			);
 			break;
 		}