From 0aba779015d73e18cbb34be582734de9805fe337 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Fri, 23 Mar 2012 14:42:23 -0700 Subject: [PATCH] bug 14191 Correctly filter domain drop-down on add account dialog if accessed via a specific domain. status 14191: resolved fixed reviewed-by: jessica --- ui/scripts/accounts.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index 17301c5f2a1..e389c3ac6de 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -95,21 +95,29 @@ label: 'label.domain', validation: { required: true }, select: function(args) { + var data = {}; + + if (args.context.users) { // In accounts section + data.listAll = true; + } else if (args.context.domains) { // In domain section (use specific domain) + data.id = args.context.domains[0].id; + } + $.ajax({ - url: createURL("listDomains&listAll=true"), - domainid: args.context.users[0].domainid, + url: createURL("listDomains"), + data: data, dataType: "json", async: false, success: function(json) { var items = []; - domainObjs = json.listdomainsresponse.domain; + domainObjs = json.listdomainsresponse.domain; $(domainObjs).each(function() { - items.push({id: this.id, description: this.path}); - - if(this.level == 0) - rootDomainId = this.id; - }); - args.response.success({data: items}); + items.push({ id: this.id, description: this.path }); + + if(this.level == 0) + rootDomainId = this.id; + }); + args.response.success({ data: items }); } }); }