--- ui/scripts/templates.js | 59 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 14 deletions(-)
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index e49b94f..44408c4 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -200,20 +200,51 @@ } }, - osTypeId: { - label: 'label.os.type', - select: function(args) { - $.ajax({ - url: createURL("listOsTypes"), - dataType: "json", - async: true, - success: function(json) { - var items = json.listostypesresponse.ostype; - args.response.success({data: items}); - } - }); - } - }, + osCategory: { + label: 'OS Category', + select: function(args) { + $.ajax({ + url: createURL("listOsCategories"), + dataType: "json", + async: true, + success: function(json) { + var osCats = json.listoscategoriesresponse.oscategory; + var items = []; + if (isAdmin()) + items.push({id: -1, description: "All OS"}); + $(osCats).each(function() { + items.push({id: this.id, description: this.name}); + }); + args.response.success({data: items}); + } + }); + } + }, + + osTypeId: { + label: 'label.os.type', + dependsOn: 'osCategory', + select: function(args) { + if(args.osCategory == null) + return; + + var apiCmd; + if(args.osCategory == -1) + apiCmd = "listOsTypes"; + else + apiCmd = "listOsTypes&oscategoryid=" + args.osCategory; + + $.ajax({ + url: createURL(apiCmd), + dataType: "json", + async: true, + success: function(json) { + var items = json.listostypesresponse.ostype; + args.response.success({data: items}); + } + }); + } + }, isExtractable: { label: "extractable", -- 1.7.10.msysgit.1