nextcloud/admin/js/users.js

123 lines
2.7 KiB
JavaScript
Raw Normal View History

2011-04-16 19:49:57 +04:00
$(document).ready(function(){
2011-04-17 01:26:55 +04:00
// Vars we need
var uid = "";
var gid = "";
2011-04-16 19:49:57 +04:00
// Dialog for adding users
$( "#adduser-form" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Create an account": function() {
2011-04-17 01:26:55 +04:00
var post = $( "#createuserdata" ).serialize();
$.post( 'ajax/createuser.php', post, function(data){
var newrow = '<tr><td>' + data.data.username + '</td>';
newrow = newrow + '<td>' + data.data.groups + '</td>';
newrow = newrow + '<td><a href="" class="edituser-button">edit</a> | <a class="removeuser-button" href="">remove</a></td></tr>';
$("#userstable").append( newrow );
});
2011-04-16 19:49:57 +04:00
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
2011-04-17 01:26:55 +04:00
true;
2011-04-16 19:49:57 +04:00
}
});
$( "#adduser-button" )
.click(function() {
$( "#adduser-form" ).dialog( "open" );
return false;
});
// Dialog for adding users
$( "#edituser-form" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Edit password": function() {
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
2011-04-17 01:26:55 +04:00
true;
2011-04-16 19:49:57 +04:00
}
});
$( ".edituser-button" )
2011-04-17 01:26:55 +04:00
.click(function(){
uid = $( this ).parent().attr( 'x-uid' );
$("#edituserusername").html(uid);
$("#edituser-form").dialog("open");
2011-04-16 19:49:57 +04:00
return false;
});
// Dialog for adding users
$( "#removeuser-form" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Remove user": function() {
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
$( ".removeuser-button" )
.click(function() {
2011-04-17 01:26:55 +04:00
uid = $( this ).parent().attr( 'x-uid' );
$("#deleteuserusername").html(uid);
2011-04-16 19:49:57 +04:00
$( "#removeuser-form" ).dialog( "open" );
return false;
});
// Dialog for adding users
$( "#removegroup-form" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
2011-04-17 01:26:55 +04:00
"Remove group": function(){
var post = $( "#deletegroupdata" ).serialize();
$.post( 'ajax/deletegroup.php', post, function(data){
$( "a[x-gid='"+gid+"']" ).parent().remove();
});
2011-04-16 19:49:57 +04:00
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
2011-04-17 01:26:55 +04:00
close: function(){
2011-04-16 19:49:57 +04:00
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
$( ".removegroup-button" )
2011-04-17 01:26:55 +04:00
.click(function(){
gid = $( this ).parent().attr( 'x-gid' );
$("#deletegroupgroupname").html(gid);
$("#deletegroupnamefield").val(gid);
$("#removegroup-form").dialog( "open" );
2011-04-16 19:49:57 +04:00
return false;
});
} );