From d0a60f3a15e9d387601257a802310e5b691599a7 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Mon, 9 Aug 2010 16:32:52 -0400 Subject: Group add functionality now implmented. - Proper navigation. (Add and edit versus add another) - posix field is respected - gid set accordingly --- install/static/group.js | 67 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) (limited to 'install/static/group.js') diff --git a/install/static/group.js b/install/static/group.js index e1aa701b..eddb272c 100644 --- a/install/static/group.js +++ b/install/static/group.js @@ -1,17 +1,78 @@ function setupGroup(facet){ if (facet == "details"){ setupGroupDetails(); + }else if (facet == "add"){ + setupAddGroup(); }else{ setupGroupSearch(); } } + +function addGroupFail(desc){ + alert(desc); +} + +function addGroup(on_success){ + + var options = { + posix: $('#isposix').is(':checked') ? 1 : 0 , + description: $("#groupdescription").val()}; + + + var gid = $("#groupidnumber").val(); + if (gid.length > 0){ + options.gidnumber = gid; + } + + var params = [$("#groupname").val()]; + + ipa_cmd( 'add', params, options, on_success, addGroupFail, 'group' ); + +} + +function addEditGroup(){ + addGroup(function (response){ + location.href="index.xhtml?tab=group&facet=details&pkey="+$("#groupname").val(); + }); +} + +function addAnotherGroup(){ + addGroup(setupAddGroup); +} + + +function setupAddGroup(){ + showContent(); + $("

Add new Group

").appendTo("#content"); + + $("
") + .appendTo("#content"); + + $("").appendTo("#addGroupForm"); + $("
").appendTo("#addGroupForm"); + + $("
Name
") + .appendTo("#groupProperties"); + $("
Description
") + .appendTo("#groupProperties"); + + $("
Is this a posix Group
") + .appendTo("#groupProperties"); + $("
GID
") + .appendTo("#groupProperties"); + + + $("#addEdit").click(addEditGroup); + $("#addAnother").click(addAnotherGroup); + +} + function setupGroupDetails(){ $('#search').css("visibility","hidden"); $('#content').css("visibility","visible"); $('#content').load("group-details.inc"); - sampleData = "sampledata/groupshow.json"; } @@ -33,9 +94,7 @@ function setupGroupSearch(){ executeSearch(groupSearchForm); }); $("#new").unbind(); - $("#new").click( function() { - alert("New Group..."); - }); + $("#new").click( setupAddGroup ); } -- cgit