X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=mkdru.theme.js;h=7d92e61cb3725e5124162f591787a0e98f9d283f;hb=66f3bea850ee445427da4ec46e18d4374dd3e953;hp=782c935e08234e467e983d47b84741f08e7514b3;hpb=83e16a5c12f1de16a989efb2a8c4db43ac71f9ef;p=mkdru-moved-to-drupal.org.git
diff --git a/mkdru.theme.js b/mkdru.theme.js
index 782c935..7d92e61 100644
--- a/mkdru.theme.js
+++ b/mkdru.theme.js
@@ -1,67 +1,141 @@
-Drupal.theme.prototype.mkdruResult = function(hit, num) {
+Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) {
var html = "";
- html += '
'
+ html += ''
+ '' + num + '. '
- + ''
+ + ''
+ hit["md-title"] + ' ';
if (hit["md-title-remainder"] !== undefined) {
- html += '' + hit["md-title-remainder"] + ' ';
+ html += ''
+ + hit["md-title-remainder"] + ' ';
}
if (hit["md-title-responsibility"] !== undefined) {
- html += ''
+ html += ''
+ hit["md-title-responsibility"]
+ '';
}
html += '';
- return (html);
+ return html;
};
-Drupal.theme.prototype.mkdruPager = function (data, curPage, pages) {
- var onsides = 6;
+Drupal.theme.prototype.mkdruDetail = function(data) {
+ var html = '';
+ if (data["md-title"] != undefined) {
+ 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 += ' |
';
+ }
+ if (data["md-date"] != undefined)
+ html += '' + Drupal.t("Date") + ' | : '
+ + data["md-date"] + ' |
';
+ if (data["md-author"] != undefined)
+ html += '' + Drupal.t("Author") + ' | : '
+ + data["md-author"] + ' |
';
+ if (data["md-electronic-url"] != undefined)
+ html += 'URL | : '
+ + data["md-electronic-url"] + '' + ' |
';
+ if (data["location"][0]["md-subject"] != undefined)
+ html += '' + Drupal.t("Subject") + ' | : '
+ + data["location"][0]["md-subject"] + ' |
';
+ if (data["location"][0]["@name"] != undefined)
+ html += '' + Drupal.t("Location") + ' | : '
+ + data["location"][0]["@name"] + " (" + data["location"][0]["@id"] + ")"
+ + ' |
';
+ html += '
';
+ html += 'Return to result list...';
+ return html;
+};
- var firstClkbl = ( curPage - onsides > 0 )
- ? curPage - onsides
- : 1;
+/**
+ * Pager theme
+ *
+ * @param pages
+ * Array of hrefs for page links.
+ * @param start
+ * Number of first page.
+ * @param current
+ * Number of current page.
+ * @param total
+ * Total number of pages.
+ * @param prev
+ * Href for previous page.
+ * @param next
+ * Href for next page.
+ */
+Drupal.theme.prototype.mkdruPager = function (pages, start, current, total, prev, next) {
+ var html = "";
+ if (prev)
+ html += ' | ';
+ else
+ html += ' | ';
- var lastClkbl = firstClkbl + 2*onsides < pages
- ? firstClkbl + 2*onsides
- : pages;
+ if (start > 1)
+ html += '...';
- var prev = '<< Prev | ';
- if (curPage > 1)
- var prev = ''
- +'<< Prev | ';
+ for (var i = 0; i < pages.length; i++) {
+ if (i + start == current)
+ html += ' ';
+ else
+ html += ' ' + (i + start) + '';
+ }
- var middle = '';
- for(var i = firstClkbl; i <= lastClkbl; i++) {
- var numLabel = i;
- if(i == curPage)
- numLabel = '' + i + '';
+ if (total > i)
+ html += ' ...';
- middle += ' '
- + numLabel + ' ';
- }
+ if (next)
+ html += ' | ';
+ else
+ html += ' | ';
- var next = ' | Next >>';
- if (pages - curPage > 0)
- var next = ' | '
- +'Next >>';
+ return html;
+};
- predots = '';
- if (firstClkbl > 1)
- predots = '...';
+Drupal.theme.prototype.mkdruCounts = function(first, last, available, total) {
+ return first + Drupal.t(' to ') + last + Drupal.t(' of ') + available
+ + Drupal.t(' available (') + total + Drupal.t(' found)');
+};
- postdots = '';
- if (lastClkbl < pages)
- postdots = '...';
+Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) {
+ return Drupal.t('Waiting on ') + activeClients + Drupal.t(' out of ')
+ + clients + Drupal.t(' targets');
+};
- return (prev + predots + middle + postdots + next);
+Drupal.theme.prototype.mkdruFacet = function (terms, facet, max) {
+ var html = "";
+ for (var i = 0; i < terms.length && i < max; i++ ) {
+ html += Drupal.theme('mkdruFacetTerm', terms[i], facet);
+ }
+ return html;
};
-Drupal.theme.prototype.mkdruTerm = function (term, freq, linkClass, id) {
- var html = '' + term + ' (' + freq + ')
';
+Drupal.theme.prototype.mkdruFacetTerm = function (term, facet) {
+ var html = '' + term.name + ' (' + term.freq + ')
';
return html;
+};
+
+Drupal.theme.prototype.mkdruFacetLimit = function (term, link) {
+ if (term) {
+ return '' + Drupal.t('Only displaying ') + term.name + '
'
+ + '' + Drupal.t('Show all...') + '
';
+ }
};
\ No newline at end of file