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;
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");
}
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;
"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
}
}
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;
};