From 0693f46afb18a46ae2d91124eeca54d7d05ae379 Mon Sep 17 00:00:00 2001 From: Jason Skomorowski Date: Thu, 31 Mar 2011 22:17:30 +0000 Subject: [PATCH] Use Ding's classes and expand result display. --- mkdru-results.tpl.php | 6 +- mkdru.css | 5 +- mkdru.theme.js | 145 +++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 128 insertions(+), 28 deletions(-) diff --git a/mkdru-results.tpl.php b/mkdru-results.tpl.php index 240cee2..51a298b 100644 --- a/mkdru-results.tpl.php +++ b/mkdru-results.tpl.php @@ -9,8 +9,10 @@
- +
+ +
diff --git a/mkdru.css b/mkdru.css index 5e16bd2..d70681a 100644 --- a/mkdru.css +++ b/mkdru.css @@ -36,6 +36,7 @@ background-color: #F6F6F2; border-color: #F9F9F9; padding: 3px 5px 3px 5px; + clear: both; } .mkdru-pager-inner-container { @@ -95,10 +96,6 @@ float: right; } -.mkdru-result a { - font-weight: bold; -} - .mkdru-detail { display: none; } 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; }; -- 1.7.10.4