Much better encapsulation for mkws.showDetails().
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index 98fc11c..d4e8166 100644 (file)
@@ -230,7 +230,6 @@ function _make_mkws_team($, teamName) {
                      "usesessions" : mkws_config.use_service_proxy ? false : true,
                      "showResponseType": '', // or "json" (for debugging?)
                      "onrecord": my_onrecord });
-    that.m_paz = m_paz; // For access from non-member functions like mkws.showDetails
 
     if (!isNaN(parseInt(mkws_config.perpage_default))) {
        m_recPerPage = parseInt(mkws_config.perpage_default);
@@ -730,7 +729,7 @@ function _make_mkws_team($, teamName) {
 
 
     // detailed record drawing
-    mkws.showDetails = function (prefixRecId, tname) {
+    that.showDetails = function (prefixRecId) {
        var recId = prefixRecId.replace('mkwsRec_', '');
        var oldRecId = m_curDetRecId;
        m_curDetRecId = recId;
@@ -748,9 +747,7 @@ function _make_mkws_team($, teamName) {
             return;
        }
        // request the record
-       var team = mkws.teams[tname];
-       if (!team) alert("no team '" + tname + "'");
-       team.m_paz.record(recId);
+       m_paz.record(recId);
     }
 
 
@@ -1351,6 +1348,11 @@ function _mkws_jquery_plugin ($) {
     }
 
 
+    mkws.showDetails = function (prefixRecId, tname) {
+       mkws.teams[tname].showDetails(prefixRecId);
+    }
+
+
     function default_mkws_config() {
        /* default mkws config */
        var config_default = {