1 Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) {
4 // OPEN - result list item
5 html += '<li class="mkdru-result" id="rec_' + hit.recid + '" >'
8 html += '<div class="picture"></div>';
11 html += '<div class="record">';
15 if (hit["md-medium"] && hit["md-medium"][0]) {
16 html += '<div class="types">'
17 + '<ul class="ting-search-collection-types item-list">'
18 + '<li class="available even first last">';
19 switch (hit["md-medium"][0]) {
20 case '(CD)videorecording':
21 html += Drupal.t('CD');
23 case '(DVD)videorecording':
24 html += Drupal.t('DVD');
27 html += Drupal.t('article');
30 html += Drupal.t('book');
32 case 'cartographic material':
33 html += Drupal.t('map');
35 case 'electronicresource':
36 html += Drupal.t('online');
38 case 'Enregistrementsonore':
39 html += Drupal.t('recording');
41 case 'enregistrementvidéo':
42 html += Drupal.t('video');
45 html += Drupal.t('map');
48 html += Drupal.t('microform');
51 html += Drupal.t('microform');
53 case 'resourceélectronique':
54 html += Drupal.t('online');
56 case 'ressourceélectronique':
57 html += Drupal.t('online');
59 case 'soundrecording':
60 html += Drupal.t('recording');
62 case 'videorecording':
63 html += Drupal.t('video');
66 html += Drupal.t('other');
69 html += '</li></ul></div>';
74 var link = choose_url(hit);
75 if (!link) link = choose_url(hit['location'][0]);
77 html += '<h3 class="title">';
78 if (link) html += '<a href="' + link + '" target="_blank" class="title">';
79 html += hit["md-title"];
80 if (hit["md-title-remainder"])
81 html += ' - ' + hit["md-title-remainder"];
82 if (link) html += '</a>';
86 html += '<div class="meta">';
88 if (hit["md-author"]) {
89 html += '<span class="creator">' + Drupal.t('By')
90 + ' <em>' + hit['md-author'] + '</em></span> ';
91 } else if (hit['md-title-responsibility']) {
92 html += '<span class="creator">' + ' <em>' + hit['md-title-responsibility'] + '</em></span>';
96 html += '<span class="publication_date"> (<em>'
97 + hit['md-date'] + '</em>)</span>';
102 html += '<div class="meta">';
103 if (hit["location"] && hit["location"][0] && hit["location"][0]["md-journal-title"]) {
104 html += hit["location"][0]["md-journal-title"];
105 if (hit["location"][0]["md-journal-subpart"]) {
106 html += ' ' + hit["location"][0]["md-journal-subpart"];
108 } else if (hit["md-journal-title"]) {
109 html += hit["md-journal-title"];
110 if (hit["md-journal-subpart"]) {
111 html += ' ' + hit["md-journal-subpart"];
118 if (hit["md-description"]) {
119 html += '<div class="abstract"><p>';
120 // limit description to 400 characters
121 html += hit["md-description"][0].substr(0, 400);
122 html += '</p></div>';
127 if (hit["location"] && hit["location"][0] && hit["location"][0]["md-subject"]) {
128 html += '<div class="subjects"><h4>'
129 + Drupal.t('Subjects') + ':</h4><ul>';
130 for (var i = 0; i < hit["location"][0]["md-subject"].length; i++) {
131 html += '<li>' + hit["location"][0]["md-subject"][i] + '</li>';
133 html += '</ul></div>';
136 // CLOSE - record div
138 // CLOSE - result list item
144 Drupal.theme.prototype.mkdruDetail = function(data, linkBack) {
145 var html = '<table id="det_' + data.recid +'">';
146 if (data["md-title"] != undefined) {
147 html += '<tr><th>' + Drupal.t("Title") + '</th><td><strong>:</strong> '
149 if (data["md-title-remainder"] !== undefined) {
150 html += ' : <span>' + data["md-title-remainder"] + ' </span>';
152 if (data["md-title-responsibility"] !== undefined) {
153 html += ' <span><i>'+ data["md-title-responsibility"] +'</i></span>';
155 html += '</td></tr>';
157 if (data["md-date"] != undefined)
158 html += '<tr><th>' + Drupal.t("Date") + '</th><td><strong>:</strong> '
159 + data["md-date"] + '</td></tr>';
160 if (data["md-author"] != undefined)
161 html += '<tr><th>' + Drupal.t("Author") + '</th><td><strong>:</strong> '
162 + data["md-author"] + '</td></tr>';
163 if (data["md-electronic-url"] != undefined)
164 html += '<tr><th>URL</th><td><strong>:</strong> <a href="'
165 + data["md-electronic-url"] + '" target="_blank">'
166 + data["md-electronic-url"] + '</a>' + '</td></tr>';
167 if (data["location"][0]["md-subject"] != undefined)
168 html += '<tr><th>' + Drupal.t("Subject") + '</th><td><strong>:</strong> '
169 + data["location"][0]["md-subject"] + '</td></tr>';
170 if (data["location"][0]["@name"] != undefined)
171 html += '<tr><th>' + Drupal.t("Location") + '</th></td><td><strong>:</strong> '
172 + data["location"][0]["@name"] + " (" + data["location"][0]["@id"] + ")"
174 html += '</table></div>';
175 html += '<a href="' + linkBack + '">Return to result list...</a>';
183 * Array of hrefs for page links.
185 * Number of first page.
187 * Number of current page.
189 * Total number of pages.
191 * Href for previous page.
193 * Href for next page.
195 Drupal.theme.prototype.mkdruPager = function (pages, start, current, total, prev, next) {
198 html += '<a href="' + prev + '" class="mkdru-pager-prev"><< '
199 + Drupal.t("Prev") + '</a> | ';
201 html += '<span class="mkdru-pager-prev"><< ' + Drupal.t("Prev")
207 for (var i = 0; i < pages.length; i++) {
208 if (i + start == current)
209 html += ' <span class="mkdru-pager-current">' + (i + start) + '</span>';
211 html += ' <a href="' + pages[i] + '">' + (i + start) + '</a>';
218 html += ' | <a href="' + next + '" class="mkdru-pager-next">'
219 + Drupal.t("Next") + ' >></a>';
221 html += ' | <span class="mkdru-pager-next">' + Drupal.t("Next")
222 + ' >></span>';
227 Drupal.theme.prototype.mkdruCounts = function(first, last, available, total) {
229 return first + Drupal.t(' to ') + last + Drupal.t(' of ') + available
230 + Drupal.t(' available (') + total + Drupal.t(' found)');
232 return Drupal.t('No results');
235 Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) {
236 if (Number(activeClients) < 1) {
237 jQuery('a[href="#addon-0-result"]').removeClass('spinning');
239 return Drupal.t('Waiting on ') + activeClients + Drupal.t(' out of ')
240 + clients + Drupal.t(' targets');
243 Drupal.theme.prototype.mkdruFacet = function (terms, facet, max, selections) {
245 for (var i = 0; i < terms.length && i < max; i++ ) {
247 html += '<a href="'+term.toggleLink+'"';
248 if (term.selected) html += ' class="cross"><strong';
249 html += '>'+terms[i].name;
250 if (term.selected) html += "</strong>";
251 html += '</a><span> (' + terms[i].freq
254 if (terms.length == 0 && selections && selections.length) {
255 for (var i=0; i<selections.length; i++) {
257 // since we have no target name (only id) go for the basename
258 // FIXME get the proper target name
259 var name = facet == "source" ? selections[i].replace(/.*[\/\\]/, "")
262 html += '<a class="cross" href="'
263 + mkdru.removeLimit(facet, selections[i])
264 + '"><strong>'+name+'</strong></a><span> (0)</span><br/>';
271 Drupal.theme.prototype.mkdruFacetContainer = function (facetsCfg) {
273 for (var fname in facetsCfg) {
274 facetsCfg[fname].originalKey = fname;
275 fs.push(facetsCfg[fname]);
277 fs.sort(function (a,b) { return a.orderWeight - b.orderWeight });
278 var html = '<div class="content"><table class="mkdru-facets-table"><tr>';
279 for (var i=0; i<fs.length; i++) {
281 html += '<td><fieldset class="form-wrapper">'
282 html += '<legend><span class="fieldset-legend">'+f.displayName
284 html += '<div class="fieldset-wrapper">';
285 html += '<div class="mkdru-facet-list-container mkdru-facet-'
286 +f.originalKey+'"/>';
288 html += '</fieldset></td>'
290 html += '</tr></table></div>';