X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=src%2Fmkws-widget.js;h=4cace293c2025351d227161f2968715517153d08;hp=fd51a12b979fd563332685f22ff0e93853a91e79;hb=058ce4a204a9ce4d63b2d319037f60cd9f94ff1b;hpb=9eb98d79cf4dd58611480d47afe14411149e8177 diff --git a/src/mkws-widget.js b/src/mkws-widget.js index fd51a12..4cace29 100644 --- a/src/mkws-widget.js +++ b/src/mkws-widget.js @@ -71,9 +71,13 @@ mkws.makeWidget = function($, team, type, node) { function expandValue(val) { if (val.match(/^!param!/)) { var param = val.replace(/^!param!/, ''); + var optional = param.match(/^\?/); + if (optional) { + param = param.replace(/^\?/, ''); + } val = mkws.getParameterByName(param); that.info("obtained val '" + val + "' from param '" + param + "'"); - if (!val) { + if (!val && !optional) { alert("This page has a MasterKey widget that needs a val specified by the '" + param + "' parameter"); } } else if (val.match(/^!path!/)) { @@ -100,17 +104,9 @@ mkws.makeWidget = function($, team, type, node) { var that = this; var query = this.config.autosearch; if (query) { - var old = this.team.config.query; - if (!old) { - // Stash this for subsequent inspection - this.team.config.query = query; - } else if (old === query) { - this.warn("duplicate autosearch: '" + query + "': ignoring"); - return; - } else { - this.warn("conflicting autosearch: '" + query + "' vs '" + old + "': ignoring"); - return; - } + // Should do this more elegantly with message passing + var widget = this.team.widget('query'); + if (widget) { widget.node.val(query); } this.team.queue("ready").subscribe(function() { // Postpone testing for the configuration items: these are not @@ -182,7 +178,7 @@ mkws.makeWidget = function($, team, type, node) { if (fn) { fn.call(that); this.info("made " + type + " widget(node=" + node + ")"); - } else if (type.match(/-Container-(narrow|wide)$/)) { + } else if (type.match(/-[Cc]ontainer-(narrow|wide)$/)) { // Not really a widget: no need to log its lack of promotion } else { this.info("made UNPROMOTED widget(type=" + type + ", node=" + node + ")");