The mkws_service_proxy_auth() method was private to the team object,
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index 1bf2137..c00252d 100644 (file)
@@ -265,17 +265,19 @@ function _make_mkws_team($, teamName) {
     // create a parameters array and pass it to the pz2's constructor
     // then register the form submit event with the pz2.search function
     // autoInit is set to true on default
-    mkws.paz = new pz2({ "onshow": my_onshow,
-                        "showtime": 500,            //each timer (show, stat, term, bytarget) can be specified this way
-                        "pazpar2path": mkws_config.pazpar2_url,
-                        "oninit": my_oninit,
-                        "onstat": my_onstat,
-                        "onterm": my_onterm,
-                        "termlist": "xtargets,subject,author",
-                        "onbytarget": my_onbytarget,
-                        "usesessions" : mkws_config.use_service_proxy ? false : true,
-                        "showResponseType": '', // or "json" (for debugging?)
-                        "onrecord": my_onrecord });
+    if (!mkws.paz) {
+       mkws.paz = new pz2({ "onshow": my_onshow,
+                            "showtime": 500,            //each timer (show, stat, term, bytarget) can be specified this way
+                            "pazpar2path": mkws_config.pazpar2_url,
+                            "oninit": my_oninit,
+                            "onstat": my_onstat,
+                            "onterm": my_onterm,
+                            "termlist": "xtargets,subject,author",
+                            "onbytarget": my_onbytarget,
+                            "usesessions" : mkws_config.use_service_proxy ? false : true,
+                            "showResponseType": '', // or "json" (for debugging?)
+                            "onrecord": my_onrecord });
+    }
 
     if (!isNaN(parseInt(mkws_config.perpage_default))) {
        m_recPerPage = parseInt(mkws_config.perpage_default);
@@ -971,15 +973,6 @@ function _make_mkws_team($, teamName) {
 
        mkws_html_switch();
 
-       if (mkws_config.use_service_proxy) {
-           mkws_service_proxy_auth(mkws_config.service_proxy_auth,
-                                   mkws_config.service_proxy_auth_domain,
-                                   mkws_config.pazpar2_url);
-       } else {
-           // raw pp2
-           run_auto_searches();
-       }
-
        if (mkws_config.responsive_design_width) {
            // Responsive web design - change layout on the fly based on
            // current screen width. Required for mobile devices.
@@ -1116,7 +1109,7 @@ function _make_mkws_team($, teamName) {
      * The username/password is configured in the apache config file
      * for the site.
      */
-    function mkws_service_proxy_auth(auth_url, auth_domain, pp2_url) {
+    mkws.service_proxy_auth = function(auth_url, auth_domain, pp2_url) {
        debug("Run service proxy auth URL: " + auth_url);
 
        if (!auth_domain) {
@@ -1439,10 +1432,22 @@ function _mkws_jquery_plugin ($) {
                alert("No MKWS team specified for mkwsRecords element with classes '" + classes + "'");
            } else if (mkws.teams[tname]) {
                log("MKWS team '" + tname + "' already exists, skipping");
+           } else if (tname === "AUTO") {
+               // ### For now: later, this will be how the backwards-compatibility is done
+               log("Skipping MKWS team '" + tname + "'");
            } else {
                mkws.teams[tname] = _make_mkws_team(j, tname);
                log("Made MKWS team '" + tname + "'");
            }
        });
+
+       if (mkws_config.use_service_proxy) {
+           mkws.service_proxy_auth(mkws_config.service_proxy_auth,
+                                   mkws_config.service_proxy_auth_domain,
+                                   mkws_config.pazpar2_url);
+       } else {
+           // raw pp2
+           run_auto_searches();
+       }
     });
 })(jQuery);