forked from extern/egroupware
Quota changes
- nicer error message - add quota for group directories with separate default - support for more decimal places in human file size - add some help_text to default quota
This commit is contained in:
parent
b31ce0922d
commit
3402ed645a
@ -28,19 +28,24 @@
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="dialogHeader">
|
||||
<description value="Group name" for="account_lid"/>
|
||||
<textbox id="account_lid" size="40" maxlength="64" class="et2_fullWidth" needed="true" onchange="app.admin.changeGroup"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Description" for="account_description"/>
|
||||
<textbox id="account_description" size="40" maxlength="64" class="et2_fullWidth"/>
|
||||
</row>
|
||||
<row disabled="!@mailAllowed">
|
||||
<description value="EMail"/>
|
||||
<url-email id="account_email" size="40" maxlength="64" class="et2_fullWidth"/>
|
||||
</row>
|
||||
</rows>
|
||||
<row class="dialogHeader">
|
||||
<description value="Group name" for="account_lid"/>
|
||||
<textbox id="account_lid" size="40" maxlength="64" class="et2_fullWidth" needed="true"
|
||||
onchange="app.admin.changeGroup"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Description" for="account_description"/>
|
||||
<textbox id="account_description" size="40" maxlength="64" class="et2_fullWidth"/>
|
||||
</row>
|
||||
<row disabled="!@mailAllowed">
|
||||
<description value="EMail"/>
|
||||
<url-email id="account_email" size="40" maxlength="64" class="et2_fullWidth"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Filesystem quota" disabled="!@epl"/>
|
||||
<textbox id="quota" readonly="true" blur="@default_quota"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<tabbox id="tabs" class="et2_nowrap" span="all" width="100%" tab_height="250px">
|
||||
<tabs>
|
||||
|
@ -1112,10 +1112,19 @@ class Vfs extends Vfs\Base
|
||||
*/
|
||||
static function hsize($size)
|
||||
{
|
||||
if ($size < 1024) return $size;
|
||||
if ($size < 1024*1024) return sprintf('%3.1fk',(float)$size/1024);
|
||||
if ($size < 1024*1024*1024) return sprintf('%3.1fM',(float)$size/(1024*1024));
|
||||
return sprintf('%3.1fG',(float)$size/(1024*1024*1024));
|
||||
if($size < 1024)
|
||||
{
|
||||
return $size;
|
||||
}
|
||||
if($size < 1024 * 1024)
|
||||
{
|
||||
return sprintf('%3.2Gk', (float)$size / 1024);
|
||||
}
|
||||
if($size < 1024 * 1024 * 1024)
|
||||
{
|
||||
return sprintf('%3.4GM', (float)$size / (1024 * 1024));
|
||||
}
|
||||
return sprintf('%3.4GG', (float)$size / (1024 * 1024 * 1024));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1133,22 +1142,24 @@ class Vfs extends Vfs\Base
|
||||
preg_match('#([0-9.]+)[\s]*([a-z]+)#i', $val, $matches);
|
||||
|
||||
$last = '';
|
||||
if(isset($matches[2])){
|
||||
if(isset($matches[2]))
|
||||
{
|
||||
$last = $matches[2];
|
||||
}
|
||||
|
||||
if(isset($matches[1])){
|
||||
$val = (int) $matches[1];
|
||||
if(isset($matches[1]))
|
||||
{
|
||||
$val = (float)$matches[1];
|
||||
}
|
||||
|
||||
switch (strtolower($last))
|
||||
switch(strtolower($last))
|
||||
{
|
||||
case 'g':
|
||||
case 'gb':
|
||||
$val *= 1024;
|
||||
$val *= 1024;
|
||||
case 'm':
|
||||
case 'mb':
|
||||
$val *= 1024;
|
||||
$val *= 1024;
|
||||
case 'k':
|
||||
case 'kb':
|
||||
$val *= 1024;
|
||||
|
@ -1790,14 +1790,34 @@ class filemanager_ui
|
||||
$tmp_path = ini_get('upload_tmp_dir') . '/' . basename($tmp_name);
|
||||
}
|
||||
|
||||
if (Vfs::copy_uploaded($tmp_path, $path, $props, false))
|
||||
try
|
||||
{
|
||||
++$arr['files'];
|
||||
$uploaded[] = $data['name'];
|
||||
if(Vfs::copy_uploaded($tmp_path, $path, $props, false))
|
||||
{
|
||||
++$arr['files'];
|
||||
$uploaded[] = $data['name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
++$arr['errs'];
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (\EGroupware\Stylite\Vfs\QuotaExceededException $e)
|
||||
{
|
||||
// File was touched but not written. Might need to delete it
|
||||
$stat = Vfs::stat($path);
|
||||
if($stat && $stat['size'] == 0)
|
||||
{
|
||||
Vfs::unlink($path);
|
||||
}
|
||||
|
||||
// Send error
|
||||
++$arr['errs'];
|
||||
++$script_error;
|
||||
$arr['msg'] = $e->getMessage();
|
||||
$arr['msg'] .= "\n" . lang("You can either delete some files or get in touch with your administrator to get more space");
|
||||
// No point continuing
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ export class filemanagerAPP extends EgwApp
|
||||
{
|
||||
if(this.egw.pushAvailable())
|
||||
{
|
||||
this.egw.message(_data.msg);
|
||||
this.egw.message(_data.msg, _data.errs > 0 ? "error" : "success");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -241,6 +241,7 @@ properties saved. filemanager en Properties saved.
|
||||
protocol to use filemanager en Protocol to use
|
||||
protocols filemanager en Protocols
|
||||
quick jump to filemanager en Quick jump to
|
||||
quota exceeded filemanager en Quota exceeded
|
||||
read & write access filemanager en Read & write access
|
||||
read access only filemanager en Read access only
|
||||
readonly share link filemanager en Readonly Share link
|
||||
@ -328,6 +329,7 @@ writable share link filemanager en Writable Share link
|
||||
wrong username or password! filemanager en Wrong username or password!
|
||||
you are not allowed to finally delete older versions and deleted files! filemanager en You are NOT allowed to finally delete older versions and deleted files!
|
||||
you are not allowed to upload a script! filemanager en You are NOT allowed to upload a script!
|
||||
you can either delete some files or get in touch with your administrator to get more space filemanager en You can either delete some files or get in touch with your administrator to get more space
|
||||
you can only grant additional rights, you can not take rights away! filemanager en You can only grant additional rights, you can NOT take rights away!
|
||||
you can use regular upload [+] button to upload files. filemanager en You can use regular upload [+] button to upload files.
|
||||
you do not have access to %1 filemanager en You do not have access to %1
|
||||
|
@ -4,7 +4,9 @@
|
||||
<overlay>
|
||||
<template id="filemanager.quota" template="" lang="" group="0" version="1.9.004">
|
||||
<vbox>
|
||||
<textbox label="Home quota" id="quota" blur="(EPL Only)" disabled="true"/>
|
||||
<textbox label="User home quota" id="quota" blur="(EPL Only)" disabled="true"/>
|
||||
<textbox label="Group home quota" id="group_quota" blur="(EPL Only)" disabled="true"
|
||||
help-text="Enter a file size, e.g. 100K, 200M or 2G"/>
|
||||
<button label="Recalculate" id="button[recalculate]" statustext="Recalculate directory sizes"/>
|
||||
|
||||
<hbox span="2" class="dialogFooterToolbar">
|
||||
@ -14,7 +16,8 @@
|
||||
</hbox>
|
||||
</vbox>
|
||||
<styles>
|
||||
#filemanager-quota_quota::part(form-control-input) {
|
||||
#filemanager-quota_quota::part(form-control-input),
|
||||
#filemanager-quota_group_quota::part(form-control-input){
|
||||
max-width: 15ex;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user