diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-02-24 21:19:23 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-02-24 23:54:38 +0100 |
commit | 0d3181b6d1fc8b2af1b222cae29fff89a0754797 (patch) | |
tree | aed1512de7083139aff4fd1f4cc0da5df544e942 /settings | |
parent | 4230e217af16b400cf6eba26c2333ee4ea1f884c (diff) | |
download | nextcloud-server-0d3181b6d1fc8b2af1b222cae29fff89a0754797.tar.gz nextcloud-server-0d3181b6d1fc8b2af1b222cae29fff89a0754797.zip |
add configure option for default quota
Diffstat (limited to 'settings')
-rw-r--r-- | settings/ajax/setquota.php | 11 | ||||
-rw-r--r-- | settings/css/settings.css | 4 | ||||
-rw-r--r-- | settings/templates/users.php | 15 | ||||
-rw-r--r-- | settings/users.php | 3 |
4 files changed, 30 insertions, 3 deletions
diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php index e66513e54cc..dc87625a05d 100644 --- a/settings/ajax/setquota.php +++ b/settings/ajax/setquota.php @@ -5,7 +5,7 @@ require_once('../../lib/base.php'); OC_JSON::checkAdminUser(); -$username = $_POST["username"]; +$username = isset($_POST["username"])?$_POST["username"]:''; //make sure the quota is in the expected format $quota=$_POST["quota"]; @@ -19,7 +19,14 @@ if($quota!='none' and $quota!='default'){ } // Return Success story -OC_Preferences::setValue($username,'files','quota',$quota); +if($username){ + OC_Preferences::setValue($username,'files','quota',$quota); +}else{//set the default quota when no username is specified + if($quota=='default'){//'default' as default quota makes no sense + $quota='none'; + } + OC_Appconfig::setValue('files','default_quota',$quota); +} OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>$quota))); ?> diff --git a/settings/css/settings.css b/settings/css/settings.css index b80d7da82c6..39d811ae10c 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -30,8 +30,10 @@ li.selected { background-color:#ddd; } table:not(.nostyle) { width:100%; } #rightcontent { padding-left: 1em; } td.quota { position:relative } -select.quota { position:absolute; left:0px; top:0px; width:10em; } +div.quota { float:right; display:block; position:absolute; right:25em; top:0; } +select.quota { position:absolute; left:0; top:0; width:10em; } input.quota-other { display:none; position:absolute; left:0.1em; top:0.1em; width:7em; border:none; -webkit-box-shadow: none -mox-box-shadow:none ; box-shadow:none; } +div.quota>span { position:absolute; right:0em; white-space:nowrap; top: 0.7em } /* APPS */ li { color:#888; } diff --git a/settings/templates/users.php b/settings/templates/users.php index 4d75b7a06db..a23a5bafe61 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -21,6 +21,21 @@ foreach($_["groups"] as $group) { </select> <input type="submit" value="<?php echo $l->t('Create')?>" /> </form> + <div class="quota"> + <span><?php echo $l->t('Default Quota');?>:</span> + <select class='quota'> + <?php foreach($_['quota_preset'] as $preset):?> + <?php if($preset!='default'):?> + <option <?php if($_['default_quota']==$preset) echo 'selected="selected"';?> value='<?php echo $preset;?>'><?php echo $preset;?></option> + <?php endif;?> + <?php endforeach;?> + <?php if(array_search($_['default_quota'],$_['quota_preset'])===false):?> + <option selected="selected" value='<?php echo $_['default_quota'];?>'><?php echo $_['default_quota'];?></option> + <?php endif;?> + <option value='other'><?php echo $l->t('Other');?>...</option> + </select> + <input class='quota-other'></input> + </div> </div> <table data-groups="<?php echo implode(', ',$allGroups);?>"> diff --git a/settings/users.php b/settings/users.php index 1ae75752115..96515a90ce4 100644 --- a/settings/users.php +++ b/settings/users.php @@ -31,10 +31,13 @@ foreach($quotaPreset as &$preset){ $preset=trim($preset); } +$defaultQuota=OC_Appconfig::getValue('files','default_quota','none'); + $tmpl = new OC_Template( "settings", "users", "user" ); $tmpl->assign( "users", $users ); $tmpl->assign( "groups", $groups ); $tmpl->assign( 'quota_preset', $quotaPreset); +$tmpl->assign( 'default_quota', $defaultQuota); $tmpl->printPage(); ?> |