mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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.
This commit is contained in:
@@ -2,6 +2,7 @@ NULL =
|
|||||||
|
|
||||||
appdir = $(IPA_DATA_DIR)/static
|
appdir = $(IPA_DATA_DIR)/static
|
||||||
app_DATA = \
|
app_DATA = \
|
||||||
|
add.js \
|
||||||
but-reset.png \
|
but-reset.png \
|
||||||
but-update.png \
|
but-update.png \
|
||||||
but-selected.png \
|
but-selected.png \
|
||||||
|
|||||||
110
install/static/add.js
Normal file
110
install/static/add.js
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
/* Authors:
|
||||||
|
* Adam Young <ayoung@redhat.com>
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Red Hat
|
||||||
|
* see file 'COPYING' for use and warranty information
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; version 2 only
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* IPA Object Add - creating new instances of entities */
|
||||||
|
|
||||||
|
/* REQUIRES: ipa.js */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* An associatev array between entity names and their builders
|
||||||
|
*/
|
||||||
|
var builders = {} ;
|
||||||
|
|
||||||
|
|
||||||
|
function add_fail(desc){
|
||||||
|
alert(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Process for managing the 'add' functionality
|
||||||
|
function EntityBuilder(obj,addProperties,addOptionsFunction ){
|
||||||
|
this.obj = obj;
|
||||||
|
this.addProperties = addProperties;
|
||||||
|
if (addOptionsFunction){
|
||||||
|
this.addOptionsFunction = addOptionsFunction;
|
||||||
|
}else{
|
||||||
|
this.addOptionsFunction = function(){
|
||||||
|
var options = { };
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.add = function(on_success){
|
||||||
|
var options = this.addOptionsFunction();
|
||||||
|
var params = [$("#pkey").val()];
|
||||||
|
ipa_cmd( 'add', params, options, on_success, add_fail, this.obj );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setup = function(){
|
||||||
|
showContent();
|
||||||
|
$("<h1/>" ,{ html : "Add new " + this.obj } ).appendTo("#content");
|
||||||
|
$("<div id='addForm'> </div>")
|
||||||
|
.appendTo("#content");
|
||||||
|
var label =$("<span>Add and </span>").appendTo("#addForm")
|
||||||
|
$("<input \>",
|
||||||
|
{id:'addEdit',
|
||||||
|
type:'button',
|
||||||
|
value:'Edit',
|
||||||
|
click: function(){
|
||||||
|
var params = ipa_parse_qs();
|
||||||
|
builders[params["tab"]].add (addEdit)
|
||||||
|
}
|
||||||
|
}).appendTo(label);
|
||||||
|
$("<input\>", {
|
||||||
|
id:'addAnother',
|
||||||
|
type:'button',
|
||||||
|
value:'Add Another',
|
||||||
|
click: function(){
|
||||||
|
var params = ipa_parse_qs();
|
||||||
|
builders[params["tab"]].add (addAnother)
|
||||||
|
}
|
||||||
|
}).appendTo(label);
|
||||||
|
$("<dl id='addProperties' />").appendTo("#addForm");
|
||||||
|
|
||||||
|
for (index = 0; index < this.addProperties.length; index++){
|
||||||
|
var prop = this.addProperties[index];
|
||||||
|
var title = $("<dt/>",{html:prop.title});
|
||||||
|
var definition = $("<dd></dd>");
|
||||||
|
$("<input/>",{
|
||||||
|
id:prop.id,
|
||||||
|
type:prop.type
|
||||||
|
}).appendTo(definition);
|
||||||
|
definition.appendTo(title);
|
||||||
|
title.appendTo("#addProperties");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//register the new object with the associatev array of builders.
|
||||||
|
builders[obj] = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function addAnother(response){
|
||||||
|
var params = ipa_parse_qs();
|
||||||
|
builders[params["tab"]].setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
function addEdit(response){
|
||||||
|
var params = ipa_parse_qs();
|
||||||
|
var hash= "tab="
|
||||||
|
+ params["tab"]
|
||||||
|
+"&facet=details&pkey="
|
||||||
|
+$("#pkey").val();
|
||||||
|
window.location.hash = hash;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
/* Authors:
|
/* Authors:
|
||||||
* Pavel Zuna <pzuna@redhat.com>
|
* Pavel Zuna <pzuna@redhat.com>
|
||||||
|
* Adam Young <ayoung@redhat.com>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Red Hat
|
* Copyright (C) 2010 Red Hat
|
||||||
* see file 'COPYING' for use and warranty information
|
* see file 'COPYING' for use and warranty information
|
||||||
@@ -16,7 +17,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* IPA Object Details - populating definiton lists from entry data */
|
/* IPA Object Details - populating definiton lists from entry data */
|
||||||
|
|
||||||
@@ -134,6 +135,7 @@ function ipa_details_update(pkey, on_win, on_fail)
|
|||||||
modlist['setattr'].push(attr + '=' + values[0]);
|
modlist['setattr'].push(attr + '=' + values[0]);
|
||||||
for (var i = 1; i < values.length; ++i)
|
for (var i = 1; i < values.length; ++i)
|
||||||
modlist['addattr'].push(attr + '=' + values[i]);
|
modlist['addattr'].push(attr + '=' + values[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_ipa_update_on_win_callback = on_win;
|
_ipa_update_on_win_callback = on_win;
|
||||||
@@ -162,6 +164,7 @@ function _ipa_update_on_fail(xhr, text_status, error_thrown)
|
|||||||
{
|
{
|
||||||
if (_ipa_update_on_fail_callback)
|
if (_ipa_update_on_fail_callback)
|
||||||
_ipa_update_on_fail_callback(xhr, text_status, error_thrown);
|
_ipa_update_on_fail_callback(xhr, text_status, error_thrown);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ipa_details_create(dls, container)
|
function ipa_details_create(dls, container)
|
||||||
@@ -173,7 +176,7 @@ function ipa_details_create(dls, container)
|
|||||||
var d = dls[i];
|
var d = dls[i];
|
||||||
|
|
||||||
ipa_generate_dl($('#detail-lists hr').last(), d[0], d[1], d[2]);
|
ipa_generate_dl($('#detail-lists hr').last(), d[0], d[1], d[2]);
|
||||||
// ipa_generate_dl($("#detail-lists"), d[0], d[1], d[2]);
|
// ipa_generate_dl($("#detail-lists"), d[0], d[1], d[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +335,7 @@ function ipa_create_input(attr, value)
|
|||||||
if (param_info['multivalue'] || param_info['class'] == 'List') {
|
if (param_info['multivalue'] || param_info['class'] == 'List') {
|
||||||
return (
|
return (
|
||||||
handler(attr, value, param_info) +
|
handler(attr, value, param_info) +
|
||||||
_ipa_create_remove_link(attr, param_info)
|
_ipa_create_remove_link(attr, param_info)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (handler(attr, value, param_info));
|
return (handler(attr, value, param_info));
|
||||||
@@ -378,6 +381,7 @@ function ipa_details_reset()
|
|||||||
{
|
{
|
||||||
if (ipa_details_cache)
|
if (ipa_details_cache)
|
||||||
ipa_details_display(ipa_details_cache);
|
ipa_details_display(ipa_details_cache);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Event handlers */
|
/* Event handlers */
|
||||||
@@ -435,3 +439,22 @@ function _h2_on_click(obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function DetailsForm(obj, details_list, pkeyCol, sampleData ){
|
||||||
|
|
||||||
|
this.obj = obj;
|
||||||
|
this.details_list = details_list;
|
||||||
|
this.sampleData = sampleData;
|
||||||
|
this.pkeyCol = pkeyCol;
|
||||||
|
|
||||||
|
this.setup= function(key){
|
||||||
|
//re initialize global parse of parameters
|
||||||
|
qs = ipa_parse_qs();
|
||||||
|
|
||||||
|
showDetails();
|
||||||
|
$('h1').text("Managing " + this.obj +": " +qs['pkey'] );
|
||||||
|
|
||||||
|
ipa_details_init(this.obj);
|
||||||
|
ipa_details_create(this.details_list, $('#details'));
|
||||||
|
ipa_details_load(qs.pkey, on_win, null, this.sampleData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
function setupGroup(facet){
|
function setupGroup(facet){
|
||||||
if (facet == "details"){
|
if (facet == "details"){
|
||||||
setupGroupDetails();
|
setupGroupDetails();
|
||||||
}else if (facet == "add"){
|
}else if (facet == "add"){
|
||||||
setupAddGroup();
|
setupAddGroup();
|
||||||
}else{
|
}else{
|
||||||
setupGroupSearch();
|
groupSearchForm.setup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,15 +14,15 @@ function addGroupFail(desc){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addGroup(on_success){
|
function addGroup(on_success){
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
posix: $('#isposix').is(':checked') ? 1 : 0 ,
|
posix: $('#isposix').is(':checked') ? 1 : 0 ,
|
||||||
description: $("#groupdescription").val()};
|
description: $("#groupdescription").val()};
|
||||||
|
|
||||||
|
|
||||||
var gid = $("#groupidnumber").val();
|
var gid = $("#groupidnumber").val();
|
||||||
if (gid.length > 0){
|
if (gid.length > 0){
|
||||||
options.gidnumber = gid;
|
options.gidnumber = gid;
|
||||||
}
|
}
|
||||||
|
|
||||||
var params = [$("#groupname").val()];
|
var params = [$("#groupname").val()];
|
||||||
@@ -33,7 +33,7 @@ function addGroup(on_success){
|
|||||||
|
|
||||||
function addEditGroup(){
|
function addEditGroup(){
|
||||||
addGroup(function (response){
|
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");
|
$("<h1>Add new Group</h1>").appendTo("#content");
|
||||||
|
|
||||||
$("<form id='addGroupForm'> </form>")
|
$("<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");
|
$("<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");
|
$("<dl id='groupProperties' />").appendTo("#addGroupForm");
|
||||||
|
|
||||||
$("<dt>Name</dt><dd><input id='groupname' type='text'/></dd>")
|
$("<dt>Name</dt><dd><input id='groupname' type='text'/></dd>")
|
||||||
.appendTo("#groupProperties");
|
.appendTo("#groupProperties");
|
||||||
$("<dt>Description</dt><dd><input id='groupdescription' type='text'/></dd>")
|
$("<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>")
|
$("<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>")
|
$("<dt>GID</dt><dd><input id='groupidnumber' type='text'/></dd>")
|
||||||
.appendTo("#groupProperties");
|
.appendTo("#groupProperties");
|
||||||
|
|
||||||
|
|
||||||
$("#addEdit").click(addEditGroup);
|
$("#addEdit").click(addEditGroup);
|
||||||
@@ -70,20 +70,15 @@ function setupAddGroup(){
|
|||||||
|
|
||||||
var group_details_list =
|
var group_details_list =
|
||||||
[['identity', 'Group Details', [
|
[['identity', 'Group Details', [
|
||||||
['cn', 'Group Name'],
|
['cn', 'Group Name'],
|
||||||
['description', 'Description'],
|
['description', 'Description'],
|
||||||
['gidnumber', 'Group ID']]]];
|
['gidnumber', 'Group ID']]]];
|
||||||
|
|
||||||
function setupGroupDetails(group){
|
function setupGroupDetails(group){
|
||||||
|
|
||||||
window.location.hash="#tab=user&facet=details&pkey="+group;
|
|
||||||
|
|
||||||
//re initialize global parse of parameters
|
//re initialize global parse of parameters
|
||||||
qs = ipa_parse_qs();
|
qs = ipa_parse_qs();
|
||||||
|
|
||||||
//TODO make this work for more than just user details
|
|
||||||
user_details_lists;
|
|
||||||
|
|
||||||
showDetails();
|
showDetails();
|
||||||
|
|
||||||
ipa_details_init('group');
|
ipa_details_init('group');
|
||||||
@@ -103,29 +98,21 @@ function renderGroupDetails(group)
|
|||||||
function renderGroupDetailColumn(current,cell){
|
function renderGroupDetailColumn(current,cell){
|
||||||
|
|
||||||
$("<a/>",{
|
$("<a/>",{
|
||||||
href:"#tab=group&facet=details&pkey="+current.cn,
|
href:"#tab=group&facet=details&pkey="+current.cn,
|
||||||
html: ""+ current[this.column],
|
html: ""+ current[this.column],
|
||||||
click: function(){ setupGroupDetails(current.cn)},
|
//click: function(){ setupGroupDetails(current.cn)},
|
||||||
}).appendTo(cell);
|
}).appendTo(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function setupGroupSearch(){
|
|
||||||
|
|
||||||
var columns = [
|
var groupSearchColumns = [
|
||||||
{title:"Group Name", column:"cn",render: renderGroupDetailColumn},
|
{title:"Group Name", column:"cn",render: renderGroupDetailColumn},
|
||||||
{title:"GID", column:"gidnumber",render: renderSimpleColumn},
|
{title:"GID", column:"gidnumber",render: renderSimpleColumn},
|
||||||
{title:"Description", column:"description",render: renderSimpleColumn}
|
{title:"Description", column:"description",render: renderSimpleColumn}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var groupSearchForm = new SearchForm("group", "find", groupSearchColumns ,"sampledata/grouplist.json");
|
||||||
|
|
||||||
var groupSearchForm = new SearchForm("group", "find", columns,"sampledata/grouplist.json");
|
|
||||||
|
|
||||||
$("#query").unbind();
|
|
||||||
$("#query").click(function(){
|
|
||||||
executeSearch(groupSearchForm);
|
|
||||||
});
|
|
||||||
$("#new").unbind();
|
|
||||||
$("#new").click( setupAddGroup );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,38 +1,32 @@
|
|||||||
function setupHost(facet){
|
function setupHost(facet){
|
||||||
if (facet == "details"){
|
if (facet == "details"){
|
||||||
setupHostDetails();
|
hostDetailsForm.setup();
|
||||||
|
}else if (facet == "add"){
|
||||||
|
hostBuilder.setup();
|
||||||
}else{
|
}else{
|
||||||
setupHostSearch();
|
hostSearchForm.setup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupHostDetails(){
|
var hostAddProperties = [{title: 'Domain Name', id: 'pkey', type: 'text'}];
|
||||||
var detailsForm = new DetailsForm();
|
var hostBuilder = new EntityBuilder("host",hostAddProperties);
|
||||||
}
|
|
||||||
|
|
||||||
function setupHostSearch(){
|
|
||||||
|
|
||||||
sampleData = "sampledata/hostlist.json";
|
var host_details_list = [['host', 'Host Details', [
|
||||||
var columns = [
|
['fqdn', 'Fully Qualified Domain Name'],
|
||||||
{title:"Host",column:"fqdn",render: function(current,cell){
|
['krbprincipalname', 'Kerberos Principal'],
|
||||||
renderDetailColumn(current,cell,current[this.column],"group");
|
['serverhostname', 'Server Host Name']
|
||||||
}},
|
]]];
|
||||||
{title:"Comment", column: "description", render: renderSimpleColumn},
|
|
||||||
{title:"Enrolled?", render: renderUnknownColumn},
|
var hostDetailsForm = new DetailsForm("host",host_details_list,"fqdn","sampledata/hostshow.json") ;
|
||||||
{title:"Manages?", render: renderUnknownColumn}
|
|
||||||
];
|
|
||||||
|
|
||||||
var hostSearchForm = new SearchForm("host", "find", columns);
|
|
||||||
|
|
||||||
$("#query").unbind();
|
var hostDetailsColumns = [
|
||||||
$("#query").click(function(){
|
{title:"Host",column:"fqdn",render: function(current,cell){
|
||||||
sampleData = "sampledata/hostlist.json";
|
renderPkeyColumn(hostDetailsForm,current,cell);
|
||||||
executeSearch(hostSearchForm);
|
}},
|
||||||
});
|
{title:"Comment", column: "description", render: renderSimpleColumn},
|
||||||
|
{title:"Enrolled?", render: renderUnknownColumn},
|
||||||
$("#new").unbind();
|
{title:"Manages?", render: renderUnknownColumn}
|
||||||
$("#new").click( function() {
|
];
|
||||||
alert("New Host...");
|
var hostSearchForm = new SearchForm("host", "find", hostDetailsColumns,"sampledata/hostlist.json");
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,35 +1,48 @@
|
|||||||
function setupHostgroup(facet){
|
function setupHostgroup(facet){
|
||||||
if (facet == "details"){
|
if (facet == "details"){
|
||||||
setupHostgroupDetails();
|
hostgroupDetailsForm.setup();
|
||||||
|
}else if (facet == "add"){
|
||||||
|
hostgroupBuilder.setup();
|
||||||
}else{
|
}else{
|
||||||
setupHostgroupSearch();
|
hostgroupSearchForm.setup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupHostgroupDetails(){
|
var hostgroup_details_list =
|
||||||
var detailsForm = new DetailsForm();
|
[['identity', 'Hostgroup Details', [
|
||||||
|
['cn', 'Hostgroup Name'],
|
||||||
|
['description', 'Description']]]];
|
||||||
|
|
||||||
|
|
||||||
|
var hostgroupDetailsForm = new DetailsForm("hostgroup",hostgroup_details_list,"cn","sampledata/hostgroupshow.json") ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function hostgroupAddOptionsFunction (){
|
||||||
|
var options = {
|
||||||
|
name: $('#pkey').val(),
|
||||||
|
description: $('#description').val()
|
||||||
|
};
|
||||||
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hostgroupAddProperties =
|
||||||
|
[{title: 'Hostgroup Name', id: 'pkey', type: 'text'},
|
||||||
|
{title: 'Description', id: 'description', type: 'text'}];
|
||||||
|
|
||||||
function setupHostgroupSearch(){
|
var hostgroupBuilder = new EntityBuilder("hostgroup",hostgroupAddProperties,hostgroupAddOptionsFunction);
|
||||||
|
|
||||||
var columns = [
|
|
||||||
{title:"Hostgroup",column:"cn",render: function(current,cell){
|
|
||||||
renderDetailColumn(current,cell,current[this.column],"hostgroup");
|
|
||||||
}},
|
|
||||||
{title:"Description", column:"description",render: renderSimpleColumn}];
|
|
||||||
|
|
||||||
var hostgroupSearchForm = new SearchForm("hostgroup", "find", columns);
|
var hostgroupSearchColumns = [
|
||||||
|
{
|
||||||
|
title:"Hostgroup",
|
||||||
|
column:"cn",
|
||||||
|
render: function(current,cell){
|
||||||
|
renderPkeyColumn(hostgroupDetailsForm, current,cell);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{title:"Description", column:"description",render: renderSimpleColumn}];
|
||||||
|
|
||||||
$("#query").unbind();
|
var hostgroupSearchForm =
|
||||||
|
new SearchForm("hostgroup", "find", hostgroupSearchColumns,
|
||||||
$("#query").click(function(){
|
"sampledata/hostgrouplist.json");
|
||||||
sampleData = "sampledata/hostgrouplist.json";
|
|
||||||
executeSearch(hostgroupSearchForm);
|
|
||||||
});
|
|
||||||
$("#new").unbind();
|
|
||||||
$("#new").click( function() {
|
|
||||||
alert("New Hostgroup...");
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<script type="text/javascript" src="sampledata/develop.js"></script>
|
<script type="text/javascript" src="sampledata/develop.js"></script>
|
||||||
<script type="text/javascript" src="search.js"></script>
|
<script type="text/javascript" src="search.js"></script>
|
||||||
<script type="text/javascript" src="details.js"></script>
|
<script type="text/javascript" src="details.js"></script>
|
||||||
|
<script type="text/javascript" src="add.js"></script>
|
||||||
<script type="text/javascript" src="user.js"></script>
|
<script type="text/javascript" src="user.js"></script>
|
||||||
<script type="text/javascript" src="usermeta.js"></script>
|
<script type="text/javascript" src="usermeta.js"></script>
|
||||||
<script type="text/javascript" src="group.js"></script>
|
<script type="text/javascript" src="group.js"></script>
|
||||||
@@ -70,14 +71,6 @@
|
|||||||
|
|
||||||
<ul id="viewtype">
|
<ul id="viewtype">
|
||||||
<li id="viewcaption">View:</li>
|
<li id="viewcaption">View:</li>
|
||||||
<li>
|
|
||||||
<img src="but-selected.png" alt="" />
|
|
||||||
Identity Details
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<img src="but-unselected.png" alt="" />
|
|
||||||
<a href="memberof?pkey=${pkey}">Memberships</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div id="detail-lists">
|
<div id="detail-lists">
|
||||||
<hr />
|
<hr />
|
||||||
@@ -89,7 +82,7 @@
|
|||||||
|
|
||||||
<div id="search" style="display:none">
|
<div id="search" style="display:none">
|
||||||
<div class="searchControls" >
|
<div class="searchControls" >
|
||||||
<span class="filter" >
|
<span id="filter" class="filter" >
|
||||||
<input id="queryFilter" type="text"/>
|
<input id="queryFilter" type="text"/>
|
||||||
<input id="query" type="submit" value="find" />
|
<input id="query" type="submit" value="find" />
|
||||||
<input id="new" type="submit" value="new" />
|
<input id="new" type="submit" value="new" />
|
||||||
@@ -104,5 +97,49 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="associations" style="display:none">
|
||||||
|
<h1>Enroll in Groups</h1>
|
||||||
|
<ul id="viewtype">
|
||||||
|
<li id="viewcaption">View:</li>
|
||||||
|
</ul>
|
||||||
|
<form>
|
||||||
|
<div style="border-width:1px">
|
||||||
|
<div >
|
||||||
|
<input type="text"/>
|
||||||
|
<input id="find" type="button" value="Find Groups"/>
|
||||||
|
<span style="float:right">
|
||||||
|
<input id="cancelEnrollGroups" type="button" value="Cancel"/>
|
||||||
|
<input id="enrollGroups" type="button" value="Enroll"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div id="results" style="border: 2px solid rgb(0, 0, 0); position:relative; height:200px;" >
|
||||||
|
<div style="float:left;">
|
||||||
|
<div>Groups</div>
|
||||||
|
<select id="grouplist" width="150px" size="10" multiple="true" >
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div style="float:left;">
|
||||||
|
<p><input id="removeFromList" type="button" value="<<"/> </p>
|
||||||
|
<p><input id="addToList" type="button" value=">>"/></p>
|
||||||
|
</div>
|
||||||
|
<div style="float:left;">
|
||||||
|
<div>Prospective Enrollments</div>
|
||||||
|
<select id="enrollments" width="150px" size="10" multiple="true" >
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr/>
|
||||||
|
<div>Message Area</div>
|
||||||
|
<hr/>
|
||||||
|
<div>
|
||||||
|
<span style="float:left">
|
||||||
|
<p>*Enter Group Names and Press Groups</p>
|
||||||
|
<p>*More stuff</p>
|
||||||
|
<p>*More stuff</p>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -89,11 +89,11 @@ div#details {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div#details ul#viewtype {
|
ul#viewtype {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#details ul#viewtype li {
|
ul#viewtype li {
|
||||||
color: #656565;
|
color: #656565;
|
||||||
display: inline;
|
display: inline;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@@ -101,16 +101,12 @@ div#details ul#viewtype li {
|
|||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#content ul#viewtype li#viewcaption {
|
|
||||||
color: #000;
|
|
||||||
padding-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#details ul#viewtype li img {
|
ul#viewtype li img {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#details ul#viewtype li a {
|
ul#viewtype li a {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,16 +39,16 @@ var qs;
|
|||||||
function ipa_init(url, on_win)
|
function ipa_init(url, on_win)
|
||||||
{
|
{
|
||||||
if (!url)
|
if (!url)
|
||||||
url = '/ipa/json';
|
url = '/ipa/json';
|
||||||
|
|
||||||
_ipa_init_on_win_callback = on_win;
|
_ipa_init_on_win_callback = on_win;
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
url: url,
|
url: url,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
processData: false,
|
processData: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajaxSetup(options);
|
$.ajaxSetup(options);
|
||||||
@@ -60,7 +60,7 @@ function _ipa_load_objs(data, textStatus, xhr)
|
|||||||
{
|
{
|
||||||
ipa_objs = data.result.result;
|
ipa_objs = data.result.result;
|
||||||
if (_ipa_init_on_win_callback)
|
if (_ipa_init_on_win_callback)
|
||||||
_ipa_init_on_win_callback(data, textStatus, xhr);
|
_ipa_init_on_win_callback(data, textStatus, xhr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call an IPA command over JSON-RPC
|
/* call an IPA command over JSON-RPC
|
||||||
@@ -95,9 +95,9 @@ function ipa_cmd(name, args, options, win_callback, fail_callback, objname,sampl
|
|||||||
};
|
};
|
||||||
|
|
||||||
var request = {
|
var request = {
|
||||||
data: JSON.stringify(data),
|
data: JSON.stringify(data),
|
||||||
success: win_callback,
|
success: win_callback,
|
||||||
error: fail_callback,
|
error: fail_callback,
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax(request);
|
$.ajax(request);
|
||||||
@@ -143,4 +143,3 @@ function ipa_get_param_info(attr)
|
|||||||
|
|
||||||
return (null);
|
return (null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,144 +15,165 @@ function unimplemented(facet){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var parentTabs;
|
||||||
|
function getParentTabs(){
|
||||||
|
if (!parentTabs){
|
||||||
|
parentTabs = {
|
||||||
|
user : "identity",
|
||||||
|
group : "identity",
|
||||||
|
host : "identity",
|
||||||
|
hostgroup: "identity",
|
||||||
|
netgroup : "identity",
|
||||||
|
policy : "policy",
|
||||||
|
config : "config"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return parentTabs;
|
||||||
|
}
|
||||||
|
|
||||||
function buildNavigation(){
|
function buildNavigation(){
|
||||||
params= ipa_parse_qs();
|
params= ipa_parse_qs();
|
||||||
var tab = params["tab"];
|
var tab = params["tab"];
|
||||||
|
|
||||||
if (!tab){
|
if (!tab){
|
||||||
tab=$.cookie("lastpage");
|
tab=$.cookie("lastpage");
|
||||||
}
|
}
|
||||||
if ( !tab ) {
|
if ( !tab ) {
|
||||||
tab="user";
|
tab="user";
|
||||||
}
|
}
|
||||||
|
|
||||||
var facet = params["facet"];
|
var facet = params["facet"];
|
||||||
|
|
||||||
|
|
||||||
var siteMap = [{name:"IDENTITY",
|
var siteMap = [{name:"IDENTITY",
|
||||||
tab:"user",
|
tab:"identity", //Default subtab
|
||||||
children : [
|
children : [
|
||||||
{name:"Users",tab:"user", setup: setupUser},
|
{name:"Users",tab:"user", setup: setupUser},
|
||||||
{name:"Groups",tab:"group",setup: setupGroup},
|
{name:"Groups",tab:"group",setup: setupGroup},
|
||||||
{name:"Hosts",tab:"host", setup: setupHost},
|
{name:"Hosts",tab:"host", setup: setupHost},
|
||||||
{name:"Hostgroups",
|
{name:"Hostgroups",
|
||||||
tab:"hostgroup",
|
tab:"hostgroup",
|
||||||
setup: setupHostgroup},
|
setup: setupHostgroup},
|
||||||
{name:"Netgroups",tab:"netgroup", setup:setupNetgroup}
|
{name:"Netgroups",tab:"netgroup", setup:setupNetgroup}
|
||||||
]},
|
]},
|
||||||
{name:"POLICY", tab:"policy", setup: unimplemented},
|
{name:"POLICY", tab:"policy", setup: unimplemented},
|
||||||
{name:"CONFIG", tab:"config", setup: unimplemented }];
|
{name:"CONFIG", tab:"config", setup: unimplemented }];
|
||||||
|
|
||||||
|
//TODO autogen this from the site map
|
||||||
|
|
||||||
var separator = $("<span class='main-separator' />");
|
var separator = $("<span class='main-separator' />");
|
||||||
|
|
||||||
var currentMain = siteMap[0];
|
var currentMain = siteMap[0];
|
||||||
for (var i = 0 ; i < siteMap.length; i++){
|
for (var i = 0 ; i < siteMap.length; i++){
|
||||||
current = siteMap[i];
|
current = siteMap[i];
|
||||||
if (i > 0){
|
if (i > 0){
|
||||||
$('#main-nav').append(separator.clone());
|
$('#main-nav').append(separator.clone());
|
||||||
}
|
}
|
||||||
var tabClass = "main-nav-off";
|
var tabClass = "main-nav-off";
|
||||||
if (tab == current.tab){
|
if (tab == current.tab){
|
||||||
currentMain = current;
|
currentMain = current;
|
||||||
tabClass = "main-nav-on";
|
tabClass = "main-nav-on";
|
||||||
}
|
|
||||||
|
|
||||||
var span = $("<span/>", {
|
|
||||||
"class": tabClass,
|
|
||||||
id: "span-tab-"+current.tab,
|
|
||||||
});
|
|
||||||
|
|
||||||
$("<a/>",{
|
|
||||||
"id": "tab-"+current.tab,
|
|
||||||
href: "#?tab="+current.tab,
|
|
||||||
text: current.name,
|
|
||||||
click: setActiveTab
|
|
||||||
}).appendTo(span);
|
|
||||||
|
|
||||||
span.appendTo("#main-nav")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var span = $("<span/>", {
|
||||||
|
"class": tabClass,
|
||||||
|
id: "span-tab-"+current.tab,
|
||||||
|
});
|
||||||
|
|
||||||
|
$("<a/>",{
|
||||||
|
"id": "tab-"+current.tab,
|
||||||
|
href: "#tab="+current.tab,
|
||||||
|
text: current.name,
|
||||||
|
}).appendTo(span);
|
||||||
|
|
||||||
|
span.appendTo("#main-nav")
|
||||||
|
}
|
||||||
|
|
||||||
if (currentMain.children){
|
if (currentMain.children){
|
||||||
var selectedSub;
|
var selectedSub;
|
||||||
for (var i =0; i < currentMain.children.length; i++){
|
for (var i =0; i < currentMain.children.length; i++){
|
||||||
var currentSub = currentMain.children[i];
|
var currentSub = currentMain.children[i];
|
||||||
|
|
||||||
var tabClass = "sub-nav-off";
|
var tabClass = "sub-nav-off";
|
||||||
if (tab == currentSub.tab){
|
if (tab == currentSub.tab){
|
||||||
tabClass = "sub-nav-on";
|
tabClass = "sub-nav-on";
|
||||||
selectedSub = currentSub;
|
selectedSub = currentSub;
|
||||||
}
|
}
|
||||||
|
|
||||||
var span = $("<span/>", {
|
var span = $("<span/>", {
|
||||||
"class": tabClass,
|
"class": tabClass,
|
||||||
id: "span-subtab-"+currentSub.tab
|
id: "span-subtab-"+currentSub.tab
|
||||||
});
|
});
|
||||||
|
|
||||||
$("<a/>",{
|
$("<a/>",{
|
||||||
"id": "subtab-"+currentSub.tab,
|
"id": "subtab-"+currentSub.tab,
|
||||||
href: "#?tab="+currentSub.tab,
|
href: "#tab="+currentSub.tab,
|
||||||
text: currentSub.name,
|
text: currentSub.name,
|
||||||
click: setActiveSubtab,
|
//click: setActiveSubtab,
|
||||||
}).appendTo(span);
|
}).appendTo(span);
|
||||||
|
|
||||||
span.appendTo("#sub-nav");
|
span.appendTo("#sub-nav");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedSub && selectedSub.setup){
|
if (selectedSub && selectedSub.setup){
|
||||||
selectedSub.setup(facet);
|
selectedSub.setup(facet);
|
||||||
}
|
}
|
||||||
}else if (currentMain && currentMain.setup){
|
}else if (currentMain && currentMain.setup){
|
||||||
currentMain.setup(facet);
|
currentMain.setup(facet);
|
||||||
}
|
}
|
||||||
|
|
||||||
var whoami = $.cookie("whoami");
|
var whoami = $.cookie("whoami");
|
||||||
if (whoami == null){
|
if (whoami == null){
|
||||||
ipa_cmd( 'whoami', [], {}, whoamiSuccess, null,null, "sampledata/whoami.json");
|
ipa_cmd( 'whoami', [], {}, whoamiSuccess, null,null, "sampledata/whoami.json");
|
||||||
}else{
|
}else{
|
||||||
setLoggedInText(whoami);
|
setLoggedInText(whoami);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var setupFunctions;
|
||||||
|
function getSetupFunctions(){
|
||||||
|
if (!setupFunctions){
|
||||||
|
setupFunctions = {
|
||||||
|
user: setupUser,
|
||||||
|
group: setupGroup,
|
||||||
|
host: setupHost,
|
||||||
|
hostgroup:setupHostgroup,
|
||||||
|
netgroup:setupNetgroup,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return setupFunctions;
|
||||||
|
}
|
||||||
|
$(window).bind( 'hashchange', function(e) {
|
||||||
|
|
||||||
function setActiveTab(){
|
var queryParams = ipa_parse_qs();
|
||||||
|
var tab=queryParams.tab;
|
||||||
|
if (!tab){
|
||||||
|
tab = 'user';
|
||||||
|
}
|
||||||
|
$(".sub-nav-on").removeClass('sub-nav-on').addClass("sub-nav-off")
|
||||||
|
var active = "#span-subtab-"+tab;
|
||||||
|
$(active).removeClass('sub-nav-off').addClass("sub-nav-on")
|
||||||
|
|
||||||
var setupFunctions = {
|
setActiveTab(getParentTabs()[tab]);
|
||||||
user: setupUser,
|
|
||||||
policy: unimplemented,
|
getSetupFunctions()[tab](queryParams.facet );
|
||||||
config: unimplemented};
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var tabName = this.id.substring("tab-".length);
|
function setActiveTab(tabName){
|
||||||
|
|
||||||
$(".main-nav-on").removeClass('main-nav-on').addClass("main-nav-off")
|
$(".main-nav-on").removeClass('main-nav-on').addClass("main-nav-off")
|
||||||
var activeTab = "#span-tab-"+tabName;
|
var activeTab = "#span-tab-"+tabName;
|
||||||
$(activeTab).removeClass('main-nav-off').addClass("main-nav-on")
|
$(activeTab).removeClass('main-nav-off').addClass("main-nav-on")
|
||||||
|
|
||||||
setupFunctions[tabName]();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function setActiveSubtab(){
|
|
||||||
|
|
||||||
var setupFunctions = {
|
|
||||||
user: setupUser,
|
|
||||||
group: setupGroup,
|
|
||||||
host: setupHost,
|
|
||||||
hostgroup:setupHostgroup,
|
|
||||||
netgroup:setupNetgroup,
|
|
||||||
};
|
|
||||||
|
|
||||||
var subtabName = this.id.substring("subtab-".length);
|
|
||||||
$(".sub-nav-on").removeClass('sub-nav-on').addClass("sub-nav-off")
|
|
||||||
var active = "#span-subtab-"+subtabName;
|
|
||||||
$(active).removeClass('sub-nav-off').addClass("sub-nav-on")
|
|
||||||
|
|
||||||
setupFunctions[subtabName]();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearOld(){
|
function clearOld(){
|
||||||
|
$('#search').css("display","none");
|
||||||
|
$('#details').css("display","none");
|
||||||
|
$('#content').css("display","none");
|
||||||
|
$('#associations').css("display","none");
|
||||||
|
|
||||||
$('#searchResultsTable thead').html("");
|
$('#searchResultsTable thead').html("");
|
||||||
$('#searchResultsTable tfoot').html("");
|
$('#searchResultsTable tfoot').html("");
|
||||||
$('#searchResultsTable tbody').find("tr").remove();
|
$('#searchResultsTable tbody').find("tr").remove();
|
||||||
@@ -163,30 +184,25 @@ function clearOld(){
|
|||||||
//remove old details
|
//remove old details
|
||||||
$('.entryattrs dd').remove();
|
$('.entryattrs dd').remove();
|
||||||
$('#detail-lists').html("<hr/>");
|
$('#detail-lists').html("<hr/>");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function showSearch(){
|
function showSearch(){
|
||||||
$('#content').css("display","none");
|
|
||||||
$('#details').css("display","none");
|
|
||||||
clearOld();
|
clearOld();
|
||||||
$('#search').css("display","block");
|
$('#search').css("display","block");
|
||||||
$("#filter").css("display","block");
|
$("#filter").css("display","block");
|
||||||
}
|
}
|
||||||
|
|
||||||
function showContent(){
|
function showContent(){
|
||||||
$('#search').css("display","none");
|
|
||||||
$('#details').css("display","none");
|
|
||||||
clearOld();
|
clearOld();
|
||||||
$('#content').css("display","block");
|
$('#content').css("display","block");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function showDetails(){
|
function showDetails(){
|
||||||
$('#search').css("display","none");
|
|
||||||
$('#content').css("display","none");
|
|
||||||
clearOld();
|
clearOld();
|
||||||
$('#details').css("display","block");
|
$('#details').css("display","block");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showAssociations(){
|
||||||
|
clearOld();
|
||||||
|
$('#associations').css("display","block");
|
||||||
|
}
|
||||||
@@ -1,39 +1,46 @@
|
|||||||
function setupNetgroup(facet){
|
function setupNetgroup(facet){
|
||||||
if (facet == "details"){
|
if (facet == "details"){
|
||||||
setupNetgroupDetails();
|
netgroupDetailsForm.setup();
|
||||||
|
}else if(facet == "add"){
|
||||||
|
netgroupBuilder.setup();
|
||||||
}else{
|
}else{
|
||||||
setupNetgroupSearch();
|
netgroupSearchForm.setup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var netgroup_details_list =
|
||||||
|
[['identity', 'Netgroup Details', [
|
||||||
|
['cn', 'Netgroup Name'],
|
||||||
|
['description', 'Description'],
|
||||||
|
['nisdomainname', 'NIS Domain']]]];
|
||||||
|
|
||||||
|
|
||||||
function setupNetgroupDetails(){
|
var netgroupDetailsForm = new DetailsForm("netgroup",netgroup_details_list,"cn","sampledata/netgroupshow.json") ;
|
||||||
var detailsForm = new DetailsForm();
|
|
||||||
|
|
||||||
|
var netgroupAddProperties =
|
||||||
|
[{title: 'Netgroup Name', id: 'pkey', type: 'text'},
|
||||||
|
{title: 'Description', id: 'description', type: 'text'}];
|
||||||
|
|
||||||
|
|
||||||
|
function netgroupAddOptionsFunction (){
|
||||||
|
var options = {
|
||||||
|
name: $('#pkey').val(),
|
||||||
|
description: $('#description').val()
|
||||||
|
};
|
||||||
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function setupNetgroupSearch(){
|
var netgroupBuilder = new EntityBuilder("netgroup",netgroupAddProperties,netgroupAddOptionsFunction);
|
||||||
|
|
||||||
|
|
||||||
var columns = [
|
var netgroupSearchColumns = [
|
||||||
{title:"Netgroup",column:"cn",render: function(current,cell){
|
{title:"Netgroup",column:"cn",render: function(current,cell){
|
||||||
renderDetailColumn(current,cell,current[this.column],"netgroup");
|
renderPkeyColumn(netgroupDetailsForm, current,cell);
|
||||||
}},
|
}},
|
||||||
{title:"Description", column:"description",render: renderSimpleColumn}];
|
{title:"Description", column:"description",render: renderSimpleColumn}];
|
||||||
|
|
||||||
var netgroupSearchForm = new SearchForm("netgroup", "find", columns);
|
var netgroupSearchForm =
|
||||||
|
new SearchForm("netgroup", "find", netgroupSearchColumns,"sampledata/netgrouplist.json");
|
||||||
$("#query").unbind();
|
|
||||||
$("#query").click(function(){
|
|
||||||
sampleData = "sampledata/netgrouplist.json";
|
|
||||||
executeSearch(netgroupSearchForm);
|
|
||||||
});
|
|
||||||
$("#new").unbind();
|
|
||||||
$("#new").click( function() {
|
|
||||||
alert("New Netgroup...");
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
17
install/static/sampledata/hostgroupshow.json
Normal file
17
install/static/sampledata/hostgroupshow.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"error": null,
|
||||||
|
"id": 0,
|
||||||
|
"result": {
|
||||||
|
"result": {
|
||||||
|
"cn": [
|
||||||
|
"host-live"
|
||||||
|
],
|
||||||
|
"description": [
|
||||||
|
"Live servers"
|
||||||
|
],
|
||||||
|
"dn": "cn=host-live,cn=hostgroups,cn=accounts,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
|
||||||
|
},
|
||||||
|
"summary": null,
|
||||||
|
"value": "host-live"
|
||||||
|
}
|
||||||
|
}
|
||||||
26
install/static/sampledata/netgroupshow.json
Normal file
26
install/static/sampledata/netgroupshow.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"error": null,
|
||||||
|
"id": 0,
|
||||||
|
"result": {
|
||||||
|
"result": {
|
||||||
|
"cn": [
|
||||||
|
"net-live"
|
||||||
|
],
|
||||||
|
"description": [
|
||||||
|
"live servers"
|
||||||
|
],
|
||||||
|
"dn": "ipauniqueid=51451097-abef-11df-ad3a-525400674dcd,cn=ng,cn=alt,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
|
||||||
|
"memberhost_hostgroup": [
|
||||||
|
"host-live"
|
||||||
|
],
|
||||||
|
"memberuser_group": [
|
||||||
|
"muppets"
|
||||||
|
],
|
||||||
|
"nisdomainname": [
|
||||||
|
"ayoung.boston.devel.redhat.com"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"summary": null,
|
||||||
|
"value": "net-live"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ var sampleData;
|
|||||||
//These are helper functions, either assigned to the rneder method
|
//These are helper functions, either assigned to the rneder method
|
||||||
//Or called from a thin wrapper render method
|
//Or called from a thin wrapper render method
|
||||||
function renderSimpleColumn(current,cell){
|
function renderSimpleColumn(current,cell){
|
||||||
cell.innerHTML = current[this.column];
|
cell.innerHTML = current[this.column];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -24,11 +24,19 @@ function renderUnknownColumn(current,cell){
|
|||||||
cell.innerHTML = "Unknown";
|
cell.innerHTML = "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function renderPkeyColumn(form,current,cell){
|
||||||
|
$("<a/>",{
|
||||||
|
href:"#tab="+form.obj+"&facet=details&pkey="+current[form.pkeyCol],
|
||||||
|
html: "" + current[form.pkeyCol],
|
||||||
|
}).appendTo(cell);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function renderDetailColumn(current,cell,pkey,obj){
|
function renderDetailColumn(current,cell,pkey,obj){
|
||||||
$("<a/>",{
|
$("<a/>",{
|
||||||
href:"#tab=user&facet=details&pkey="+pkey,
|
href:"#tab="+obj+"&facet=details&pkey="+pkey,
|
||||||
html: ""+ current[this.column],
|
html: ""+ current[this.column],
|
||||||
click: function(){ setupUserDetails(current.uid)},
|
|
||||||
}).appendTo(cell);
|
}).appendTo(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,67 +45,59 @@ function renderDetailColumn(current,cell,pkey,obj){
|
|||||||
function SearchForm(obj, method, cols, searchSampleData){
|
function SearchForm(obj, method, cols, searchSampleData){
|
||||||
|
|
||||||
this.buildColumnHeaders = function (){
|
this.buildColumnHeaders = function (){
|
||||||
var columnHeaders = document.createElement("tr");
|
var columnHeaders = document.createElement("tr");
|
||||||
for (var i =0 ; i != this.columns.length ;i++){
|
for (var i =0 ; i != this.columns.length ;i++){
|
||||||
var th = document.createElement("th");
|
var th = document.createElement("th");
|
||||||
th.innerHTML = this.columns[i].title;
|
th.innerHTML = this.columns[i].title;
|
||||||
columnHeaders.appendChild(th);
|
columnHeaders.appendChild(th);
|
||||||
}
|
}
|
||||||
$('#searchResultsTable thead:last').append(columnHeaders);
|
$('#searchResultsTable thead:last').append(columnHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.renderResultRow = function(current){
|
this.renderResultRow = function(current){
|
||||||
var row = document.createElement("tr");
|
var row = document.createElement("tr");
|
||||||
var cell;
|
var cell;
|
||||||
var link;
|
var link;
|
||||||
for(var index = 0 ; index < this.columns.length; index++){
|
for(var index = 0 ; index < this.columns.length; index++){
|
||||||
this.columns[index].render(current, row.insertCell(-1));
|
this.columns[index].render(current, row.insertCell(-1));
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.searchSuccess = function (json){
|
this.searchSuccess = function (json){
|
||||||
if (json.result.truncated){
|
if (json.result.truncated){
|
||||||
$("#searchResultsTable tfoot").html("More than "+sizelimit+" results returned. First "+ sizelimit+" results shown." );
|
$("#searchResultsTable tfoot").html("More than "+sizelimit+" results returned. First "+ sizelimit+" results shown." );
|
||||||
}else{
|
}else{
|
||||||
$("#searchResultsTable tfoot").html(json.result.summary);
|
$("#searchResultsTable tfoot").html(json.result.summary);
|
||||||
}
|
}
|
||||||
$("#searchResultsTable tbody").find("tr").remove();
|
$("#searchResultsTable tbody").find("tr").remove();
|
||||||
for (var index = 0; index != json.result.result.length; index++){
|
for (var index = 0; index != json.result.result.length; index++){
|
||||||
var current = json.result.result[index];
|
var current = json.result.result[index];
|
||||||
$('#searchResultsTable tbody:last').append(this.renderResultRow(current));
|
$('#searchResultsTable tbody:last').append(this.renderResultRow(current));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.searchWithFilter = function(queryFilter){
|
this.searchWithFilter = function(queryFilter){
|
||||||
var form = this;
|
var form = this;
|
||||||
window.location.hash="#tab="
|
|
||||||
+this.obj
|
|
||||||
+"&facet=search&criteria="
|
|
||||||
+queryFilter;
|
|
||||||
|
|
||||||
$('#searchResultsTable tbody').html("");
|
$('#searchResultsTable tbody').html("");
|
||||||
$('#searchResultsTable tbody').html("");
|
$('#searchResultsTable tbody').html("");
|
||||||
$('#searchResultsTable tfoot').html("");
|
$('#searchResultsTable tfoot').html("");
|
||||||
|
|
||||||
ipa_cmd(this.method,
|
ipa_cmd(this.method,
|
||||||
[queryFilter],
|
[queryFilter],
|
||||||
{"all":"true"},
|
{"all":"true"},
|
||||||
function(json){
|
function(json){
|
||||||
form.searchSuccess(json);
|
form.searchSuccess(json);
|
||||||
},
|
},
|
||||||
function(json){
|
function(json){
|
||||||
alert("Search Failed");
|
alert("Search Failed");
|
||||||
},form.obj, form.searchSampleData);
|
},form.obj, form.searchSampleData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.obj = obj;
|
this.setup = function(){
|
||||||
this.method = method;
|
|
||||||
this.columns = cols;
|
|
||||||
this.searchSampleData = searchSampleData;
|
|
||||||
|
|
||||||
showSearch();
|
showSearch();
|
||||||
|
|
||||||
$('#searchResultsTable thead').html("");
|
$('#searchResultsTable thead').html("");
|
||||||
@@ -105,20 +105,39 @@ function SearchForm(obj, method, cols, searchSampleData){
|
|||||||
$('#searchResultsTable tfoot').html("");
|
$('#searchResultsTable tfoot').html("");
|
||||||
|
|
||||||
$("#new").click(function(){
|
$("#new").click(function(){
|
||||||
location.href="#tab="+obj+"&facet=add";
|
location.hash="tab="+obj+"&facet=add";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#query").click(executeSearch);
|
||||||
|
|
||||||
this.buildColumnHeaders();
|
this.buildColumnHeaders();
|
||||||
|
|
||||||
var params = ipa_parse_qs();
|
var params = ipa_parse_qs();
|
||||||
|
|
||||||
if (params["criteria"]){
|
qs = location.hash.substring(1);
|
||||||
this.searchWithFilter(params["criteria"]);
|
//TODO fix this hack. since parse returns an object, I don't know how to see if that object has a"critia" property if criteria is null.
|
||||||
|
if (qs.indexOf("criteria") > 0)
|
||||||
|
{
|
||||||
|
this.searchWithFilter(params["criteria"]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.obj = obj;
|
||||||
|
this.method = method;
|
||||||
|
this.columns = cols;
|
||||||
|
this.searchSampleData = searchSampleData;
|
||||||
|
|
||||||
|
this.setup();
|
||||||
}
|
}
|
||||||
|
executeSearch = function(){
|
||||||
|
|
||||||
executeSearch = function(searchForm){
|
|
||||||
var queryFilter = $("#queryFilter").val();
|
var queryFilter = $("#queryFilter").val();
|
||||||
searchForm.searchWithFilter(queryFilter);
|
var qp = ipa_parse_qs();
|
||||||
|
var tab = qp.tab;
|
||||||
|
if (!tab){
|
||||||
|
tab = 'user';
|
||||||
|
}
|
||||||
|
window.location.hash="#tab="
|
||||||
|
+tab
|
||||||
|
+"&facet=search&criteria="
|
||||||
|
+queryFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
$(document).ready( initializeUserGroupEnrollments);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<h1>Enroll in Groups</h1>
|
|
||||||
|
|
||||||
<form>
|
|
||||||
<div style="border-width:1px">
|
|
||||||
<div >
|
|
||||||
<input type="text"/>
|
|
||||||
<input id="query" type="button" value="Find Groups"/>
|
|
||||||
|
|
||||||
<span style="float:right">
|
|
||||||
<input id="cancelEnrollGroups" type="button" value="Cancel"/>
|
|
||||||
<input id="enrollGroups" type="button" value="Enroll"/>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="results" style="border: 2px solid rgb(0, 0, 0); position:relative; height:200px;" >
|
|
||||||
<div style="float:left;">
|
|
||||||
<div>Groups</div>
|
|
||||||
<select id="grouplist" width="150px" size="10" multiple="true" >
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div style="float:left;">
|
|
||||||
<p><input id="removeFromList" type="button" value="<<"/> </p>
|
|
||||||
<p><input id="addToList" type="button" value=">>"/></p>
|
|
||||||
</div>
|
|
||||||
<div style="float:left;">
|
|
||||||
<div>Prospective Enrollments</div>
|
|
||||||
<select id="enrollments" width="150px" size="10" multiple="true" >
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr/>
|
|
||||||
<div>Message Area</div>
|
|
||||||
<hr/>
|
|
||||||
<div>
|
|
||||||
<span style="float:left">
|
|
||||||
<p>*Enter Group Names and Press Groups</p>
|
|
||||||
<p>*More stuff</p>
|
|
||||||
<p>*More stuff</p>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
@@ -1,102 +1,121 @@
|
|||||||
|
|
||||||
|
|
||||||
var user_details_lists = [
|
var user_details_lists = [
|
||||||
['identity', 'Identity Details', [
|
['identity', 'Identity Details', [
|
||||||
['title', 'Title'],
|
['title', 'Title'],
|
||||||
['givenname', 'First Name'],
|
['givenname', 'First Name'],
|
||||||
['sn', 'Last Name'],
|
['sn', 'Last Name'],
|
||||||
['cn', 'Full Name'],
|
['cn', 'Full Name'],
|
||||||
['displayname', 'Dispaly Name'],
|
['displayname', 'Dispaly Name'],
|
||||||
['initials', 'Initials']
|
['initials', 'Initials']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
['account', 'Account Details', [
|
['account', 'Account Details', [
|
||||||
['call_a_status', 'Account Status'],
|
['call_a_status', 'Account Status'],
|
||||||
['uid', 'Login'],
|
['uid', 'Login'],
|
||||||
['call_a_password', 'Password'],
|
['call_a_password', 'Password'],
|
||||||
['uidnumber', 'UID'],
|
['uidnumber', 'UID'],
|
||||||
['gidnumber', 'GID'],
|
['gidnumber', 'GID'],
|
||||||
['homedirectory', 'homedirectory']
|
['homedirectory', 'homedirectory']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
['contact', 'Contact Details', [
|
['contact', 'Contact Details', [
|
||||||
['mail', 'E-mail Address'],
|
['mail', 'E-mail Address'],
|
||||||
['call_a_numbers', 'Numbers']
|
['call_a_numbers', 'Numbers']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
['address', 'Mailing Address', [
|
['address', 'Mailing Address', [
|
||||||
['street', 'Address'],
|
['street', 'Address'],
|
||||||
['location', 'City'],
|
['location', 'City'],
|
||||||
['call_a_st', 'State'],
|
['call_a_st', 'State'],
|
||||||
['postalcode', 'ZIP']
|
['postalcode', 'ZIP']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
['employee', 'Employee Information', [
|
['employee', 'Employee Information', [
|
||||||
['ou', 'Org. Unit'],
|
['ou', 'Org. Unit'],
|
||||||
['call_a_manager', 'Manager']
|
['call_a_manager', 'Manager']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
['misc', 'Misc. Information', [
|
['misc', 'Misc. Information', [
|
||||||
['carlicense', 'Car License']
|
['carlicense', 'Car License']
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
function setupUser(facet){
|
function setupUser(facet){
|
||||||
if (facet == "details"){
|
if (facet == "details"){
|
||||||
setupUserDetails()
|
setupUserDetails();
|
||||||
}else if (facet == "add"){
|
}else if (facet == "add"){
|
||||||
setupAddUser();
|
userBuilder.setup();
|
||||||
}else if (facet == "group"){
|
}else if (facet == "group"){
|
||||||
setupUserGroupEnrollmentSearch();
|
setupUserGroupList();
|
||||||
}else if (facet == "groupmembership"){
|
}else if (facet == "groupmembership"){
|
||||||
setupUserGroupMembership();
|
setupUserGroupMembership();
|
||||||
}else{
|
}else{
|
||||||
|
userSearchForm.setup();
|
||||||
setupUserSearch();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_user_fail(reason){
|
function add_user_fail(reason){
|
||||||
alert("Add User Failed:"+JSON.stringify(reason));
|
alert("Add User Failed:"+JSON.stringify(reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
function addUser(on_success){
|
function addUser(on_success){
|
||||||
|
|
||||||
var options = { givenname: $("#firstname").val(),
|
var options = { givenname: $("#firstname").val(),
|
||||||
sn: $("#lastname").val(),
|
sn: $("#lastname").val(),
|
||||||
uid : $("#login").val()};
|
uid : $("#login").val()};
|
||||||
|
|
||||||
ipa_cmd( 'add', [], options, on_success, add_user_fail, 'user' );
|
ipa_cmd( 'add', [], options, on_success, add_user_fail, 'user' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function addAnotherUser(){
|
function addAnotherUser(){
|
||||||
|
|
||||||
addUser(setupAddUser);
|
addUser(setupAddUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addEditUser(){
|
function addEditUser(){
|
||||||
addUser(function (response){
|
addUser(function (response){
|
||||||
setupUserDetails($("#login").val());
|
setupUserDetails($("#login").val());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupAddUser(){
|
var userAddProperties = [
|
||||||
showContent();
|
{title: 'login', id: 'pkey', type: 'text'},
|
||||||
$('#content').load("user-add.inc");
|
{title: 'First Name', id: 'firstname', type:'text'},
|
||||||
|
{title: 'Last Name', id: 'lastname', type:'text'}
|
||||||
|
];
|
||||||
|
var userBuilder =
|
||||||
|
new EntityBuilder(
|
||||||
|
"user",
|
||||||
|
userAddProperties,
|
||||||
|
function(){
|
||||||
|
var options = { givenname: $("#firstname").val(),
|
||||||
|
sn: $("#lastname").val()};
|
||||||
|
return options;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function setupFacetNavigation(pkey,facet){
|
||||||
|
$("#viewtype").html("");
|
||||||
|
var facets = ["details","group", "groupmembership"];
|
||||||
|
|
||||||
|
for (var i =0; i < facets.length; i++){
|
||||||
|
var li = $('<li>').appendTo($("#viewtype"));
|
||||||
|
if (facets[i] == facet){
|
||||||
|
$('<img src="but-selected.png" alt="" />');
|
||||||
|
li.html(facets[i]);
|
||||||
|
}else{
|
||||||
|
$('<img src="but-unselected.png" alt="" />').appendTo(li);
|
||||||
|
$('<a/>',{
|
||||||
|
href: "#tab=user&facet="+facets[i]+"&pkey="+pkey,
|
||||||
|
html: facets[i]
|
||||||
|
}).appendTo(li);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupUserDetails(user){
|
function setupUserDetails(user){
|
||||||
|
|
||||||
window.location.hash="#tab=user&facet=details&pkey="+user;
|
|
||||||
|
|
||||||
//re initialize global parse of parameters
|
|
||||||
qs = ipa_parse_qs();
|
qs = ipa_parse_qs();
|
||||||
|
setupFacetNavigation(qs.pkey,qs.facet);
|
||||||
//TODO make this work for more than just user details
|
|
||||||
details_lists = user_details_lists;
|
|
||||||
|
|
||||||
showDetails();
|
showDetails();
|
||||||
renderUserDetails();
|
renderUserDetails();
|
||||||
}
|
}
|
||||||
@@ -122,48 +141,44 @@ function renderUserDetails()
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderSimpleColumn(current,cell){
|
function renderSimpleColumn(current,cell){
|
||||||
cell.innerHTML = current[this.column];
|
cell.innerHTML = current[this.column];
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderUserLinks(current, cell){
|
function renderUserLinks(current, cell){
|
||||||
link = document.createElement("a");
|
link = document.createElement("a");
|
||||||
cell.appendChild(link);
|
cell.appendChild(link);
|
||||||
|
|
||||||
$("<a/>",{
|
$("<a/>",{
|
||||||
href:"#tab=user&facet=details&pkey="+current.uid,
|
href:"#tab=user&facet=details&pkey="+current.uid,
|
||||||
html: "[D]",
|
html: "[D]",
|
||||||
click: function(){ setupUserDetails(current.uid)},
|
|
||||||
}).appendTo(cell);
|
}).appendTo(cell);
|
||||||
|
|
||||||
$("<a/>",{
|
$("<a/>",{
|
||||||
href: "#tab=user&facet=group&pkey="+current.uid,
|
href: "#tab=user&facet=group&pkey="+current.uid,
|
||||||
click:setupUserGroupMembership,
|
html: "[G]"
|
||||||
html: "[G]"
|
|
||||||
}).appendTo(cell);
|
}).appendTo(cell);
|
||||||
|
|
||||||
$("<a/>",{
|
$("<a/>",{
|
||||||
href:"#tab=user&facet=netgroup&pkey="+current.uid,
|
href:"#tab=user&facet=netgroup&pkey="+current.uid,
|
||||||
html: "[N]"
|
html: "[N]"
|
||||||
}).appendTo(cell);
|
}).appendTo(cell);
|
||||||
|
|
||||||
$("<a/>",{
|
$("<a/>",{
|
||||||
href:"#tab=user&facet=role&pkey="+current.uid,
|
href:"#tab=user&facet=role&pkey="+current.uid,
|
||||||
html:"[R]"
|
html:"[R]"
|
||||||
}).appendTo(cell);
|
}).appendTo(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function renderUserDetailColumn(current,cell){
|
function renderUserDetailColumn(current,cell){
|
||||||
|
|
||||||
$("<a/>",{
|
$("<a/>",{
|
||||||
href:"#tab=user&facet=details&pkey="+current.uid,
|
href:"#tab=user&facet=details&pkey="+current.uid,
|
||||||
html: ""+ current[this.column],
|
html: ""+ current[this.column],
|
||||||
click: function(){ setupUserDetails(current.uid)},
|
click: function(){ setupUserDetails(current.uid)},
|
||||||
}).appendTo(cell);
|
}).appendTo(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
var columns = [
|
var userSearchColumns = [
|
||||||
{title:"Name", column:"cn", render: renderSimpleColumn},
|
{title:"Name", column:"cn", render: renderSimpleColumn},
|
||||||
{title:"Login", column:"uid", render: renderUserDetailColumn},
|
{title:"Login", column:"uid", render: renderUserDetailColumn},
|
||||||
{title:"UID", column:"uidnumber", render: renderSimpleColumn},
|
{title:"UID", column:"uidnumber", render: renderSimpleColumn},
|
||||||
@@ -173,18 +188,7 @@ var columns = [
|
|||||||
{title:"Actions", column:"none", render: renderUserLinks}
|
{title:"Actions", column:"none", render: renderUserLinks}
|
||||||
];
|
];
|
||||||
|
|
||||||
function setupUserSearch(){
|
var userSearchForm = new SearchForm("user", "find", userSearchColumns, "sampledata/userlist.json");
|
||||||
var userSearchForm = new SearchForm("user", "find", columns, "sampledata/userlist.json");
|
|
||||||
|
|
||||||
$("#query").unbind();
|
|
||||||
$("#query").click(function(){
|
|
||||||
sampleData = "sampledata/userlist.json";
|
|
||||||
executeSearch(userSearchForm);
|
|
||||||
});
|
|
||||||
$("#new").unbind();
|
|
||||||
$("#new").click(setupAddUser);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Usr group enrollement:
|
/*Usr group enrollement:
|
||||||
given a user, manage the groups in which they are enrolled */
|
given a user, manage the groups in which they are enrolled */
|
||||||
@@ -192,22 +196,53 @@ function populateUserGroupFailure(){
|
|||||||
alert("Can't find user");
|
alert("Can't find user");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupUserGroupEnrollmentSearch(pkey){
|
function setupUserGroupMembership(pkey){
|
||||||
sampleData = "sampledata/usershow.json";
|
sampleData = "sampledata/usershow.json";
|
||||||
showContent();
|
showAssociations();
|
||||||
$("#content").load("user-groups.inc");
|
qs = ipa_parse_qs();
|
||||||
}
|
setupFacetNavigation(qs['pkey'],qs['facet']);
|
||||||
|
|
||||||
|
$('h1').text('Enroll user ' + qs['pkey'] + ' in groups');
|
||||||
|
|
||||||
|
$("#enrollGroups").click(function(){
|
||||||
|
groupsToEnroll = [];
|
||||||
|
$('#enrollments').children().each(function(i, selected){
|
||||||
|
groupsToEnroll.push(selected.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
currentUserToEnroll = qs['pkey'];
|
||||||
|
enrollUserInNextGroup();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#addToList").click(function(){
|
||||||
|
$('#grouplist :selected').each(function(i, selected){
|
||||||
|
$("#enrollments").append(selected);
|
||||||
|
});
|
||||||
|
$('#grouplist :selected').remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#removeFromList").click(function(){
|
||||||
|
$('#enrollments :selected').each(function(i, selected){
|
||||||
|
$("#grouplist").append(selected);
|
||||||
|
});
|
||||||
|
$('#enrollments :selected').remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#find").click(function(){
|
||||||
|
ipa_cmd( 'find', [], {}, populateUserGroupSearch, populateUserGroupFailure, 'group', "sampledata/grouplist.json" );
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function populateUserGroupSearch(searchResults){
|
function populateUserGroupSearch(searchResults){
|
||||||
results = searchResults.result;
|
results = searchResults.result;
|
||||||
$("#grouplist").html("");
|
$("#grouplist").html("");
|
||||||
for (var i =0; i != searchResults.result.count; i++){
|
for (var i =0; i != searchResults.result.count; i++){
|
||||||
var li = document.createElement("option");
|
var li = document.createElement("option");
|
||||||
li.value = searchResults.result.result[i].cn;
|
li.value = searchResults.result.result[i].cn;
|
||||||
li.innerHTML = searchResults.result.result[i].cn;
|
li.innerHTML = searchResults.result.result[i].cn;
|
||||||
$("#grouplist").append(li);
|
$("#grouplist").append(li);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentUserToEnroll;
|
var currentUserToEnroll;
|
||||||
@@ -222,63 +257,27 @@ function enrollUserInGroupFailure(response){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function enrollUserInNextGroup(){
|
function enrollUserInNextGroup(){
|
||||||
var currentGroupToEnroll = groupsToEnroll.shift();
|
var currentGroupToEnroll = groupsToEnroll.shift();
|
||||||
|
|
||||||
if (currentGroupToEnroll){
|
if (currentGroupToEnroll){
|
||||||
var options = {"user":currentUserToEnroll};
|
var options = {"user":currentUserToEnroll};
|
||||||
var args = [currentGroupToEnroll];
|
var args = [currentGroupToEnroll];
|
||||||
|
|
||||||
ipa_cmd( 'add_member',args, options ,
|
ipa_cmd( 'add_member',args, options ,
|
||||||
enrollUserInGroupSuccess,
|
enrollUserInGroupSuccess,
|
||||||
enrollUserInGroupFailure );
|
enrollUserInGroupFailure );
|
||||||
}else{
|
}else{
|
||||||
setupUserGroupMembership();
|
location.hash="tab=user&facet=group&pkey="+qs.pkey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeUserGroupEnrollments(){
|
|
||||||
|
|
||||||
$('h1').text('Enroll user ' + qs['pkey'] + ' in groups');
|
|
||||||
|
|
||||||
$("#enrollGroups").click(function(){
|
|
||||||
groupsToEnroll = [];
|
|
||||||
$('#enrollments').children().each(function(i, selected){
|
|
||||||
groupsToEnroll.push(selected.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
currentUserToEnroll = qs['pkey'];
|
|
||||||
enrollUserInNextGroup();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#addToList").click(function(){
|
|
||||||
$('#grouplist :selected').each(function(i, selected){
|
|
||||||
$("#enrollments").append(selected);
|
|
||||||
});
|
|
||||||
$('#grouplist :selected').remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#removeFromList").click(function(){
|
|
||||||
$('#enrollments :selected').each(function(i, selected){
|
|
||||||
$("#grouplist").append(selected);
|
|
||||||
});
|
|
||||||
$('#enrollments :selected').remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#query").click(function(){
|
|
||||||
ipa_cmd( 'find', [], {}, populateUserGroupSearch, populateUserGroupFailure, 'group', "sampledata/grouplist.json" );
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function renderUserGroupColumn(){
|
function renderUserGroupColumn(){
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Group Membership&*/
|
/*Group Membership&*/
|
||||||
|
|
||||||
function renderUserGroupColumn(current,cell){
|
function renderUserGroupColumn(current,cell){
|
||||||
cell.innerHTML = "Nothing to see here";
|
cell.innerHTML = "Nothing to see here";
|
||||||
}
|
}
|
||||||
|
|
||||||
var groupMembershipColumns = [
|
var groupMembershipColumns = [
|
||||||
@@ -293,52 +292,51 @@ function populateUserEnrollments(userData){
|
|||||||
|
|
||||||
var memberof_group = userData.result.result.memberof_group
|
var memberof_group = userData.result.result.memberof_group
|
||||||
for (var j = 0; j < memberof_group.length; j++){
|
for (var j = 0; j < memberof_group.length; j++){
|
||||||
var row = document.createElement("tr");
|
var row = document.createElement("tr");
|
||||||
|
|
||||||
var td = document.createElement("td");
|
var td = document.createElement("td");
|
||||||
td.innerHTML = memberof_group[j];
|
td.innerHTML = memberof_group[j];
|
||||||
row.appendChild(td);
|
row.appendChild(td);
|
||||||
|
|
||||||
td = document.createElement("td");
|
td = document.createElement("td");
|
||||||
td.innerHTML = "TBD";
|
td.innerHTML = "TBD";
|
||||||
row.appendChild(td);
|
row.appendChild(td);
|
||||||
|
|
||||||
var td = document.createElement("td");
|
var td = document.createElement("td");
|
||||||
td.innerHTML = "TBD";
|
td.innerHTML = "TBD";
|
||||||
row.appendChild(td);
|
row.appendChild(td);
|
||||||
|
|
||||||
$('#searchResultsTable thead:last').append(row);
|
$('#searchResultsTable thead:last').append(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function setupUserGroupMembership(){
|
function setupUserGroupList(){
|
||||||
|
qs = ipa_parse_qs();
|
||||||
|
setupFacetNavigation(qs['pkey'],qs['facet']);
|
||||||
|
showSearch();
|
||||||
|
|
||||||
|
$("#filter").css("display","none");
|
||||||
|
|
||||||
$("#searchButtons").html("");
|
$("#searchButtons").html("");
|
||||||
|
|
||||||
$("<input/>",{
|
$("<input/>",{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
value: 'enroll',
|
value: 'enroll',
|
||||||
click: setupUserGroupEnrollmentSearch
|
click: function(){
|
||||||
|
location.hash="tab=user&facet=groupmembership&pkey="+qs['pkey'];
|
||||||
|
}
|
||||||
}).appendTo("#searchButtons");
|
}).appendTo("#searchButtons");
|
||||||
|
|
||||||
|
|
||||||
showSearch();
|
|
||||||
var columnHeaders = document.createElement("tr");
|
var columnHeaders = document.createElement("tr");
|
||||||
for (var i =0 ; i != groupMembershipColumns.length ;i++){
|
for (var i =0 ; i != groupMembershipColumns.length ;i++){
|
||||||
var th = document.createElement("th");
|
var th = document.createElement("th");
|
||||||
th.innerHTML = groupMembershipColumns[i].title;
|
th.innerHTML = groupMembershipColumns[i].title;
|
||||||
columnHeaders.appendChild(th);
|
columnHeaders.appendChild(th);
|
||||||
}
|
}
|
||||||
$('#searchResultsTable thead:last').append(columnHeaders);
|
$('#searchResultsTable thead:last').append(columnHeaders);
|
||||||
|
|
||||||
sampleData="sampledata/usershow.json";
|
ipa_cmd( 'show', [qs['pkey']], {}, populateUserEnrollments, populateUserGroupFailure, 'user',"sampledata/usershow.json" );
|
||||||
ipa_cmd( 'show', [qs['pkey']], {}, populateUserEnrollments, populateUserGroupFailure, 'user' );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* user-details.inc javascript */
|
|
||||||
|
|
||||||
function on_win(data, textStatus, xhr)
|
function on_win(data, textStatus, xhr)
|
||||||
{
|
{
|
||||||
@@ -501,4 +499,3 @@ function a_st(jobj, result, mode)
|
|||||||
else
|
else
|
||||||
sel.val('');
|
sel.val('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user