@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
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') {
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();
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); }
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();
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');
[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 ],
--- /dev/null
+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