From 1421c7008b78d2dc030f90992eb3e43e1c79ab4a Mon Sep 17 00:00:00 2001 From: pines Date: Mon, 13 Mar 2006 16:50:36 +0000 Subject: [PATCH] check for upgrade instructions git-svn-id: svn://svn.open-ils.org/ILS/trunk@3345 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../chrome/content/auth/controller.js | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js index bfabb1cb32..fd14ed4561 100644 --- a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js +++ b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js @@ -160,9 +160,12 @@ auth.controller.prototype = { 'test_server' : function(url) { var obj = this; + 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('style','color: orange;'); + document.getElementById('version').value = ''; if (!url) { s.setAttribute('value','Please enter a server hostname.'); s.setAttribute('style','color: red;'); @@ -204,18 +207,21 @@ auth.controller.prototype = { s.setAttribute('style','color: orange;'); try { var x = new XMLHttpRequest(); - url = url + '/xul/server/'; - dump('version url = ' + url + '\n'); - x.open("GET",url,true); + var url2 = url + '/xul/server/'; + dump('version url = ' + url2 + '\n'); + x.open("GET",url2,true); x.onreadystatechange = function() { try { if (x.readyState != 4) return; s.setAttribute('value',x.status + ' : ' + x.statusText); if (x.status == 200) { s.setAttribute('style','color: green;'); + obj.controller.view.submit_button.disabled = false; } else { s.setAttribute('style','color: red;'); + obj.test_upgrade_instructions(url); } + obj.controller.view.server_prompt.disabled = false; } catch(E) { s.setAttribute('value','There was an error checking version support.'); s.setAttribute('style','color: red;'); @@ -230,6 +236,31 @@ auth.controller.prototype = { } }, + 'test_upgrade_instructions' : function(url) { + var obj = this; + try { + var x = new XMLHttpRequest(); + var url2 = url + '/xul/versions.html'; + dump('upgrade url = ' + url2 + '\n'); + x.open("GET",url2,true); + x.onreadystatechange = function() { + try { + if (x.readyState != 4) return; + 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.'); + } + } catch(E) { + obj.error.sdump('D_ERROR',E); + } + } + x.send(null); + } catch(E) { + obj.error.sdump('D_ERROR',E); + } + }, + 'login' : function() { var obj = this; @@ -300,6 +331,9 @@ auth.controller.prototype = { this.session.close(); + /* FIXME - need some locking or object destruction for the async tests */ + /* this.test_server( this.controller.view.server_prompt.value ); */ + if (typeof this.on_logoff == 'function') { this.error.sdump('D_AUTH','auth.controller.on_logoff()\n'); this.on_logoff(); -- 2.43.2