Separate generation of pp2filter and pp2limit
[mkws-moved-to-github.git] / src / mkws-team.js
index b9d899b..1278870 100644 (file)
@@ -5,8 +5,8 @@
 // Some functions are visible as member-functions to be called from
 // outside code -- specifically, from generated HTML. These functions
 // are that.switchView(), showDetails(), limitTarget(), limitQuery(),
-// delimitTarget(), delimitQuery(), showPage(), pagerPrev(),
-// pagerNext().
+// limitCategory(), delimitTarget(), delimitQuery(), showPage(),
+// pagerPrev(), pagerNext().
 //
 function team($, teamName) {
     var that = {};
@@ -189,6 +189,14 @@ function team($, teamName) {
     };
 
 
+    that.limitCategory = function(id) {
+       log("limitCategory(id=" + id + ")");
+       m_filters.push({ category: id });
+       //triggerSearch();
+       return false;
+    };
+
+
     that.delimitTarget = function(id) {
        log("delimitTarget(id=" + id + ")");
        removeMatchingFilters(function(f) { return f.id });
@@ -301,7 +309,11 @@ function team($, teamName) {
                    filter.id = 'pz:id=' + filter.id;
                }
                pp2filter += filter.id;
-           } else {
+           }
+       }
+       for (var i in m_filters) {
+           var filter = m_filters[i];
+           if (!filter.id) {
                if (pp2limit)
                    pp2limit += ",";
                pp2limit += filter.field + "=" + filter.value.replace(/[\\|,]/g, '\\$&');