Remove any old category filters when setting a new one.
[mkws-moved-to-github.git] / src / mkws-core.js
index a030d5b..11a4889 100644 (file)
@@ -182,6 +182,10 @@ mkws.limitQuery  = function(tname, field, value) {
     mkws.teams[tname].limitQuery(field, value);
 };
 
+mkws.limitCategory  = function(tname, id) {
+    mkws.teams[tname].limitCategory(id);
+};
+
 mkws.delimitTarget = function(tname, id) {
     mkws.teams[tname].delimitTarget(id);
 };
@@ -299,8 +303,10 @@ mkws.pagerNext = function(tname) {
            log("Service proxy auth successfully done");
            mkws.authenticated = true;
            var authName = $(data).find("displayName").text();
+           // You'd think there would be a better way to do this:
+           var realm = $(data).find("realm:not(realmAttributes realm)").text();
            for (var teamName in mkws.teams) {
-               mkws.teams[teamName].queue("authenticated").publish(authName);
+               mkws.teams[teamName].queue("authenticated").publish(authName, realm);
            }
 
            runAutoSearches();
@@ -371,15 +377,6 @@ mkws.pagerNext = function(tname) {
            }
        }
 
-       // For all MKWS-classed nodes that don't have a team
-       // specified, set the team to AUTO.
-       $('[class^="mkws"],[class*=" mkws"]').each(function() {
-           if (!this.className.match(/mkwsTeam_/)) {
-               log("adding AUTO team to node with class '" + this.className + "'");
-               $(this).addClass('mkwsTeam_AUTO');
-           }
-       });
-
        // Find all nodes with an MKWS class, and determine their team from
        // the mkwsTeam_* class. Make all team objects.
        var then = $.now();
@@ -399,11 +396,22 @@ mkws.pagerNext = function(tname) {
            handleNodeWithTeam(this, function(tname, type) {
                var myTeam = mkws.teams[tname];
                var myWidget = widget(j, myTeam, type, this);
+                myTeam.addWidget(myWidget);
            });
        });
        var now = $.now();
        log("Walking MKWS nodes took " + (now-then) + " ms");
 
+//        for (var tName in mkws.teams) {
+//            var myTeam = mkws.teams[tName]
+//            var types = myTeam.widgetTypes();
+//            log("TEAM '" + tName + "' = " + myTeam + " has widget types " + types);
+//            for (var i = 0; i < types.length; i++) {
+//                var type = types[i];
+//                log("  has widget of type '" + type + "': " + myTeam.widget(type));
+//            }
+//        }
+
        if (mkws.config.use_service_proxy) {
            authenticateSession(mkws.config.service_proxy_auth,
                                mkws.config.service_proxy_auth_domain,