X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-widget-categories.js;h=339e28b2eea680aeeb37183017f26ea1b56be57e;hb=5c3962d2493b37fad16ce01137506b0785b81179;hp=c80bc0c1535ebb71671198810bafeb943c6e0fde;hpb=4bd749eb0ae27515075b7c4224321ecb374cfbe6;p=mkws-moved-to-github.git diff --git a/src/mkws-widget-categories.js b/src/mkws-widget-categories.js index c80bc0c..339e28b 100644 --- a/src/mkws-widget-categories.js +++ b/src/mkws-widget-categories.js @@ -1,34 +1,35 @@ mkws.registerWidgetType('Categories', function() { - var that = this; + var that = this; - if (!this.config.use_service_proxy) { - alert("can't use categories widget without Service Proxy"); - return; - } + if (!mkws.authenticated) { + alert("can't use categories widget when not authenticated"); + return; + } - this.team.queue("authenticated").subscribe(function(authName, realm) { - var req = new pzHttpRequest(that.config.pazpar2_url + "?command=categories", function(err) { - alert("HTTP call for categories failed: " + err) - }); + this.team.queue("authenticated").subscribe(function(authName, realm) { + var req = new pzHttpRequest(that.config.pazpar2_url + "?command=categories", function(err) { + alert("HTTP call for categories failed: " + err) + }); - req.get(null, function(data) { - if (!$.isXMLDoc(data)) { - alert("categories response document is not XML"); - return; - } - that.log("got categories: " + data); + req.get(null, function(data) { + if (!$.isXMLDoc(data)) { + alert("categories response document is not XML"); + return; + } + that.log("got categories: " + data); - var text = []; - text.push("Select category: "); - text.push(""); - $(that.node).html(text.join('')); - }); + var text = []; + text.push("Select category: "); + text.push(""); + that.node.html(text.join('')); }); + }); });