X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-core.js;h=668b44a6b26478508269f642565e25e0e249c657;hb=5d823f96587dafbe34c2a53df0b1792c1282d95a;hp=712a12dae158da1db65943b799081aebd3094ad7;hpb=a5d6c10d06e7e78761393b3670984f91d8e51f7a;p=mkws-moved-to-github.git diff --git a/src/mkws-core.js b/src/mkws-core.js index 712a12d..668b44a 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -11,10 +11,12 @@ // var mkws = { authenticated: false, + authName: undefined, log_level: 1, // Will be overridden from mkws_config, but // initial value allows jQuery popup to use logging. - paz: undefined, // will be set up during initialisation teams: {}, + widgetType2function: {}, + locale_lang: { "de": { "Authors": "Autoren", @@ -85,7 +87,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; @@ -101,10 +103,20 @@ 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]; + } - mkws.handleNodeWithTeam = function(node, callback) { + function handleNodeWithTeam(node, callback) { // First branch for DOM objects; second branch for jQuery objects var classes = node.className || node.attr('class'); if (!classes) { @@ -130,7 +142,7 @@ if (mkws_config == null || typeof mkws_config != 'object') { } - mkws.resizePage = function () { + function resizePage() { var list = ["mkwsSwitch", "mkwsLang"]; var width = mkws_config.responsive_design_width; @@ -162,6 +174,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); } @@ -199,87 +215,6 @@ if (mkws_config == null || typeof mkws_config != 'object') { } - mkws.defaultTemplate = function(name) - { - if (name === 'Record') { - return '\ -
{{translate "Title"}} | \ -\ - {{md-title}}\ - {{#if md-title-remainder}}\ - ({{md-title-remainder}})\ - {{/if}}\ - {{#if md-title-responsibility}}\ - {{md-title-responsibility}}\ - {{/if}}\ - | \ -
---|---|
{{translate "Date"}} | \ -{{md-date}} | \ -
{{translate "Author"}} | \ -{{md-author}} | \ -
{{translate "Links"}} | \ -\ - {{#each md-electronic-url}}\ - Link{{index1}}\ - {{/each}}\ - | \ -
{{translate "Subject"}} | \ -\ - {{#first location having="md-subject"}}\ - {{#if md-subject}}\ - {{#commaList md-subject}}\ - {{this}}{{/commaList}}\ - {{/if}}\ - {{/first}}\ - | \ -
{{translate "Locations"}} | \ -\ - {{#commaList location}}\ - {{attr "@name"}}{{/commaList}}\ - | \ -