1 Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) {
2 var link = choose_url(hit);
3 if (!link) link = choose_url(hit['location'][0]);
5 html += '<li class="search-result" id="rec_' + hit.recid + '" >'
6 + '<h3 class="title">';
7 if (link) html += '<a href="'+link+'" target="_blank" >';
8 html += hit["md-title"];
9 if (link) html += '</a>';
11 html += '<div class="search-snippet-info">'
12 + '<p class="search-snippet"></p>'
13 + '<div class="ting-object clearfix">'
14 + '<div class="ting-overview clearfix">'
15 + '<div class="left-column left">'
16 + '<div class="picture"></div>'
18 + '<div class="right-column left">';
19 if (hit["md-author"]) {
20 html += '<div class="creator"><span class="byline">By </span>'
21 + '<a class="author" href="/search/meta/'+hit['md-author']+'">'
22 + hit['md-author']+'</a>';
24 html += '<span class="date"> ('+hit['md-date']+')</span>';
26 html += '</div><p></p>';
29 if (hit["md-description"]) {
30 // limit description to 400 characters
31 html += hit["md-description"][0].substr(0, 400);
40 Drupal.theme.prototype.mkdruDetail = function(data, linkBack) {
41 var html = '<table id="det_' + data.recid +'">';
42 if (data["md-title"] != undefined) {
43 html += '<tr><th>' + Drupal.t("Title") + '</th><td><strong>:</strong> '
45 if (data["md-title-remainder"] !== undefined) {
46 html += ' : <span>' + data["md-title-remainder"] + ' </span>';
48 if (data["md-title-responsibility"] !== undefined) {
49 html += ' <span><i>'+ data["md-title-responsibility"] +'</i></span>';
53 if (data["md-date"] != undefined)
54 html += '<tr><th>' + Drupal.t("Date") + '</th><td><strong>:</strong> '
55 + data["md-date"] + '</td></tr>';
56 if (data["md-author"] != undefined)
57 html += '<tr><th>' + Drupal.t("Author") + '</th><td><strong>:</strong> '
58 + data["md-author"] + '</td></tr>';
59 if (data["md-electronic-url"] != undefined)
60 html += '<tr><th>URL</th><td><strong>:</strong> <a href="'
61 + data["md-electronic-url"] + '" target="_blank">'
62 + data["md-electronic-url"] + '</a>' + '</td></tr>';
63 if (data["location"][0]["md-subject"] != undefined)
64 html += '<tr><th>' + Drupal.t("Subject") + '</th><td><strong>:</strong> '
65 + data["location"][0]["md-subject"] + '</td></tr>';
66 if (data["location"][0]["@name"] != undefined)
67 html += '<tr><th>' + Drupal.t("Location") + '</th></td><td><strong>:</strong> '
68 + data["location"][0]["@name"] + " (" + data["location"][0]["@id"] + ")"
70 html += '</table></div>';
71 html += '<a href="' + linkBack + '">Return to result list...</a>';
79 * Array of hrefs for page links.
81 * Number of first page.
83 * Number of current page.
85 * Total number of pages.
87 * Href for previous page.
91 Drupal.theme.prototype.mkdruPager = function (pages, start, current, total, prev, next) {
94 html += '<a href="' + prev + '" class="mkdru-pager-prev"><< '
95 + Drupal.t("Prev") + '</a> | ';
97 html += '<span class="mkdru-pager-prev"><< ' + Drupal.t("Prev")
103 for (var i = 0; i < pages.length; i++) {
104 if (i + start == current)
105 html += ' <span class="mkdru-pager-current">' + (i + start) + '</span>';
107 html += ' <a href="' + pages[i] + '">' + (i + start) + '</a>';
114 html += ' | <a href="' + next + '" class="mkdru-pager-next">'
115 + Drupal.t("Next") + ' >></a>';
117 html += ' | <span class="mkdru-pager-next">' + Drupal.t("Next")
118 + ' >></span>';
123 Drupal.theme.prototype.mkdruCounts = function(first, last, available, total) {
125 return first + Drupal.t(' to ') + last + Drupal.t(' of ') + available
126 + Drupal.t(' available (') + total + Drupal.t(' found)');
128 return Drupal.t('No results');
131 Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) {
132 return Drupal.t('Waiting on ') + activeClients + Drupal.t(' out of ')
133 + clients + Drupal.t(' targets');
136 Drupal.theme.prototype.mkdruFacet = function (terms, facet, max, selections) {
138 for (var i = 0; i < terms.length && i < max; i++ ) {
140 html += '<a href="'+term.toggleLink+'"';
141 if (term.selected) html += ' class="cross"><strong';
142 html += '>'+terms[i].name;
143 if (term.selected) html += "</strong>";
144 html += '</a><span> (' + terms[i].freq
147 if (terms.length == 0 && selections && selections.length) {
148 for (var i=0; i<selections.length; i++) {
150 // since we have no target name (only id) go for the basename
151 // FIXME get the proper target name
152 var name = facet == "source" ? selections[i].replace(/.*[\/\\]/, "")
155 html += '<a class="cross" href="'
156 + mkdru.removeLimit(facet, selections[i])
157 + '"><strong>'+name+'</strong></a><span> (0)</span><br/>';
164 Drupal.theme.prototype.mkdruFacetContainer = function (facetsCfg) {
166 for (var fname in facetsCfg) {
167 facetsCfg[fname].originalKey = fname;
168 fs.push(facetsCfg[fname]);
170 fs.sort(function (a,b) { return a.orderWeight - b.orderWeight });
171 var html = '<div class="content"><table class="mkdru-facets-table"><tr>';
172 for (var i=0; i<fs.length; i++) {
174 html += '<td><fieldset class="form-wrapper">'
175 html += '<legend><span class="fieldset-legend">'+f.displayName
177 html += '<div class="fieldset-wrapper">';
178 html += '<div class="mkdru-facet-list-container mkdru-facet-'
179 +f.originalKey+'"/>';
181 html += '</fieldset></td>'
183 html += '</tr></table></div>';