X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=mkdru.theme.js;h=41cc7fcf18c1f2bb9efa3f12b83eccc658b2304c;hb=89ab9a6226eb6fa7da943bb221d720225977329f;hp=fa4964cccdfc1541aac2f39f688d91bd012cb72c;hpb=1ce6a60df53c9b5e33a5328890bca1133b11ae8e;p=mkdru-moved-to-drupal.org.git diff --git a/mkdru.theme.js b/mkdru.theme.js index fa4964c..41cc7fc 100644 --- a/mkdru.theme.js +++ b/mkdru.theme.js @@ -1,39 +1,140 @@ Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) { + var html = ""; + + // OPEN - result list item + html += '
  • ' + + // 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 '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]); - var html = ""; - html += '
  • ' - + '

    '; - if (link) html += ''; + + html += '

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

    '; - html += '
    ' - + '

    ' - + '
    ' - + '
    ' - + '
    ' - + '
    ' - + '
    ' - + '
    '; + + + html += '
    '; + // author if (hit["md-author"]) { - html += '
    ' - + '' - + hit['md-author']+''; - if (hit['md-date']) { - html += ' ('+hit['md-date']+')'; + 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"]; } - html += '

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

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

    '; } - html += '
    ' - html += '
    ' - 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; };