X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-team.js;h=d5f8bc0c7f1c2fdd05e0bbb2ea5dd145e8e89c10;hb=72982e91181c46d88a2146d9a53deb64677fc498;hp=d0907441c6ba4306dea96980c58f8cd936670a85;hpb=a11c920efd56cf7b6240e852b6826bc671856f88;p=mkws-moved-to-github.git diff --git a/src/mkws-team.js b/src/mkws-team.js index d090744..d5f8bc0 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -33,6 +33,7 @@ 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; @@ -88,9 +89,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 +174,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"); } @@ -309,7 +307,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 +334,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 @@ -502,8 +500,19 @@ 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; };