2 xtargets: [ "Sources", 16, false ],
3 subject: [ "Subjects", 10, true ],
4 author: [ "Authors", 10, true ]
7 mkws.registerWidgetType('Termlists', function() {
9 var facets = that.config.facets;
11 this.team.queue("termlists").subscribe(function(data) {
12 // display if we first got results
16 for (var i = 0; i < facets.length; i++) {
18 var ref = mkws.facetConfig[name];
20 alert("bad facet configuration: '" + name + "'");
24 widget.autosearch(that);
28 mkws.registerWidgetType('Facet', function() {
30 var teamName = that.team.name();
31 var name = that.config.facet;
32 var ref = mkws.facetConfig[name] || alert("no facet definition for '" + name + "'");
35 var pzIndex = ref[2] ? name : null;
37 that.team.queue("termlists").subscribe(function(data) {
41 acc.push('<div class="termtitle">' + mkws.M(caption) + '</div>');
42 for (var i = 0; i < data.length && i < max; i++) {
43 acc.push('<div class="term">');
44 acc.push('<a href="#" ');
47 // Special case: target selection
48 acc.push('target_id='+data[i].id+' ');
49 if (!that.team.targetFiltered(data[i].id)) {
50 action = 'mkws.limitTarget(\'' + teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
53 action = 'mkws.limitQuery(\'' + teamName + '\', \'' + pzIndex + '\', this.firstChild.nodeValue)';
55 acc.push('onclick="' + action + ';return false;">' + data[i].name + '</a>'
56 + ' <span>' + data[i].freq + '</span>');
60 $(that.node).html(acc.join(''));