From 80363a24af57761c17eb958d354d7ff07d353406 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Thu, 24 Mar 2011 16:55:21 -0500 Subject: Prototype --- install/ui/controllers/user.js | 96 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100755 install/ui/controllers/user.js (limited to 'install/ui/controllers/user.js') diff --git a/install/ui/controllers/user.js b/install/ui/controllers/user.js new file mode 100755 index 00000000..0a9ddcc3 --- /dev/null +++ b/install/ui/controllers/user.js @@ -0,0 +1,96 @@ +$.Controller.extend('IPA.Controllers.UserSearchTable', +{ +}, +{ + init: function(el) { + this.tbody = $('tbody', this.element); + this.row = $('tr', this.tbody).first(); + + IPA.Models.User.find([], { all: true }, this.callback('list')); + }, + list: function(users) { + this.tbody.empty(); + + for (var i=0; i'); + + dialog.append('Login name: '); + + var uid = $('', { + name: 'uid' + }).appendTo(dialog); + + dialog.append('
'); + dialog.append('First name: '); + + var givenname = $('', { + name: 'givenname' + }).appendTo(dialog); + + dialog.append('
'); + dialog.append('Last name: '); + + var sn = $('', { + name: 'sn' + }).appendTo(dialog); + + var list = this.callback('list'); + dialog.dialog({ + title: 'Add', + modal: true, + buttons: { + 'Add': function() { + IPA.Models.User.add( + [uid.val()], + { + givenname: givenname.val(), + sn: sn.val() + }, + function(data, text_status, xhr) { + IPA.Models.User.find([], { all: true }, list); + + dialog.dialog('destroy'); + dialog.remove(); + } + ); + }, + 'Cancel': function() { + dialog.dialog('destroy'); + dialog.remove(); + } + } + }); + + ev.preventDefault(); + }, + 'input[name="delete"] click': function(el, ev) { + var args = []; + $('input[name="select"]:checked', this.tbody).each(function() { + args.push($(this).val()); + }); + + var list = this.callback('list'); + IPA.Models.User.del(args, {},function(data, text_status, xhr) { + IPA.Models.User.find([], { all: true }, list); + }); + + ev.preventDefault(); + } +}); -- cgit