X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=src%2Fmkws-team.js;h=8c81a1a857518f444447b963978375174ccba213;hp=c88d58b3b9666f8acb728885e30f40eafb7b012b;hb=HEAD;hpb=175f20ac816c2654cb7d3f413368795f7b8afd69 diff --git a/src/mkws-team.js b/src/mkws-team.js index c88d58b..8c81a1a 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -88,9 +88,6 @@ mkws.makeTeam = function($, teamName) { that.queue("log").publish(m_teamName, timestamp, s); } - // ### transitional placeholder function until we have promoted all invocations - that.log = function (x) { _log(mkws.log, x) }; - that.trace = function(x) { _log(mkws.trace, x) }; that.debug = function(x) { _log(mkws.debug, x) }; that.info = function(x) { _log(mkws.info, x) }; @@ -176,7 +173,7 @@ mkws.makeTeam = function($, teamName) { params.onbytarget = onBytarget; that.info("setting bytarget callback"); } - if (m_queues.stat) { + if (m_queues.stat || m_queues.firstrecords || m_queues.complete) { params.onstat = onStat; that.info("setting stat callback"); } @@ -291,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) { @@ -299,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 @@ -309,7 +326,6 @@ mkws.makeTeam = function($, teamName) { function triggerSearch(query, sortOrder, maxrecs, perpage, limit, targets, torusquery) { resetPage(); - queue("navi").publish(); // Continue to use previous query/sort-order unless new ones are specified if (query) m_query = query; @@ -337,6 +353,7 @@ mkws.makeTeam = function($, teamName) { "pp2filter = " + pp2filter + ", params = " + $.toJSON(params)); m_paz.search(m_query, m_perpage, m_sortOrder, pp2filter, undefined, params); + queue("searchtriggered").publish(); } // fetch record details to be retrieved from the record queue @@ -426,7 +443,7 @@ mkws.makeTeam = function($, teamName) { that.registerTemplate = function(name, text) { if(mkws._old2new.hasOwnProperty(name)) { - that.warn("Warning: registerTemplate old widget name: " + name + " => " + mkws._old2new[name]); + that.warn("registerTemplate: old widget name: " + name + " => " + mkws._old2new[name]); name = mkws._old2new[name]; } m_templateText[name] = text; @@ -435,7 +452,7 @@ mkws.makeTeam = function($, teamName) { function loadTemplate(name, fallbackString) { if(mkws._old2new.hasOwnProperty(name)) { - that.warn("Warning loadTemplate: old widget name: " + name + " => " + mkws._old2new[name]); + that.warn("loadTemplate: old widget name: " + name + " => " + mkws._old2new[name]); name = mkws._old2new[name]; } @@ -502,8 +519,7 @@ mkws.makeTeam = function($, teamName) { } } return undefined; - } - + }; return that; };