New team member-function, name().
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index 60b9388..039ca55 100644 (file)
@@ -186,15 +186,15 @@ function widget($, team, type, node) {
     } else if (type === 'Stat') {
        promoteStat();
     } else {
-       // Unsupported widget type: call an extension?
+       // ### Handle other types here
     }
 
-    // ### More to do here, surely: e.g. wiring into the team
     mkws.debug("made widget(team=" + team + ", type=" + type + ", node=" + node);
+    return that;
 
 
     function promoteTargets() {
-       mkws.queue("targets").subscribe(function(data) {
+       mkws.queue("targets." + team.name()).subscribe(function(data) {
            if (node.length === 0) alert("huh?!");
 
            var table ='<table><thead><tr>' +
@@ -231,9 +231,6 @@ function widget($, team, type, node) {
                '<span class="records">' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '</span>');
        });
     }
-
-
-    return that;
 }
 
 
@@ -248,6 +245,7 @@ function widget($, team, type, node) {
 function team($, teamName) {
     var that = {};
     var m_teamName = teamName;
+    that.name = function() { return m_teamName; }
     var m_submitted = false;
     var m_query; // initially undefined
     var m_sort; // will be set below
@@ -300,26 +298,26 @@ function team($, teamName) {
     //
     // pz2.js event handlers:
     //
-    function onInit(teamName) {
+    function onInit() {
        debug("init");
        m_paz.stat();
        m_paz.bytarget();
     }
 
 
-    function onBytarget(data, teamName) {
+    function onBytarget(data) {
        debug("target");
-       mkws.queue("targets").publish(data);
+       mkws.queue("targets." + m_teamName).publish(data);
     }
 
 
-    function onStat(data, teamName) {
+    function onStat(data) {
        debug("stat");
        mkws.queue("stat").publish(data);
     }
 
 
-    function onTerm(data, teamName) {
+    function onTerm(data) {
        debug("term");
        var node = findnode(".mkwsTermlists");
        if (node.length == 0) return;