Skip to content
Snippets Groups Projects
Commit 43646dbf authored by Jakob Sack's avatar Jakob Sack
Browse files

User management works, now we need some usability expert ...

parent 8c5831d9
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,12 @@ $(document).ready(function(){ ...@@ -23,7 +23,12 @@ $(document).ready(function(){
groups.push($(this).val()); groups.push($(this).val());
} }
}); });
$("#changegroups").prev().html( groups.join(", ")); if( groups.length == 0 ){
$("#changegroups").prev().html( ' ' );
}
else{
$("#changegroups").prev().html( groups.join(", "));
}
} }
else{ else{
alert( "something went wrong! sorry!" ); alert( "something went wrong! sorry!" );
...@@ -38,10 +43,15 @@ $(document).ready(function(){ ...@@ -38,10 +43,15 @@ $(document).ready(function(){
// Manipulating the page after crteating a user // Manipulating the page after crteating a user
function userCreated( username, groups ){ function userCreated( username, groups ){
// We need at least a space for showing the div
if( groups == "" ){
groups = '&nbps;';
}
// Add user to table // Add user to table
var newrow = '<tr x-uid="'+username+'"><td x-use="username"><span x-use="usernamespan">'+username+'</span></td>'; var newrow = '<tr x-uid="'+username+'"><td x-use="username"><div x-use="usernamediv">'+username+'</div></td>';
newrow = newrow+'<td x-use="usergroups">'+groups+'</td>'; newrow = newrow+'<td x-use="usergroups"><div x-use="usergroupsdiv">'+groups+'</td>';
newrow = newrow+'<td><a href="" class="edituserbutton">edit</a> | <a class="removeuserbutton" href="">remove</a></td></tr>'; newrow = newrow+'<td><a class="removeuserbutton" href="">remove</a></td></tr>';
$("#usertable").append( newrow ); $("#usertable").append( newrow );
// Clear forms // Clear forms
...@@ -96,7 +106,7 @@ $(document).ready(function(){ ...@@ -96,7 +106,7 @@ $(document).ready(function(){
//######################################################################### //#########################################################################
// Password (clicking on user name) // Password (clicking on user name)
$("span[x-use='usernamespan']").live( "click", function(){ $("div[x-use='usernamediv']").live( "click", function(){
if( togglepassword == "" || $(this).parent().parent().attr("x-uid") != togglepassword ){ if( togglepassword == "" || $(this).parent().parent().attr("x-uid") != togglepassword ){
togglepassword = $(this).parent().parent().attr("x-uid"); togglepassword = $(this).parent().parent().attr("x-uid");
// Set the username! // Set the username!
...@@ -128,7 +138,7 @@ $(document).ready(function(){ ...@@ -128,7 +138,7 @@ $(document).ready(function(){
}); });
// Groups // Groups
$("span[x-use='usergroupsspan']").live( "click", function(){ $("div[x-use='usergroupsdiv']").live( "click", function(){
if( togglegroup == "" || $(this).parent().parent().attr("x-uid") != togglegroup){ if( togglegroup == "" || $(this).parent().parent().attr("x-uid") != togglegroup){
togglegroup = $(this).parent().parent().attr("x-uid"); togglegroup = $(this).parent().parent().attr("x-uid");
var groups = $(this).text(); var groups = $(this).text();
...@@ -161,7 +171,12 @@ $(document).ready(function(){ ...@@ -161,7 +171,12 @@ $(document).ready(function(){
groups.push($(this).val()); groups.push($(this).val());
} }
}); });
$(this).html( groups.join(", ")); if( groups.length == 0 ){
$("#changegroups").prev().html( '&nbsp;' );
}
else{
$("#changegroups").prev().html( groups.join(", "));
}
$('#changegroups').hide(); $('#changegroups').hide();
togglegroup = ""; togglegroup = "";
} }
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
<tbody> <tbody>
<?php foreach($_["users"] as $user): ?> <?php foreach($_["users"] as $user): ?>
<tr x-uid="<?php echo $user["name"] ?>"> <tr x-uid="<?php echo $user["name"] ?>">
<td x-use="username"><span x-use="usernamespan"><?php echo $user["name"]; ?></span></td> <td x-use="username"><div x-use="usernamediv"><?php echo $user["name"]; ?></div></td>
<td x-use="usergroups"><span x-use="usergroupsspan"><?php echo $user["groups"]; ?></span></td> <td x-use="usergroups"><div x-use="usergroupsdiv"><?php if( $user["groups"] ){ echo $user["groups"]; }else{echo "&nbsp";} ?></div></td>
<td><a class="removeuserbutton" href="">remove</a></td> <td><a class="removeuserbutton" href="">remove</a></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
......
...@@ -4,7 +4,7 @@ OC_APP::register( array( "order" => 1, "id" => "help", "name" => "Help" )); ...@@ -4,7 +4,7 @@ OC_APP::register( array( "order" => 1, "id" => "help", "name" => "Help" ));
// Workaround for having help as the last entry always // Workaround for having help as the last entry always
$entry = array( "id" => "help", "order" => 1000, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_HELPER::imagePath( "help", "help.png" )); $entry = array( "id" => "help", "order" => 1000, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_HELPER::imagePath( "help", "help.png" ));
if( OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){ if( isset( $_SESSION["user_id"] ) && OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){
OC_APP::addAdminPage( $entry ); OC_APP::addAdminPage( $entry );
} }
else{ else{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment