X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=tools%2Fhtdocs%2Fmkws.js;h=d3adf6d42de244fe5af23c2c46e0b6c8071b8fb5;hb=2d0ada79f156cfca001f06278156ee4fea848837;hp=df75dd61cf8b2f39f81561ff93cf1287a4e8328e;hpb=4cd979fd64927a1fce7e7903a15e4282fc6957d1;p=mkws-moved-to-github.git diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index df75dd6..d3adf6d 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -160,6 +160,7 @@ Handlebars.registerHelper('commaList', function(items, options) { /* default mkws config */ var config_default = { use_service_proxy: true, + pazpar2_url: "http://mkws.indexdata.com/service-proxy/", service_proxy_auth: "http://mkws.indexdata.com/service-proxy-auth", lang: "", sort_options: [["relevance"], ["title:1", "title"], ["date:0", "newest"], ["date:1", "oldest"]], @@ -196,7 +197,6 @@ Handlebars.registerHelper('commaList', function(items, options) { mkws.sort = mkws_config.sort_default; debug("copied mkws_config.sort_default '" + mkws_config.sort_default + "' to mkws.sort"); -mkws.pazpar2path = mkws_config.pazpar2_url || "http://mkws.indexdata.com/service-proxy/"; mkws.usesessions = mkws_config.use_service_proxy ? false : true; if (mkws_config.query_width < 5 || mkws_config.query_width > 150) { @@ -221,7 +221,7 @@ for (var key in mkws_config) { // autoInit is set to true on default var my_paz = new pz2( { "onshow": my_onshow, "showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way - "pazpar2path": mkws.pazpar2path, + "pazpar2path": mkws_config.pazpar2_url, "oninit": my_oninit, "onstat": my_onstat, "onterm": my_onterm, @@ -906,7 +906,8 @@ function mkws_html_all() { if (mkws_config.use_service_proxy) mkws_service_proxy_auth(mkws_config.service_proxy_auth, - mkws_config.service_proxy_auth_domain); + mkws_config.service_proxy_auth_domain, + mkws_config.pazpar2_url); if (mkws_config.responsive_design_width) { // Responsive web design - change layout on the fly based on @@ -1015,9 +1016,14 @@ function mkws_html_perpage() { * The username/password is configured in the apache config file * for the site. */ -function mkws_service_proxy_auth(auth_url, auth_domain) { +function mkws_service_proxy_auth(auth_url, auth_domain, pp2_url) { debug("Run service proxy auth URL: " + auth_url); + if (!auth_domain) { + auth_domain = pp2_url.replace(/^http:\/\/(.*?)\/.*/, '$1'); + debug("guessed auth_domain '" + auth_domain + "' from pp2_url '" + pp2_url + "'"); + } + var request = new pzHttpRequest(auth_url, function(err) { alert("HTTP call for authentication failed: " + err) return;