Remove unused teamName arguments from several pz2 callbacks.
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index f320111..796fd2c 100644 (file)
@@ -183,16 +183,18 @@ function widget($, team, type, node) {
 
     if (type === 'Targets') {
        promoteTargets();
+    } else if (type === 'Stat') {
+       promoteStat();
+    } else {
+       // Unsupported widget type: call an extension?
     }
 
     // ### More to do here, surely: e.g. wiring into the team
     mkws.debug("made widget(team=" + team + ", type=" + type + ", node=" + node);
 
+
     function promoteTargets() {
-       mkws.debug("promoting widget to type Targets");
        mkws.queue("targets").subscribe(function(data) {
-           mkws.debug("notified that there are targets");
-
            if (node.length === 0) alert("huh?!");
 
            var table ='<table><thead><tr>' +
@@ -217,6 +219,20 @@ function widget($, team, type, node) {
        });
     }
 
+
+    function promoteStat() {
+       mkws.queue("stat").subscribe(function(data) {
+           if (node.length === 0)  alert("huh?!");
+
+           $(node).html('<span class="head">' + M('Status info') + '</span>' +
+               ' -- ' +
+               '<span class="clients">' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '</span>' +
+               ' -- ' +
+               '<span class="records">' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '</span>');
+       });
+    }
+
+
     return that;
 }
 
@@ -284,33 +300,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);
     }
 
 
-    function onStat(data, teamName) {
+    function onStat(data) {
        debug("stat");
-       var node = findnode('.mkwsStat');
-       if (node.length === 0) return;
-
-       node.html('<span class="head">' + M('Status info') + '</span>' +
-           ' -- ' +
-           '<span class="clients">' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '</span>' +
-           ' -- ' +
-           '<span class="records">' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '</span>');
+       mkws.queue("stat").publish(data);
     }
 
 
-    function onTerm(data, teamName) {
+    function onTerm(data) {
        debug("term");
        var node = findnode(".mkwsTermlists");
        if (node.length == 0) return;