From b1d0de95a9407662933c1d662834410fe927423c Mon Sep 17 00:00:00 2001
From: kondou <kondou@ts.unde.re>
Date: Tue, 2 Jul 2013 04:28:52 +0200
Subject: Show a summary as the last filelist entry

Fix #993
---
 apps/files/css/files.css           |  8 ++++++++
 apps/files/templates/part.list.php | 41 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 47 insertions(+), 2 deletions(-)

(limited to 'apps')

diff --git a/apps/files/css/files.css b/apps/files/css/files.css
index 108dcd741c6..f2ca1065eca 100644
--- a/apps/files/css/files.css
+++ b/apps/files/css/files.css
@@ -159,6 +159,14 @@ a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; }
 	display:inline;
 }
 
+.summary {
+	opacity: .5;
+}
+
+.summary .info {
+	margin-left: 3em;
+}
+
 #scanning-message{ top:40%; left:40%; position:absolute; display:none; }
 
 div.crumb a{ padding:0.9em 0 0.7em 0; color:#555; }
diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php
index 1e94275dcba..05fbb892509 100644
--- a/apps/files/templates/part.list.php
+++ b/apps/files/templates/part.list.php
@@ -1,6 +1,14 @@
 <input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>">
-
+<?php $totalfiles = 0;
+$totaldirs = 0;
+$totalsize = 0; ?>
 <?php foreach($_['files'] as $file):
+	$totalsize += $file['size'];
+	if ($file['type'] === 'dir') {
+		$totaldirs++;
+	} else {
+		$totalfiles++;
+	}
 	$simple_file_size = OCP\simple_file_size($file['size']);
 	// the bigger the file, the darker the shade of grey; megabytes*2
 	$simple_size_color = intval(160-$file['size']/(1024*1024)*2);
@@ -60,4 +68,33 @@
 			</span>
 		</td>
 	</tr>
-<?php endforeach;
+<?php endforeach; ?>
+	<?php if ($totaldirs !== 0 || $totalfiles !== 0): ?>
+	<tr class="summary">
+		<td><span class="info">
+			<?php if ($totaldirs !== 0) {
+				p($totaldirs.' ');
+				if ($totaldirs === 1) {
+					p($l->t('directory'));
+				} else {
+					p($l->t('directories'));
+				}
+			}
+			if ($totaldirs !== 0 && $totalfiles !== 0) {
+				p(' & ');
+			}
+			if ($totalfiles !== 0) {
+				p($totalfiles.' ');
+				if ($totalfiles === 1) {
+					p($l->t('file'));
+				} else {
+					p($l->t('files'));
+				}
+			} ?>
+		</span></td>
+		<td class="filesize">
+		<?php p(OCP\simple_file_size($totalsize)); ?>
+		</td>
+		<td></td>
+	</tr>
+	<?php endif;
-- 
cgit v1.2.3


From 063b0a2d174b5c103ec35b2cd88458fe8f54f332 Mon Sep 17 00:00:00 2001
From: kondou <kondou@ts.unde.re>
Date: Tue, 2 Jul 2013 13:09:07 +0200
Subject: Don't escape filesize (can contain a '<')

---
 apps/files/templates/part.list.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'apps')

diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php
index 05fbb892509..502ddd329b1 100644
--- a/apps/files/templates/part.list.php
+++ b/apps/files/templates/part.list.php
@@ -93,7 +93,7 @@ $totalsize = 0; ?>
 			} ?>
 		</span></td>
 		<td class="filesize">
-		<?php p(OCP\simple_file_size($totalsize)); ?>
+		<?php print_unescaped(OCP\simple_file_size($totalsize)); ?>
 		</td>
 		<td></td>
 	</tr>
-- 
cgit v1.2.3