X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-team.js;h=0ddc962337aa069d3aa534d5cc69b19e7a1acf5e;hb=3c53e60026d9717687c1a05ea383b7e26eb3927a;hp=4898d12951f12d0f899ac4e33f47dd53fbd705ee;hpb=9d26a026e849d700db55c0b30d84d9c0c4a545ce;p=mkws-moved-to-github.git diff --git a/src/mkws-team.js b/src/mkws-team.js index 4898d12..0ddc962 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -28,6 +28,7 @@ function team($, teamName) { var m_paz; // will be initialised below var m_template = {}; var m_config = mkws.objectInheritingFrom(mkws.config); + var m_widgets = {}; // Maps widget-type to object that.toString = function() { return '[Team ' + teamName + ']'; }; @@ -48,7 +49,7 @@ function team($, teamName) { // The following PubSub code is modified from the jQuery manual: - // https://api.jquery.com/jQuery.Callbacks/ + // http://api.jquery.com/jQuery.Callbacks/ // // Use as: // team.queue("eventName").subscribe(function(param1, param2 ...) { ... }); @@ -240,6 +241,7 @@ function team($, teamName) { that.reShow = function() { + resetPage(); m_paz.show(0, m_perpage, m_sortOrder); }; @@ -603,7 +605,12 @@ function team($, teamName) { teamName = teamName || m_teamName; selector = $.map(selector.split(','), function(s, i) { - return s + '.mkwsTeam_' + teamName; + if (teamName === 'AUTO') { + return (s + '.mkwsTeam_' + teamName + ',' + + s + ':not([class^="mkwsTeam"],[class*=" mkwsTeam"])'); + } else { + return s + '.mkwsTeam_' + teamName; + } }).join(','); var node = $(selector); @@ -735,6 +742,28 @@ function team($, teamName) { return s; } + that.addWidget = function(w) { + if (!m_widgets[w.type]) { + m_widgets[w.type] = w; + log("Registered '" + w.type + "' widget in team '" + m_teamName + "'"); + } else if (typeof(m_widgets[w.type]) !== 'number') { + m_widgets[w.type] = 2; + log("Registered duplicate '" + w.type + "' widget in team '" + m_teamName + "'"); + } else { + m_widgets[w.type] += 1; + log("Registered '" + w.type + "' widget #" + m_widgets[w.type] + "' in team '" + m_teamName + "'"); + } + } + + that.widgetTypes = function() { + var keys = []; + for (var k in m_widgets) keys.push(k); + return keys.sort(); + } + + that.widget = function(type) { + return m_widgets[type]; + } mkwsHtmlAll()