diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php new file mode 100644 index 00000000000..244a85e3d9c --- /dev/null +++ b/settings/ajax/setquota.php @@ -0,0 +1,22 @@ + "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$username = $_POST["username"]; +$quota= OC_Helper::computerFileSize($_POST["quota"]); + +// Return Success story +OC_Preferences::setValue($username,'files','quota',$quota); +echo json_encode( array( "status" => "success", "data" => array( "username" => $username ,'quota'=>$quota))); + +?> diff --git a/settings/js/users.js b/settings/js/users.js index bc1b8fc3ed0..3122f5614c7 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -75,6 +75,45 @@ $(document).ready(function(){ $('td.password').live('click',function(event){ $(this).children('img').click(); }); + + $('td.quota>img').live('click',function(event){ + event.stopPropagation(); + var img=$(this); + var uid=img.parent().parent().data('uid'); + var input=$(''); + var quota=img.parent().children('span').text(); + img + if(quota=='None'){ + quota=''; + } + input.val(quota); + img.css('display','none'); + img.parent().children('span').replaceWith(input); + input.focus(); + input.keypress(function(event) { + if(event.keyCode == 13) { + $(this).parent().attr('data-quota',$(this).val()); + if($(this).val().length>0){ + $.post( + OC.filePath('settings','ajax','setquota.php'), + {username:uid,quota:$(this).val()}, + function(result){} + ); + input.blur(); + }else{ + input.blur(); + } + } + }); + input.blur(function(){ + var quota=$(this).parent().data('quota'); + $(this).replaceWith($(''+quota+'')); + img.css('display',''); + }); + }); + $('td.quota').live('click',function(event){ + $(this).children('img').click(); + }); $('#newuser').submit(function(event){ event.preventDefault(); diff --git a/settings/templates/users.php b/settings/templates/users.php index 01e2adf4e97..9733c3e9a50 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -31,6 +31,10 @@ foreach($_["groups"] as $group) { + + 0)?$user['quota']:'None';?> + set new password + Delete diff --git a/settings/users.php b/settings/users.php index cd7d04a55e7..8bf64e16fff 100644 --- a/settings/users.php +++ b/settings/users.php @@ -38,7 +38,7 @@ $users = array(); $groups = array(); foreach( OC_User::getUsers() as $i ){ - $users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) )); + $users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ),'quota'=>OC_Helper::humanFileSize(OC_Preferences::getValue($i,'files','quota',0))); } foreach( OC_Group::getGroups() as $i ){