mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-29 10:21:18 -06:00
49584d6efc
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.
119 lines
2.8 KiB
JavaScript
119 lines
2.8 KiB
JavaScript
function setupGroup(facet){
|
|
if (facet == "details"){
|
|
setupGroupDetails();
|
|
}else if (facet == "add"){
|
|
setupAddGroup();
|
|
}else{
|
|
groupSearchForm.setup();
|
|
}
|
|
}
|
|
|
|
|
|
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.hash="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);
|
|
|
|
}
|
|
|
|
var group_details_list =
|
|
[['identity', 'Group Details', [
|
|
['cn', 'Group Name'],
|
|
['description', 'Description'],
|
|
['gidnumber', 'Group ID']]]];
|
|
|
|
function setupGroupDetails(group){
|
|
|
|
//re initialize global parse of parameters
|
|
qs = ipa_parse_qs();
|
|
|
|
showDetails();
|
|
|
|
ipa_details_init('group');
|
|
ipa_details_create(group_details_list, $('#details'));
|
|
ipa_details_load(qs['pkey'], on_win, null, "sampledata/groupshow.json");
|
|
$('h1').text('Managing group: ' + group);
|
|
}
|
|
|
|
|
|
|
|
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)},
|
|
}).appendTo(cell);
|
|
}
|
|
|
|
|
|
|
|
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", groupSearchColumns ,"sampledata/grouplist.json");
|
|
|
|
|
|
|