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 += ''+ marker + ' |
';
- if (data["md-title"] != undefined) {
- details += '' + 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 += ' |
';
- }
- if (data["md-date"] != undefined)
- details += '' + M('Date') + ' | : ' + data["md-date"] + ' |
';
- if (data["md-author"] != undefined)
- details += '' + M('Author') + ' | : ' + data["md-author"] + ' |
';
- if (data["md-electronic-url"] != undefined)
- details += 'URL | : ' + data["md-electronic-url"] + '' + ' |
';
- if (data["location"][0]["md-subject"] != undefined)
- details += '' + M('Subject') + ' | : ' + data["location"][0]["md-subject"] + ' |
';
- if (data["location"][0]["@name"] != undefined)
- details += '' + M('Location') + ' | : ' + data["location"][0]["@name"] + " (" +data["location"][0]["@id"] + ")" + ' |
';
+
+ 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 += '
';
+
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) {
\
\
\
|