-// Some functions are visible to be called from outside code, namely
-// generated HTML: that.switchView(), showDetails(), limitTarget(),
-// limitQuery(), delimitTarget(), delimitQuery(), pagerPrev(),
-// pagerNext(), showPage(). Also mkws.M() is made available for the
-// Handlebars helper 'translate'
-
-
-// Set up global mkws object. Contains a hash of team objects,
-// indexed by windowid.
+// Set up global mkws object. Contains truly global state such as SP
+// authentication, and a hash of team objects, indexed by windowid.
+//
var mkws = {
authenticated: false,
- debug_function: undefined, // will be set during initialisation
debug_level: undefined, // will be initialised from mkws_config
paz: undefined, // will be set up during initialisation
teams: {},
}
-// wrapper for jQuery lib
+// Factory function for team objects. As much as possible, this uses
+// only member variables (prefixed "m_") and inner functions with
+// private scope. Some functions are visibl as member-functions to be
+// called from outside code -- specifically, from generated
+// HTML. These functions are that.switchView(), showDetails(),
+// limitTarget(), limitQuery(), delimitTarget(), delimitQuery(),
+// pagerPrev(), pagerNext(), showPage(). Also mkws.M() is made
+// available for the Handlebars helper 'translate'
+//
function team($, teamName) {
var that = {};
var m_teamName = teamName;
m_filters = []
redraw_navi();
- resetPage(); // ### the globals it resents should be indexed by windowid
+ resetPage();
loadSelect();
triggerSearch(query, sort, targets, windowid);
that.switchView('records'); // In case it's configured to start off as hidden