From 378aaf4a61176832f91cf8a95b3962915ee13708 Mon Sep 17 00:00:00 2001 From: Paolo Tacconi Date: Wed, 25 Jun 2014 11:54:10 +0200 Subject: Display quota and translatable strings --- include/reddav.php | 103 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 37 deletions(-) (limited to 'include') diff --git a/include/reddav.php b/include/reddav.php index fe05af606..37fa49c20 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -897,11 +897,11 @@ class RedBrowser extends DAV\Browser\Plugin { - + - - - + + + "; @@ -917,21 +917,19 @@ class RedBrowser extends DAV\Browser\Plugin { if ($path) { - list($parentUri) = DAV\URLUtil::splitPath($path); $fullPath = DAV\URLUtil::encodePath($this->server->getBaseUri() . $parentUri); $icon = $this->enableAssets?'Parent':''; - $html.= " - - - - - - - "; - + $html.= " + + + + + + + "; } foreach($files as $file) { @@ -955,22 +953,22 @@ class RedBrowser extends DAV\Browser\Plugin { // Some name mapping is preferred switch($v) { case '{DAV:}collection' : - $type[$k] = 'Collection'; + $type[$k] = t('Collection'); break; case '{DAV:}principal' : - $type[$k] = 'Principal'; + $type[$k] = t('Principal'); break; case '{urn:ietf:params:xml:ns:carddav}addressbook' : - $type[$k] = 'Addressbook'; + $type[$k] = t('Addressbook'); break; case '{urn:ietf:params:xml:ns:caldav}calendar' : - $type[$k] = 'Calendar'; + $type[$k] = t('Calendar'); break; case '{urn:ietf:params:xml:ns:caldav}schedule-inbox' : - $type[$k] = 'Schedule Inbox'; + $type[$k] = t('Schedule Inbox'); break; case '{urn:ietf:params:xml:ns:caldav}schedule-outbox' : - $type[$k] = 'Schedule Outbox'; + $type[$k] = t('Schedule Outbox'); break; case '{http://calendarserver.org/ns/}calendar-proxy-read' : $type[$k] = 'Proxy-Read'; @@ -1012,7 +1010,6 @@ class RedBrowser extends DAV\Browser\Plugin { break; } - } } @@ -1037,38 +1034,70 @@ class RedBrowser extends DAV\Browser\Plugin { if($is_owner) { $html .= " - "; + "; } else { $html .= ""; } $html .= " - + "; } - $html.= ""; - - $output = ''; + $html.= " +
".t('Name')."".t('Name')."    TypeSizeLast modified".t('Type')."   ".t('Size')."   ".t('Last modified')."

$icon.. - [parent]
$icon.. + [".t('parent')."]
" . (($size) ? $attachIcon : '') . " {$type}". $size ."". $this->userReadableSize($size) ." " . (($lastmodified) ? datetime_convert('UTC', date_default_timezone_get(),$lastmodified) : '') . "


"; + $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, + $this->userReadableSize($used)); + } + if ($limit && $used) { + $quotaDesc = t('%1$s used of %2$s (%3$s%)'); + $quotaDesc = sprintf($quotaDesc, + $this->userReadableSize($used), + $this->userReadableSize($limit), + round($used / $limit, 1)); + } + if ($limit || $used) { + $html.= "

".t('Total')." ".$quotaDesc."

"; + } + + $output = ''; if ($this->enablePost) { $this->server->broadcastEvent('onHTMLActionsPanel',array($parent, &$output)); } - $html.=$output; - - $html.= ""; - - get_app()->page['content'] = $html; - construct_page(get_app()); + + get_app()->page['content'] = $html; + construct_page(get_app()); // return $html; } + function userReadableSize($size){ + if (is_numeric($size)) { + $incr = 0; + $k = 1024; + $unit = array('bytes','KB','MB','GB','TB','PB'); + while(($size / $k) >= 1){ + $incr++; + $size = round($size / $k, 2); + } + return $size." ".$unit[$incr]; + } else { + return ""; + } + } public function htmlActionsPanel(DAV\INode $node, &$output) { @@ -1092,17 +1121,17 @@ class RedBrowser extends DAV\Browser\Plugin { $output.= ' - + - + -- cgit v1.2.3 From dda949ee3b6f81662762f6598348bd68cf40ae83 Mon Sep 17 00:00:00 2001 From: Paolo Tacconi Date: Wed, 25 Jun 2014 12:07:36 +0200 Subject: Delete confirmation is translatable --- include/reddav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/reddav.php b/include/reddav.php index 37fa49c20..d3c4b2866 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -1034,7 +1034,7 @@ class RedBrowser extends DAV\Browser\Plugin { if($is_owner) { $html .= " - "; + "; } else { $html .= ""; -- cgit v1.2.3
Create new folder   '.t('Create new folder').'   
- +
Upload file   '.t('Upload file').'   
- +
" . (($size) ? $attachIcon : '') . "