X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=mkdru.theme.js;h=229c482dd6c7870c8f68582a3fbb24ea63dcce5b;hb=9af415332645247f224d98148691d6b6ece99f60;hp=800f2b3fcb953f13101a3918f40843ea55b3dbd8;hpb=aa8e1fdaaa759602a95aa4cdd9186d209ae8abe6;p=mkdru-moved-to-drupal.org.git diff --git a/mkdru.theme.js b/mkdru.theme.js index 800f2b3..229c482 100644 --- a/mkdru.theme.js +++ b/mkdru.theme.js @@ -1,8 +1,8 @@ -Drupal.theme.prototype.mkdruResult = function(hit, num) { +Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) { var html = ""; html += '
  • ' + '' + num + '. ' - + '' + + '' + hit["md-title"] + ' '; if (hit["md-title-remainder"] !== undefined) { html += '' @@ -17,78 +17,130 @@ Drupal.theme.prototype.mkdruResult = function(hit, num) { return html; }; -Drupal.theme.prototype.mkdruDetail = function(data) { - var html = '
    '; +Drupal.theme.prototype.mkdruDetail = function(data, linkBack) { + var html = '
    '; if (data["md-title"] != undefined) { - html += ''; + html += ''; } if (data["md-date"] != undefined) - html += ''; + html += ''; if (data["md-author"] != undefined) - html += ''; + html += ''; if (data["md-electronic-url"] != undefined) - html += ''; + html += ''; if (data["location"][0]["md-subject"] != undefined) - html += ''; + html += ''; if (data["location"][0]["@name"] != undefined) - html += ''; + html += ''; html += '
    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 += '
    ' + 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 += '
    Date: ' + data["md-date"] + '
    ' + Drupal.t("Date") + ': ' + + data["md-date"] + '
    Author: ' + data["md-author"] + '
    ' + Drupal.t("Author") + ': ' + + data["md-author"] + '
    URL: ' + data["md-electronic-url"] + '' + '
    URL: ' + + data["md-electronic-url"] + '' + '
    Subject: ' + data["location"][0]["md-subject"] + '
    ' + Drupal.t("Subject") + ': ' + + data["location"][0]["md-subject"] + '
    Location: ' + data["location"][0]["@name"] + " (" +data["location"][0]["@id"] + ")" + '
    ' + Drupal.t("Location") + ': ' + + data["location"][0]["@name"] + " (" + data["location"][0]["@id"] + ")" + + '
    '; + html += 'Return to result list...'; return html; }; -Drupal.theme.prototype.mkdruPager = function (data, curPage, pages) { - var onsides = 6; - - var firstClkbl = ( curPage - onsides > 0 ) - ? curPage - onsides - : 1; - - var lastClkbl = firstClkbl + 2*onsides < pages - ? firstClkbl + 2*onsides - : pages; +/** + * 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 += '<< ' + + Drupal.t("Prev") + ' | '; + else + html += '<< ' + Drupal.t("Prev") + + ' | '; - var prev = '<< Prev | '; - if (curPage > 1) - var prev = '' - +'<< Prev | '; + if (start > 1) + html += '...'; - var middle = ''; - for(var i = firstClkbl; i <= lastClkbl; i++) { - var numLabel = i; - if(i == curPage) - numLabel = '' + i + ''; + for (var i = 0; i < pages.length; i++) { + if (i + start == current) + html += ' ' + (i + start) + ''; + else + html += ' ' + (i + start) + ''; + } - middle += ' ' - + numLabel + ' '; - } + if (total > i) + html += ' ...'; - var next = ' | Next >>'; - if (pages - curPage > 0) - var next = ' | ' - +'Next >>'; + if (next) + html += ' | ' + + Drupal.t("Next") + ' >>'; + else + html += ' | ' + Drupal.t("Next") + + ' >>'; - predots = ''; - if (firstClkbl > 1) - predots = '...'; + return html; +}; - postdots = ''; - if (lastClkbl < pages) - postdots = '...'; +Drupal.theme.prototype.mkdruCounts = function(first, last, available, total) { + if (last > 0) + return first + Drupal.t(' to ') + last + Drupal.t(' of ') + available + + Drupal.t(' available (') + total + Drupal.t(' found)'); + else + return Drupal.t('No results'); +}; - return (prev + predots + middle + postdots + next); +Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) { + return Drupal.t('Waiting on ') + activeClients + Drupal.t(' out of ') + + clients + Drupal.t(' targets'); }; -Drupal.theme.prototype.mkdruTerm = function (term, freq, linkClass, id) { - var html = '' + term + ' (' + freq + ')
    '; +Drupal.theme.prototype.mkdruFacet = function (terms, facet, max, selections) { + var html = ""; + for (var i = 0; i < terms.length && i < max; i++ ) { + var term = terms[i]; + html += '
    '; + } + if (terms.length == 0 && selections && selections.length) { + for (var i=0; i'+name+'
    (0)
    '; + } + } + } return html; -}; \ No newline at end of file +}; + +Drupal.theme.prototype.mkdruFacetContainer = function (facetsCfg) { + return ""; +};