summaryrefslogtreecommitdiffstats
path: root/admin/js/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'admin/js/users.js')
-rw-r--r--admin/js/users.js57
1 files changed, 47 insertions, 10 deletions
diff --git a/admin/js/users.js b/admin/js/users.js
index 0713cf8e5dc..7cd1ed6f624 100644
--- a/admin/js/users.js
+++ b/admin/js/users.js
@@ -12,10 +12,15 @@ $(document).ready(function(){
"Create an account": function() {
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 );
+ if( data.status == "success" ){
+ 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 );
+ }
+ else{
+ alert( "Bug By Jakob (c)" );
+ }
});
$( this ).dialog( "close" );
},
@@ -61,7 +66,7 @@ $(document).ready(function(){
return false;
});
- // Dialog for adding users
+ // Removing users
$( "#removeuser-form" ).dialog({
autoOpen: false,
height: 300,
@@ -69,6 +74,15 @@ $(document).ready(function(){
modal: true,
buttons: {
"Remove user": function() {
+ var post = $( "#removeuserdata" ).serialize();
+ $.post( 'ajax/removeuser.php', post, function(data){
+ if( data.status == "success" ){
+ $( "a[x-uid='"+uid+"']" ).parent().remove();
+ }
+ else{
+ alert( "Bug By Jakob (c)" );
+ }
+ });
$( this ).dialog( "close" );
},
Cancel: function() {
@@ -76,7 +90,7 @@ $(document).ready(function(){
}
},
close: function() {
- allFields.val( "" ).removeClass( "ui-state-error" );
+ true;
}
});
@@ -84,10 +98,28 @@ $(document).ready(function(){
.click(function() {
uid = $( this ).parent().attr( 'x-uid' );
$("#deleteuserusername").html(uid);
+ $("#deleteusernamefield").val(uid);
$( "#removeuser-form" ).dialog( "open" );
return false;
});
+ // Add a group
+ $( "#creategroupbutton" )
+ .click(function(){
+ var post = $( "#creategroupdata" ).serialize();
+ $.post( 'ajax/creategroup.php', post, function(data){
+ if( data.status == "success" ){
+ var newrow = '<tr><td>' + data.data.groupname + '</td>';
+ newrow = newrow + '<td><a class="removegroup-button" href="">remove</a></td></tr>';
+ $("#groupstable").append( newrow );
+ }
+ else{
+ alert( "something went wrong! sorry!" );
+ }
+ });
+ return false;
+ });
+
// Dialog for adding users
$( "#removegroup-form" ).dialog({
autoOpen: false,
@@ -96,9 +128,14 @@ $(document).ready(function(){
modal: true,
buttons: {
"Remove group": function(){
- var post = $( "#deletegroupdata" ).serialize();
- $.post( 'ajax/deletegroup.php', post, function(data){
- $( "a[x-gid='"+gid+"']" ).parent().remove();
+ var post = $( "#removegroupdata" ).serialize();
+ $.post( 'ajax/removegroup.php', post, function(data){
+ if( data.status == "success" ){
+ $( "a[x-gid='"+gid+"']" ).parent().remove();
+ }
+ else{
+ alert( "Bug By Jakob (c)" );
+ }
});
$( this ).dialog( "close" );
},
@@ -107,7 +144,7 @@ $(document).ready(function(){
}
},
close: function(){
- allFields.val( "" ).removeClass( "ui-state-error" );
+ true;
}
});