From 55c817ad62040878a1a8d9ff197cbd643e819ecd Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 7 Nov 2011 15:38:18 -0800 Subject: [PATCH] cloudStack 3.0 new UI - user page - implement Edit User action. --- ui/scripts/accounts.js | 56 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index d1ca45a5158..3933bbdd97f 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -709,13 +709,38 @@ detailView: { name: 'User details', + actions: { + edit: { + label: 'Edit', + action: function(args) { + var array1 = []; + array1.push("&username=" + todb(args.data.username)); + array1.push("&email=" + todb(args.data.email)); + array1.push("&firstname=" + todb(args.data.firstname)); + array1.push("&lastname=" + todb(args.data.lastname)); + array1.push("&timezone=" + todb(args.data.timezone)); + $.ajax({ + url: createURL("updateUser&id=" + args.context.users[0].id + array1.join("")), + dataType: "json", + success: function(json) { + var item = json.updateuserresponse.user; + args.response.success({data:item}); + } + }); + + } + } + }, tabs: { details: { title: 'details', fields: [ { - username: { label: 'Name' } + username: { + label: 'Name', + isEditable: true + } }, { id: { label: 'ID' }, @@ -730,17 +755,34 @@ } }, domain: { label: 'Domain' }, - email: { label: 'Email' }, - firstname: { label: 'First name' }, - lastname: { label: 'Last name' }, + email: { + label: 'Email', + isEditable: true + }, + firstname: { + label: 'First name', + isEditable: true + }, + lastname: { + label: 'Last name', + isEditable: true + }, timezone: { label: 'Timezone', converter: function(args) { if(args == null || args.length == 0) return ""; - else - return timezoneMap[args]; - } + else + return args; + }, + isEditable: true, + select: function(args) { + var items = []; + items.push({id: "", description: ""}); + for(var p in timezoneMap) + items.push({id: p, description: timezoneMap[p]}); + args.response.success({data: items}); + } } } ],