X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=experiments%2Fspclient%2Fmkws.js;h=5db9f7e86ec88b483baa1be6bd4811b9bbf3fc76;hb=dec2efeac34c321727cd999f2c72606ab1f2854f;hp=a7fb02a33daf2b2c6fdd161fe7cec8c79bd7d5cf;hpb=62c0346fbbeff005cbbeaec128ff3052cb1b71d6;p=mkws-moved-to-github.git diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index a7fb02a..5db9f7e 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -13,10 +13,13 @@ if (!mkws_config) var mkws_config = {}; // for the guys who forgot to define mkws_config... +if (typeof mkws_config.use_service_proxy === 'undefined') + mkws_config.use_service_proxy = true; + var mkws_debug = 1; var pazpar2_url = mkws_config.pazpar2_url ? mkws_config.pazpar2_url : "/pazpar2/search.pz2"; -var service_proxy_url = mkws_config.service_proxy_url ? mkws_config.service_proxy_url : "/service-proxy/"; +var service_proxy_url = mkws_config.service_proxy_url ? mkws_config.service_proxy_url : "http://mkws.indexdata.com/service-proxy/"; var pazpar2path = mkws_config.use_service_proxy ? service_proxy_url : pazpar2_url; var usesessions = mkws_config.use_service_proxy ? false : true; @@ -231,6 +234,7 @@ function onFormSubmitEventHandler() resetPage(); loadSelect(); triggerSearch(); + switchView('records'); // In case it's configured to start off as hidden submitted = true; return false; } @@ -612,25 +616,22 @@ function mkws_html_perpage(config) { */ function mkws_service_proxy_auth(auth_url) { if (!auth_url) - auth_url = "/service-proxy-auth"; + auth_url = "http://mkws.indexdata.com/service-proxy-auth"; debug("Run service proxy auth URL: " + auth_url); - var jqxhr = jQuery.get(auth_url) - .fail(function() { - alert("service proxy authentication failed, give up!"); - }) - .success(function(data) { - if (!jQuery.isXMLDoc(data)) { - alert("service proxy auth response document is not valid XML document, give up!"); - return; - } - var status = $(data).find("status"); - if (status.text() != "OK") { - alert("service proxy auth repsonse status: " + status.text() + ", give up!"); - return; - } - }); + var request = new pzHttpRequest(auth_url); + request.get(null, function(data) { + if (!jQuery.isXMLDoc(data)) { + alert("service proxy auth response document is not valid XML document, give up!"); + return; + } + var status = $(data).find("status"); + if (status.text() != "OK") { + alert("service proxy auth repsonse status: " + status.text() + ", give up!"); + return; + } + }); } /* create locale language menu */ @@ -646,13 +647,15 @@ function mkws_html_lang(mkws_config) { hash[lang_display[i]] = 1; } - if (hash[lang_default] == 1) - list.push(lang_default); - for (var k in mkws_locale_lang) { if (hash[k] == 1 || lang_display.length == 0) list.push(k); } + + // add english link + if (lang_display.length == 0 || hash[lang_default] == 1) + list.push(lang_default); + debug("Language menu for: " + list.join(", ")); /* the HTML part */ @@ -685,7 +688,7 @@ function M(word) { /* implement jQuery.parseQuerystring() for parsing URL parameters */ jQuery.extend({ - parseQuerystring: function() { + parseQuerystring: function() { var nvpair = {}; var qs = window.location.search.replace('?', ''); var pairs = qs.split('&'); @@ -694,13 +697,27 @@ jQuery.extend({ nvpair[pair[0]] = pair[1]; }); return nvpair; -} }); + }, + pazpar2: function(data) { + document.write('
\ +
\ +
\ +
\ +
\ + '); + + mkws_html_all(mkws_config); + } +}); function debug(string) { if (!mkws_debug) return; - if (typeof console === "undefined" || typeof console.log === "undefined") { /* ARGH!!! */ + if (typeof console === "undefined" || typeof console.log === "undefined") { /* ARGH!!! old IE */ return; }