X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-core.js;h=a485f34c351fa6bd067467e990fc5e8b421c0cdb;hb=acc4c917f360440927547e958ebd32b1d2aca711;hp=0a175e45a7aafe0eab55b228be606d311169b662;hpb=2893e2e505c2b6d6e53afb2e866c44638ce9f0b1;p=mkws-moved-to-github.git diff --git a/src/mkws-core.js b/src/mkws-core.js index 0a175e4..a485f34 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -14,6 +14,8 @@ var mkws = { log_level: 1, // Will be overridden from mkws_config, but // initial value allows jQuery popup to use logging. teams: {}, + widgetType2function: {}, + locale_lang: { "de": { "Authors": "Autoren", @@ -84,7 +86,7 @@ if (mkws_config == null || typeof mkws_config != 'object') { // wrapper to call team() after page load (function (j) { - mkws.log = function (string) { + function log(string) { if (!mkws.log_level) return; @@ -100,7 +102,17 @@ if (mkws_config == null || typeof mkws_config != 'object') { } console.log(string); } - var log = mkws.log; + mkws.log = log; + + + mkws.registerWidgetType = function(name, fn) { + mkws.widgetType2function[name] = fn; + log("registered widget-type '" + name + "'"); + } + + mkws.promotionFunction = function(name) { + return mkws.widgetType2function[name]; + } function handleNodeWithTeam(node, callback) { @@ -161,6 +173,10 @@ if (mkws_config == null || typeof mkws_config != 'object') { }; + // The following functions are dispatchers for team methods that + // are called from the UI using a team-name rather than implicit + // context. Apart from mkws.log, they are the ONLY public UI to + // this module. mkws.switchView = function(tname, view) { mkws.teams[tname].switchView(view); } @@ -272,12 +288,17 @@ if (mkws_config == null || typeof mkws_config != 'object') { } var status = $(data).find("status"); if (status.text() != "OK") { - alert("service proxy auth repsonse status: " + status.text() + ", give up!"); + alert("service proxy auth response status: " + status.text() + ", give up!"); return; } log("Service proxy auth successfully done"); mkws.authenticated = true; + var authName = $(data).find("displayName").text(); + for (var teamName in mkws.teams) { + mkws.teams[teamName].queue("authenticated").publish(authName); + } + runAutoSearches(); }); } @@ -293,7 +314,6 @@ if (mkws_config == null || typeof mkws_config != 'object') { $(document).ready(function() { - log("on load ready"); defaultMkwsConfig(); if (mkws_config.query_width < 5 || mkws_config.query_width > 150) {