diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2012-12-29 11:19:52 +0400 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2012-12-29 11:19:52 +0400 |
commit | 36da34e5f66f59167c52b21cc92f0c93bda0e007 (patch) | |
tree | 858f8d9dc87660284ca1aa84c4ff1029b269954a /settings | |
parent | 9aefbea07467ba6e1bcedc87c85f98bc8d7e8398 (diff) | |
parent | f922f836ce11b87192c1904e01da2f6f579cac41 (diff) |
Merge pull request #902 from owncloud/storage-wording
Storage wording
Diffstat (limited to 'settings')
-rw-r--r-- | settings/css/settings.css | 2 | ||||
-rw-r--r-- | settings/templates/users.php | 29 | ||||
-rw-r--r-- | settings/users.php | 30 |
3 files changed, 43 insertions, 18 deletions
diff --git a/settings/css/settings.css b/settings/css/settings.css index 36457481911..4d0f6efd2c8 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -39,7 +39,7 @@ div.quota-select-wrapper { position: relative; } select.quota { position:absolute; left:0; top:0; width:10em; } select.quota-user { position:relative; left:0; top:0; width:10em; } input.quota-other { display:none; position:absolute; left:0.1em; top:0.1em; width:7em; border:none; box-shadow:none; } -div.quota>span { position:absolute; right:0em; white-space:nowrap; top: 0.7em } +div.quota>span { position:absolute; right:0; white-space:nowrap; top:.7em; color:#888; text-shadow:0 1px 0 #fff; } select.quota.active { background: #fff; } /* APPS */ diff --git a/settings/templates/users.php b/settings/templates/users.php index de7e50da8f3..e8bf9edf604 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -32,10 +32,15 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>; </select> <input type="submit" value="<?php echo $l->t('Create')?>" /> </form> <div class="quota"> - <span><?php echo $l->t('Default Quota');?>:</span> + <span><?php echo $l->t('Default Storage');?></span> <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($_['defaultQuotaIsUserDefined']):?> <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"> @@ -79,7 +84,7 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>; <?php if(is_array($_['subadmins']) || $_['subadmins']): ?> <th id="headerSubAdmins"><?php echo $l->t('Group Admin'); ?></th> <?php endif;?> - <th id="headerQuota"><?php echo $l->t( 'Quota' ); ?></th> + <th id="headerQuota"><?php echo $l->t('Storage'); ?></th> <th id="headerRemove"> </th> </tr> </thead> @@ -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($user['isQuotaUserDefined']):?> <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"> @@ -151,4 +166,4 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>; </tr> <?php endforeach; ?> </tbody> -</table>
\ No newline at end of file +</table> diff --git a/settings/users.php b/settings/users.php index 93a259f1cd8..07a7620d3c0 100644 --- a/settings/users.php +++ b/settings/users.php @@ -29,11 +29,27 @@ if($isadmin) { $subadmins = false; } +// load preset quotas +$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', 'none'); +$defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false && array_search($defaultQuota, array('none', 'default'))===false; + +// load users and quota foreach($accessibleusers as $i) { + $quota=OC_Preferences::getValue($i, 'files', 'quota', 'default'); + $isQuotaUserDefined=array_search($quota, $quotaPreset)===false && array_search($quota, array('none', 'default'))===false; + $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'=>$quota, + 'isQuotaUserDefined'=>$isQuotaUserDefined, 'subadmin'=>implode(', ', OC_SubAdmin::getSubAdminsGroups($i))); } @@ -41,20 +57,14 @@ foreach( $accessiblegroups as $i ) { // Do some more work here soon $groups[] = array( "name" => $i ); } -$quotaPreset=OC_Appconfig::getValue('files', 'quota_preset', 'default,none,1 GB, 5 GB, 10 GB'); -$quotaPreset=explode(',', $quotaPreset); -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( 'users', $users ); +$tmpl->assign( 'groups', $groups ); $tmpl->assign( 'isadmin', (int) $isadmin); $tmpl->assign( 'subadmins', $subadmins); $tmpl->assign( 'numofgroups', count($accessiblegroups)); $tmpl->assign( 'quota_preset', $quotaPreset); $tmpl->assign( 'default_quota', $defaultQuota); +$tmpl->assign( 'defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined); $tmpl->printPage(); |