[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. 3977a280bc7cb27e16ac890b02b68ac043c94d13

Evergreen Git git at git.evergreen-ils.org
Wed Oct 31 10:48:40 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_3 has been updated
       via  3977a280bc7cb27e16ac890b02b68ac043c94d13 (commit)
      from  8645f10ad262f5c620345ab14868451ef57ebbb5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3977a280bc7cb27e16ac890b02b68ac043c94d13
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Aug 2 13:28:44 2012 -0400

    Staff client initial hostname
    
    Add support for an initial staff client hostname.
    
    It can be specified during building the staff client or via configure.
    
    During making the staff client:
    
    make INITIAL_HOST=hostname build
    
    During configure:
    
    ./configure --with-initialhost=hostname
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/xul/staff_client/Makefile.am b/Open-ILS/xul/staff_client/Makefile.am
index e69cc4d..9ecac6d 100644
--- a/Open-ILS/xul/staff_client/Makefile.am
+++ b/Open-ILS/xul/staff_client/Makefile.am
@@ -159,6 +159,8 @@ stamp:
 	@if [ -n "${AUTOUPDATE_HOST}" ]; then echo "Applying automatic update host ${AUTOUPDATE_HOST}"; fi
 	@if [ -n "${AUTOUPDATE_HOST}" ]; then sed -i -e "s|::HOSTNAME::|${AUTOUPDATE_HOST}|" -e "s|https\?://\(https\?://\)|\1|" build/defaults/preferences/autoupdate.js; fi
 	@if [ -n "${AUTOUPDATE_HOST}" ]; then sed -i -e "s|::HOSTNAME::|${AUTOUPDATE_HOST}|" -e "s|https\?://\(https\?://\)|\1|" build/install.rdf; fi
+	@if [ -z "${INITIAL_HOST}" ]; then rm -f build/defaults/preferences/initialhost.js; fi
+	@if [ -n "${INITIAL_HOST}" ]; then sed -i -e "s/%INITIAL_HOST%/${INITIAL_HOST}/" build/defaults/preferences/initialhost.js; fi
 	@cp build/STAMP_ID PREV_STAMP_ID
 	@cp build/VERSION PREV_VERSION
 
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 071fc66..e30410c 100644
--- a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js
+++ b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js
@@ -271,7 +271,6 @@ auth.controller.prototype = {
         obj.session = new auth.session(obj.controller.view);
 
         obj.controller.render();
-        obj.test_server( obj.controller.view.server_prompt.value );
         obj.controller.render('ws_deck'); 
 
         if (typeof this.on_init == 'function') {
@@ -315,9 +314,15 @@ auth.controller.prototype = {
                     if (x.status == 200) {
                         s.setAttribute('style','color: green;');
                     } else {
+                        if(x.status == 0) {
+                            s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_hostname'));
+                            obj.controller.view.server_prompt.disabled = false;
+                            obj.controller.view.server_prompt.focus();
+                        }
                         s.setAttribute('style','color: red;');
                     }
-                    obj.test_version(url);
+                    if(x.status > 0)
+                        obj.test_version(url);
                 } catch(E) {
                     obj.controller.view.server_prompt.disabled = false;
                     obj.controller.view.server_prompt.focus();
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/main.js b/Open-ILS/xul/staff_client/chrome/content/main/main.js
index c131bbe..d5e10bc 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/main.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/main.js
@@ -706,13 +706,20 @@ function main_init() {
             document.getElementById('offline_import_btn').disabled = true;
         }
 
+        var should_test_server = true;
         // Attempt auto-login, if provided
         if("arguments" in window && window.arguments.length > 0 && window.arguments[0].wrappedJSObject != undefined && window.arguments[0].wrappedJSObject.loginInfo != undefined) {
-            auto_login(window.arguments[0].wrappedJSObject.loginInfo);
+            should_test_server = auto_login(window.arguments[0].wrappedJSObject.loginInfo);
             // Regardless of success, clear that variable now, so we don't possibly have passwords hanging around.
             window.arguments[0].wrappedJSObject.loginInfo = null;
         }
 
+        if (should_test_server) {
+            G.auth.test_server(G.auth.controller.view.server_prompt.value);
+            G.auth.controller.render('ws_deck');
+        }
+        setTimeout(load_init_hostname, 500);
+
     } catch(E) {
         var error = offlineStrings.getFormattedString('common.exception', [E, '']);
         try { G.error.sdump('D_ERROR',error); } catch(E) { dump(error); }
@@ -721,6 +728,18 @@ function main_init() {
     dump('exiting main_init()\n');
 }
 
+function load_init_hostname() {
+    G.data.stash_retrieve();
+    if(!G.auth.controller.view.server_prompt.value) {
+        try {
+            G.auth.controller.view.server_prompt.value = G.pref.getCharPref('open-ils.initial_hostname');
+            G.auth.test_server(G.pref.getCharPref('open-ils.initial_hostname'));
+            G.auth.controller.render('ws_deck');
+        } catch(E) {
+        }
+    }
+}
+
 function found_ws_info_in_Achrome() {
     JSAN.use('util.file');
     var f = new util.file();
@@ -766,13 +785,21 @@ function handle_migration() {
 
 function auto_login(loginInfo) {
     G.data.stash_retrieve();
+    var should_test_server = true;
     if(G.data.session) return; // We are logged in. No auto-logoff supported.
-    if(loginInfo.host) G.auth.controller.view.server_prompt.value = loginInfo.host;
+    if(loginInfo.host) {
+        G.auth.controller.view.server_prompt.value = loginInfo.host;
+        G.auth.test_server(loginInfo.host);
+        G.auth.controller.render('ws_deck');
+        should_test_server = false;
+    }
     if(loginInfo.user) G.auth.controller.view.name_prompt.value = loginInfo.user;
     if(loginInfo.passwd) G.auth.controller.view.password_prompt.value = loginInfo.passwd;
     if(loginInfo.host && loginInfo.user && loginInfo.passwd && G.data.ws_info && G.data.ws_info[loginInfo.host]) {
-        G.auth.login();
+        // Give test_server time to finish
+        setTimeout(function() { G.auth.login(); }, 1000);
     }
+    return should_test_server;
 }
 
 dump('exiting main/main.js\n');
diff --git a/Open-ILS/xul/staff_client/defaults/preferences/initialhost.js b/Open-ILS/xul/staff_client/defaults/preferences/initialhost.js
new file mode 100644
index 0000000..3b5ad2d
--- /dev/null
+++ b/Open-ILS/xul/staff_client/defaults/preferences/initialhost.js
@@ -0,0 +1,3 @@
+// Initial hostname
+// For clean installs
+pref("open-ils.initial_hostname", "%INITIAL_HOST%");
diff --git a/configure.ac b/configure.ac
index 1d99e19..89e64f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,14 @@ AC_ARG_WITH([updateshost],
 [AUTOUPDATE_HOST=])
 AC_SUBST([AUTOUPDATE_HOST])
 
+# Default updates host?
+AC_ARG_WITH([initialhost],
+[  --with-initialhost=hostname    default hostname for staff client (default is blank)],
+[INITIAL_HOST=${withval}],
+[INITIAL_HOST=])
+AC_SUBST([INITIAL_HOST])
+
+
 # install Evergreen Apache modules?
 AC_ARG_ENABLE([apache-modules],
 [  --disable-apache-modules    disables installation of the Evergreen Apache modules ],
diff --git a/docs/RELEASE_NOTES_NEXT/initial_host.txt b/docs/RELEASE_NOTES_NEXT/initial_host.txt
new file mode 100644
index 0000000..7699480
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/initial_host.txt
@@ -0,0 +1,12 @@
+Staff Client Initial Hostname
+-----------------------------
+
+For fresh installs of the staff client a common issue is people remembering what hostname to specify. If you are building your own staff clients you can now fill this in automatically.
+
+You can specify this when configuring Evergreen with a new configure option:
+
+--with-initialhost=example.org
+
+It is also possible to specify when building the staff client itself using the INITIAL_HOST variable:
+
+make INITIAL_HOST=example.org build

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/xul/staff_client/Makefile.am              |    2 +
 .../staff_client/chrome/content/auth/controller.js |    9 ++++-
 .../xul/staff_client/chrome/content/main/main.js   |   33 ++++++++++++++++++--
 .../defaults/preferences/initialhost.js            |    3 ++
 configure.ac                                       |    8 +++++
 docs/RELEASE_NOTES_NEXT/initial_host.txt           |   12 +++++++
 6 files changed, 62 insertions(+), 5 deletions(-)
 create mode 100644 Open-ILS/xul/staff_client/defaults/preferences/initialhost.js
 create mode 100644 docs/RELEASE_NOTES_NEXT/initial_host.txt


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list