X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=mkdru.theme.js;h=4b0638f5ff80905998b7539c7a35991d5ff31d35;hb=ac4124aa6e65f509bd976ca2b7a06af171a66fc1;hp=7e660f6b1bf18d1879972800dcf7ab5996d0841e;hpb=26900b02cc656a600d67454547cf1699174c713b;p=mkdru-moved-to-drupal.org.git diff --git a/mkdru.theme.js b/mkdru.theme.js index 7e660f6..4b0638f 100644 --- a/mkdru.theme.js +++ b/mkdru.theme.js @@ -1,46 +1,74 @@ Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) { + var link = choose_url(hit); + if (!link) link = choose_url(hit['location'][0]); var html = ""; - html += '
  • ' - + '' + num + '. ' - + '' - + hit["md-title"] + ' '; - if (hit["md-title-remainder"] !== undefined) { - html += '' - + hit["md-title-remainder"] + ' '; + html += '
  • ' + + '

    '; + if (link) html += ''; + html += hit["md-title"]; + if (link) html += ''; + html += '

    '; + html += '
    ' + + '

    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    '; + if (hit["md-author"]) { + html += '
    ' + + '' + + hit['md-author']+''; + if (hit['md-date']) { + html += ' ('+hit['md-date']+')'; + } + html += '

    '; } - if (hit["md-title-responsibility"] !== undefined) { - html += '' - + hit["md-title-responsibility"] - + ''; + html += "
    "; + if (hit["md-description"]) { + // limit description to 400 characters + html += hit["md-description"][0].substr(0, 400); } + html += '
    ' + html += '
    ' + html += '
    ' html += '
  • '; return html; }; -Drupal.theme.prototype.mkdruDetail = function(data) { - var html = ''; +Drupal.theme.prototype.mkdruDetail = function(data, linkBack) { + var html = '
    '; if (data["md-title"] != undefined) { - html += ''; + html += ''; } if (data["md-date"] != undefined) - html += ''; + html += ''; if (data["md-author"] != undefined) - html += ''; + html += ''; if (data["md-electronic-url"] != undefined) - html += ''; + html += ''; if (data["location"][0]["md-subject"] != undefined) - html += ''; + html += ''; if (data["location"][0]["@name"] != undefined) - html += ''; + html += ''; html += '
    Title: '+data["md-title"]; - if (data["md-title-remainder"] !== undefined) { - html += ' : ' + data["md-title-remainder"] + ' '; - } - if (data["md-title-responsibility"] !== undefined) { - html += ' '+ data["md-title-responsibility"] +''; - } - html += '
    ' + Drupal.t("Title") + ': ' + + data["md-title"]; + if (data["md-title-remainder"] !== undefined) { + html += ' : ' + data["md-title-remainder"] + ' '; + } + if (data["md-title-responsibility"] !== undefined) { + html += ' '+ data["md-title-responsibility"] +''; + } + html += '
    Date: ' + data["md-date"] + '
    ' + Drupal.t("Date") + ': ' + + data["md-date"] + '
    Author: ' + data["md-author"] + '
    ' + Drupal.t("Author") + ': ' + + data["md-author"] + '
    URL: ' + data["md-electronic-url"] + '' + '
    URL: ' + + data["md-electronic-url"] + '' + '
    Subject: ' + data["location"][0]["md-subject"] + '
    ' + Drupal.t("Subject") + ': ' + + data["location"][0]["md-subject"] + '
    Location: ' + data["location"][0]["@name"] + " (" +data["location"][0]["@id"] + ")" + '
    ' + Drupal.t("Location") + ': ' + + data["location"][0]["@name"] + " (" + data["location"][0]["@id"] + ")" + + '
    '; - html += 'Return to result list...'; + html += 'Return to result list...'; return html; }; @@ -92,10 +120,65 @@ Drupal.theme.prototype.mkdruPager = function (pages, start, current, total, prev return html; }; -Drupal.theme.prototype.mkdruTerm = function (term, freq, linkClass, id) { - var html = '' + term + ' (' + freq + ')
    '; +Drupal.theme.prototype.mkdruCounts = function(first, last, available, total) { + if (last > 0) + return first + Drupal.t(' to ') + last + Drupal.t(' of ') + available + + Drupal.t(' available (') + total + Drupal.t(' found)'); + else + return Drupal.t('No results'); +}; + +Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) { + return Drupal.t('Waiting on ') + activeClients + Drupal.t(' out of ') + + clients + Drupal.t(' targets'); +}; + +Drupal.theme.prototype.mkdruFacet = function (terms, facet, max, selections) { + var html = ""; + for (var i = 0; i < terms.length && i < max; i++ ) { + var term = terms[i]; + html += '
    '; + } + if (terms.length == 0 && selections && selections.length) { + for (var i=0; i'+name+'
    (0)
    '; + } + } + } + return html; +}; + +Drupal.theme.prototype.mkdruFacetContainer = function (facetsCfg) { + var fs = []; + for (var fname in facetsCfg) { + facetsCfg[fname].originalKey = fname; + fs.push(facetsCfg[fname]); + } + fs.sort(function (a,b) { return a.orderWeight - b.orderWeight }); + var html = '
    '; + for (var i=0; i'; + html += '
    '; + html += '
    '; + html += '
    '; + html += '' + } + html += '
    '; return html; -}; \ No newline at end of file +};