add configure option for default quota

This commit is contained in:
Robin Appelman 2012-02-24 21:19:23 +01:00
Родитель 4230e217af
Коммит 0d3181b6d1
4 изменённых файлов: 30 добавлений и 3 удалений

Просмотреть файл

@ -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)));
?>

Просмотреть файл

@ -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; }

Просмотреть файл

@ -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);?>">

Просмотреть файл

@ -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();
?>