X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=experiments%2Fspclient%2Fmkws.js;h=b29be6d17210470f2defebb11ecf0995dc4566d0;hb=8d5d8113fbe6cfe3e4061dff828eb0fddae2061c;hp=43c4bacdb38180586caf8b9181c9c5bd83f505bf;hpb=e1f238d333815904dea82d85893d10852f228328;p=mkws-moved-to-github.git diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index 43c4bac..b29be6d 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -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') + '.\
\ @@ -666,7 +693,7 @@ function mkws_html_lang(mkws_config) { data += ' | '; if (lang == l) { - data += l; + data += ' ' + l + ' '; } else { data += ' ' + l + ' ' }