1 Drupal.theme.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.mkdruFacetContainer = function (facetsCfg) {
42 for (var fname in facetsCfg) {
43 facetsCfg[fname].originalKey = fname;
44 fs.push(facetsCfg[fname]);
46 fs.sort(function (a,b) { return a.orderWeight - b.orderWeight });
47 var html = '<h2>Facet browser</h2><div class="content">';
48 for (var i=0; i<fs.length; i++) {
51 html += '<div id="mkdru-container-'+f.originalKey
52 +'" style="display: none;">';
53 html += '<fieldset class="form-wrapper">'
54 html += '<legend><span class="fieldset-legend">'+f.displayName
56 html += '<div class="fieldset-wrapper">';
57 html += '<div class="mkdru-facet-'+f.originalKey+' form-checkboxes"/>';
59 html += '</fieldset>';
66 Drupal.theme.mkdruFacet = function (terms, facet, max, selections) {
67 jQuery('#mkdru-container-'+facet).hide();
70 for (var i = 0; i < terms.length && i < max; i++ ) {
73 var id = term.name.split(/w+/).join("-").toLowerCase();
74 html += '<div class="form-item form-type-checkbox">';
75 html += '<input type="checkbox" id="'+id+'" onclick="window.location=\''
76 +term.toggleLink+'\'; return true;" class="form-checkbox"';
77 if (term.selected) html += ' checked="checked"';
78 html += '/><label class="option" for="'+id+'">'+term.name;
79 html += '<span> ('+term.freq+')</span></label></div>';
81 if (terms.length == 0 && selections && selections.length) {
82 for (var i=0; i<selections.length; i++) {
85 // since we have no target name (only id) go for the basename
86 // FIXME get the proper target name
87 var name = facet == "source" ? selections[i].replace(/.*[\/\\]/, "")
90 html += '<div class="form-item form-type-checkbox">';
91 html += '<input type="checkbox" checked="checked" id="'+name+'" '
92 +'onclick="window.location=\''+mkdru.removeLimit(facet, selections[i])
93 +'\';return true;" class="form-checkbox"/><label class="option" for="'
94 +name+'">'+name+'</a><span> (0)</span></label></div>';
98 if (show) jQuery('#mkdru-container-'+facet).show();