From 5b702c3daf41dfea3c46a42c0c55a6c1488a44b4 Mon Sep 17 00:00:00 2001
From: Thomas Berezansky <tsbere@mvlc.org>
Date: Thu, 25 Aug 2011 07:44:03 -0400
Subject: [PATCH] Support server/id for server name

Strip off the /id part to get the real server name.
Each /id gets a different workstation registration.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
---
 Open-ILS/xul/staff_client/chrome/content/auth/controller.js | 5 +++--
 Open-ILS/xul/staff_client/chrome/content/main/main.js       | 2 +-
 2 files changed, 4 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 2b3a14a458..35d885c9bf 100644
--- a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js
+++ b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js
@@ -132,7 +132,7 @@ auth.controller.prototype = {
                                 '', 
                                 'chrome,centerscreen,modal', 
                                 { 
-                                    'location' : 'https://' + obj.controller.view.server_prompt.value, 
+                                    'location' : 'https://' + obj.controller.view.server_prompt.value.match(/^[^\/]*/), 
                                     'prefetchCert' : true 
                                 } 
                             );
@@ -291,6 +291,7 @@ auth.controller.prototype = {
                 obj.controller.view.server_prompt.value = url;
             }
         }
+        url = url.match(/^[^\/]*/).toString(); // Only test the pre-slash URL
         obj.controller.view.submit_button.disabled = true;
         obj.controller.view.server_prompt.disabled = true;
         var s = document.getElementById('status');
@@ -427,7 +428,7 @@ auth.controller.prototype = {
         this.controller.view.password_prompt.disabled = true;
         this.controller.view.submit_button.disabled = true;
         this.controller.view.apply_locale_btn.disabled = true;
-        XML_HTTP_SERVER = this.controller.view.server_prompt.value;
+        XML_HTTP_SERVER = this.controller.view.server_prompt.value.match(/^[^\/]*/).toString();
 
         try {
 
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 77e72afb46..123e3de467 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/main.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/main.js
@@ -342,7 +342,7 @@ function main_init() {
 
         G.auth.on_login = function() {
 
-            var url = G.auth.controller.view.server_prompt.value || urls.remote;
+            var url = G.auth.controller.view.server_prompt.value.match(/^[^\/]*/).toString() || urls.remote;
 
             G.data.server_unadorned = url; G.data.stash('server_unadorned'); G.data.stash_retrieve();
 
-- 
2.11.0