summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2010-08-09 16:32:52 -0400
committerAdam Young <ayoung@redhat.com>2010-08-09 17:21:30 -0400
commitd0a60f3a15e9d387601257a802310e5b691599a7 (patch)
treec2f74e5c5d1442e393d24b26a97a674bf94f833a /install
parent4c1fc48ee55153c7fd711082d413b2d9e7ee3fec (diff)
downloadfreeipa-d0a60f3a15e9d387601257a802310e5b691599a7.tar.gz
freeipa-d0a60f3a15e9d387601257a802310e5b691599a7.tar.xz
freeipa-d0a60f3a15e9d387601257a802310e5b691599a7.zip
Group add functionality now implmented.
- Proper navigation. (Add and edit versus add another) - posix field is respected - gid set accordingly
Diffstat (limited to 'install')
-rw-r--r--install/static/group.js67
1 files changed, 63 insertions, 4 deletions
diff --git a/install/static/group.js b/install/static/group.js
index e1aa701be..eddb272c6 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();
+ $("<h1>Add new Group</h1>").appendTo("#content");
+
+ $("<form id='addGroupForm'> </form>")
+ .appendTo("#content");
+
+ $("<label>Add and </label><input id='addEdit' type='button' value='Edit'/><input id='addAnother' type='button' value='Add Another'/>").appendTo("#addGroupForm");
+ $("<dl id='groupProperties' />").appendTo("#addGroupForm");
+
+ $("<dt>Name</dt><dd><input id='groupname' type='text'/></dd>")
+ .appendTo("#groupProperties");
+ $("<dt>Description</dt><dd><input id='groupdescription' type='text'/></dd>")
+ .appendTo("#groupProperties");
+
+ $("<dt>Is this a posix Group</dt><dd><input id='isposix' type='checkbox'/></dd>")
+ .appendTo("#groupProperties");
+ $("<dt>GID</dt><dd><input id='groupidnumber' type='text'/></dd>")
+ .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 );
}