From: Wolfram Schneider Date: Wed, 23 Apr 2014 12:17:46 +0000 (+0000) Subject: Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws X-Git-Tag: 1.0.0~894^2 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=b46c4b42269ecabe17260f983a70f4b68b68dd18;hp=628fcb727478a7ee7fb2a52bd3f564f44fe0235b;p=mkws-moved-to-github.git Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws --- diff --git a/src/Makefile b/src/Makefile index 749d205..fc5673f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -12,7 +12,8 @@ JQUERY_UI_URL = http://code.jquery.com/ui/1.10.3/jquery-ui.js VERSION = $(shell tr -d '\012' < VERSION) COMPONENTS = mkws-handlebars.js \ - mkws-core.js mkws-team.js mkws-widgets.js mkws-widget-termlists.js \ + mkws-core.js mkws-team.js mkws-filter.js \ + mkws-widgets.js mkws-widget-termlists.js \ mkws-widget-authname.js mkws-widget-categories.js mkws-widget-log.js \ mkws-widget-record.js mkws-widget-builder.js diff --git a/src/mkws-core.js b/src/mkws-core.js index d6433f4..11a4889 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -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); }; diff --git a/src/mkws-filter.js b/src/mkws-filter.js new file mode 100644 index 0000000..c62235e --- /dev/null +++ b/src/mkws-filter.js @@ -0,0 +1,12 @@ +// Factory function for filters. These can be of several types. +function filter(id, field, value) { + var res; + + if (id) { + res = { id: id, name: name }; + } else { + res = { field: field, value: value }; + } + + return res; +} diff --git a/src/mkws-team.js b/src/mkws-team.js index b9d899b..aa84176 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -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 }); diff --git a/src/mkws-widget-categories.js b/src/mkws-widget-categories.js index afb3875..6ce09fe 100644 --- a/src/mkws-widget-categories.js +++ b/src/mkws-widget-categories.js @@ -19,16 +19,16 @@ mkws.registerWidgetType('Categories', function() { that.log("got categories: " + data); var text = []; - text.push("

Categories for " + realm + "

"); - text.push("