1 mkws.registerWidgetType('Termlists', function() {
3 var facets = that.config.facets;
5 this.team.queue("termlists").subscribe(function(data) {
6 // display if we first got results
10 widget.autosearch(that);
14 mkws.registerWidgetType('Facet', function() {
16 xtargets: [ "Sources", 16, false ],
17 subject: [ "Subjects", 10, true ],
18 author: [ "Authors", 10, true ]
22 var name = that.config.facet;
23 var ref = facetConfig[name] || alert("no facet definition for '" + name + "'");
26 var pzIndex = ref[2] ? name : null;
28 that.team.queue("termlists").subscribe(function(data) {
31 var teamName = that.team.name();
33 acc.push('<div class="termtitle">' + mkws.M(caption) + '</div>');
34 for (var i = 0; i < data.length && i < max; i++) {
35 acc.push('<div class="term">');
36 acc.push('<a href="#" ');
39 // Special case: target selection
40 acc.push('target_id='+data[i].id+' ');
41 if (!that.team.targetFiltered(data[i].id)) {
42 action = 'mkws.limitTarget(\'' + teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
45 action = 'mkws.limitQuery(\'' + teamName + '\', \'' + pzIndex + '\', this.firstChild.nodeValue)';
47 acc.push('onclick="' + action + ';return false;">' + data[i].name + '</a>'
48 + ' <span>' + data[i].freq + '</span>');
52 $(that.node).html(acc.join(''));