enable translations for quota sizes 'none' and 'default'

This commit is contained in:
Thomas Müller 2012-12-20 15:35:36 +01:00
parent 74d41b8b96
commit 436df6b67d
2 changed files with 28 additions and 7 deletions

View File

@ -36,6 +36,11 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
<div class="quota-select-wrapper">
<?php if((bool) $_['isadmin']): ?>
<select class='quota'>
<option
<?php if($_['default_quota']=='none') echo 'selected="selected"';?>
value='none'>
<?php echo $l->t('Unlimited');?>
</option>
<?php foreach($_['quota_preset'] as $preset):?>
<?php if($preset!='default'):?>
<option
@ -45,7 +50,7 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
</option>
<?php endif;?>
<?php endforeach;?>
<?php if(array_search($_['default_quota'], $_['quota_preset'])===false):?>
<?php if(array_search($_['default_quota'], $_['quota_preset'])===false && array_search($_['default_quota'], array('none', 'default'))===false):?>
<option selected="selected"
value='<?php echo $_['default_quota'];?>'>
<?php echo $_['default_quota'];?>
@ -55,7 +60,7 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
<?php echo $l->t('Other');?>
...
</option>
</select> <input class='quota-other'></input>
</select> <input class='quota-other'/>
<?php endif; ?>
<?php if((bool) !$_['isadmin']): ?>
<select class='quota' disabled="disabled">
@ -122,6 +127,16 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
<td class="quota">
<div class="quota-select-wrapper">
<select class='quota-user'>
<option
<?php if($user['quota']=='default') echo 'selected="selected"';?>
value='default'>
<?php echo $l->t('Default');?>
</option>
<option
<?php if($user['quota']=='none') echo 'selected="selected"';?>
value='none'>
<?php echo $l->t('Unlimited');?>
</option>
<?php foreach($_['quota_preset'] as $preset):?>
<option
<?php if($user['quota']==$preset) echo 'selected="selected"';?>
@ -129,7 +144,7 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
<?php echo $preset;?>
</option>
<?php endforeach;?>
<?php if(array_search($user['quota'], $_['quota_preset'])===false):?>
<?php if(array_search($user['quota'], $_['quota_preset'])===false && array_search($user['quota'], array('none', 'default'))===false):?>
<option selected="selected" value='<?php echo $user['quota'];?>'>
<?php echo $user['quota'];?>
</option>
@ -138,7 +153,7 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
<?php echo $l->t('Other');?>
...
</option>
</select> <input class='quota-other'></input>
</select> <input class='quota-other'/>
</div>
</td>
<td class="remove">

View File

@ -30,10 +30,15 @@ if($isadmin) {
}
foreach($accessibleusers as $i) {
$quota=OC_Preferences::getValue($i, 'files', 'quota', 'default');
// translation of old value 'none' to 'unlimited'
if ($quota=='none')
$quota='unlimited';
$users[] = array(
"name" => $i,
"groups" => join( ", ", /*array_intersect(*/OC_Group::getUserGroups($i)/*, OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()))*/),
'quota'=>OC_Preferences::getValue($i, 'files', 'quota', 'Default'),
'quota'=>OC_Preferences::getValue($i, 'files', 'quota', 'default'),
'subadmin'=>implode(', ', OC_SubAdmin::getSubAdminsGroups($i)));
}
@ -41,13 +46,14 @@ foreach( $accessiblegroups as $i ) {
// Do some more work here soon
$groups[] = array( "name" => $i );
}
$quotaPreset=OC_Appconfig::getValue('files', 'quota_preset', 'Default, Unlimited, 1 GB, 5 GB, 10 GB');
$quotaPreset=OC_Appconfig::getValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
$quotaPreset=explode(',', $quotaPreset);
foreach($quotaPreset as &$preset) {
$preset=trim($preset);
}
$quotaPreset=array_diff($quotaPreset, array('default', 'none'));
$defaultQuota=OC_Appconfig::getValue('files', 'default_quota', 'Unlimited');
$defaultQuota=OC_Appconfig::getValue('files', 'default_quota', 'none');
$tmpl = new OC_Template( "settings", "users", "user" );
$tmpl->assign( "users", $users );