diff --git a/files/js/files.js b/files/js/files.js index b491b90275c..2434fceff43 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -128,7 +128,7 @@ $(document).ready(function() { $('#file_upload_submit').click(function(){ var name=$('#file_upload_filename').val(); if($('#file_upload_start')[0].files[0] && $('#file_upload_start')[0].files[0].size>0){ - var size=humanFileSize($('#file_upload_start')[0].files[0].size); + var size=simpleFileSize($('#file_upload_start')[0].files[0].size); }else{ var size='Pending'; } @@ -205,6 +205,14 @@ function humanFileSize(bytes){ return bytes+' GB'; } +function simpleFileSize(bytes) { + mbytes = Math.round(bytes/(1024*1024),1); + if(bytes == 0) { return '0'; } + else if(mbytes < 0.1) { return '< 0.1'; } + else if(mbytes > 1000) { return '> 1000'; } + else { return mbytes.toFixed(1); } +} + function formatDate(date){ var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; diff --git a/files/templates/index.php b/files/templates/index.php index ee5e0900e2c..b9f8c02c93b 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -32,7 +32,7 @@ t( 'Name' ); ?> - t( 'Size' ); ?> + t( 'Size (MB)' ); ?> t( 'Modified' ); ?> diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 443990af34f..fd7f3f644df 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,9 +1,9 @@ - - ' data-type='' data-mime=''> + + - )" href="" title="">"; echo htmlspecialchars($file["name"]); if($file["type"] == "dir") echo ""; ?> - - - + "; echo htmlspecialchars($file['name']); if($file['type'] == 'dir') echo ""; ?> + + + diff --git a/lib/template.php b/lib/template.php index 9393fe6908e..3c0cdf7e161 100644 --- a/lib/template.php +++ b/lib/template.php @@ -67,6 +67,14 @@ function human_file_size( $bytes ){ return OC_HELPER::humanFileSize( $bytes ); } +function simple_file_size($bytes) { + $mbytes = round($bytes/(1024*1024),1); + if($bytes == 0) { return '0'; } + else if($mbytes < 0.1) { return '< 0.1'; } + else if($mbytes > 1000) { return '> 1000'; } + else { return number_format($mbytes, 1); } +} + /** * This class provides the templates for owncloud. */