1 mkws.registerWidgetType('Categories', function() {
4 if (!this.config.use_service_proxy) {
5 alert("can't use categories widget without Service Proxy");
9 this.team.queue("authenticated").subscribe(function(authName, realm) {
10 var req = new pzHttpRequest(that.config.pazpar2_url + "?command=categories", function(err) {
11 alert("HTTP call for categories failed: " + err)
14 req.get(null, function(data) {
15 if (!$.isXMLDoc(data)) {
16 alert("categories response document is not XML");
19 that.log("got categories: " + data);
22 text.push("Select category: ");
23 text.push("<select name='mkwsCategory' onchange='alert(1)'>");
24 $(data).find('category').each(function() {
25 var name = $(this).find('categoryName').text();
26 var id = $(this).find('categoryId').text();
27 text.push("<option value='", id, "'>", name, "</option>");
29 text.push("</select>");
30 $(that.node).html(text.join(''));