X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=src%2Fmkws-team.js;h=8c81a1a857518f444447b963978375174ccba213;hp=d5f8bc0c7f1c2fdd05e0bbb2ea5dd145e8e89c10;hb=HEAD;hpb=d1cc4e416a295d7980eb79dbce50d3fe51cdf84b diff --git a/src/mkws-team.js b/src/mkws-team.js index d5f8bc0..8c81a1a 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -33,7 +33,6 @@ mkws.makeTeam = function($, teamName) { var m_template = {}; // compiled templates, from any source var m_widgets = {}; // Maps widget-type to array of widget objects var m_gotRecords = false; - var m_targetMap = {}; // Maps target ID to human-readable name var config = mkws.objectInheritingFrom(mkws.config); that.config = config; @@ -289,7 +288,7 @@ mkws.makeTeam = function($, teamName) { that.resetPage = resetPage; - function newSearch(query, sortOrder, maxrecs, perpage, limit, targets, torusquery) { + function newSearch(widget, query, sortOrder, maxrecs, perpage, limit, targets, torusquery) { that.info("newSearch: " + query); if (config.use_service_proxy && !mkws.authenticated) { @@ -297,6 +296,26 @@ mkws.makeTeam = function($, teamName) { return; } + { + if (!sortOrder) sortOrder = widget.config.sort; + if (!maxrecs) maxrecs = widget.config.maxrecs; + if (!perpage) perpage = widget.config.perpage; + if (!limit) limit = widget.config.limit; + if (!targets) targets = widget.config.targets; + if (!torusquery) torusquery = widget.config.targetfilter; + var target = widget.config.target; + if (target) torusquery = 'udb=="' + target + '"'; + + var s = "running search: '" + query + "'"; + if (sortOrder) s += " sorted by '" + sortOrder + "'"; + if (maxrecs) s += " restricted to " + maxrecs + " records"; + if (perpage) s += " with " + perpage + " per page"; + if (limit) s += " limited by '" + limit + "'"; + if (targets) s += " in targets '" + targets + "'"; + if (torusquery) s += " constrained by torusquery '" + torusquery + "'"; + that.info(s); + } + 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 @@ -502,17 +521,5 @@ mkws.makeTeam = function($, teamName) { return undefined; }; - that.mapTarget = function(id, name) { - var old = m_targetMap[id]; - m_targetMap[id] = name; - if (old && name !== old) { - that.warn("targetMap for id '" + id + "' changed from '" + old + "' to '" + name + "'"); - } - }; - - that.targetName = function(id) { - return m_targetMap[id] || id; - } - return that; };