From: Mike Taylor Date: Mon, 19 Jan 2015 11:54:17 +0000 (+0000) Subject: Towards MKWS-352. X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=d1cc4e416a295d7980eb79dbce50d3fe51cdf84b;p=mkws-moved-to-github.git Towards MKWS-352. MKWS teams now maintain a mapping of target IDs to displayNames. This mapping can be updated using team.mapTarget() and inspected using team.targetName(). --- diff --git a/src/mkws-team.js b/src/mkws-team.js index 3d40f23..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; @@ -499,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; };