X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=experiments%2Fspclient%2Fmkws.js;h=d52ffb1922a18a07fb88196e66da396a3d822c97;hb=80a184ac5707055704a91c5470c1913160fa45c2;hp=480c6885207f41c11eda7418ee8d338b4e6bed23;hpb=ff5ea5c06779a2c7e9f004dc80b8d83e39efdf89;p=mkws-moved-to-github.git diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index 480c688..d52ffb1 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -442,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. @@ -530,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') + '.\
\