Hardcode the Ding1 theme
authorJakub Skoczen <jakub@indexdata.dk>
Tue, 8 Mar 2011 11:06:20 +0000 (12:06 +0100)
committerJakub Skoczen <jakub@indexdata.dk>
Tue, 8 Mar 2011 11:06:20 +0000 (12:06 +0100)
Since enabling the the theme externally breaks the site-layout,
for some reason

mkdru-results.tpl.php
mkdru.client.js
mkdru.css
mkdru.theme.js

index 1dcfc53..1f72b89 100644 (file)
@@ -1,7 +1,9 @@
 <div class="mkdru-detail"></div>
+<div id="mkdru-raw-facet-container">
+</div>
 <div class="mkdru-results">
   <div class="mkdru-above mkdru-above-below"><span class="mkdru-counts"></span><span class="mkdru-status"></span></div>
   <div class="mkdru-navi"></div>
   <ul class="mkdru-result-list"></ul>
   <div class="mkdru-below mkdru-above-below"><span class="mkdru-pager"></span></div>
-</div>
\ No newline at end of file
+</div>
index 5638dd1..fde7675 100644 (file)
@@ -8,7 +8,7 @@ var mkdru = {
   totalRec: 0,
   pagerRange: 6,
   pazpar2Path: Drupal.settings.mkdru.pz2_path,
-  facetContainerSelector: Drupal.settings.mkdru.facetContainerSelector,
+  facetContainerSelector: '#mkdru-raw-facet-container',
   // Facets
   facets: {
     source: {
index 7efeb50..772b332 100644 (file)
--- a/mkdru.css
+++ b/mkdru.css
@@ -1,7 +1,12 @@
-a.cross {
+a.cross:hover {
   text-decoration: line-through;
 }
 
+.mkdru-facets-table {
+  table-layout: fixed;
+  width: 700px;
+}
+
 .node-mkdru div {
   margin: 1em 0em;
 }
index 034b403..4b0638f 100644 (file)
@@ -1,18 +1,38 @@
 Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) {
+  var link = choose_url(hit);
+  if (!link) link = choose_url(hit['location'][0]);
   var html = "";
-  html += '<li class="mkdru-result" id="rec_' + hit.recid + '" >'
-          + '<span>' + num + '. </span>'
-          + '<a href="' + detailLink + '" class="mkdru-result-title">'
-          + hit["md-title"] + '</a> ';
-  if (hit["md-title-remainder"] !== undefined) {
-    html += '<span class="mkdru-result-title-remainder">' 
-            + hit["md-title-remainder"] + ' </span>';
+  html += '<li class="search-result" id="rec_' + hit.recid + '" >'
+    + '<h3 class="title">';
+  if (link) html += '<a href="'+link+'" target="_blank" >';
+  html += hit["md-title"];
+  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">';
+  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 += '</div><p></p>';
   }
-  if (hit["md-title-responsibility"] !== undefined) {
-    html += '<span class="mkdru-result-author"><i>'
-            + hit["md-title-responsibility"]
-            + '</i></span>';
+  html += "</div>";
+  if (hit["md-description"]) {
+    // limit description to 400 characters
+    html += hit["md-description"][0].substr(0, 400);
   }
+  html += '</div>'
+  html += '</div>'
+  html += '</div>'
   html += '</li>';
   return html;
 };
@@ -141,6 +161,24 @@ Drupal.theme.prototype.mkdruFacet = function (terms, facet, max, selections) {
   return html;
 };
 
-Drupal.theme.prototype.mkdruFacetContainer = function (facetCfg) {
-  return "";
+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 = '<div class="content"><table class="mkdru-facets-table"><tr>';
+  for (var i=0; i<fs.length; i++) {
+    var f = fs[i];
+    html += '<td><fieldset class="form-wrapper">'
+    html += '<legend><span class="fieldset-legend">'+f.displayName
+      +'</span></legend>';
+    html += '<div class="fieldset-wrapper">';
+    html += '<div class="mkdru-facet-'+f.originalKey+'"/>';
+    html += '</div>';
+    html += '</fieldset></td>'
+  }
+  html += '</tr></table></div>';
+  return html;
 };