X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=mkdru.theme.js;h=ce5fe15300c2de9a83a11680ca45527d70be64db;hb=refs%2Fheads%2Fding1-theme;hp=7e660f6b1bf18d1879972800dcf7ab5996d0841e;hpb=26900b02cc656a600d67454547cf1699174c713b;p=mkdru-moved-to-drupal.org.git diff --git a/mkdru.theme.js b/mkdru.theme.js index 7e660f6..ce5fe15 100644 --- a/mkdru.theme.js +++ b/mkdru.theme.js @@ -1,46 +1,178 @@ Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) { var html = ""; + + // OPEN - result list item html += '
  • ' - + '' + num + '. ' - + '' - + hit["md-title"] + ' '; - if (hit["md-title-remainder"] !== undefined) { - html += '' - + hit["md-title-remainder"] + ' '; + + // thumbnail + html += '
    '; + + // OPEN - record div + html += '
    '; + + + // media type + if (hit["md-medium"] && hit["md-medium"][0]) { + html += '
    ' + + '
      ' + + '
    • '; + switch (hit["md-medium"][0]) { + case '(CD)videorecording': + html += Drupal.t('CD'); + break; + case '(DVD)videorecording': + html += Drupal.t('DVD'); + break; + case 'article': + html += Drupal.t('article'); + break; + case 'book': + html += Drupal.t('book'); + break; + case 'cartographic material': + html += Drupal.t('map'); + break; + case 'electronicresource': + html += Drupal.t('online'); + break; + case 'Enregistrementsonore': + html += Drupal.t('recording'); + break; + case 'enregistrementvidéo': + html += Drupal.t('video'); + break; + case 'map': + html += Drupal.t('map'); + break; + case 'microform': + html += Drupal.t('microform'); + break; + case 'microforme': + html += Drupal.t('microform'); + break; + case 'resourceélectronique': + html += Drupal.t('online'); + break; + case 'ressourceélectronique': + html += Drupal.t('online'); + break; + case 'soundrecording': + html += Drupal.t('recording'); + break; + case 'videorecording': + html += Drupal.t('video'); + break; + default: + html += Drupal.t('other'); + break; + } + html += '
    '; + } + + + // title and link + var link = choose_url(hit); + if (!link) link = choose_url(hit['location'][0]); + + html += '

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

    '; + + + html += '
    '; + // author + if (hit["md-author"]) { + html += '' + Drupal.t('By') + + ' ' + hit['md-author'] + ' '; + } else if (hit['md-title-responsibility']) { + html += '' + ' ' + hit['md-title-responsibility'] + ''; + } + // date + if (hit['md-date']) { + html += ' (' + + hit['md-date'] + ')'; + } + html += '
    '; + + // journal title + html += '
    '; + if (hit["location"] && hit["location"][0] && hit["location"][0]["md-journal-title"]) { + html += hit["location"][0]["md-journal-title"]; + if (hit["location"][0]["md-journal-subpart"]) { + html += '   ' + hit["location"][0]["md-journal-subpart"]; + } + } else if (hit["md-journal-title"]) { + html += hit["md-journal-title"]; + if (hit["md-journal-subpart"]) { + html += '   ' + hit["md-journal-subpart"]; + } } - if (hit["md-title-responsibility"] !== undefined) { - html += '' - + hit["md-title-responsibility"] - + ''; + html += '
    '; + + + // description + if (hit["md-description"]) { + html += '

    '; + // limit description to 400 characters + html += hit["md-description"][0].substr(0, 400); + html += '

    '; } + + + // subjects + if (hit["location"] && hit["location"][0] && hit["location"][0]["md-subject"]) { + html += '

    ' + + Drupal.t('Subjects') + ':

      '; + for (var i = 0; i < hit["location"][0]["md-subject"].length; i++) { + html += '
    • ' + hit["location"][0]["md-subject"][i] + '
    • '; + } + html += '
    '; + } + + // CLOSE - record div + html += '
    '; + // CLOSE - result list item 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 +224,69 @@ 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) { + if (Number(activeClients) < 1) { + jQuery('a[href="#addon-0-result"]').parent().removeClass('spinning'); + } + 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 +};