+Drupal.theme.mkdruFacet = function (terms, facet, max, selections) {
+ var html = "";
+ for (var i = 0; i < terms.length && i < max; i++ ) {
+ var term = terms[i];
+ var id = term.name.split(/w+/).join("-").toLowerCase();
+ html += '<div class="form-item form-type-checkbox">';
+ html += '<input type="checkbox" id="'+id+'" onclick="window.location=\''
+ +term.toggleLink+'\'; return true;" class="form-checkbox"';
+ if (term.selected) html += ' checked="checked"';
+ html += '/><label class="option" for="'+id+'">'+term.name;
+ html += '<span> ('+term.freq+')</span></label></div>';
+ }
+ 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 += '<div class="form-item form-type-checkbox">';
+ html += '<input type="checkbox" checked="checked" id="'+name+'" '
+ +'onclick="window.location=\''+mkdru.removeLimit(facet, selections[i])
+ +'\';return true;" class="form-checkbox"/><label class="option" for="'
+ +name+'">'+name+'</a><span> (0)</span></label></div>';
+ }
+ }
+ }
+ return html;
+};