Use Ding's classes and expand result display.
authorJason Skomorowski <jason@indexdata.com>
Thu, 31 Mar 2011 22:17:30 +0000 (22:17 +0000)
committerJason Skomorowski <jason@indexdata.com>
Thu, 31 Mar 2011 22:17:30 +0000 (22:17 +0000)
mkdru-results.tpl.php
mkdru.css
mkdru.theme.js

index 240cee2..51a298b 100644 (file)
@@ -9,8 +9,10 @@
     </div>
   </div>
   <div class="mkdru-navi"></div>
-  <ul class="mkdru-result-list search-results">
-  </ul>
+  <div id="ting-search-result">
+    <ul class="mkdru-result-list search-results">
+    </ul>
+  </div>
   <div class="mkdru-below mkdru-above-below mkdru-pager-container">
     <div class="mkdru-pager-inner-container">
       <span class="mkdru-pager">
index 5e16bd2..d70681a 100644 (file)
--- 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 {
   float: right;
 }
 
-.mkdru-result a {
-  font-weight: bold;
-}
-
 .mkdru-detail {
   display: none;
 }
index fa4964c..41cc7fc 100644 (file)
 Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) {
+  var html = "";
+
+  // OPEN - result list item
+  html += '<li class="mkdru-result" id="rec_' + hit.recid + '" >'
+
+  // thumbnail
+  html += '<div class="picture"></div>';
+
+  // OPEN - record div
+  html += '<div class="record">';
+
+
+  // media type
+  if (hit["md-medium"] && hit["md-medium"][0]) {
+    html += '<div class="types">'
+      + '<ul class="ting-search-collection-types item-list">'
+      + '<li class="available even first last">';
+    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 += '</li></ul></div>';
+  }
+
+
+  // title and link
   var link = choose_url(hit);
   if (!link) link = choose_url(hit['location'][0]);
-  var html = "";
-  html += '<li class="search-result" id="rec_' + hit.recid + '" >'
-    + '<h3 class="title">';
-  if (link) html += '<a href="'+link+'" target="_blank" >';
+
+  html += '<h3 class="title">';
+  if (link) html += '<a href="' + link + '" target="_blank" class="title">';
   html += hit["md-title"];
+  if (hit["md-title-remainder"])
+    html += ' - ' + hit["md-title-remainder"];
   if (link) html += '</a>';
   html += '</h3>';
-  html += '<div class="search-snippet-info">'
-     + '<p class="search-snippet"></p>'
-     + '<div class="ting-object clearfix">'
-      + '<div class="ting-overview clearfix">'
-        + '<div class="left-column left">'
-          + '<div class="picture"></div>'
-        + '</div>'
-        + '<div class="right-column left">';
+
+
+  html += '<div class="meta">';
+  // author
   if (hit["md-author"]) {
-    html += '<div class="creator"><span class="byline">By </span>'
-      + '<a class="author" href="/search/meta/'+hit['md-author']+'">'
-      + hit['md-author']+'</a>';
-    if (hit['md-date']) {
-      html += '<span class="date"> ('+hit['md-date']+')</span>';
+    html += '<span class="creator">' + Drupal.t('By')
+      + ' <em>' + hit['md-author'] + '</em></span> ';
+  } else if (hit['md-title-responsibility']) {
+    html += '<span class="creator">' + ' <em>' + hit['md-title-responsibility'] + '</em></span>';
+  }
+  // date
+  if (hit['md-date']) {
+    html += '<span class="publication_date"> (<em>'
+      + hit['md-date'] + '</em>)</span>';
+  }
+  html += '</div>';
+
+  // journal title
+  html += '<div class="meta">';
+  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 += '&nbsp;&nbsp;&nbsp;' + hit["location"][0]["md-journal-subpart"];
+    }
+  } else if (hit["md-journal-title"]) {
+    html += hit["md-journal-title"];
+    if (hit["md-journal-subpart"]) {
+      html += '&nbsp;&nbsp;&nbsp;' + hit["md-journal-subpart"];
     }
-    html += '</div><p></p>';
   }
-  html += "</div>";
+  html += '</div>';
+  
+  
+  // description
   if (hit["md-description"]) {
+    html += '<div class="abstract"><p>';
     // limit description to 400 characters
     html += hit["md-description"][0].substr(0, 400);
+    html += '</p></div>';
   }
-  html += '</div>'
-  html += '</div>'
-  html += '</div>'
+
+
+  // subjects
+  if (hit["location"] && hit["location"][0] && hit["location"][0]["md-subject"]) {
+    html += '<div class="subjects"><h4>'
+      + Drupal.t('Subjects') + ':</h4><ul>';
+    for (var i = 0; i < hit["location"][0]["md-subject"].length; i++) {
+      html += '<li>' + hit["location"][0]["md-subject"][i]  + '</li>';
+    }
+    html += '</ul></div>';
+  }
+
+  // CLOSE - record div
+  html += '</div>';
+  // CLOSE - result list item
   html += '</li>';
+
   return html;
 };