aboutsummaryrefslogtreecommitdiffstats
path: root/include/RedDAV
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-10-21 15:02:32 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-10-21 15:02:32 -0700
commit01e84edd0a52b77872fa19f472491dff13e20566 (patch)
tree47abc15b3b366f1eece0c4405362dcc091279bd4 /include/RedDAV
parentb7538b6ada4df7ace6f27bc6349b63ca7f8651e8 (diff)
parent232742a5e6c2912fe53249465d5fe31ef3b9722f (diff)
downloadvolse-hubzilla-01e84edd0a52b77872fa19f472491dff13e20566.tar.gz
volse-hubzilla-01e84edd0a52b77872fa19f472491dff13e20566.tar.bz2
volse-hubzilla-01e84edd0a52b77872fa19f472491dff13e20566.zip
Merge https://github.com/redmatrix/hubzilla into pending_merge
Diffstat (limited to 'include/RedDAV')
-rw-r--r--include/RedDAV/RedBrowser.php55
1 files changed, 28 insertions, 27 deletions
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php
index d74bba220..efea5d92f 100644
--- a/include/RedDAV/RedBrowser.php
+++ b/include/RedDAV/RedBrowser.php
@@ -217,31 +217,6 @@ class RedBrowser extends DAV\Browser\Plugin {
$f[] = $ft;
}
- // Storage and quota for the account (all channels of the owner of this directory)!
- $limit = service_class_fetch($owner, 'attach_upload_limit');
- $r = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d",
- intval($this->auth->channel_account_id)
- );
- $used = $r[0]['total'];
- if ($used) {
- $quotaDesc = t('%1$s used');
- $quotaDesc = sprintf($quotaDesc,
- userReadableSize($used));
- }
- if ($limit && $used) {
- $quotaDesc = t('%1$s used of %2$s (%3$s&#37;)');
- $quotaDesc = sprintf($quotaDesc,
- userReadableSize($used),
- userReadableSize($limit),
- round($used / $limit, 1));
- }
-
- // prepare quota for template
- $quota = array();
- $quota['used'] = $used;
- $quota['limit'] = $limit;
- $quota['desc'] = $quotaDesc;
-
$output = '';
if ($this->enablePost) {
$this->server->broadcastEvent('onHTMLActionsPanel', array($parent, &$output));
@@ -249,7 +224,6 @@ class RedBrowser extends DAV\Browser\Plugin {
$html .= replace_macros(get_markup_template('cloud.tpl'), array(
'$header' => t('Files') . ": " . $this->escapeHTML($path) . "/",
- '$quota' => $quota,
'$total' => t('Total'),
'$actionspanel' => $output,
'$shared' => t('Shared'),
@@ -298,11 +272,38 @@ class RedBrowser extends DAV\Browser\Plugin {
if (get_class($node) === 'Sabre\\DAV\\SimpleCollection')
return;
+ // Storage and quota for the account (all channels of the owner of this directory)!
+ $limit = service_class_fetch($owner, 'attach_upload_limit');
+ $r = q("SELECT SUM(filesize) AS total FROM attach WHERE aid = %d",
+ intval($this->auth->channel_account_id)
+ );
+ $used = $r[0]['total'];
+ if ($used) {
+ $quotaDesc = t('You are using %1$s of your available file storage.');
+ $quotaDesc = sprintf($quotaDesc,
+ userReadableSize($used));
+ }
+ if ($limit && $used) {
+ $quotaDesc = t('You are using %1$s of %2$s available file storage. (%3$s&#37;)');
+ $quotaDesc = sprintf($quotaDesc,
+ userReadableSize($used),
+ userReadableSize($limit),
+ round($used / $limit, 1) * 100);
+ }
+
+ // prepare quota for template
+ $quota = array();
+ $quota['used'] = $used;
+ $quota['limit'] = $limit;
+ $quota['desc'] = $quotaDesc;
+ $quota['warning'] = ((($limit) && ((round($used / $limit, 1) * 100) >= 90)) ? t('WARNING:') : ''); // 10485760 bytes = 100MB
+
$output .= replace_macros(get_markup_template('cloud_actionspanel.tpl'), array(
'$folder_header' => t('Create new folder'),
'$folder_submit' => t('Create'),
'$upload_header' => t('Upload file'),
- '$upload_submit' => t('Upload')
+ '$upload_submit' => t('Upload'),
+ '$quota' => $quota
));
}