diff options
author | Adam Young <ayoung@redhat.com> | 2010-08-23 22:32:23 -0400 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2010-08-26 13:15:00 -0400 |
commit | 49584d6efc6a10fa0b76ce81b2638d424f2208a8 (patch) | |
tree | 08c87c7d7bd2ee0fef6e5045948a977a5c61cdc9 /install/static/group.js | |
parent | 02479babb9cd5fdd0673175fde22e40f3a1b10b4 (diff) | |
download | freeipa-49584d6efc6a10fa0b76ce81b2638d424f2208a8.tar.gz freeipa-49584d6efc6a10fa0b76ce81b2638d424f2208a8.tar.xz freeipa-49584d6efc6a10fa0b76ce81b2638d424f2208a8.zip |
hashchange
We now catch the hashchange event and use that to drive most of the site.
To trigger page transitions, modify location.hash.
Params start with # not ?.
Removed user-group.inc.
converted tabs to spaces
trivial imlementation of add and details for netgroup and hostgroup
lots of bug fixes based on routing problems and the refactorings.
Diffstat (limited to 'install/static/group.js')
-rw-r--r-- | install/static/group.js | 71 |
1 files changed, 29 insertions, 42 deletions
diff --git a/install/static/group.js b/install/static/group.js index beb10879..981e048b 100644 --- a/install/static/group.js +++ b/install/static/group.js @@ -1,10 +1,10 @@ function setupGroup(facet){ if (facet == "details"){ - setupGroupDetails(); + setupGroupDetails(); }else if (facet == "add"){ - setupAddGroup(); + setupAddGroup(); }else{ - setupGroupSearch(); + groupSearchForm.setup(); } } @@ -14,15 +14,15 @@ function addGroupFail(desc){ } function addGroup(on_success){ - - var options = { - posix: $('#isposix').is(':checked') ? 1 : 0 , - description: $("#groupdescription").val()}; + var options = { + posix: $('#isposix').is(':checked') ? 1 : 0 , + description: $("#groupdescription").val()}; - var gid = $("#groupidnumber").val(); + + var gid = $("#groupidnumber").val(); if (gid.length > 0){ - options.gidnumber = gid; + options.gidnumber = gid; } var params = [$("#groupname").val()]; @@ -33,7 +33,7 @@ function addGroup(on_success){ function addEditGroup(){ addGroup(function (response){ - location.href="index.xhtml?tab=group&facet=details&pkey="+$("#groupname").val(); + location.hash="tab=group&facet=details&pkey="+$("#groupname").val(); }); } @@ -47,20 +47,20 @@ function setupAddGroup(){ $("<h1>Add new Group</h1>").appendTo("#content"); $("<form id='addGroupForm'> </form>") - .appendTo("#content"); - + .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"); + .appendTo("#groupProperties"); $("<dt>Description</dt><dd><input id='groupdescription' type='text'/></dd>") - .appendTo("#groupProperties"); + .appendTo("#groupProperties"); $("<dt>Is this a posix Group</dt><dd><input id='isposix' type='checkbox'/></dd>") - .appendTo("#groupProperties"); + .appendTo("#groupProperties"); $("<dt>GID</dt><dd><input id='groupidnumber' type='text'/></dd>") - .appendTo("#groupProperties"); + .appendTo("#groupProperties"); $("#addEdit").click(addEditGroup); @@ -70,20 +70,15 @@ function setupAddGroup(){ var group_details_list = [['identity', 'Group Details', [ - ['cn', 'Group Name'], - ['description', 'Description'], - ['gidnumber', 'Group ID']]]]; + ['cn', 'Group Name'], + ['description', 'Description'], + ['gidnumber', 'Group ID']]]]; function setupGroupDetails(group){ - window.location.hash="#tab=user&facet=details&pkey="+group; - //re initialize global parse of parameters qs = ipa_parse_qs(); - //TODO make this work for more than just user details - user_details_lists; - showDetails(); ipa_details_init('group'); @@ -103,29 +98,21 @@ function renderGroupDetails(group) function renderGroupDetailColumn(current,cell){ $("<a/>",{ - href:"#tab=group&facet=details&pkey="+current.cn, - html: ""+ current[this.column], - click: function(){ setupGroupDetails(current.cn)}, + href:"#tab=group&facet=details&pkey="+current.cn, + html: ""+ current[this.column], + //click: function(){ setupGroupDetails(current.cn)}, }).appendTo(cell); } -function setupGroupSearch(){ - var columns = [ - {title:"Group Name", column:"cn",render: renderGroupDetailColumn}, - {title:"GID", column:"gidnumber",render: renderSimpleColumn}, - {title:"Description", column:"description",render: renderSimpleColumn} - ]; +var groupSearchColumns = [ + {title:"Group Name", column:"cn",render: renderGroupDetailColumn}, + {title:"GID", column:"gidnumber",render: renderSimpleColumn}, + {title:"Description", column:"description",render: renderSimpleColumn} +]; - var groupSearchForm = new SearchForm("group", "find", columns,"sampledata/grouplist.json"); +var groupSearchForm = new SearchForm("group", "find", groupSearchColumns ,"sampledata/grouplist.json"); - $("#query").unbind(); - $("#query").click(function(){ - executeSearch(groupSearchForm); - }); - $("#new").unbind(); - $("#new").click( setupAddGroup ); -} |