X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=experiments%2Fspclient%2Fmkws.js;h=c97464dfa43dd4dee9dabd0c702d56aaeb36751c;hb=f19fe8fd7a7ec7405272654995aeb07cfdb70c2e;hp=ee5c17a89a28de364fa0a32df27d5e785cfa7ce2;hpb=4e11563b74f5eeb9dc8f0d6a5b305be6159e4339;p=mkws-moved-to-github.git diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index ee5c17a..c97464d 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -19,7 +19,7 @@ if (typeof mkws_config.use_service_proxy === 'undefined') 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; @@ -30,7 +30,7 @@ var mkws_locale_lang = { "Authors": "Autoren", "Subjects": "Schlagwörter", "Sources": "Daten und Quellen", - "TERMLISTS": "Termlisten", + "Termlists": "Termlisten", "Next": "Weiter", "Prev": "Zurück", "Search": "Suche", @@ -54,7 +54,7 @@ var mkws_locale_lang = { "Authors": "Forfattere", "Subjects": "Emner", "Sources": "Kilder", - "TERMLISTS": "TERMLISTS", + "Termlists": "Termlists", "Next": "Næste", "Prev": "Forrige", "Search": "Søg", @@ -150,11 +150,11 @@ function my_onstat(data) { if (stat == null) return; - stat.innerHTML = 'STATUS INFO -- Active clients: ' - + data.activeclients - + '/' + data.clients + ' -- ' - + 'Retrieved records: ' + data.records - + '/' + data.hits + ' :.'; + stat.innerHTML = 'Status info' + + ' -- ' + + '' + data.activeclients + '/' + data.clients + '' + + ' -- ' + + '' + data.records + '/' + data.hits + ''; } function my_onterm(data) { @@ -162,20 +162,27 @@ function my_onterm(data) { return; var termlists = []; - termlists.push('
' + M('TERMLISTS') + ':
' + M('Sources') + '
'); + termlists.push('
' + M('Termlists') + '
'); + + termlists.push('
'); + termlists.push('
' + M('Sources') + '
'); for (var i = 0; i < data.xtargets.length && i < SourceMax; i++ ) { termlists.push('' + data.xtargets[i].name + ' (' + data.xtargets[i].freq + ')
'); } + termlists.push('
'); - termlists.push('
' + M('Subjects') + '
'); + termlists.push('
'); + termlists.push('
' + M('Subjects') + '
'); for (var i = 0; i < data.subject.length && i < SubjectMax; i++ ) { termlists.push('' + data.subject[i].name + ' (' + data.subject[i].freq + ')
'); } + termlists.push('
'); - termlists.push('
' + M('Authors') + '
'); + termlists.push('
'); + termlists.push('
' + M('Authors') + '
'); for (var i = 0; i < data.author.length && i < AuthorMax; i++ ) { termlists.push('' + data.author[i].name @@ -183,6 +190,8 @@ function my_onterm(data) { + data.author[i].freq + ')
'); } + termlists.push('
'); + var termlist = document.getElementById("termlist"); replaceHtml(termlist, termlists.join('')); } @@ -234,6 +243,7 @@ function onFormSubmitEventHandler() resetPage(); loadSelect(); triggerSearch(); + switchView('records'); // In case it's configured to start off as hidden submitted = true; return false; } @@ -369,15 +379,23 @@ function switchView(view) { var targets = document.getElementById('mkwsTargets'); var records = document.getElementById('mkwsRecords'); + var blanket = document.getElementById('mkwsBlanket'); switch(view) { case 'targets': targets.style.display = "block"; records.style.display = "none"; + if (blanket) { blanket.style.display = "none"; } break; case 'records': targets.style.display = "none"; records.style.display = "block"; + if (blanket) { blanket.style.display = "block"; } + break; + case 'none': + targets.style.display = "none"; + records.style.display = "none"; + if (blanket) { blanket.style.display = "none"; } break; default: alert('Unknown view.'); @@ -424,30 +442,39 @@ function renderDetails(data, marker) { var details = '
'; if (marker) details += ''; - if (data["md-title"] != undefined) { - details += ''; - } - if (data["md-date"] != undefined) - details += ''; - if (data["md-author"] != undefined) - details += ''; - if (data["md-electronic-url"] != undefined) - details += ''; - if (data["location"][0]["md-subject"] != undefined) - details += ''; - if (data["location"][0]["@name"] != undefined) - details += ''; + + details += renderField("Title", data["md-title"], data["md-title-remainder"], data["md-title-responsibility"]); + details += renderField("Date", data["md-date"]); + details += renderField("Author", data["md-author"]); + details += renderField("URL", data["md-electronic-url"]); + details += renderField("Subject", data["location"][0]["md-subject"]); + details += renderField("Location", data["location"][0]["@name"], data["location"][0]["@id"]); details += '
'+ marker + '
' + M('Title') + ': '+data["md-title"]; - if (data["md-title-remainder"] !== undefined) { - details += ' : ' + data["md-title-remainder"] + ' '; - } - if (data["md-title-responsibility"] !== undefined) { - details += ' '+ data["md-title-responsibility"] +''; - } - details += '
' + M('Date') + ': ' + data["md-date"] + '
' + M('Author') + ': ' + data["md-author"] + '
URL: ' + data["md-electronic-url"] + '' + '
' + M('Subject') + ': ' + data["location"][0]["md-subject"] + '
' + M('Location') + ': ' + data["location"][0]["@name"] + " (" +data["location"][0]["@id"] + ")" + '
'; + return details; } +function renderField(caption, data, data2, data3) { + if (data === undefined) { + return ""; + } + + if (caption == "URL") { + data = '
' + data + ''; + } + + if (data2 != undefined) { + data = data + " (" + data2 + ")"; + } + + if (data3 != undefined) { + data = data + " " + data3 + ""; + } + + return '' + M(caption) + ': ' + data + ''; +} + + /* * All the HTML stuff to render the search forms and * result pages. @@ -512,7 +539,7 @@ function mkws_html_all(config) { \
\
\ - ' + M('Sort by') + mkws_html_sort(config) + '\ + ' + M('Sort by') + ' ' + mkws_html_sort(config) + '\ ' + M('and show') + ' ' + mkws_html_perpage(config) + '\ ' + M('per page') + '.\
\ @@ -615,7 +642,7 @@ 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);