diff --git a/admin/ajax/creategroup.php b/admin/ajax/creategroup.php
new file mode 100644
index 0000000000..ab99d2a5be
--- /dev/null
+++ b/admin/ajax/creategroup.php
@@ -0,0 +1,34 @@
+ "error", "data" => array( "message" => "Authentication error" )));
+ exit();
+}
+
+$groups = array();
+if( isset( $_POST["groups"] )){
+ $groups = $_POST["groups"];
+}
+$username = $_POST["username"];
+$password = $_POST["password"];
+
+foreach( $groups as $i ){
+ OC_GROUP::addToGroup( $username, $i );
+}
+
+// Return Success story
+if( OC_USER::createUser( $username, $password )){
+ echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "groups" => implode( ", ", $groups ))));
+}
+else{
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to add user" )));
+}
+
+?>
diff --git a/admin/ajax/createuser.php b/admin/ajax/createuser.php
new file mode 100644
index 0000000000..ab99d2a5be
--- /dev/null
+++ b/admin/ajax/createuser.php
@@ -0,0 +1,34 @@
+ "error", "data" => array( "message" => "Authentication error" )));
+ exit();
+}
+
+$groups = array();
+if( isset( $_POST["groups"] )){
+ $groups = $_POST["groups"];
+}
+$username = $_POST["username"];
+$password = $_POST["password"];
+
+foreach( $groups as $i ){
+ OC_GROUP::addToGroup( $username, $i );
+}
+
+// Return Success story
+if( OC_USER::createUser( $username, $password )){
+ echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "groups" => implode( ", ", $groups ))));
+}
+else{
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to add user" )));
+}
+
+?>
diff --git a/admin/js/users.js b/admin/js/users.js
index 6d59a2efb7..0713cf8e5d 100644
--- a/admin/js/users.js
+++ b/admin/js/users.js
@@ -1,4 +1,7 @@
$(document).ready(function(){
+ // Vars we need
+ var uid = "";
+ var gid = "";
// Dialog for adding users
$( "#adduser-form" ).dialog({
autoOpen: false,
@@ -7,6 +10,13 @@ $(document).ready(function(){
modal: true,
buttons: {
"Create an account": function() {
+ var post = $( "#createuserdata" ).serialize();
+ $.post( 'ajax/createuser.php', post, function(data){
+ var newrow = '
' + data.data.username + ' | ';
+ newrow = newrow + '' + data.data.groups + ' | ';
+ newrow = newrow + 'edit | remove |
';
+ $("#userstable").append( newrow );
+ });
$( this ).dialog( "close" );
},
Cancel: function() {
@@ -14,7 +24,7 @@ $(document).ready(function(){
}
},
close: function() {
- allFields.val( "" ).removeClass( "ui-state-error" );
+ true;
}
});
@@ -39,13 +49,15 @@ $(document).ready(function(){
}
},
close: function() {
- allFields.val( "" ).removeClass( "ui-state-error" );
+ true;
}
});
$( ".edituser-button" )
- .click(function() {
- $( "#edituser-form" ).dialog( "open" );
+ .click(function(){
+ uid = $( this ).parent().attr( 'x-uid' );
+ $("#edituserusername").html(uid);
+ $("#edituser-form").dialog("open");
return false;
});
@@ -70,6 +82,8 @@ $(document).ready(function(){
$( ".removeuser-button" )
.click(function() {
+ uid = $( this ).parent().attr( 'x-uid' );
+ $("#deleteuserusername").html(uid);
$( "#removeuser-form" ).dialog( "open" );
return false;
});
@@ -81,21 +95,28 @@ $(document).ready(function(){
width: 350,
modal: true,
buttons: {
- "Remove group": function() {
+ "Remove group": function(){
+ var post = $( "#deletegroupdata" ).serialize();
+ $.post( 'ajax/deletegroup.php', post, function(data){
+ $( "a[x-gid='"+gid+"']" ).parent().remove();
+ });
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
- close: function() {
+ close: function(){
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
$( ".removegroup-button" )
- .click(function() {
- $( "#removegroup-form" ).dialog( "open" );
+ .click(function(){
+ gid = $( this ).parent().attr( 'x-gid' );
+ $("#deletegroupgroupname").html(gid);
+ $("#deletegroupnamefield").val(gid);
+ $("#removegroup-form").dialog( "open" );
return false;
});
} );
diff --git a/admin/system.php b/admin/system.php
index 8abef28709..de62b133f8 100644
--- a/admin/system.php
+++ b/admin/system.php
@@ -28,15 +28,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin'
exit();
}
-$adminpages = array();
-
-foreach( OC_APP::getAdminPages() as $i ){
- // Do some more work here soon
- $adminpages[] = $i;
-}
-
-$tmpl = new OC_TEMPLATE( "admin", "index", "admin" );
-$tmpl->assign( "adminpages", $adminpages );
+$tmpl = new OC_TEMPLATE( "admin", "system", "admin" );
$tmpl->printPage();
?>
diff --git a/admin/templates/users.php b/admin/templates/users.php
index 88edc01aef..ce78ffac77 100644
--- a/admin/templates/users.php
+++ b/admin/templates/users.php
@@ -6,20 +6,20 @@
Administration
Users
-