X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-team.js;h=b02b441c32fc0b1aa6d4ff37fd71ab17c9baa765;hb=00225202a26b07fdcccf237e9302eefe686ad2a5;hp=4c59becdcdef59b31a6d62430b9bb3fba69d53dc;hpb=9186abcca4ee19b73053093c6ba90abc252ff5f9;p=mkws-moved-to-github.git diff --git a/src/mkws-team.js b/src/mkws-team.js index 4c59bec..b02b441 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -170,7 +170,7 @@ function team($, teamName) { that.limitTarget = function(id, name) { log("limitTarget(id=" + id + ", name=" + name + ")"); m_filterSet.add(targetFilter(id, name)); - triggerSearch(); + if (m_query) triggerSearch(); return false; }; @@ -178,14 +178,16 @@ function team($, teamName) { that.limitQuery = function(field, value) { log("limitQuery(field=" + field + ", value=" + value + ")"); m_filterSet.add(fieldFilter(field, value)); - triggerSearch(); + if (m_query) triggerSearch(); return false; }; that.limitCategory = function(id) { log("limitCategory(id=" + id + ")"); - m_filterSet.add(categoryFilter(id)); + // Only one category filter at a time + m_filterSet.removeMatching(function(f) { return f.type === 'category' }); + if (id !== '') m_filterSet.add(categoryFilter(id)); if (m_query) triggerSearch(); return false; }; @@ -194,7 +196,7 @@ function team($, teamName) { that.delimitTarget = function(id) { log("delimitTarget(id=" + id + ")"); m_filterSet.removeMatching(function(f) { return f.type === 'target' }); - triggerSearch(); + if (m_query) triggerSearch(); return false; }; @@ -203,7 +205,7 @@ function team($, teamName) { log("delimitQuery(field=" + field + ", value=" + value + ")"); m_filterSet.removeMatching(function(f) { return f.type == 'field' && field == f.field && value == f.value }); - triggerSearch(); + if (m_query) triggerSearch(); return false; }; @@ -249,7 +251,7 @@ function team($, teamName) { return; } - m_filterSet = filterSet(that); + m_filterSet.removeMatching(function(f) { return f.type !== 'category' }); triggerSearch(query, sortOrder, maxrecs, perpage, limit, targets, torusquery); switchView('records'); // In case it's configured to start off as hidden m_submitted = true; @@ -261,7 +263,6 @@ function team($, teamName) { resetPage(); queue("navi").publish(); - // Continue to use previous query/sort-order unless new ones are specified if (query) m_query = query; if (sortOrder) m_sortOrder = sortOrder; @@ -270,9 +271,11 @@ function team($, teamName) { var pp2filter = m_filterSet.pp2filter(); var pp2limit = m_filterSet.pp2limit(limit); + var pp2catLimit = m_filterSet.pp2catLimit(); var params = {}; if (pp2limit) params.limit = pp2limit; + if (pp2catLimit) params.categoryfilter = pp2catLimit; if (maxrecs) params.maxrecs = maxrecs; if (torusquery) { if (!mkws.config.use_service_proxy)