[open-ils-commits] r8590 - in trunk/Open-ILS/xul/staff_client/chrome: content/auth content/main locale/en-US

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Feb 4 01:12:00 EST 2008


Author: dbs
Date: 2008-02-04 00:43:50 -0500 (Mon, 04 Feb 2008)
New Revision: 8590

Added:
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/auth.properties
Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/auth/controller.js
   trunk/Open-ILS/xul/staff_client/chrome/content/auth/session.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/main.xul
Log:
Bring i18n to the main login window


Modified: trunk/Open-ILS/xul/staff_client/chrome/content/auth/controller.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/auth/controller.js	2008-02-03 19:08:44 UTC (rev 8589)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/auth/controller.js	2008-02-04 05:43:50 UTC (rev 8590)
@@ -1,4 +1,5 @@
 dump('entering auth/controller.js\n');
+// vim:sw=4:ts=4:noet:
 
 if (typeof auth == 'undefined') auth = {};
 auth.controller = function (params) {
@@ -130,7 +131,7 @@
 								} else {
 									x.appendChild(
 										document.createTextNode(
-											'Not yet configured for the specified server.'
+											document.getElementById('authStrings').getString('staff.auth.controller.not_configured')
 										)
 									);
 								}
@@ -211,11 +212,11 @@
 		obj.controller.view.submit_button.disabled = true;
 		obj.controller.view.server_prompt.disabled = true;
 		var s = document.getElementById('status');
-		s.setAttribute('value','Testing hostname...');
+		s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.testing_hostname'));
 		s.setAttribute('style','color: orange;');
 		document.getElementById('version').value = '';
 		if (!url) {
-			s.setAttribute('value','Please enter a server hostname.');
+			s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.prompt_hostname'));
 			s.setAttribute('style','color: red;');
 			obj.controller.view.server_prompt.disabled = false;
 			obj.controller.view.server_prompt.focus();
@@ -229,7 +230,7 @@
 			x.onreadystatechange = function() {
 				try {
 					if (x.readyState != 4) return;
-					s.setAttribute('value',x.status + ' : ' + x.statusText);
+					s.setAttribute('value', document.getElementById('authStrings').getFormattedString('staff.auth.controller.status', [x.status, x.statusText]));
 					if (x.status == 200) {
 						s.setAttribute('style','color: green;');
 					} else {
@@ -239,14 +240,14 @@
 				} catch(E) {
 					obj.controller.view.server_prompt.disabled = false;
 					obj.controller.view.server_prompt.focus();
-					s.setAttribute('value','There was an error testing this hostname.');
+					s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_hostname'));
 					s.setAttribute('style','color: red;');
 					obj.error.sdump('D_ERROR',E);
 				}
 			}
 			x.send(null);
 		} catch(E) {
-			s.setAttribute('value','There was an error testing this hostname.');
+			s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_hostname'));
 			s.setAttribute('style','color: brown;');
 			obj.error.sdump('D_ERROR',E);
 			obj.controller.view.server_prompt.disabled = false;
@@ -257,7 +258,7 @@
 	'test_version' : function(url) {
 		var obj = this;
 		var s = document.getElementById('version');
-		s.setAttribute('value','Testing version...');
+		s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.testing_version'));
 		s.setAttribute('style','color: orange;');
 		try {
 			var x = new XMLHttpRequest();
@@ -267,7 +268,7 @@
 			x.onreadystatechange = function() {
 				try {
 					if (x.readyState != 4) return;
-					s.setAttribute('value',x.status + ' : ' + x.statusText);
+					s.setAttribute('value', document.getElementById('authStrings').getFormattedString('staff.auth.controller.status', [x.status, x.statusText]));
 					if (x.status == 200) {
 						s.setAttribute('style','color: green;');
 						obj.controller.view.submit_button.disabled = false;
@@ -277,7 +278,7 @@
 					}
 					obj.controller.view.server_prompt.disabled = false;
 				} catch(E) {
-					s.setAttribute('value','There was an error checking version support.');
+					s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_version'));
 					s.setAttribute('style','color: red;');
 					obj.error.sdump('D_ERROR',E);
 					obj.controller.view.server_prompt.disabled = false;
@@ -285,7 +286,7 @@
 			}
 			x.send(null);
 		} catch(E) {
-			s.setAttribute('value','There was an error checking version support.');
+			s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_version'));
 			s.setAttribute('style','color: brown;');
 			obj.error.sdump('D_ERROR',E);
 			obj.controller.view.server_prompt.disabled = false;
@@ -305,7 +306,7 @@
 					if (x.status == 200) {
 						window.open('data:text/html,'+window.escape(x.responseText),'upgrade','chrome,resizable,modal,centered');
 					} else {
-						alert('This server does not support your version of the staff client.  Please check with your system administrator.');
+						alert(document.getElementById('authStrings').getString('staff.auth.controller.version_mismatch'));
 					}
 					obj.controller.view.server_prompt.disabled = false;
 				} catch(E) {
@@ -324,10 +325,14 @@
 
 		var obj = this;
 
-		this.error.sdump('D_AUTH','login with ' 
-			+ this.controller.view.name_prompt.value + ' and ' 
-			+ this.controller.view.password_prompt.value + ' at ' 
-			+ this.controller.view.server_prompt.value + '\n'
+		this.error.sdump('D_AUTH',
+			document.getElementById('authStrings').getFormattedString(
+				'staff.auth.controller.error_login', [
+					this.controller.view.name_prompt.value,
+					this.controller.view.password_prompt.value,
+					this.controller.view.server_prompt.value
+				]
+			)
 		); 
 		this.controller.view.server_prompt.disabled = true;
 		this.controller.view.name_prompt.disabled = true;
@@ -455,7 +460,7 @@
 	
 		this.error.sdump('D_AUTH','close' + this.w + '\n');
 
-		if (window.confirm('Are you sure you would like to exit the program completely?')) {
+		if (window.confirm(document.getElementById('authStrings').getString('staff.auth.controller.confirm_close'))) {
 			this.logoff();
 			this.w.close(); /* Probably won't go any further */
 

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/auth/session.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/auth/session.js	2008-02-03 19:08:44 UTC (rev 8589)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/auth/session.js	2008-02-04 05:43:50 UTC (rev 8590)
@@ -1,4 +1,5 @@
 dump('entering auth/session.js\n');
+// vim:sw=4:ts=4:noet:
 
 if (typeof auth == 'undefined') auth = {};
 auth.session = function (view,login_type) {
@@ -52,7 +53,7 @@
 						this.authtime = robj.payload.authtime;
 					break;
 					case 1520 /* WORKSTATION_NOT_FOUND */:
-						alert(params.workstation + ' is not registered with this server.');
+						alert(document.getElementById('authStrings').getFormattedString('staff.auth.session.unregistered', [params.workstation]));
 						delete(params.workstation);
 						delete(data.ws_info[ this.view.server_prompt.value ]);
 						data.stash('ws_info');
@@ -82,13 +83,13 @@
 
 			} else {
 
-				var error = 'open-ils.auth.authenticate.init returned false\n';
+				var error = document.getElementById('authStrings').getStrint('staff.auth.session.init_false') + '\n';
 				this.error.sdump('D_ERROR',error);
 				throw(error);
 			}
 
 		} catch(E) {
-			alert('Login failed.  Please check your Server Hostname, Username, Password, and your CAPS LOCK key.');
+			alert(document.getElementById('authStrings').getString('staff.auth.session.login_failed'));
 			//obj.error.standard_unexpected_error_alert('Error on auth.session.init()',E); 
 
 			if (typeof this.on_init_error == 'function') {

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/main.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/main.xul	2008-02-03 19:08:44 UTC (rev 8589)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/main.xul	2008-02-04 05:43:50 UTC (rev 8590)
@@ -55,6 +55,8 @@
 		dump("lang.version = " + &lang.version; + '\n');
 	</script>
 
+	<messagecatalog id="authStrings" src="chrome://open_ils_staff_client/locale/auth.properties"/>
+
 	<commandset id="auth_cmds">
 		<command id="cmd_login" />
 		<command id="cmd_logoff"/>

Added: trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/auth.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/auth.properties	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/auth.properties	2008-02-04 05:43:50 UTC (rev 8590)
@@ -0,0 +1,14 @@
+staff.auth.controller.not_configured=Not yet configured for the specified server.
+staff.auth.controller.testing_hostname=Testing hostname...
+staff.auth.controller.prompt_hostname=Please enter a server hostname.
+staff.auth.controller.error_hostname=There was an error testing this hostname.
+staff.auth.controller.status=%1$s : %2$s
+staff.auth.controller.testing_version=Testing version...
+staff.auth.controller.error_version=There was an error checking version support.
+staff.auth.controller.version_mismatch=This server does not support your version of the staff client.  Please check with your system administrator.
+# login with <username> and <password> at <server>
+staff.auth.controller.error_login=login with %1$s and %2$s at %3$s
+staff.auth.controller.confirm_close=Are you sure you would like to exit the program completely?
+staff.auth.session.unregistered=%1$s is not registered with this server.
+staff.auth.session.login_failed=Login failed.  Please check your Server Hostname, Username, Password, and your CAPS LOCK key.
+staff.auth.session.init_false=open-ils.auth.authenticate.init returned false



More information about the open-ils-commits mailing list