X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fmkws-widget-categories.js;h=fc8896f30bd08db0667b60b0db4156fa7c3ca109;hb=fd5d0f9300f108fd5d1b867ef6bd187d16bb05c7;hp=afb38751226297eced7f84338f7ff53a26f90e2d;hpb=0c7d7cc39103aa776108fff06e8f3ebf43e7350c;p=mkws-moved-to-github.git diff --git a/src/mkws-widget-categories.js b/src/mkws-widget-categories.js index afb3875..fc8896f 100644 --- a/src/mkws-widget-categories.js +++ b/src/mkws-widget-categories.js @@ -1,35 +1,35 @@ -mkws.registerWidgetType('Categories', function() { - var that = this; +mkws.registerWidgetType('categories', function() { + 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(mkws.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("
Categories for " + realm + "
"); - text.push("