Drupal.theme.prototype.mkdruResult = function(hit, num, detailLink) {
var html = "";
+
+ // OPEN - result list item
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>';
+
+ // thumbnail
+ html += '<div class="picture"></div>';
+
+ // OPEN - record div
+ html += '<div class="record">';
+
+
+ // media type
+ if (hit["md-medium"] && hit["md-medium"][0]) {
+ html += '<div class="types">'
+ + '<ul class="ting-search-collection-types item-list">'
+ + '<li class="available even first last">';
+ switch (hit["md-medium"][0]) {
+ case '(CD)videorecording':
+ html += Drupal.t('CD');
+ break;
+ case '(DVD)videorecording':
+ html += Drupal.t('DVD');
+ break;
+ case 'article':
+ html += Drupal.t('article');
+ break;
+ case 'book':
+ html += Drupal.t('book');
+ break;
+ case 'cartographic material':
+ html += Drupal.t('map');
+ break;
+ case 'electronicresource':
+ html += Drupal.t('online');
+ break;
+ case 'Enregistrementsonore':
+ html += Drupal.t('recording');
+ break;
+ case 'enregistrementvidéo':
+ html += Drupal.t('video');
+ break;
+ case 'map':
+ html += Drupal.t('map');
+ break;
+ case 'microform':
+ html += Drupal.t('microform');
+ break;
+ case 'microforme':
+ html += Drupal.t('microform');
+ break;
+ case 'resourceélectronique':
+ html += Drupal.t('online');
+ break;
+ case 'soundrecording':
+ html += Drupal.t('recording');
+ break;
+ case 'videorecording':
+ html += Drupal.t('video');
+ break;
+ default:
+ html += Drupal.t('other');
+ break;
+ }
+ html += '</li></ul></div>';
+ }
+
+
+ // title and link
+ var link = choose_url(hit);
+ if (!link) link = choose_url(hit['location'][0]);
+
+ html += '<h3 class="title">';
+ if (link) html += '<a href="' + link + '" target="_blank" class="title">';
+ html += hit["md-title"];
+ if (hit["md-title-remainder"])
+ html += ' - ' + hit["md-title-remainder"];
+ if (link) html += '</a>';
+ html += '</h3>';
+
+
+ html += '<div class="meta">';
+ // author
+ if (hit["md-author"]) {
+ html += '<span class="creator">' + Drupal.t('By')
+ + ' <em>' + hit['md-author'] + '</em></span> ';
+ } else if (hit['md-title-responsibility']) {
+ html += '<span class="creator">' + ' <em>' + hit['md-title-responsibility'] + '</em></span>';
+ }
+ // date
+ if (hit['md-date']) {
+ html += '<span class="publication_date"> (<em>'
+ + hit['md-date'] + '</em>)</span>';
+ }
+ html += '</div>';
+
+ // journal title
+ html += '<div class="meta">';
+ if (hit["location"] && hit["location"][0] && hit["location"][0]["md-journal-title"]) {
+ html += hit["location"][0]["md-journal-title"];
+ if (hit["location"][0]["md-journal-subpart"]) {
+ html += ' ' + hit["location"][0]["md-journal-subpart"];
+ }
+ } else if (hit["md-journal-title"]) {
+ html += hit["md-journal-title"];
+ if (hit["md-journal-subpart"]) {
+ html += ' ' + hit["md-journal-subpart"];
+ }
}
- if (hit["md-title-responsibility"] !== undefined) {
- html += '<span class="mkdru-result-author"><i>'
- + hit["md-title-responsibility"]
- + '</i></span>';
+ html += '</div>';
+
+
+ // description
+ if (hit["md-description"]) {
+ html += '<div class="abstract"><p>';
+ // limit description to 400 characters
+ html += hit["md-description"][0].substr(0, 400);
+ html += '</p></div>';
}
+
+
+ // subjects
+ if (hit["location"] && hit["location"][0] && hit["location"][0]["md-subject"]) {
+ html += '<div class="subjects"><h4>'
+ + Drupal.t('Subjects') + ':</h4><ul>';
+ for (var i = 0; i < hit["location"][0]["md-subject"].length; i++) {
+ html += '<li>' + hit["location"][0]["md-subject"][i] + '</li>';
+ }
+ html += '</ul></div>';
+ }
+
+ // CLOSE - record div
+ html += '</div>';
+ // CLOSE - result list item
html += '</li>';
+
return html;
};
-Drupal.theme.prototype.mkdruDetail = function(data) {
- var html = '<table id=det_"' + data.recid +'>';
+Drupal.theme.prototype.mkdruDetail = function(data, linkBack) {
+ var html = '<table id="det_' + data.recid +'">';
if (data["md-title"] != undefined) {
- html += '<tr><td><b>Title</b></td><td><b>:</b> '+data["md-title"];
- if (data["md-title-remainder"] !== undefined) {
- html += ' : <span>' + data["md-title-remainder"] + ' </span>';
- }
- if (data["md-title-responsibility"] !== undefined) {
- html += ' <span><i>'+ data["md-title-responsibility"] +'</i></span>';
- }
- html += '</td></tr>';
+ html += '<tr><th>' + Drupal.t("Title") + '</th><td><strong>:</strong> '
+ + data["md-title"];
+ if (data["md-title-remainder"] !== undefined) {
+ html += ' : <span>' + data["md-title-remainder"] + ' </span>';
+ }
+ if (data["md-title-responsibility"] !== undefined) {
+ html += ' <span><i>'+ data["md-title-responsibility"] +'</i></span>';
+ }
+ html += '</td></tr>';
}
if (data["md-date"] != undefined)
- html += '<tr><td><b>Date</b></td><td><b>:</b> ' + data["md-date"] + '</td></tr>';
+ html += '<tr><th>' + Drupal.t("Date") + '</th><td><strong>:</strong> '
+ + data["md-date"] + '</td></tr>';
if (data["md-author"] != undefined)
- html += '<tr><td><b>Author</b></td><td><b>:</b> ' + data["md-author"] + '</td></tr>';
+ html += '<tr><th>' + Drupal.t("Author") + '</th><td><strong>:</strong> '
+ + data["md-author"] + '</td></tr>';
if (data["md-electronic-url"] != undefined)
- html += '<tr><td><b>URL</b></td><td><b>:</b> <a href="' + data["md-electronic-url"] + '" target="_blank">' + data["md-electronic-url"] + '</a>' + '</td></tr>';
+ html += '<tr><th>URL</th><td><strong>:</strong> <a href="'
+ + data["md-electronic-url"] + '" target="_blank">'
+ + data["md-electronic-url"] + '</a>' + '</td></tr>';
if (data["location"][0]["md-subject"] != undefined)
- html += '<tr><td><b>Subject</b></td><td><b>:</b> ' + data["location"][0]["md-subject"] + '</td></tr>';
+ html += '<tr><th>' + Drupal.t("Subject") + '</th><td><strong>:</strong> '
+ + data["location"][0]["md-subject"] + '</td></tr>';
if (data["location"][0]["@name"] != undefined)
- html += '<tr><td><b>Location</b></td><td><b>:</b> ' + data["location"][0]["@name"] + " (" +data["location"][0]["@id"] + ")" + '</td></tr>';
+ html += '<tr><th>' + Drupal.t("Location") + '</th></td><td><strong>:</strong> '
+ + data["location"][0]["@name"] + " (" + data["location"][0]["@id"] + ")"
+ + '</td></tr>';
html += '</table></div>';
- html += '<a class="mkdru-detail-back">Return to result list...</a>';
+ html += '<a href="' + linkBack + '">Return to result list...</a>';
return html;
};
return html;
};
-Drupal.theme.prototype.mkdruTerm = function (term, freq, linkClass, id) {
- var html = '<a href="#"';
- if (id)
- html += ' target_id="' + id + '"';
- html += ' class="' + linkClass + '">' + term + '</a><span> (' + freq + ')</span><br/>';
+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');
+};
+
+Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) {
+ return Drupal.t('Waiting on ') + activeClients + Drupal.t(' out of ')
+ + clients + Drupal.t(' targets');
+};
+
+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 += '<a href="'+term.toggleLink+'"';
+ if (term.selected) html += ' class="cross"><strong';
+ html += '>'+terms[i].name;
+ if (term.selected) html += "</strong>";
+ html += '</a><span> (' + terms[i].freq
+ + ')</span><br/>';
+ }
+ if (terms.length == 0 && selections && selections.length) {
+ for (var i=0; i<selections.length; i++) {
+ if (selections[i]) {
+ // since we have no target name (only id) go for the basename
+ // FIXME get the proper target name
+ var name = facet == "source" ? selections[i].replace(/.*[\/\\]/, "")
+ .replace(/\?.*/, '')
+ : selections[i];
+ html += '<a class="cross" href="'
+ + mkdru.removeLimit(facet, selections[i])
+ + '"><strong>'+name+'</strong></a><span> (0)</span><br/>';
+ }
+ }
+ }
+ return html;
+};
+
+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-list-container mkdru-facet-'
+ +f.originalKey+'"/>';
+ html += '</div>';
+ html += '</fieldset></td>'
+ }
+ html += '</tr></table></div>';
return html;
-};
\ No newline at end of file
+};