X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-widget-categories.js;h=a11e52239657c8089c869bf89d91158c60127991;hb=467a5f1e52a2fc97c28510659658a91f1dcabb98;hp=0b1f1148ca8fa78060c7a0f3d4652e22c575c62b;hpb=6d77d26b06a5a066405c63ca02369cd9f30ed46e;p=mkws-moved-to-github.git diff --git a/src/mkws-widget-categories.js b/src/mkws-widget-categories.js index 0b1f114..a11e522 100644 --- a/src/mkws-widget-categories.js +++ b/src/mkws-widget-categories.js @@ -1,24 +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 (!this.config.use_service_proxy) { + alert("can't use categories widget without Service Proxy"); + return; + } - this.team.queue("authenticated").subscribe(function(authName, realm) { - $(that.node).append("

Categories for " + 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); - // Parse once we've figured out the format - }); + var text = []; + text.push("Select category: "); + text.push(""); + that.node.html(text.join('')); }); + }); });